Summary
Svelte and Vue files are discovered and parsed, but imports inside their <script> blocks are not extracted into IMPORTS edges.
Root cause
cbm_extract_imports() only routes JavaScript, TypeScript, and TSX through the ES import walker. Svelte and Vue parse to a markup-oriented AST at the root, where imports live inside document -> script_element -> raw_text, so they never reach the normal ES import extraction path.
Proposed fix
- add a Svelte/Vue-specific import extractor in
internal/cbm/extract_imports.c
- find
script_element -> raw_text
- re-parse the embedded script text with the JavaScript grammar
- run the existing ES import walker on that sub-tree
- add regression tests for
.svelte and .vue import extraction
Validation
I verified this against a downstream Svelte repo after building the local branch:
- before the fix:
src/App.svelte had zero outgoing IMPORTS edges
- after the fix:
src/App.svelte produced 7 IMPORTS edges to relative imports such as:
src/components/TopNavigation.svelte
src/components/TreeView.svelte
src/components/AdCanvas.svelte
Alias imports like $lib/... and @/... still do not resolve, but that is a separate pipeline concern and not part of this fix.
Scope
This issue is only about extracting imports from embedded script blocks in .svelte / .vue files.
Summary
Svelte and Vue files are discovered and parsed, but imports inside their
<script>blocks are not extracted intoIMPORTSedges.Root cause
cbm_extract_imports()only routes JavaScript, TypeScript, and TSX through the ES import walker. Svelte and Vue parse to a markup-oriented AST at the root, where imports live insidedocument -> script_element -> raw_text, so they never reach the normal ES import extraction path.Proposed fix
internal/cbm/extract_imports.cscript_element -> raw_text.svelteand.vueimport extractionValidation
I verified this against a downstream Svelte repo after building the local branch:
src/App.sveltehad zero outgoingIMPORTSedgessrc/App.svelteproduced 7IMPORTSedges to relative imports such as:src/components/TopNavigation.sveltesrc/components/TreeView.sveltesrc/components/AdCanvas.svelteAlias imports like
$lib/...and@/...still do not resolve, but that is a separate pipeline concern and not part of this fix.Scope
This issue is only about extracting imports from embedded script blocks in
.svelte/.vuefiles.