Repository navigation
1.3.2: lib/ loads under Node's ESM loader - #30
Merged
Merged
Conversation
…en whole after tsc (scripts/fully-specify-lib.mjs), check:pack refuses a tarball whose lib/ imports a file it does not carry or cannot load as written; 1.3.1's './wire' failed every unbundled consumer
There was a problem hiding this comment.
🟡 Changes recommended
The packaging check needs Windows shell handling to launch npm successfully.
1 open issue
What changed in this PR
Makes compiled Reactor libraries compatible with Node’s ESM loader for unbundled consumers.
Changes:
- Fully specifies relative imports after root and plugin builds.
- Adds tarball import checks to CI and releases.
- Bumps coordinated package versions to 1.3.2.
| File | Description |
|---|---|
| scripts/fully-specify-lib.mjs | Rewrites compiled relative imports. |
| scripts/esm-specifiers.mjs | Extracts and resolves relative specifiers. |
| scripts/check-npm-pack.mjs | Validates packed import targets. |
| RELEASE.md | Documents packaging validation. |
| plugins/shell/package.json | Adds build rewriting and checks; bumps version. |
| plugins/manager/package.json | Adds build rewriting and checks; bumps version. |
| plugins/graph/package.json | Adds build rewriting and checks; bumps version. |
| plugins/commands/package.json | Adds build rewriting and checks; bumps version. |
| package.json | Integrates rewriting and checks; bumps version. |
| apps/mcp-server/reactor_mcp_server/__init__.py | Updates fallback version. |
| apps/mcp-server/pyproject.toml | Updates version and Reactor dependency minimum. |
| .github/workflows/release.yaml | Validates tarballs before packing. |
| .github/workflows/ci.yaml | Validates tarballs after building. |
Review effort: Balanced
| import { relativeSpecifiers, resolveSpecifier } from './esm-specifiers.mjs'; | ||
|
|
||
| const listing = JSON.parse( | ||
| execFileSync('npm', ['pack', '--dry-run', '--json', '--ignore-scripts'], { |
…erwrites the other on macOS and Windows installs)
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.

tsc with bundler resolution keeps relative specifiers as written ('./wire'), which Node's ESM loader refuses: it adds no extension and reads no folder's index.js. A consumer that loads lib/ without bundling it (vitest's externalized dependencies, a Node service) failed with ERR_MODULE_NOT_FOUND on lib/ui/wire, a file 1.3.1's tarball carries.
scripts/fully-specify-lib.mjswrites each relative specifier of lib/**/*.js whole after tsc (root and the four plugins' build).npm run check:pack(scripts/check-npm-pack.mjsovernpm pack --dry-run --json, root and plugins) refuses a tarball whose lib/ imports a file it does not carry, or one Node cannot load as written; run in ci.yaml after the build and in release.yaml before packing.make bump-patch.Checked on 1.3.1's published lib/: 114 specifiers written whole in 48 files, then the check passes; before, Node's loader fails on './wire'.