Skip to content

fix: resolve package subpath exports in import graph#1374

Closed
pkudinov wants to merge 1 commit into
Graphify-Labs:v8from
pkudinov:codex/tokenbooks-jest-impact-graph
Closed

fix: resolve package subpath exports in import graph#1374
pkudinov wants to merge 1 commit into
Graphify-Labs:v8from
pkudinov:codex/tokenbooks-jest-impact-graph

Conversation

@pkudinov

Copy link
Copy Markdown
Contributor

Summary

This PR fixes Graphify import resolution for package subpath exports that point at source files in monorepos using package.json exports with subpath keys.

What this changes

  • In graphify/extract.py, resolves subpath export target strings through _package_export_target_values.
  • Added array-form support for export targets so both "./foo.ts" and ["./foo.ts", "./foo.dev.ts"] forms are handled recursively.
  • Extended tests/test_js_import_resolution.py with a regression test covering pnpm workspace imports of package subpath exports.

Why this matters for tokenbooks

packages/accounting uses package subpath exports (for browser/server split) and Graphify currently recorded the target as browser instead of resolving through package.json to a source file path.
That prevented accurate Jest test impact and could over-run package-level test selection.

Verification

  • uv run pytest -q
    • Result: 2098 passed, 28 skipped.

Notes

This also resolves the rebase conflict from prior comment context by preserving both npm/yarn and pnpm import scenarios in existing test coverage.

@pkudinov

Copy link
Copy Markdown
Contributor Author

Closing this as a duplicate. I pushed the same rebased fix to the original PR: #1333.

@pkudinov pkudinov closed this Jun 18, 2026
@pkudinov
pkudinov deleted the codex/tokenbooks-jest-impact-graph branch June 18, 2026 00:03
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.

1 participant