Skip to content

fix(build): resolve workspace imports to source through a development condition (#1056) - #1065

Merged
jimhoyd merged 1 commit into
mainfrom
claude/dev-conditions-1056
Sep 30, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/dev-conditions-1056

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1056

Why the condition was missing

#305 ("Slim and enforce release packages", 410a23b) removed every development condition. The package audit it added requires every export target to be in the tarball, and src/ never ships. docs/TYPESCRIPT.md kept describing the condition, so workspace packages and tests resolved dist/, which went stale after merges until someone ran npm run build.

Change

  • Core's package.json and each add-on's (audit, auth, mcp, store) now list "development": "<src>.ts" first in every JS exports entry. It has to come before types, or tsc matches types (dist declarations) and never gets to development. customConditions: ["development"] in tsconfig.base.json is now in effect.
  • Published tarballs never carry it: scripts/published-manifest.mjs strips development conditions, as it already strips prepare. Core was already packed from a staged copy with that manifest. pack-addons now packs add-ons the same way (new packPublished), which also means the checkout is never modified, and workerd-parity packs core that way too. package-audit checks the published manifest, and a new assertion refuses any published export that names source.
  • Each add-on's tsconfig.build.json sets customConditions: []. Its emit (rootDir src) reads core's built declarations instead of pulling core source outside its rootDir. The Worker build, package smoke test and examples still run from dist/.
  • The root tsconfig paths workaround for audit is gone, and so is bench:store's audit prebuild; both are covered by the condition now.
  • create-extension scaffolds the same exports and build-config shape.
  • docs/TYPESCRIPT.md is corrected, docs/LOCAL-DEVELOPMENT.md gets a note, and the tsconfig.base.json comment is updated.

Evidence

  • New tests in test/exports.test.ts:
    • every JS export of core and of each add-on has development first, pointing at an existing src/*.ts that matches its default;
    • publishedManifest leaves no source condition in the exports;
    • from packages/store, node --conditions=development resolves @jimhoyd/urlcode/sqlite, /extensions and @jimhoyd/urlcode-audit to packages/core/src and packages/audit/src, and ts.resolveModuleName with the store's tsconfig does too (the build config resolves dist).
  • Manual check: I added a new export to packages/core/src/sqlite.ts and imported it from packages/store/src, with dist not rebuilt. tsc --noEmit in store passed and node --conditions=development printed the value. Both changes were reverted.
  • npm run verify and npm run test:package pass locally (macOS, Node 26). All six package audits pass; the packed sizes are within budget and did not grow.

Not run

npm run test:workerd needs the network and is optional; I checked only that its change typechecks.

🤖 Generated with Claude Code

… condition (#1056)

docs/TYPESCRIPT.md said every export entry had a `development` condition
pointing at source; #305 had removed them because the package audit required
every export target to ship, and src/ never does. Workspace packages and tests
therefore read dist/, which went stale after merges until a rebuild.

- Core's and each add-on's exports list `development` first (ahead of `types`,
  so tsc resolves source through customConditions too), naming the .ts source.
- Packing strips the condition: publishedManifest drops it, add-ons are now
  packed from a staged copy with their published manifest like core, and
  workerd-parity packs the same way. The package audit reads the published
  manifest and refuses any export naming source.
- Add-on tsconfig.build.json clears customConditions so the emit (rootDir src)
  reads core's built declarations. The root tsconfig paths workaround for
  audit and the bench's audit prebuild are gone.
- create-extension scaffolds the same shape.
- Tests assert the manifests' shape, that the packed manifest has no source
  condition, and that packages/store resolves @jimhoyd/urlcode/sqlite and
  @jimhoyd/urlcode-audit to source in Node and tsc.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 30, 2026 16:07
@jimhoyd
jimhoyd merged commit 1066090 into main Sep 30, 2026
29 checks passed
@jimhoyd
jimhoyd deleted the claude/dev-conditions-1056 branch September 30, 2026 16:21
jimhoyd added a commit that referenced this pull request Sep 30, 2026
…hs-filter plan and release-please config

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

docs/TYPESCRIPT.md claims exports have a development condition; none do, so workspace code runs stale dist

1 participant