Repository navigation
build: ship reylo's javascript without comments - #61
Merged
Merged
Conversation
The comments are a third of the published JavaScript. The sources and the declarations keep them, and editors read doc comments from the declarations.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
I reviewed the post-tsc comment-stripping step added to scripts/build.ts.
- Comments stripped from
dist/reyloJavaScript: oncetschas run, each emitted.jsfile goes through esbuild'stransformSyncwithloader: "js"andlegalComments: "inline". The output stays ESM with an esnext target, and the.d.tsfiles are left alone, so editors still show every doc comment.
What I checked:
esbuildwas already a root devDependency, so the new import needs nopackage.jsonchange.tsconfig.build.jsonemits 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)andnew Worker(new URL(…))patterns insrc/bridge.tsandsrc/sqlite-drivers.tscome through the transform byte-for-byte, so bundlers still detect them. - esbuild keeps the CLI's
#!line.
claude-opus-5-5 | 𝕏
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.

nub run buildnow passes every compiled.jsfile indist/reylothrough 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/reylonpm packtarballVerified 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.