build: migrate to tsgo, strip internal declarations, extract FieldMetaApplier - #43
Closed
parkrevil wants to merge 4 commits into
Closed
build: migrate to tsgo, strip internal declarations, extract FieldMetaApplier#43parkrevil wants to merge 4 commits into
parkrevil wants to merge 4 commits into
Conversation
Replace the per-file `bun build --production` + `tsc --emitDeclarationOnly` + extension-fixup pipeline with a single `tsgo -p tsconfig.build.json`, matching the sibling @zipbul/* packages (e.g. ashward). typecheck and typecheck:bench move to tsgo as well. - add @typescript/native-preview (exact pin, same as ashward) - tsconfig: add `types: ["bun"]` (tsgo does not auto-include bun ambient types) - tsconfig.build: `noEmitOnError` so a broken emit fails loud - delete scripts/build.sh and scripts/add-js-extensions.ts - drop stale `--production` enum-inlining comments and the knip `tsc` binary ignore Typecheck drops from ~1.75s to ~0.17s. Emitted .d.ts is byte-identical to tsc except cosmetic quote style. JS now ships extensionless relative imports (as the sibling packages do); baker is Bun-only (relies on Symbol.metadata), so Node-native ESM resolvability is not a supported consumption path, and bundlers resolve fine. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Enable `stripInternal` so @internal-tagged symbols (toBakerIssueSet, checkCallOptions, CircularPlaceholder, EmitContext.pathExpr) are removed from the emitted .d.ts while remaining exported from source for direct unit testing — the intended use of @internal. Two source fixes were required so stripping leaves no dangling references: - makeRule/makePlannedRule now return EmittableRule (not the internal InternalRule), so public rule constants (isString, min, …) surface as EmittableRule. @field already casts to InternalRule at the metadata boundary, so builders keep .plan. - toBakerIssueSet is no longer re-exported from the common barrel; the two runtime consumers import it directly from common/errors. - InternalRule keeps its @internal-free doc (it is shared metadata↔builder plumbing, never reachable through the exports map, so it needs no stripping). Verified: published .d.ts no longer contains the stripped helpers; a consumer typecheck (skipLibCheck:true) against the built package is clean and cannot import the stripped symbols; 2469 tests green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The six meta-application helpers (applyValidation/applyExpose/applyTransform + decorateRuleDef/withGroups/wrapTransform) plus the inline flags/type/exclude/ message-context blocks all threaded the same (meta, propertyKey, options) trio — the exact param-threading pattern the seal-stage builders were refactored away from. Move them into a FieldMetaApplier class that holds the trio as fields, so the @field decorator now only validates the decorator context and parses args, then delegates application. Pure move; behavior and public API unchanged; field.ts stays 100% covered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
`tsgo -p tsconfig.build.json` does not remove obsolete output, so a renamed or deleted source could leave a stale file that the `dist/**` files glob would publish. Prepend `rm -rf dist` (the old build.sh did this) so the build is self-cleaning. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Closing — continuing work directly, not as a separate PR. |
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.
Summary
Build-infra + internal-hygiene changes. No public API change (no semver-major).
bun build --production+tsc --emitDeclarationOnly+ extension-fixup pipeline with a singletsgo -p tsconfig.build.json, matching sibling@zipbul/*packages. typecheck ~10× faster.types: ["bun"]added;noEmitOnErroron the build; stale build scripts +--productioncomments removed.@internalhelpers (toBakerIssueSet,checkCallOptions,CircularPlaceholder,EmitContext.pathExpr) are now stripped from published.d.ts. Public rule constants surface asEmittableRule(were leakingInternalRule);toBakerIssueSetno longer re-exported from the common barrel.@Fieldmeta-application helpers (which threaded the samemeta/propertyKey/optionstrio) become a class, mirroring the seal-stage builders.rm -rf distbefore emit so stale output can't be published.Verification
skipLibCheck:true) against the built package is clean; stripped internals are provably not importable🤖 Generated with Claude Code