Skip to content

🧼 optimize install size#35

Open
natemoo-re wants to merge 14 commits into
mainfrom
ref/opt
Open

🧼 optimize install size#35
natemoo-re wants to merge 14 commits into
mainfrom
ref/opt

Conversation

@natemoo-re
Copy link
Copy Markdown
Member

@natemoo-re natemoo-re commented May 23, 2026

Reduces npm install size by 86% (832 kB → 113 kB unpacked) via:

  • optimizing clang build flags with explicit exports and dead code elimination

  • running wasm-opt on the generated wasm output

  • deflate-compressed base64 wasm.ts file (decodes and passes through DecompressionStream before instantiating) brotli-11 compressed z85 wasm.ts file (decodes via node:zlib before instantiating)

  • stripped source maps and src/ duplication from the npm package

  • two rewrite passes on the wcwidth table

    • remove known single-width characters, reducing from 2,143 entries to 498 (width-0 [combining] and width-2 [wide CJK])
    • split into separate lo and count tables with compact 4-byte encodings where uint16_t count = hi - lo

Also bumps minimum node version to v22 (current LTS).

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 23, 2026

Open in StackBlitz

npm i https://pkg.pr.new/clayterm@35

commit: e40745b

Copy link
Copy Markdown
Member

@dreyfus92 dreyfus92 left a comment

Choose a reason for hiding this comment

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

overall looks really good. since you're optimizing install size, are you planning on the near future to add a "no size regression test", cause rn there's nothing in the CI that asserts the package stays under a certain size. without that the size could quietly creep back up over time.

Comment thread tasks/build-npm.ts Outdated
Comment thread tasks/build-npm.ts
Comment thread tasks/build-npm.ts Outdated
natemoo-re added a commit that referenced this pull request May 24, 2026
Co-Authored-By: ghostdevv <ghostdevbusiness@gmail.com>
natemoo-re added a commit that referenced this pull request May 24, 2026
- replace sourceMap/declarationMap/target compiler options with skipSourceOutput: true
- add type: "module" to package config
- remove redundant files: ["esm"] (npm excludes lock files automatically, .npmignore handles the rest)

Co-Authored-By: ghostdevv <ghostdevbusiness@gmail.com>
Co-Authored-By: ghostdevv <47755378+ghostdevv@users.noreply.github.com>
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.

3 participants