Skip to content

feat!: modernize toolchain (TypeScript 7, rslib/SWC, Vitest, Biome) and drop UMD bundle#131

Open
rolandjitsu wants to merge 12 commits into
mainfrom
feat/modernize-toolchain
Open

feat!: modernize toolchain (TypeScript 7, rslib/SWC, Vitest, Biome) and drop UMD bundle#131
rolandjitsu wants to merge 12 commits into
mainfrom
feat/modernize-toolchain

Conversation

@rolandjitsu

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

  • Bug Fix
  • Feature
  • Refactoring
  • Style
  • Build
  • Chore
  • Documentation
  • CI

Did you add tests for your changes?

  • Yes, my code is well tested
  • Not relevant

If relevant, did you update the documentation?

  • Yes, I've updated the documentation
  • Not relevant

Summary

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.

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

…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.
@rolandjitsu rolandjitsu self-assigned this Jul 11, 2026
@coveralls

coveralls commented Jul 11, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 29149860605

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 64 of 64 lines across 5 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 106
Covered Lines: 106
Line Coverage: 100.0%
Relevant Branches: 69
Covered Branches: 69
Branch Coverage: 100.0%
Branches in Coverage %: Yes
Coverage Strength: 195.61 hits per line

💛 - Coveralls

Roland Groza added 9 commits July 11, 2026 15:25
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
@jonkoops jonkoops self-requested a review July 11, 2026 10:14
@jonkoops

Copy link
Copy Markdown
Collaborator

@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.

@jonkoops

Copy link
Copy Markdown
Collaborator

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.

@rolandjitsu

Copy link
Copy Markdown
Collaborator Author

@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.

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:

  1. The alignment argument is real. Vitest is already in this PR and it's what Vite+ ships anyway, so consolidating the rest onto the same Oxc/Rolldown base (tsdown for the build, oxlint/oxfmt for lint+format) genuinely reduces the fragmentation you're pointing at - and it's the first-party path for a lib in this ecosystem.
  2. My hesitation is maturity, not direction. Vite+ only hit alpha in March and is still in beta; oxfmt is very young next to Biome's formatter. Since file-selector ships in react-dropzone's dep tree, I'm wary of putting the release-critical build/publish pipeline on a beta meta-tool just yet. The underlying pieces (Vitest, Rolldown, Oxc) are solid - it's the vp wrapper and oxfmt I'd want to derisk.
  3. Possible middle path: adopt the Oxc-aligned pieces directly where they're ready (e.g. tsdown for the build instead of rslib) without taking on the full vp wrapper, then move to Vite+ proper once it's GA.

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.

@rolandjitsu

Copy link
Copy Markdown
Collaborator Author

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.

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.

@rolandjitsu

Copy link
Copy Markdown
Collaborator Author

@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.

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:

  1. The alignment argument is real. Vitest is already in this PR and it's what Vite+ ships anyway, so consolidating the rest onto the same Oxc/Rolldown base (tsdown for the build, oxlint/oxfmt for lint+format) genuinely reduces the fragmentation you're pointing at - and it's the first-party path for a lib in this ecosystem.
  2. My hesitation is maturity, not direction. Vite+ only hit alpha in March and is still in beta; oxfmt is very young next to Biome's formatter. Since file-selector ships in react-dropzone's dep tree, I'm wary of putting the release-critical build/publish pipeline on a beta meta-tool just yet. The underlying pieces (Vitest, Rolldown, Oxc) are solid - it's the vp wrapper and oxfmt I'd want to derisk.
  3. Possible middle path: adopt the Oxc-aligned pieces directly where they're ready (e.g. tsdown for the build instead of rslib) without taking on the full vp wrapper, then move to Vite+ proper once it's GA.

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.

To be honest, Vite+ also seems pretty attractive. I'll rework locally to see how that compares as well.

@jonkoops

Copy link
Copy Markdown
Collaborator

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 :)

@jonkoops

Copy link
Copy Markdown
Collaborator

To be honest, Vite+ also seems pretty attractive. I'll rework locally to see how that compares as well.

Doing the same, I'll have something minimal working very soon that we can use as a basis.

@rolandjitsu

Copy link
Copy Markdown
Collaborator Author

To be honest, Vite+ also seems pretty attractive. I'll rework locally to see how that compares as well.

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.

@rolandjitsu

Copy link
Copy Markdown
Collaborator Author
  1. It also looks like tsdown is not yet fully ready for ts 7. Had to use legacy-peer-deps=true to make it work. rslib already works with ts 7.
  2. Biome import organization seems better; not a deal breaker
  3. until vp is ready, using oxc directly seems like more clutter as compared to using biome + rstack-ish; not a deal breaker either

@rolandjitsu

rolandjitsu commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author
  1. It also looks like tsdown is not yet fully ready for ts 7. Had to use legacy-peer-deps=true to make it work. rslib already works with ts 7.
  2. Biome import organization seems better; not a deal breaker
  3. until vp is ready, using oxc directly seems like more clutter as compared to using biome + rstack-ish; not a deal breaker either

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.

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