Skip to content

feat(build): finish compiler and package config audits - #648

Merged
ScriptedAlchemy merged 24 commits into
mainfrom
audit/compiler-package-config
Sep 6, 2026
Merged

feat(build): finish compiler and package config audits#648
ScriptedAlchemy merged 24 commits into
mainfrom
audit/compiler-package-config

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • derive the generated executable ES2022 target from the Node 22.19 compiler-host floor, preserve future minified licence comments inline, and add the documented output.sourceMap opt-in
  • target MCP App and RSC example browser surfaces at Chrome 144, deduplicate React, narrow safe template parameters, and configure pluginReact({ fastRefresh: false })
  • broaden @agent-bundle/runtime React peers to ^19.2.0, pack rsc-markdown-stream from workspace:^, use Rslib's ESM shims, and reject removed Rsbuild v2 hatch keys with AB4726

Refs #566 and #572.

Decisions

  • Browserslist: chrome >= 144, the oldest verified shipped MCP desktop host floor (Cursor 3.18); newer Claude Desktop and Codex builds ship newer Chromium.
  • Legal comments: inline, because linked comments would create an unplanned sibling asset if minification is enabled; current minify: false bytes are unchanged.
  • React peers: ^19.2.0, within react-server-dom-rspack's ^19.1.0 contract while leaving exact React/React DOM matching to the host pair.
  • Development Flight: the Playwright trace proved a development producer is incompatible with the production decoder. The final branch restores main's production Flight pin while retaining development entries, output roots, server, and HMR topology; the lifecycle assertion is unchanged.

Local merge gate

Branch includes current origin/main (461a6dc5c9). All commands passed locally:

  • pnpm build && pnpm typecheck && pnpm lint && pnpm test:unit
  • pnpm exec rstest --config rstest.config.ts packages/workbench/tests/lifecycles.e2e.test.ts
  • pnpm --filter @agent-bundle-example/mcp-app test:browser-app
  • pnpm test:packed
  • pnpm docs:site:build

Review hygiene

  • Deslop: GPT-5.6 Sol, 5 edits; removed three speculative Flight fix layers, folded the compiler profile into its Rslib owner, and deleted redundant config.
  • Self-review: Claude Fable 5.1 Thinking High. It found no correctness, breaking-change, test, or documentation risks. The standalone compiler-profile and redundant source-map findings were fixed; re-review passed. legalComments: 'inline' and the Node-floor guard were retained because they are explicit audit requirements, with linked comments rejected by the single-file artifact contract.

Keep generated executables on es2022 from a single Node 22.19 constant,
inline legal comments so license text stays in the planned artifact, and
add output.sourceMap as an opt-in wired to the compiler profile.
…ESM shims (#566 §2/§4)

@agent-bundle/runtime declares react and react-dom as `^19.2.0` peers instead
of the exact `19.2.8` pins: the runtime only calls stable React 19 APIs,
react-dom enforces the react/react-dom exact match itself, and the Flight
binding react-server-dom-rspack@0.1.0 (still an exact dependency) accepts
`^19.1.0`, so the caret sits inside what it admits at the minor the suite
proves. rsc-markdown-stream is declared `workspace:^`; pnpm's packer rewrites
it to `^<version>` on publish, so the pnpm-workspace override goes away and a
rsc-markdown-stream release now patch-bumps the runtime through changesets.

The packed pool and the shared-pack fallback pack with `pnpm pack --json`
(scripts/pnpm-pack.mjs) — the packer `changeset publish` ships through — so
the tarball under test carries the rewritten range; `npm pack` would have
shipped `workspace:^` for a consumer's npm to refuse.

The package build's custom `agent-bundle:esm-node-globals` plugin and the
`node.__dirname/__filename = false` override are replaced by Rslib 1.0's
`lib.shims.esm` on both libs: it rewrites the bundled TypeScript parser's
`__filename`/`__dirname` inside the module to `fileURLToPath(import.meta.url)`
from `node:url`, and the only dist chunk that changes is the parser's.

Tests: manifest-contract.test.ts (caret ranges inside the Flight binding's,
pinned React inside the range, workspace:^, README claim), dist-esm-node-globals.test.ts
(no bare CommonJS path global in any emitted chunk), rstest-rslib-adapter
(shims on both libs, no plugin), packed-entry-identity (installed manifest
carries `^0.1.0`, peers as declared, `npm ls` reports no problems).
The provider session pinned production React and a bare pluginReact().
Development now follows options.mode, Fast Refresh stays off for the
srcdoc App, and the web hosts target chrome >= 144.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@changeset-bot

changeset-bot Bot commented Sep 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f448048

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
agent-bundle Minor
@agent-bundle/runtime Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Sep 5, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@648
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@648
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@648
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@648

commit: 2108b8a

@ScriptedAlchemy
ScriptedAlchemy merged commit 96c44ce into main Sep 6, 2026
1 check 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.

1 participant