Repository navigation
Conversation
Record re-export statements (export * / export * as ns / export { x } from) as imports in the TypeScript extractor, and follow relative tsconfig extends chains so path aliases inherited from a base config (Nx tsconfig.base.json) resolve, anchored per TypeScript's baseUrl/paths rules.
|
what was this about
…On Mon, Oct 5, 2026 at 3:33 PM Roman Gurevich ***@***.***> wrote:
Summary
extract-import-map.mjs missed most TypeScript imports in Nx/pnpm
monorepos. There were two independent causes:
1.
*Re-exports were never recorded as imports.*
TypeScriptExtractor.processExportStatement ignored its imports
argument. As a result, export * from './a', export * as ns from './a'
and export { x } from './a' produced no dependency, so barrel index.ts
files looked edgeless. The fix: when an export_statement has a source
field, it is now recorded as an import, with the re-exported names as
specifiers. The exports themselves are unchanged.
2.
*tsconfig extends was not followed.* Only the nearest tsconfig.json's
own compilerOptions.paths were read. Nx keeps every alias in a root
tsconfig.base.json that package tsconfigs only extends, so
@scope/lib/... imports stayed unresolved. The fix: loadTsConfigs now
resolves relative/absolute extends chains, including TS 5 array extends,
following TypeScript's rules:
- paths and baseUrl from later configs replace earlier ones;
- baseUrl is anchored at the config that declares it;
- without baseUrl, paths are anchored at the config that declares
them.
Alias targets are now resolved through absolute paths. This also
covers scanning a single package whose aliases come from a base config
above the project root and point back into it. Missing extends targets
and cycles produce a Warning: and contribute nothing.
Package-specifier extends ***@***.***/...) are skipped.
Linked issue(s)
None.
How I tested this
-
pnpm lint
-
pnpm --filter @understand-anything/core test: 1015 passed
-
pnpm vitest run tests/skill: all passed, including
test_extract_import_map with 73 tests
-
Manual smoke test on a real Nx monorepo (≈14k tracked files, 131 paths
aliases in tsconfig.base.json, package tsconfigs that only extends
it). I compared against an import graph built with the TypeScript compiler
API (ts.preProcessFile + ts.resolveModuleName):
before (2.9.7) after
resolved import edges 14,059 31,072
agreement with TS compiler resolution 45.0% 99.5%
The new tests cover:
- all re-export forms in the extractor;
- barrel resolution in the import map;
- an inherited Nx-style base config;
- child paths overriding the base together with an inherited baseUrl;
- a base config outside the scanned package root;
- a missing extends target;
- an extends cycle.
The re-export and inherited-config tests fail without the fix.
Note: the import lists of barrel files now include their re-exported
modules, so their structural fingerprints change once after upgrading.
Versioning
- Version bumped in all five manifests, OR
- N/A — left for the maintainer to bump on merge
------------------------------
You can view, comment on, or merge this pull request online at:
#708
Commit Summary
- 929a72f
<929a72f>
fix(import-map): resolve TS re-exports and tsconfig extends path aliases
File Changes
(4 files <https://github.com/Egonex-AI/Understand-Anything/pull/708/files>
)
- *M* tests/skill/understand/test_extract_import_map.test.mjs
<https://github.com/Egonex-AI/Understand-Anything/pull/708/files#diff-d1edb6e650b004bcb9cc84b17233920382cfac6ed34e6e0e8fc9100eae4e52c4>
(176)
- *M*
understand-anything-plugin/packages/core/src/plugins/extractors/__tests__/typescript-extractor.test.ts
<https://github.com/Egonex-AI/Understand-Anything/pull/708/files#diff-1de110acc131759cb352fb3595855f448f3bbf9df14ab48b2049e93ef198e2c2>
(39)
- *M*
understand-anything-plugin/packages/core/src/plugins/extractors/typescript-extractor.ts
<https://github.com/Egonex-AI/Understand-Anything/pull/708/files#diff-0afd5be1e25712e3bba7356d217d6e51d2a294f34c33cc6ee78892dcccb89697>
(46)
- *M*
understand-anything-plugin/skills/understand/extract-import-map.mjs
<https://github.com/Egonex-AI/Understand-Anything/pull/708/files#diff-4d7bca3a1f6bb8735bab0def059b86aa84a9cc75a512c42830b0c1209d3565fd>
(166)
Patch Links:
- https://github.com/Egonex-AI/Understand-Anything/pull/708.patch
- https://github.com/Egonex-AI/Understand-Anything/pull/708.diff
—
Reply to this email directly, view it on GitHub
<#708?email_source=notifications&email_token=B4NTZVOBWDAJT7RA3N4WJBT5SL257A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DOMZZGEZDIOBVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVRTG633UMVZF6Y3MNFRWW>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/B4NTZVPH2UEIWQCI6GCRWS35SL257AVCNFSNUABGKJSXA33TNF2G64TZHMYTCOBSGA4DCOJTGE5US43TOVSTWNJXGA2TCNJUHE2TBILWAI>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/B4NTZVP267WZ7OZ2OFOHSRT5SL257A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DOMZZGEZDIOBVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/B4NTZVJQPYSTC5EOUP2DHWT5SL257A5CNFSNUABEM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UF42DOMZZGEZDIOBVHGTHEZLBONXW5KTTOVRHGY3SNFRGKZFFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
This branch has not been deployed
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
extract-import-map.mjsmissed most TypeScript imports in Nx/pnpm monorepos. There were two independent causes:Re-exports were never recorded as imports.
TypeScriptExtractor.processExportStatementignored itsimportsargument. As a result,export * from './a',export * as ns from './a'andexport { x } from './a'produced no dependency, so barrelindex.tsfiles looked edgeless. The fix: when anexport_statementhas asourcefield, it is now recorded as an import, with the re-exported names as specifiers. The exports themselves are unchanged.tsconfig
extendswas not followed. Only the nearesttsconfig.json's owncompilerOptions.pathswere read. Nx keeps every alias in a roottsconfig.base.jsonthat package tsconfigs onlyextends, so@scope/lib/...imports stayed unresolved. The fix:loadTsConfigsnow resolves relative/absoluteextendschains, including TS 5 arrayextends, following TypeScript's rules:pathsandbaseUrlfrom later configs replace earlier ones;baseUrlis anchored at the config that declares it;baseUrl,pathsare anchored at the config that declares them.Alias targets are now resolved through absolute paths. This also covers scanning a single package whose aliases come from a base config above the project root and point back into it. Missing
extendstargets and cycles produce aWarning:and contribute nothing. Package-specifierextends(@tsconfig/...) are skipped.Linked issue(s)
None.
How I tested this
pnpm lintpnpm --filter @understand-anything/core test: 1015 passedpnpm vitest run tests/skill: all passed, includingtest_extract_import_mapwith 73 testsManual smoke test on a real Nx monorepo (≈14k tracked files, 131
pathsaliases intsconfig.base.json, package tsconfigs that onlyextendsit). I compared against an import graph built with the TypeScript compiler API (ts.preProcessFile+ts.resolveModuleName):The new tests cover:
pathsoverriding the base together with an inheritedbaseUrl;extendstarget;extendscycle.The re-export and inherited-config tests fail without the fix.
Note: the import lists of barrel files now include their re-exported modules, so their structural fingerprints change once after upgrading.
Versioning