Skip to content

build: ship reylo's javascript without comments - #61

Merged
colinhacks merged 1 commit into
mainfrom
engine-api-slim
Oct 23, 2026
Merged

colinhacks merged 1 commit into
mainfrom
engine-api-slim

Conversation

@colinhacks

Copy link
Copy Markdown
Owner

nub run build now passes every compiled .js file in dist/reylo through esbuild's transform, which drops comments and keeps the code otherwise as tsc wrote it (no minifying, no bundling; the #! line of the CLI stays). The declarations are untouched, so every doc comment an editor shows is still there.

dist/reylo Before After
Unpacked 411 KB 293 KB
JavaScript 330 KB 211 KB
Declarations 73 KB 73 KB
npm pack tarball about 117 KB 86 KB

Verified with the typecheck, the package build and every example, each of which links the built dist/ (Node, nub, Bun, Vite, Next.js, esbuild, webpack, Rspack, Jest, Cloudflare Workers): all pass.

The comments are a third of the published JavaScript. The sources and the declarations keep them, and editors read doc comments from the declarations.
Copilot AI balanced review requested due to automatic review settings October 23, 2026 04:55
@vercel

vercel Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
reylo Ready Ready Preview Oct 23, 2026 4:56am UTC

Request Review

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

I reviewed the post-tsc comment-stripping step added to scripts/build.ts.

  • Comments stripped from dist/reylo JavaScript: once tsc has run, each emitted .js file goes through esbuild's transformSync with loader: "js" and legalComments: "inline". The output stays ESM with an esnext target, and the .d.ts files are left alone, so editors still show every doc comment.

What I checked:

  • esbuild was already a root devDependency, so the new import needs no package.json change.
  • tsconfig.build.json emits no source maps, so the rewrite can't leave a stale map behind.
  • src/ has no bundler magic comments (webpackIgnore, @vite-ignore) that the transform could drop.
  • Nothing at run time reads the text of its own JS files.
  • The new URL(…, import.meta.url) and new Worker(new URL(…)) patterns in src/bridge.ts and src/sqlite-drivers.ts come through the transform byte-for-byte, so bundlers still detect them.
  • esbuild keeps the CLI's #! line.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@colinhacks
colinhacks merged commit 98259cd into main Oct 23, 2026
6 checks passed
@colinhacks
colinhacks deleted the engine-api-slim branch October 23, 2026 05:03
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