Withdrawn by author#834
Closed
tecnos-okazaki wants to merge 1 commit into
Closed
Conversation
A Yarn/Lerna/npm monorepo references a sibling package by its declared `name` (e.g. `@org/a`), but package.json `main`/`exports` often points at a build artifact (dist/index.js) that is not indexed. pkgmap maps the name to that dead entry QN, so the import resolves to no node and no cross-package IMPORTS edge (and therefore no downstream CALLS edge) is produced. Phase 1 (npm `workspaces` only, per the maintainer's scoping in #271): - Detect workspace roots and member manifests during the existing pkgmap manifest walk (cbm_workspace_try_detect) — no extra file IO. Roots declare `workspaces` as an array or {"packages":[...]}; member globs are compiled with the reused gitignore engine ('*', '**', '!' negation, charclasses). Brace {a,b} expansion is out of scope (debug-logged). - Collect-then-finalize (cbm_workspaces_finalize) so a member can be parsed before its declaring root; maps each member NAME -> source DIR, first-wins on name collision. - Resolver Strategy 1c (resolve_workspace_member) probes conventional source entry files (src/index, index, src/main, ...) and subpath targets (`@org/a/utils/helper` -> <dir>/src/utils/helper). Runs only after the existing pkgmap/sibling strategies miss, so healthy repos (entry points at a real indexed file) are byte-for-byte unchanged. The import-targetable label filter preserves the #767 Folder-phantom guard; self-imports are rejected. Because the CALLS import-map is built from IMPORTS edges, fixing IMPORTS here also improves cross-package call resolution without touching the generic module resolver. Tests: new tests/test_workspaces.c (11 unit cases — array/object detection, single-star/doublestar/negation glob matching, first-wins, NULL-safety, scan_repo end-to-end) plus two previously-RED contract tests in test_lang_contract.c (unbuilt dist `main`, and subpath import) that now pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Hitoshi Okazaki <okazaki.hitoshi@tecnos.co.jp>
a9a6e22 to
f77cbf2
Compare
Owner
|
Thanks for the npm workspace import-resolution work. Triage: parsing/enhancement PR for #271 Phase 1. Since this is a draft, we will wait for ready-for-review before going deep. Review should stay scoped to npm workspaces first: workspace glob parsing, package-name to source resolution, repo-bounded path handling, and tests that cross-package imports resolve without misattributing external packages. |
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.
No description provided.