Skip to content

Ship smaller builds and stop publishing unplugin's test bundle - #92

Merged
k0d13 merged 3 commits into
mainfrom
kodie/smaller-published-bundles
Aug 10, 2026
Merged

Ship smaller builds and stop publishing unplugin's test bundle#92
k0d13 merged 3 commits into
mainfrom
kodie/smaller-published-bundles

Conversation

@k0d13

@k0d13 k0d13 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Build settings and dependencies. The one source change is a Babel plugin reading types from the api object it is already handed.

unplugin-saykit was publishing its test suite

entry: ['src/index.ts', 'src/*.ts'] matched src/index.test.ts, so dist/index.test.mjs (538kb) and a bundled magic-string chunk shipped to npm. The glob now excludes tests: 574kb → 4kb.

turbo never rebuilt on a config change

build.inputs was ["src/**"], so edits to tsdown.config.ts or package.json hit a stale cache and left dist untouched — the first rebuild after changing a config returned "7 cached" and stale output. Both are inputs now, along with tsconfig.json; check gained tsconfig.json and package.json too.

Doc comments move to the declarations

outputOptions: { comments: { jsdoc: false } } on every package. The comments a consumer reads in an editor come from the .d.mts/.d.cts, which keep every one of them. Nothing is minified — identifiers, formatting and //#region markers survive, so a stack trace still points at readable code — and /* @__PURE__ */ annotations are preserved for downstream tree-shaking.

Package before after
unplugin-saykit 574.7kb 4.3kb
@saykit/config 127.7kb 107.8kb
saykit 41.6kb 27.1kb
@saykit/react 19.7kb 17.1kb
babel-plugin-saykit 17.3kb 13.1kb
@saykit/transform-jsx 16.3kb 14.6kb
@saykit/transform-js 15.2kb 13.6kb
@saykit/carbon 6.9kb 6.3kb
@saykit/format-json 5.3kb 4.8kb
@saykit/format-po 2.3kb 2.3kb

Two dependencies dropped

  • @babel/core is now a peer of babel-plugin-saykit. It was a hard dependency for one runtime value, types, which Babel already passes to every plugin as its first argument. The import is now type-only. This is what every babel-plugin-* does, it drops 1.1MB plus Babel's own tree from the install for anyone who already has Babel — which, for a plugin that only runs inside Babel, is everyone — and it removes any chance of the plugin running against a different copy of Babel than its host.
  • vite-tsconfig-paths → vitest's own resolve.tsconfigPaths, which vitest 4 had started warning about.

Also

  • saykit and @saykit/react target ES2022 rather than ES2020. Below ES2022 a #private field is lowered to a WeakMap per field plus accessor helpers, which cost 2.8kb in the runtime alone.
  • "sideEffects": false on saykit and @saykit/carbon. Deliberately not on @saykit/react: src/runtime/server.ts opens with import 'server-only', a bare side-effect import whose whole job is to throw when it reaches a client bundle, and declaring the package side-effect-free invites a bundler to drop exactly that guard.

What was measured and rejected

js-sha256 (125kb) looked like an easy swap for node:crypto's createHash, and the ids came out byte-identical, but the playground threw "[unenv] crypto.createHash is not implemented yet!" — unenv leaves that entry point unimplemented, so any Nitro or workerd build of a saykit plugin would break. It is now hashed in userland again, with a comment recording why, since the Web Crypto equivalent is async and an id is resolved from a synchronous extraction pass.

minify in any form, whole-comment stripping, tuned treeshake options, noExternal, platform: 'neutral' — each either bought nothing over what rolldown already does, or cost readability or @__PURE__ annotations for under 100 bytes.

Two source-level dedups in saykit were tried and reverted: folding number()/datetime() in values.ts into one factory (−175 bytes minified, +7 gzipped) and collapsing the six macro stubs' repeated error string into a helper (−376 bytes minified, +6 gzipped). gzip already deduplicates both, so each traded free repetition for structure that is not free.

Bundled size of saykit with its dependencies is unchanged at 20.5kb gzipped — a consumer's bundler was already stripping the comments, and the project's own code is only 3.4kb of that. Moving the number means addressing dependencies: the MF1 parser and moo are 5.0kb gzipped, the two skeleton parsers 5.3kb, and messageformat 7.2kb — the last of which is largely DefaultFunctions and the MF2 syntax parser, neither of which this runtime uses but neither of which can be tree-shaken through the public API.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
saykit Ready Ready Preview Aug 10, 2026 2:00pm

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4da16d4

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

This PR includes changesets to release 10 packages
Name Type
unplugin-saykit Patch
saykit Patch
@saykit/react Patch
@saykit/carbon Patch
@saykit/config Patch
@saykit/format-json Patch
@saykit/format-po Patch
babel-plugin-saykit Patch
@saykit/transform-js Patch
@saykit/transform-jsx 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

@github-actions github-actions Bot added package: core Related to the core saykit package package: react Related to @saykit/react package: carbon Related to @saykit/carbon package: config Related to @saykit/config and the CLI package: format-po Related to @saykit/format-po package: babel-plugin Related to babel-plugin-saykit package: unplugin Related to unplugin-saykit package: transform-js Related to @saykit/transform-js package: transform-jsx Related to @saykit/transform-jsx package: format-json Related to @saykit/format-json labels Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The changes update package build output, package metadata, and Turbo task inputs. Generated JavaScript omits JSDoc comments, selected builds target ES2022, test entries are excluded, and release notes document smaller packages.

Changes

Build output and package metadata

Layer / File(s) Summary
Build output configuration
packages/*/tsdown.config.ts
Builds omit JSDoc comments. Integration builds target ES2022. The unplugin build excludes test entries.
Package and task metadata
packages/integration*/package.json, turbo.json
Integration packages declare "sideEffects": false. Turbo tracks package and build configuration files for check and build.
Release notes
.changeset/*.md
Changesets record patch releases, retained type declaration comments, smaller builds, and removal of the published test bundle.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit checks the bundle size,
JSDoc hops from JavaScript skies.
Test files stay behind the gate,
ES2022 sets the date.
Tiny packages thump with cheer,
While type comments remain clear.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarises the main changes: smaller builds and stopping publication of the unplugin test bundle.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kodie/smaller-published-bundles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown

Greptile Summary

The PR reduces published package sizes by excluding the unplugin test bundle and removing JSDoc comments from JavaScript output while retaining declaration documentation.

  • Adds build and type-check configuration files to Turbo cache inputs.
  • Raises the saykit and @saykit/react output target to ES2022.
  • Marks saykit and @saykit/carbon as side-effect-free.
  • Adds patch changesets for the affected published packages.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code-triggered failures identified.

The test exclusion retains every public unplugin adapter, the comment option affects JavaScript rather than declaration documentation, Turbo now tracks relevant configuration inputs, and the new side-effect metadata does not suppress any established module-evaluation requirement.

Reviews (1): Last reviewed commit: "Ship smaller builds and stop publishing ..." | Re-trigger Greptile

@k0d13
k0d13 force-pushed the kodie/smaller-published-bundles branch from 85b7af1 to da9fc02 Compare August 10, 2026 13:42
@github-actions github-actions Bot added the dependencies Updates or changes related to project dependencies label Aug 10, 2026
@k0d13 k0d13 added the preview Publish a preview build and link it from the pull request label Aug 10, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@saykit/config

npm i https://pkg.pr.new/@saykit/config@92

@saykit/format-json

npm i https://pkg.pr.new/@saykit/format-json@92

@saykit/format-po

npm i https://pkg.pr.new/@saykit/format-po@92

saykit

npm i https://pkg.pr.new/saykit@92

@saykit/carbon

npm i https://pkg.pr.new/@saykit/carbon@92

@saykit/react

npm i https://pkg.pr.new/@saykit/react@92

babel-plugin-saykit

npm i https://pkg.pr.new/babel-plugin-saykit@92

unplugin-saykit

npm i https://pkg.pr.new/unplugin-saykit@92

@saykit/transform-js

npm i https://pkg.pr.new/@saykit/transform-js@92

@saykit/transform-jsx

npm i https://pkg.pr.new/@saykit/transform-jsx@92

commit: da9fc02

@github-actions

Copy link
Copy Markdown
Contributor

The preview build of da9fc02 is published. Open it in the playground to run this pull request against your own code, straight from the browser.

@github-actions github-actions Bot removed the preview Publish a preview build and link it from the pull request label Aug 10, 2026
@k0d13
k0d13 merged commit 8456e04 into main Aug 10, 2026
8 checks passed
@k0d13
k0d13 deleted the kodie/smaller-published-bundles branch August 10, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Updates or changes related to project dependencies package: babel-plugin Related to babel-plugin-saykit package: carbon Related to @saykit/carbon package: config Related to @saykit/config and the CLI package: core Related to the core saykit package package: format-json Related to @saykit/format-json package: format-po Related to @saykit/format-po package: react Related to @saykit/react package: transform-js Related to @saykit/transform-js package: transform-jsx Related to @saykit/transform-jsx package: unplugin Related to unplugin-saykit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant