Fix SFC and SCSS dependency extraction#87
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes dependency extraction gaps for Vue/Svelte SFCs and SCSS resolution so the dependency graph matches common real-world expectations (external <script src="..."> edges are captured, SCSS extensionless @use resolves to underscore partials, and url(...) assets do not get mis-resolved as SCSS partials).
Changes:
- Add Vue/Svelte SFC support for external
<script src="...">by appending synthetic imports to the masked script source used for extraction. - Add SCSS underscore-partial resolution for extensionless relative imports (e.g.,
@use "./tokens"→_tokens.scss) while preventingurl(...)assets from being treated as importable SCSS partials. - Update fixtures, parity expectations, and documentation to reflect the corrected dependency graph behavior.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/samples/svelte/App.svelte | Updates Svelte sample to reference an existing external script (logic.ts). |
| tests/samples/scss/main.scss | Adds extensionless @use "./tokens" and a url("./icons") case for regression coverage. |
| tests/samples/scss/_tokens.ts | Adds a same-basename non-stylesheet file to validate SCSS partial preference. |
| tests/samples/scss/_tokens.scss | Adds the SCSS partial resolved by extensionless @use "./tokens". |
| tests/samples/scss/_icons.scss | Adds an SCSS partial that must not be resolved from url("./icons"). |
| tests/languages/vue.test.ts | Adds expected dependency edge for Vue external <script src="./logic.ts">. |
| tests/languages/svelte.test.ts | Adds expected dependency edge for Svelte external <script src="./logic.ts">. |
| tests/languages/scss.test.ts | Updates SCSS parity expectations + adds focused tests for url(...) vs partials and partial preference over non-stylesheet basenames. |
| tests/languages/parity.test.ts | Updates SCSS parity expectations to file targets for underscore partials. |
| src/util.ts | Adds SCSS partial candidate resolution and a resolver option to enable it safely. |
| src/languages/sfc.ts | Extracts external script src attrs and appends synthetic import statements for dependency extraction. |
| src/graphs/specifiers.ts | Marks CSS url(...) specifiers as resolutionKind: "document" to avoid SCSS partial resolution for assets. |
| src/graph-edge-collector.ts | Enables SCSS partial resolution for SCSS import-like specifiers, but not for document (asset/link) specifiers. |
| docs/scenario-catalog.md | Documents new SCSS extensionless partial and Vue/Svelte external script src scenarios. |
| docs/plans/language-support-review-plan.md | Adds an internal remediation plan describing the addressed gaps and verification steps. |
| docs/language-parity.md | Updates the parity matrix to reflect tested dependency-graph support for CSS/Less/Vue/Svelte. |
| codegraph-skill/codegraph/SKILL.md | Updates skill doc to reflect expanded graph-first coverage (Vue/Svelte external script src, stylesheet imports). |
| .gitignore | Ignores codegraph.json (graph output artifact) to avoid accidental commits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| from: "ExternalScripts.vue", | ||
| to: { type: "file", path: "missing.ts" }, | ||
| }, |
There was a problem hiding this comment.
Fixed in 3f21e65: ExternalScripts.vue now includes ./missing.ts as a script src, asserts it remains an external edge, and still asserts it does not resolve to a file.
| to: { type: "external", name: "" }, | ||
| }, | ||
| { | ||
| from: "ExternalScripts.svelte", |
There was a problem hiding this comment.
Fixed in 3f21e65: ExternalScripts.svelte now includes ./missing.ts as a script src, asserts it remains an external edge, and still asserts it does not resolve to a file.
| resolveNodeModules: !!opts.resolveNodeModules, | ||
| ...(resolutionExtensions ? { resolutionExtensions } : {}), | ||
| ...(opts.resolutionHints ? { resolutionHints: opts.resolutionHints } : {}), | ||
| ...(sup.id === "scss" && resolutionKind !== "document" ? { allowScssPartialResolution: true } : {}), |
There was a problem hiding this comment.
Fixed in ea7a023: removed the unreachable SCSS partial-resolution option from the csharp/ruby/rust/php branch; the active SCSS path keeps the option in the general branch.
| const baseExt = path.extname(base).toLowerCase(); | ||
| if (baseExt && baseExt !== ".scss") return null; | ||
| const partialBasename = baseExt ? `_${basename}` : `_${basename}.scss`; |
* Fix SFC and SCSS dependency extraction * Expand language dependency coverage * Fix SFC missing script coverage * Fix SCSS partial edge cases
No description provided.