Commit 7c6af4e
committed
build: replace rollup/babel/terser build with tsdown
Collapse the hand-rolled Rollup orchestrator (scripts/configs.cjs +
config-types.cjs + build.main.cjs, 373 lines) and 8 build devDeps into one
tsdown.config.ts (rolldown engine + built-in dts). Chosen over tsup after a
problem-blind Codex assessment and a spike: tsdown emits constructor-direct
CJS (require('fuse.js') === Fuse) and named worker CJS automatically, no
footer hacks.
Behavior-preserving on the public surface:
- identical 15-file dist set (12 runtime + 3 dts)
- CJS require() contract unchanged; named fuse-worker.cjs export preserved
- feature-flag DCE intact (basic build strips logical/extended/token)
- dev/prod default-export split preserved
- Fuse.version injected via define (bare __VERSION__ + ambient declare;
honors process.env.VERSION for releases)
Worker-URL resolution no longer depends on a bundler's import.meta.url
codegen: a per-format __WORKER_IS_CJS__ define routes browser-CJS to a
document base while ESM keeps the literal new URL('./fuse.worker.mjs',
import.meta.url) so bundlers still detect and rewrite the worker asset.
test/worker-url.test.js gates node-ESM, node-CJS, browser-ESM (Vite), and
browser-CJS. test/cjs-interop.test.js gates require() === constructor for
every lib cjs plus the named worker cjs.
Sizes: minified artifacts are 287-313 bytes smaller raw; gzip is +8..+28
bytes (<=0.4%, accepted) since rolldown's minifier compresses marginally
worse than Terser.
Build/release now requires Node >=22.18 (tsdown engines): CI builds on 22/24
and runs the Node 20 leg against the committed dist. docs-deploy
reconciliation is descoped (deploy-docs.sh is the only path that bumps docs
before deploy; needs a release-ordering fix first).
Removed devDeps: rollup, @rollup/plugin-babel, @rollup/plugin-node-resolve,
@rollup/plugin-replace, @babel/core, @babel/preset-typescript, terser,
rollup-plugin-dts. Added: tsdown.1 parent 50f6b24 commit 7c6af4e
30 files changed
Lines changed: 8714 additions & 11436 deletions
File tree
- .github/workflows
- dist
- scripts
- src
- workers
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
29 | 32 | | |
| 33 | + | |
30 | 34 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | | - | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
45 | | - | |
| 46 | + | |
| 47 | + | |
46 | 48 | | |
47 | 49 | | |
48 | 50 | | |
| |||
0 commit comments