You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(extraction): CommonJS require() import extraction for JS/TS
The ES module import walker (walk_es_imports) only handled 'import' statements
but not CommonJS 'require()' calls. JS codebases using require() had zero
imports extracted.
Adds require() detection in walk_es_imports:
- Detects variable_declarator/assignment_expression with require() call value
- Handles: const X = require('Y') (default import)
- Handles: const { A, B } = require('Y') (destructured import via object_pattern)
- Handles: const [A, B] = require('Y') (array destructured)
- Supports shorthand_property_identifier_pattern and pair_pattern variants
- Falls back to path_last() for unnamed requires
Also adds variable_declaration and expression_statement to js_import_types
in lang_specs.c, catching 'var X = require()' patterns (older JS codebases).
Tested: JS service went from 0 to 335 IMPORTS with both ESM and CJS detected.
0 commit comments