uppy/packages/@uppy/react/package.json
Prakash 804363e86e
@uppy: upgrade vitest to v4 (#6309)
This PR Bumps the `vitest` across the monorepo:

AI Disclaimer : **AI Used**

  | Package | From | To |
  |---|---|---|
  | `vitest` | `^3.2.4` | `^4.1.6` |
  | `@vitest/browser` | `^3.2.4` | `^4.1.6` |
  | `@vitest/browser-playwright` | _(new)_ | `^4.1.6` |
| `vitest-browser-react/-vue/-svelte` | `^1.0.0` | `^2.x` (required by
vitest 4) |

Covers **21 `package.json` files** for `vitest`/`@vitest/browser` + the
**7 browser-mode packages** that need the new
  `@vitest/browser-playwright` provider.

  ### Code changes required by vitest 4

Per the [official migration
guide](https://vitest.dev/guide/migration.html#vitest-4):

- **Browser provider rework** — `provider: 'playwright'` (string) →
`playwright()` factory. Migrated 7 `vitest.config.ts` files
(`@uppy/{url,dashboard,golden-retriever,xhr-upload}` +
`examples/{react,vue,sveltekit}`).
- **Deprecated `@vitest/browser/context` imports** → `vitest/browser`.
Migrated 8 test files.
- **`vi.fn(arrow)` no longer constructible with `new`.** Vitest 4 made
`vi.fn()` callable as a constructor but arrow-fn
implementations throw. Switched `@uppy/transloadit`'s `EventSource` mock
to a regular function:
    ```js
global.EventSource = vi.fn(function MockEventSource() { return { /* ...
*/ } })
    ```
- **`Mock<T>` generic shape changed.** `ReturnType<typeof vi.fn>` now
resolves to `Mock<Procedure | Constructable>` (not directly
callable). Updated `@uppy/core`'s two `acquirerPlugin*.ts` mock helpers
to use an explicit `Mock<(...args: any[]) => any>`.
- **`vitest-browser-*` v2 made `render()` async.** Added `await
render(...)` in the 3 example test files.
- **`@types/node` needed in TS program for 4 packages** whose test files
import `node:assert`/`node:fs`/`node:path`
(`@uppy/{core,compressor,aws-s3,store-default}`). Vitest 3 transitively
pulled in `@types/node`; vitest 4 does not. Added the
  devDep + `types: ["preact", "node"]` to those four tsconfigs.
- **`@uppy/utils` `AbortController.test.ts`** — vitest 4's jsdom env
puts jsdom's `Event` on `globalThis`, while Node's
`AbortController` fires Node-realm `Event`s, breaking cross-realm
`instanceof`. Added `// @vitest-environment node` to that one
  file (DOM-agnostic test, no behavior change).
  
  ### Notes

- This PR is built on top of `uppy-upgrade-deps-v2` (the no-code-changes
dep bumps PR) and inherits those. If merging out of order,
   rebase onto `main` after `uppy-upgrade-deps-v2` lands.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-26 21:54:07 +05:30

87 lines
2.2 KiB
JSON

{
"name": "@uppy/react",
"description": "React component wrappers around Uppy's official UI plugins.",
"version": "5.2.0",
"license": "MIT",
"type": "module",
"sideEffects": [
"*.css"
],
"scripts": {
"build": "tsc --build tsconfig.build.json",
"build:css": "mkdir -p dist && cp ../components/dist/styles.css dist/styles.css && cp ../components/dist/image-editor.css dist/image-editor.css",
"typecheck": "tsc --build",
"test": "vitest run --environment=jsdom --silent='passed-only'"
},
"keywords": [
"file uploader",
"uppy",
"uppy-plugin",
"react",
"react-components"
],
"homepage": "https://uppy.io",
"bugs": {
"url": "https://github.com/transloadit/uppy/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/transloadit/uppy.git"
},
"files": [
"src",
"lib",
"dist",
"CHANGELOG.md"
],
"dependencies": {
"@uppy/components": "workspace:^",
"preact": "^10.29.2",
"use-sync-external-store": "^1.6.0"
},
"devDependencies": {
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^16.0.0",
"@types/react": "^19.2.14",
"@types/use-sync-external-store": "^0.0.6",
"@uppy/core": "workspace:^",
"jsdom": "^26.1.0",
"react": "^19.2.6",
"react-dom": "^19.2.6",
"typescript": "^5.8.3",
"vitest": "^4.1.6"
},
"exports": {
".": "./lib/index.js",
"./css/style.css": "./dist/styles.css",
"./css/image-editor.css": "./dist/image-editor.css",
"./dashboard": "./lib/Dashboard.js",
"./status-bar": "./lib/StatusBar.js",
"./dashboard-modal": "./lib/DashboardModal.js",
"./package.json": "./package.json"
},
"peerDependencies": {
"@uppy/core": "workspace:^",
"@uppy/dashboard": "workspace:^",
"@uppy/screen-capture": "workspace:^",
"@uppy/status-bar": "workspace:^",
"@uppy/webcam": "workspace:^",
"react": "^18.0.0 || ^19.0.0",
"react-dom": "^18.0.0 || ^19.0.0"
},
"peerDependenciesMeta": {
"@uppy/dashboard": {
"optional": true
},
"@uppy/screen-capture": {
"optional": true
},
"@uppy/status-bar": {
"optional": true
},
"@uppy/webcam": {
"optional": true
}
}
}