Skip to main content

Module config_parser

Module config_parser 

Source
Expand description

AST-based config file parser utilities.

Provides helpers to extract configuration values from JS/TS config files without evaluating them. Uses Oxc’s parser for fast, safe AST walking.

Common patterns handled:

  • export default { key: "value" } (default export object)
  • export default defineConfig({ key: "value" }) (factory function)
  • module.exports = { key: "value" } (CJS)
  • Import specifiers (import x from 'pkg')
  • Array literals (["a", "b"])
  • Object properties ({ key: "value" })

Functions§

extract_config_property_strings
Extract string values from top-level properties of the default export/module.exports object. Returns all string literal values found for the given property key, recursively.
extract_config_shallow_strings
Extract only top-level string values from a property’s array.
extract_config_string
Extract a single string from a property at a nested path.
extract_config_string_array
Extract string array from a property at a nested path in a config’s default export.
extract_imports
Extract all import source specifiers from JS/TS source code.