fix(imports): resolve workspace subpath exports (#1308)#1541
Closed
guyoron1 wants to merge 1 commit into
Closed
Conversation
…node IDs (Graphify-Labs#1308) Workspace imports with subpath exports (e.g. `@pkg/foo/browser`) now resolve through the package.json `exports` map instead of falling back to a bare path string. Also normalizes import node IDs to use _file_stem instead of full paths for consistency across JS/Svelte/Astro/Vue extractors.
safishamsi
pushed a commit
that referenced
this pull request
Jun 29, 2026
…orts map (#1308) Workspace imports with subpath exports (e.g. `import { x } from "@scope/pkg/browser"`) now resolve through the package's `exports` map instead of falling back to a bare path. Supports string values, condition objects, nested conditions, and single-`*` wildcard patterns (`"./*": "./src/*.js"`), falling back to the existing bare-path/index resolution when there is no exports map or no match. Adapted from #1541, taking only the exports-map resolver and not that PR's competing import-node-ID normalization (current v8 already resolves the node-ID mismatch via the #1529 id-remap post-pass, and the PR's _file_stem approach regressed the relative-input alias case). Two hardening changes over the original: - `default` is consulted LAST in the condition priority (it is Node's catch-all), so a matching `import`/`module`/`svelte` condition wins. - Export targets that escape the package directory are rejected (`_contained_in_package`), so a malicious `exports` value like `"./x": "../../../etc/..."` cannot resolve to a file outside the package. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thanks for this — the I landed the resolver portion only, with two changes:
Brought your 4 subpath tests plus two more (path-escape, default-last). Full suite green (2551), and the #1529 test still passes. Closing as shipped — credit for #1308 is yours. Thank you. |
safishamsi
added a commit
that referenced
this pull request
Jun 29, 2026
Covers #1499 (Ruby type-aware resolution), #1308/#1541 (workspace exports map), #1529 (alias/workspace import-edge regression), #1531 (tsconfig paths fallbacks), #1527 (semantic cache pruning), #1475 (three ObjC fixes), #1533 (Swift static-call confidence), #1442 (secondary LLM timeout), #1502 (GraphML null coercion + save-result --answer-file), #1530 (host-generic skill wording), and the Dependabot dep bumps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 tasks
mathieucarbou-ibm
pushed a commit
to mathieucarbou-ibm/graphify
that referenced
this pull request
Jun 29, 2026
…orts map (Graphify-Labs#1308) Workspace imports with subpath exports (e.g. `import { x } from "@scope/pkg/browser"`) now resolve through the package's `exports` map instead of falling back to a bare path. Supports string values, condition objects, nested conditions, and single-`*` wildcard patterns (`"./*": "./src/*.js"`), falling back to the existing bare-path/index resolution when there is no exports map or no match. Adapted from Graphify-Labs#1541, taking only the exports-map resolver and not that PR's competing import-node-ID normalization (current v8 already resolves the node-ID mismatch via the Graphify-Labs#1529 id-remap post-pass, and the PR's _file_stem approach regressed the relative-input alias case). Two hardening changes over the original: - `default` is consulted LAST in the condition priority (it is Node's catch-all), so a matching `import`/`module`/`svelte` condition wins. - Export targets that escape the package directory are rejected (`_contained_in_package`), so a malicious `exports` value like `"./x": "../../../etc/..."` cannot resolve to a file outside the package. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mathieucarbou-ibm
pushed a commit
to mathieucarbou-ibm/graphify
that referenced
this pull request
Jun 29, 2026
Covers safishamsi#1499 (Ruby type-aware resolution), safishamsi#1308/safishamsi#1541 (workspace exports map), safishamsi#1529 (alias/workspace import-edge regression), safishamsi#1531 (tsconfig paths fallbacks), safishamsi#1527 (semantic cache pruning), safishamsi#1475 (three ObjC fixes), safishamsi#1533 (Swift static-call confidence), safishamsi#1442 (secondary LLM timeout), safishamsi#1502 (GraphML null coercion + save-result --answer-file), safishamsi#1530 (host-generic skill wording), and the Dependabot dep bumps. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
import { value } from "@example/pkg-a/browser") now resolve through thepackage.jsonexportsmap instead of falling back to a bare path stringsource > import > module > default > require > svelte > types), nested conditions, and wildcard patterns ("./*": "./src/*.ts")_file_steminstead of full paths across JS/Svelte/Astro/Vue extractorsCloses #1308
Test plan