Skip to content

Fix SFC and SCSS dependency extraction#87

Merged
lzehrung merged 4 commits into
mainfrom
fix-sfc-parsing
May 8, 2026
Merged

Fix SFC and SCSS dependency extraction#87
lzehrung merged 4 commits into
mainfrom
fix-sfc-parsing

Conversation

@lzehrung
Copy link
Copy Markdown
Owner

@lzehrung lzehrung commented May 8, 2026

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 preventing url(...) 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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Comment on lines +76 to +79
{
from: "ExternalScripts.vue",
to: { type: "file", path: "missing.ts" },
},
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Comment thread src/graph-edge-collector.ts Outdated
resolveNodeModules: !!opts.resolveNodeModules,
...(resolutionExtensions ? { resolutionExtensions } : {}),
...(opts.resolutionHints ? { resolutionHints: opts.resolutionHints } : {}),
...(sup.id === "scss" && resolutionKind !== "document" ? { allowScssPartialResolution: true } : {}),
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/util.ts Outdated
Comment on lines +1870 to +1872
const baseExt = path.extname(base).toLowerCase();
if (baseExt && baseExt !== ".scss") return null;
const partialBasename = baseExt ? `_${basename}` : `_${basename}.scss`;
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in ea7a023: SCSS partial candidate construction now normalizes explicit .scss extension casing, with a regression fixture for @use "./tokens.SCSS" resolving to _tokens.scss.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated no new comments.

@lzehrung lzehrung merged commit 3c8ae07 into main May 8, 2026
7 checks passed
@lzehrung lzehrung deleted the fix-sfc-parsing branch May 14, 2026 12:47
lzehrung added a commit that referenced this pull request May 14, 2026
* Fix SFC and SCSS dependency extraction

* Expand language dependency coverage

* Fix SFC missing script coverage

* Fix SCSS partial edge cases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants