Skip to content

1.3.2: lib/ loads under Node's ESM loader - #30

Merged
echarles merged 2 commits into
mainfrom
fix/esm-specifiers
Oct 21, 2026
Merged

echarles merged 2 commits into
mainfrom
fix/esm-specifiers

Conversation

@echarles

Copy link
Copy Markdown
Member

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.mjs writes each relative specifier of lib/**/*.js whole after tsc (root and the four plugins' build).
  • npm run check:pack (scripts/check-npm-pack.mjs over npm 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.
  • Versions bumped to 1.3.2 with 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'.

…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
Copilot AI balanced review requested due to automatic review settings October 21, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)
@echarles
echarles merged commit 0d4b649 into main Oct 21, 2026
5 checks passed
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.

2 participants