feat!: modernize toolchain (TypeScript 7, rslib/SWC, Vitest, Biome) and drop UMD bundle#131
feat!: modernize toolchain (TypeScript 7, rslib/SWC, Vitest, Biome) and drop UMD bundle#131rolandjitsu wants to merge 12 commits into
Conversation
…nd drop UMD bundle Migrate the build/test/lint stack to a modern SWC-era toolchain: - Build with rslib (Rspack/SWC) instead of Rollup + multiple tsc passes; emit ESM (dist/index.js), CommonJS (dist/index.cjs) and type declarations (dist/index.d.ts) from a single config. - Type-check with TypeScript 7. - Replace Jest + ts-jest with Vitest (jsdom, v8 coverage). - Replace the deprecated TSLint with Biome (lint + format). - Drop the runtime tslib dependency (es2020 output needs no helpers); the package is now dependency-free. - Modernize package.json: exports map, "type": "module", Node >= 20 engine. - Update CI to Node 20/22/24 and refresh Dependabot. BREAKING CHANGE: the UMD bundle (dist/bundles/*.umd.js) has been removed and the published dist layout has changed - dist/index.js is now an ES module and dist/index.cjs is the CommonJS build. Script-tag/CDN consumers should load the ESM build from a CDN such as https://esm.sh/file-selector. The minimum supported Node.js version for development is now 20.
Coverage Report for CI Build 29149860605Coverage remained the same at 100.0%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Throw a dedicated UnexpectedObjectError (carrying the offending DataTransferItem) instead of a generic Error that stringified to the useless "[object Object] is not a File". Ports #123 to the modernized (Vitest/Biome) toolchain.
The legacy Entry API (readEntries) throws on some platforms, e.g. dragging a folder from Windows Explorer into Chromium, which rejected the entire drop. Prefer getAsFileSystemHandle for directories and fall back to readEntries. Closes #130
|
@rolandjitsu Since we're already in the Vite ecosystem, perhaps we should retool around that instead? Vitest, Rstack and Biome are nice tools, but they each bring in their own tooling ecosystem. Whereas Vite+ brings all the same tools with a unified toolchain, all based on the same Oxc libraries. Let me set up a PR so we can compare solutions. |
|
Also, let's split up any refactor work to keep this reviewable. I am available to review if you can open up separate PRs for them. |
Thanks @jonkoops. You're right that this PR pulls in three separate ecosystems: rslib on Rspack/SWC, Vitest on the Vite/Rolldown side, and Biome as its own Rust toolchain. Three parsers/transformers for a tiny zero-dep lib is more surface area than ideal. A few thoughts on Vite+ specifically:
That said, let's not decide this in the abstract - please do put up the comparison PR. We can judge them on the concrete stuff: bundle output (ESM/CJS/d.ts, tree-shaking, size-limit numbers), config complexity, CI wall-clock, and release behavior. Happy to go with Vite+ if it wins on those. |
I wanted to land this quick since all repos within react-dropzone have been unmaintained for some time. I'll see if I have the time to await reviews. Whatever needs change can be addressed in subsequent PRs. P.S.: I'm also reworking react-dropzone. |
To be honest, Vite+ also seems pretty attractive. I'll rework locally to see how that compares as well. |
|
Nice, yeah, let's work together on this! If you can split out the refactor work unrelated to tooling, I can get straight on reviewing that for you. I am not a maintainer on react-dropzone, but you can just add me as a reviewer :) |
Doing the same, I'll have something minimal working very soon that we can use as a basis. |
#132 . The luxury of AI 😆 Converging on the oxc/rolldown seems to produce smaller bundles. But the vp wrapper itself is not ready (it broke the dependency tree in testing), so the sweet spot today is adopting the oxc components directly, not Vite+ (yet). Let me get more notes down. |
|
Ok. These are not deal breakers, so we could potentially move forward with vite+ (well, oxc until vite+ is GA). Changes are in #133. I'll follow up with PRs for the other changes. But, I want to note that the changes in react-dropzone are a bit awkward due to vite leaning more towards vue in terms of docs - vitepress. rspress looked easier to adopt. Looking into alternatives or ways to make it work - maybe https://vocs.dev/. Main reason is that stylegudist is more or less unmaintained and it's difficult to move tooling fwd with it. |
What kind of change does this PR introduce?
Did you add tests for your changes?
If relevant, did you update the documentation?
Summary
Migrate the build/test/lint stack to a modern SWC-era toolchain:
Does this PR introduce a breaking change?
The UMD bundle (dist/bundles/*.umd.js) has been removed and the published dist layout has changed - dist/index.js is now an ES module and dist/index.cjs is the CommonJS build. Script-tag/CDN consumers should load the ESM build from a CDN such as https://esm.sh/file-selector. The minimum supported Node.js version for development is now 20.
Other information