Merge branch 'main' into restore/pr-6136

This commit is contained in:
Prakash 2026-07-26 16:23:41 +05:30 committed by GitHub
commit eea62ec02d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
90 changed files with 2098 additions and 2541 deletions

View file

@ -0,0 +1,9 @@
---
"@uppy/companion": patch
"@uppy/angular": patch
---
Upgrade runtime dependencies. Companion moves to `ws` 8.21.1, `morgan` 1.11.0,
`helmet` 8.3.0, `ioredis` 5.11.1, `serialize-javascript` 7.0.7,
`content-disposition` 2.0.1 and `p-map` 7.0.5. `@uppy/angular` moves to
`zone.js` ~0.16.2, matching its Angular 21 peer range.

View file

@ -0,0 +1,26 @@
---
"@uppy/screen-capture": minor
"@uppy/image-generator": minor
"@uppy/google-drive": minor
"@uppy/image-editor": minor
"@uppy/components": minor
"@uppy/status-bar": minor
"@uppy/dashboard": minor
"@uppy/drag-drop": minor
"@uppy/facebook": minor
"@uppy/onedrive": minor
"@uppy/unsplash": minor
"@uppy/dropbox": minor
"@uppy/svelte": minor
"@uppy/webcam": minor
"@uppy/webdav": minor
"@uppy/audio": minor
"@uppy/react": minor
"@uppy/core": minor
"@uppy/zoom": minor
"@uppy/box": minor
"@uppy/url": minor
"@uppy/vue": minor
---
Import Preact from @uppy/core utilities to guarantee a single version across packages.

View file

@ -2,6 +2,14 @@
version: 2
updates:
# Maintain dependencies for npm
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
cooldown:
default-days: 7
# Maintain dependencies for GitHub Actions
- package-ecosystem: 'github-actions'
directory: '/'

1
.gitignore vendored
View file

@ -19,6 +19,7 @@ tsconfig.build.tsbuildinfo
.svelte-kit
.turbo
__screenshots__
.vitest-attachments
dist/
lib/

View file

@ -9,6 +9,6 @@ initScope: uppy
nodeLinker: node-modules
npmMinimalAgeGate: 2880
npmMinimalAgeGate: "1w"
npmPublishAccess: public

View file

@ -14,7 +14,7 @@
"@aws-sdk/client-sts": "^3.338.0",
"@aws-sdk/s3-request-presigner": "^3.338.0",
"body-parser": "^1.20.4",
"dotenv": "^16.0.0",
"dotenv": "^17.4.2",
"express": "^5.2.1"
}
}

View file

@ -8,7 +8,7 @@
"uppy": "workspace:*"
},
"devDependencies": {
"esbuild": "^0.25.0"
"esbuild": "^0.28.1"
},
"private": true,
"type": "module",

View file

@ -16,9 +16,9 @@
"@uppy/transloadit": "workspace:*",
"@uppy/tus": "workspace:*",
"@uppy/xhr-upload": "workspace:*",
"next": "16.1.5",
"react": "19.1.0",
"react-dom": "19.1.0"
"next": "16.2.10",
"react": "19.2.7",
"react-dom": "19.2.7"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",

View file

@ -29,7 +29,7 @@
"@vitest/browser": "^4.1.6",
"@vitest/browser-playwright": "^4.1.6",
"msw": "^2.10.4",
"playwright": "1.60.0",
"playwright": "1.61.1",
"typescript": "^5.7.3",
"vite": "^8.0.14",
"vitest": "^4.1.6",

View file

@ -29,7 +29,7 @@
"@vitest/browser": "^4.1.6",
"@vitest/browser-playwright": "^4.1.6",
"msw": "^2.10.4",
"playwright": "1.60.0",
"playwright": "1.61.1",
"svelte": "^5.0.0",
"svelte-check": "^4.0.0",
"tailwindcss": "^4.0.0",

View file

@ -25,7 +25,7 @@
"@vitest/browser": "^4.1.6",
"@vitest/browser-playwright": "^4.1.6",
"msw": "^2.10.4",
"playwright": "1.60.0",
"playwright": "1.61.1",
"tailwindcss": "^4.0.0",
"vite": "^7.1.11",
"vitest": "^4.1.6",

View file

@ -30,7 +30,7 @@
},
"devDependencies": {
"@biomejs/biome": "2.4.15",
"@changesets/changelog-github": "^0.5.1",
"@changesets/changelog-github": "^0.7.0",
"@changesets/cli": "patch:@changesets/cli@npm%3A2.29.5#~/.yarn/patches/@changesets-cli-npm-2.29.5-68d8030bf3.patch",
"npm-run-all": "^4.1.5",
"turbo": "^2.5.4",

View file

@ -19,19 +19,19 @@
"@angular/router": "^21.2.10",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
"zone.js": "~0.16.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^21.2.8",
"@angular/cli": "^21.2.8",
"@angular/compiler-cli": "^21.2.10",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.1.0",
"@types/jasmine": "~6.0.0",
"jasmine-core": "~6.3.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"karma-jasmine-html-reporter": "~2.2.0",
"ng-packagr": "^21.2.3",
"typescript": "~5.9.0"
}

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import type { h } from 'preact'
import type { h } from '@uppy/core/utils/preact'
interface PermissionsScreenProps {
icon: () => h.JSX.Element | null

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import { useEffect, useRef } from 'preact/hooks'
import { useEffect, useRef } from '@uppy/core/utils/preact/hooks'
import AudioSourceSelect, {
type AudioSourceSelectProps,
} from './AudioSourceSelect.js'

View file

@ -44,12 +44,12 @@
"@types/node": "^20.19.0",
"@uppy/core": "workspace:^",
"@vitest/browser-playwright": "^4.1.6",
"jsdom": "^26.1.0",
"jsdom": "^29.1.1",
"nock": "^13.1.0",
"playwright": "1.60.0",
"playwright": "1.61.1",
"typescript": "^5.8.3",
"vitest": "^4.1.6",
"whatwg-fetch": "3.6.2"
"whatwg-fetch": "3.6.20"
},
"peerDependencies": {
"@uppy/core": "workspace:^"

View file

@ -16,7 +16,7 @@ import {
import { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -42,7 +42,7 @@
"body-parser": "2.2.2",
"common-tags": "1.8.2",
"connect-redis": "7.1.1",
"content-disposition": "2.0.0",
"content-disposition": "2.0.1",
"cookie-parser": "1.4.7",
"cors": "2.8.6",
"escape-goat": "4.0.0",
@ -55,26 +55,26 @@
"formdata-node": "^6.0.3",
"got": "^13.0.0",
"grant": "^5.4.24",
"helmet": "8.1.0",
"ioredis": "5.10.1",
"helmet": "8.3.0",
"ioredis": "5.11.1",
"ipaddr.js": "2.4.0",
"jsonwebtoken": "9.0.3",
"lodash": "4.18.1",
"mime-types": "3.0.2",
"moment": "2.30.1",
"moment-timezone": "0.6.2",
"morgan": "1.10.1",
"morgan": "1.11.0",
"ms": "2.1.3",
"node-schedule": "2.1.1",
"p-map": "7.0.4",
"p-map": "7.0.5",
"prom-client": "15.1.3",
"serialize-error": "13.0.1",
"serialize-javascript": "7.0.5",
"serialize-javascript": "7.0.7",
"supports-color": "10.2.2",
"tus-js-client": "4.3.1",
"validator": "13.15.35",
"webdav": "5.10.0",
"ws": "8.20.1",
"ws": "8.21.1",
"zod": "4.4.3"
},
"devDependencies": {
@ -95,11 +95,11 @@
"@types/node-schedule": "2.1.8",
"@types/request": "2.48.13",
"@types/serialize-javascript": "5.0.4",
"@types/supertest": "7.2.0",
"@types/supertest": "7.2.1",
"@types/validator": "13.15.10",
"@types/webpack": "5.28.5",
"@types/ws": "8.18.1",
"execa": "9.6.1",
"execa": "10.0.0",
"http-proxy": "1.18.1",
"nock": "^14.0.15",
"supertest": "7.2.2",

View file

@ -64,7 +64,7 @@ import {
%%ComponentName%% as %%PreactComponentName%%,
type %%PropsTypeName%%,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'
@ -96,7 +96,7 @@ import {
%%ComponentName%% as %%PreactComponentName%%,
type %%PropsTypeName%%,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useUppyContext } from '../useUppyContext.js'
export default defineComponent({
@ -149,7 +149,7 @@ const SVELTE_TEMPLATE = `\
type %%PropsTypeName%%,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<%%PropsTypeName%%, 'ctx'> = $props()

View file

@ -1,5 +1,5 @@
import { useMemo } from '@uppy/core/utils/preact/hooks'
import { clsx } from 'clsx'
import { useMemo } from 'preact/hooks'
import { createDropzone } from './hooks/dropzone.js'
import type { NonNullableUppyContext, UppyContext } from './types.js'

View file

@ -1,7 +1,7 @@
import type { Body, Meta, UppyEventMap, UppyFile } from '@uppy/core'
import { Fragment } from '@uppy/core/utils/preact'
import { useEffect, useState } from '@uppy/core/utils/preact/hooks'
import { clsx } from 'clsx'
import { Fragment } from 'preact'
import { useEffect, useState } from 'preact/hooks'
import prettyBytes from 'pretty-bytes'
import { Thumbnail } from './index.js'
import type { UppyContext } from './types.js'

View file

@ -1,7 +1,7 @@
import type { Body, Meta, UppyEventMap, UppyFile } from '@uppy/core'
import { Fragment } from '@uppy/core/utils/preact'
import { useEffect, useState } from '@uppy/core/utils/preact/hooks'
import { clsx } from 'clsx'
import { Fragment } from 'preact'
import { useEffect, useState } from 'preact/hooks'
import prettyBytes from 'pretty-bytes'
import { Thumbnail, type UppyContext } from './index.js'

View file

@ -1,5 +1,5 @@
import type { Body, Meta, UppyFile } from '@uppy/core'
import { useEffect, useMemo } from 'preact/hooks'
import { useEffect, useMemo } from '@uppy/core/utils/preact/hooks'
import type { UppyContext } from './types.js'
export type ThumbnailProps = {

View file

@ -40,6 +40,8 @@
"./css/style.scss": "./src/style.scss",
"./store-default": "./lib/store/index.js",
"./utils": "./lib/utils/index.js",
"./utils/preact": "./lib/utils/preact/index.js",
"./utils/preact/hooks": "./lib/utils/preact/hooks.js",
"./companion-client": "./lib/companion-client/index.js",
"./provider-views": "./lib/provider-views/index.js",
"./provider-views/css/style.min.css": "./dist/provider-views.min.css",

View file

@ -0,0 +1 @@
export * from 'preact/hooks'

View file

@ -0,0 +1 @@
export * from 'preact'

View file

@ -62,7 +62,7 @@
"@vitest/browser-playwright": "^4.1.6",
"cssnano": "^8.0.1",
"jsdom": "^29.1.1",
"playwright": "1.60.0",
"playwright": "1.61.1",
"postcss": "^8.5.15",
"postcss-cli": "^11.0.1",
"resize-observer-polyfill": "^1.5.0",

View file

@ -13,9 +13,9 @@ import { UIPlugin } from '@uppy/core'
import { defaultPickerIcon } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
import { findAllDOMElements, getDroppedFiles, toArray } from '@uppy/core/utils'
import type { ComponentChild, h, VNode } from '@uppy/core/utils/preact'
import ThumbnailGenerator from '@uppy/thumbnail-generator'
import { nanoid } from 'nanoid/non-secure'
import type { ComponentChild, h, VNode } from 'preact'
import packageJson from '../package.json' with { type: 'json' }
import DashboardUI from './components/Dashboard.js'
import locale from './locale.js'

View file

@ -1,5 +1,10 @@
import type { I18n, Translator } from '@uppy/core/utils'
import { Component, type ComponentChild, Fragment, type h } from 'preact'
import {
Component,
type ComponentChild,
Fragment,
type h,
} from '@uppy/core/utils/preact'
import type { DashboardState, TargetWithRender } from '../Dashboard.js'
interface AddFilesProps {

View file

@ -9,8 +9,8 @@ import type {
} from '@uppy/core'
import type { I18n, Translator } from '@uppy/core/utils'
import { isDragDropSupported } from '@uppy/core/utils'
import type { h } from '@uppy/core/utils/preact'
import classNames from 'classnames'
import type { h } from 'preact'
import type { DashboardState, TargetWithRender } from '../Dashboard.js'
import AddFiles from './AddFiles.js'
import AddFilesPanel from './AddFilesPanel.js'

View file

@ -1,4 +1,4 @@
import { h } from 'preact'
import { h } from '@uppy/core/utils/preact'
type $TSFixMe = any

View file

@ -1,6 +1,11 @@
import {
useCallback,
useEffect,
useRef,
useState,
} from '@uppy/core/utils/preact/hooks'
import classNames from 'classnames'
import { nanoid } from 'nanoid/non-secure'
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
import getFileTypeIcon from '../../utils/getFileTypeIcon.js'
import ignoreEvent from '../../utils/ignoreEvent.js'
import FilePreview from '../FilePreview.js'

View file

@ -1,6 +1,6 @@
import type { Body, Meta, State, Uppy, UppyFile } from '@uppy/core'
import type { I18n } from '@uppy/core/utils'
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
interface Props<M extends Meta, B extends Body> {
uppy: Uppy<M, B>

View file

@ -1,9 +1,9 @@
import type Uppy from '@uppy/core'
import type { Body, Meta, State, UppyFile } from '@uppy/core'
import type { I18n } from '@uppy/core/utils'
import classNames from 'classnames'
// biome-ignore lint/style/useImportType: h is not a type
import { Component, type ComponentChild, h } from 'preact'
import { Component, type ComponentChild, h } from '@uppy/core/utils/preact'
import classNames from 'classnames'
import { shallowEqualObjects } from 'shallow-equal'
import type { DashboardState } from '../../Dashboard.js'
import Buttons from './Buttons/index.js'

View file

@ -1,7 +1,7 @@
import type { Body, Meta, State, Uppy, UppyFile } from '@uppy/core'
import type { I18n } from '@uppy/core/utils'
import { VirtualList } from '@uppy/core/utils'
import { useMemo } from 'preact/hooks'
import { useMemo } from '@uppy/core/utils/preact/hooks'
import type { DashboardState } from '../Dashboard.js'
import FileItem from './FileItem/index.js'

View file

@ -1,4 +1,8 @@
import { Component, type ComponentChild, createRef } from 'preact'
import {
Component,
type ComponentChild,
createRef,
} from '@uppy/core/utils/preact'
const TRANSITION_MS = 300

View file

@ -1,5 +1,5 @@
import type { UIPluginOptions, Uppy } from '@uppy/core'
import { Component, type ComponentChild } from 'preact'
import { Component, type ComponentChild } from '@uppy/core/utils/preact'
import FadeIn from './FadeIn.js'
import TransitionGroup from './TransitionGroup.js'

View file

@ -4,7 +4,12 @@
* @source https://github.com/developit/preact-transition-group
*/
import { Component, cloneElement, h, toChildArray } from 'preact'
import {
Component,
cloneElement,
h,
toChildArray,
} from '@uppy/core/utils/preact'
function assign(obj, props) {
return Object.assign(obj, props)

View file

@ -1,5 +1,5 @@
import { useRef } from '@uppy/core/utils/preact/hooks'
import classNames from 'classnames'
import { useRef } from 'preact/hooks'
import ignoreEvent from '../utils/ignoreEvent.js'
type $TSFixMe = any

View file

@ -1,11 +1,16 @@
import classNames from 'classnames'
import {
type ComponentChildren,
cloneElement,
toChildArray,
type VNode,
} from 'preact'
import { useCallback, useEffect, useRef, useState } from 'preact/hooks'
} from '@uppy/core/utils/preact'
import {
useCallback,
useEffect,
useRef,
useState,
} from '@uppy/core/utils/preact/hooks'
import classNames from 'classnames'
const transitionName = 'uppy-transition-slideDownUp'
const duration = 250

View file

@ -1,8 +1,8 @@
import type { Body, Meta, State, Uppy, UppyFile } from '@uppy/core'
import type { I18n } from '@uppy/core/utils'
import { emaFilter } from '@uppy/core/utils'
import type { ComponentChild } from 'preact'
import { Component } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
import { Component } from '@uppy/core/utils/preact'
import statusBarStates from './StatusBarStates.js'
import StatusBarUI, { type StatusBarUIProps } from './StatusBarUI.js'

View file

@ -8,7 +8,7 @@ import type {
import { UIPlugin } from '@uppy/core'
import type { LocaleStrings } from '@uppy/core/utils'
import { getDroppedFiles, isDragDropSupported, toArray } from '@uppy/core/utils'
import type { ComponentChild, h } from 'preact'
import type { ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -16,7 +16,7 @@ import {
import { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -16,7 +16,7 @@ import {
import { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -53,7 +53,7 @@
"@uppy/xhr-upload": "workspace:^",
"@vitest/browser": "^4.1.6",
"@vitest/browser-playwright": "^4.1.6",
"playwright": "1.60.0",
"playwright": "1.61.1",
"typescript": "^5.8.3",
"vitest": "^4.1.6"
}

View file

@ -16,7 +16,7 @@ import {
import type { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import DriveProviderViews from './DriveProviderViews.js'
import locale from './locale.js'

View file

@ -1,6 +1,6 @@
import type { Body, Meta } from '@uppy/core'
import type { I18n, LocalUppyFile } from '@uppy/core/utils'
import { Component } from 'preact'
import { Component } from '@uppy/core/utils/preact'
import type ImageEditor from './ImageEditor.js'
import type { AspectRatio } from './ImageEditor.js'

View file

@ -2,13 +2,13 @@ import type { Body, Meta, MinimalRequiredUppyFile, Uppy } from '@uppy/core'
import { UIPlugin, type UIPluginOptions } from '@uppy/core'
import { FilterInput, SearchView } from '@uppy/core/provider-views'
import { RateLimitedQueue } from '@uppy/core/utils'
import type { h } from '@uppy/core/utils/preact'
import {
Assembly,
type AssemblyResult,
Client,
type OptionsWithRestructuredFields,
} from '@uppy/transloadit'
import type { h } from 'preact'
import locale from './locale.js'
export interface ImageGeneratorOptions extends UIPluginOptions {

View file

@ -16,7 +16,7 @@ import {
import { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -4,7 +4,7 @@ import {
type DropzoneProps,
Dropzone as PreactDropzone,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -4,7 +4,7 @@ import {
type FilesGridProps,
FilesGrid as PreactFilesGrid,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -4,7 +4,7 @@ import {
type FilesListProps,
FilesList as PreactFilesList,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -4,7 +4,7 @@ import {
ProviderIcon as PreactProviderIcon,
type ProviderIconProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -4,7 +4,7 @@ import {
Thumbnail as PreactThumbnail,
type ThumbnailProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -4,7 +4,7 @@ import {
UploadButton as PreactUploadButton,
type UploadButtonProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { useContext, useEffect, useRef } from 'react'
import { UppyContext } from '../UppyContextProvider.js'

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import type { h } from 'preact'
import type { h } from '@uppy/core/utils/preact'
interface DiscardButtonProps {
onDiscard: () => void

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import type { h } from 'preact'
import type { h } from '@uppy/core/utils/preact'
interface RecordButtonProps {
recording: boolean | undefined

View file

@ -1,5 +1,9 @@
import type { Body, Meta } from '@uppy/core'
import { Component, type ComponentChild, Fragment } from 'preact'
import {
Component,
type ComponentChild,
Fragment,
} from '@uppy/core/utils/preact'
import DiscardButton from './DiscardButton.js'
import RecordButton from './RecordButton.js'
import type ScreenCapture from './ScreenCapture.js'

View file

@ -8,7 +8,7 @@ import type {
import { UIPlugin } from '@uppy/core'
import type { LocaleStrings } from '@uppy/core/utils'
import { getFileTypeExtension } from '@uppy/core/utils'
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'
import RecorderScreen from './RecorderScreen.js'

View file

@ -1,4 +1,4 @@
import { Component } from 'preact'
import { Component } from '@uppy/core/utils/preact'
type $TSFixMe = any

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import type { h } from 'preact'
import type { h } from '@uppy/core/utils/preact'
interface SubmitButtonProps {
recording: boolean

View file

@ -8,7 +8,7 @@ import type {
} from '@uppy/core'
import { UIPlugin } from '@uppy/core'
import { emaFilter, getTextDirection } from '@uppy/core/utils'
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'
import type { StatusBarOptions } from './StatusBarOptions.js'

View file

@ -7,7 +7,7 @@
type DropzoneProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<DropzoneProps, 'ctx'> = $props()

View file

@ -7,7 +7,7 @@
type FilesGridProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<FilesGridProps, 'ctx'> = $props()

View file

@ -7,7 +7,7 @@
type FilesListProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<FilesListProps, 'ctx'> = $props()

View file

@ -7,7 +7,7 @@
type ProviderIconProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<ProviderIconProps, 'ctx'> = $props()

View file

@ -7,7 +7,7 @@
type ThumbnailProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<ThumbnailProps, 'ctx'> = $props()

View file

@ -7,7 +7,7 @@
type UploadButtonProps,
type UppyContext,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { UppyContextKey } from '../UppyContextProvider.svelte'
const props: Omit<UploadButtonProps, 'ctx'> = $props()

View file

@ -36,7 +36,12 @@ vi.mock('tus-js-client', async (importOriginal) => {
setTimeout(() => this.options.onError(err), 0)
}
abort() {}
abort() {
// Mirrors XMLHttpRequest.abort(): the response object is reset. This
// makes the test fail if Tus aborts the completed errored request.
fakeXhr.status = 0
fakeXhr.responseText = ''
}
// ponytail: tus calls this before start(); return empty so no resume logic runs
findPreviousUploads() {
@ -115,13 +120,19 @@ describe('Tus', () => {
}),
event.then(([, , response]) => {
expect(response?.status).toBe(403)
expect(response?.body?.xhr.status).toBe(403)
expect(JSON.parse(response!.body!.xhr.responseText).message).toBe(
'File cannot be uploaded as the BIN content type is disallowed!',
)
}),
])
expect(core.getFile(id).response?.status).toBe(403)
const file = core.getFile(id)
expect(file.response?.status).toBe(403)
expect(file.response?.body?.xhr.status).toBe(403)
expect(JSON.parse(file.response!.body!.xhr.responseText).message).toBe(
'File cannot be uploaded as the BIN content type is disallowed!',
)
})
})
})

View file

@ -160,34 +160,25 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
this.uploaderEvents = Object.create(null)
}
/**
* Stop the upload in Tus. If `terminate` is `true`, it will also terminate the
* upload on the Tus server by sending a `DELETE` request. If not, it will just
* cancel any current upload request and leave the upload in a half-uploaded state.
*
* @param fileID
* @param terminate Whether to terminate the upload on the server.
*/
#abortUploader(fileID: string, terminate?: boolean) {
const uploader = this.uploaders[fileID]
uploader?.abort(terminate)
}
/**
* Clean up all references for a file's upload: the tus.Upload instance,
* any events related to the file, and the Companion WebSocket connection.
*/
resetUploaderReferences(
fileID: string,
opts?: {
/** Terminate the upload on the server (sends a `DELETE` request). */
abort?: boolean
/**
* Abort the underlying request. Defaults to `true`. Set to `false` when
* the request has already completed (e.g. in the error handler), so the
* underlying `xhr` and thus the server response is preserved instead
* of being reset by `abort()`.
*/
abortRequest?: boolean
},
): void {
const uploader = this.uploaders[fileID]
if (uploader) {
if (opts?.abortRequest !== false) {
uploader.abort()
if (opts?.abort) {
uploader.abort(true)
}
}
#resetUploaderReferences(fileID: string): void {
if (this.uploaders[fileID]) {
this.uploaders[fileID] = null
}
if (this.uploaderEvents[fileID]) {
@ -218,7 +209,7 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
*
* When working on this function, keep in mind:
* - When an upload is completed or cancelled for any reason, the tus.Upload and EventManager instances need to be cleaned
* up using this.resetUploaderReferences().
* up using this.#resetUploaderReferences() and this.#abortUploader().
* - When an upload is cancelled or paused, for any reason, it needs to be removed from the `this.requests` queue using
* `queuedRequest.abort()`.
* - When an upload is completed for any reason, including errors, it needs to be marked as such using
@ -232,7 +223,8 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
async #uploadLocalFile(
file: LocalUppyFile<M, B>,
): Promise<tus.Upload | string> {
this.resetUploaderReferences(file.id)
this.#abortUploader(file.id)
this.#resetUploaderReferences(file.id)
// Captured in `onError` and forwarded to the `upload-error` event in the
// `.catch` below, so consumers can read the failing server response.
@ -341,7 +333,7 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
// it would reset the underlying `xhr` (status `0`, empty body) and
// discard the response we just captured. We still drop our references
// and remove the event listeners.
this.resetUploaderReferences(file.id, { abortRequest: false })
this.#resetUploaderReferences(file.id)
queuedRequest?.abort()
if (typeof opts.onError === 'function') {
@ -380,7 +372,8 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
this.uppy.emit('upload-success', this.uppy.getFile(file.id), uploadResp)
this.resetUploaderReferences(file.id)
this.#abortUploader(file.id)
this.#resetUploaderReferences(file.id)
queuedRequest.done()
if (upload.url) {
@ -502,7 +495,7 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
upload.start()
}
// Don't do anything here, the caller will take care of cancelling the upload itself
// using resetUploaderReferences(). This is because resetUploaderReferences() has to be
// using #resetUploaderReferences(). This is because #resetUploaderReferences() has to be
// called when this request is still in the queue, and has not been started yet, too. At
// that point this cancellation function is not going to be called.
// Also, we need to remove the request from the queue _without_ destroying everything
@ -523,7 +516,8 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
eventManager.onFileRemove(file.id, (targetFileID) => {
queuedRequest.abort()
this.resetUploaderReferences(file.id, { abort: !!upload.url })
this.#abortUploader(file.id, !!upload.url)
this.#resetUploaderReferences(file.id)
resolve(`upload ${targetFileID} was removed`)
})
@ -546,7 +540,8 @@ export default class Tus<M extends Meta, B extends Body> extends BasePlugin<
eventManager.onCancelAll(file.id, () => {
queuedRequest.abort()
this.resetUploaderReferences(file.id, { abort: !!upload.url })
this.#abortUploader(file.id, !!upload.url)
this.#resetUploaderReferences(file.id)
resolve(`upload ${file.id} was canceled`)
})

View file

@ -16,7 +16,7 @@ import {
import { SearchProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -56,7 +56,7 @@
"@vitest/browser": "^4.1.6",
"@vitest/browser-playwright": "^4.1.6",
"cssnano": "^8.0.1",
"playwright": "1.60.0",
"playwright": "1.61.1",
"postcss": "^8.5.15",
"postcss-cli": "^11.0.1",
"sass": "^1.89.2",

View file

@ -11,7 +11,7 @@ import type {
} from '@uppy/core/utils'
import { toArray } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'
import UrlUI from './UrlUI.js'

View file

@ -1,6 +1,6 @@
import type { I18n } from '@uppy/core/utils'
import { Component, type ComponentChild } from '@uppy/core/utils/preact'
import { nanoid } from 'nanoid/non-secure'
import { Component, type ComponentChild } from 'preact'
type UrlUIProps = {
i18n: I18n

View file

@ -5,7 +5,7 @@ import {
type DropzoneProps,
Dropzone as PreactDropzone,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -5,7 +5,7 @@ import {
type FilesGridProps,
FilesGrid as PreactFilesGrid,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -5,7 +5,7 @@ import {
type FilesListProps,
FilesList as PreactFilesList,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -5,7 +5,7 @@ import {
ProviderIcon as PreactProviderIcon,
type ProviderIconProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -5,7 +5,7 @@ import {
Thumbnail as PreactThumbnail,
type ThumbnailProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -5,7 +5,7 @@ import {
UploadButton as PreactUploadButton,
type UploadButtonProps,
} from '@uppy/components'
import { h as preactH, render as preactRender } from 'preact'
import { h as preactH, render as preactRender } from '@uppy/core/utils/preact'
import { defineComponent, h, onMounted, ref, watch } from 'vue'
import { useUppyContext } from '../useUppyContext.js'

View file

@ -1,4 +1,4 @@
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
export default function CameraIcon(): ComponentChild {
return (

View file

@ -1,5 +1,9 @@
import type { I18n } from '@uppy/core/utils'
import { Component, type ComponentChild, type ComponentProps } from 'preact'
import {
Component,
type ComponentChild,
type ComponentProps,
} from '@uppy/core/utils/preact'
import DiscardButton from './DiscardButton.js'
import RecordButton from './RecordButton.js'
import RecordingLength from './RecordingLength.js'

View file

@ -1,5 +1,5 @@
import type { I18n } from '@uppy/core/utils'
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
interface PermissionScreenProps {
hasCamera: boolean

View file

@ -1,4 +1,4 @@
import type { ComponentChild } from 'preact'
import type { ComponentChild } from '@uppy/core/utils/preact'
export interface VideoSourceSelectProps {
currentDeviceId: string | MediaStreamTrack | null | undefined

View file

@ -10,9 +10,9 @@ import type {
import { UIPlugin } from '@uppy/core'
import type { LocaleStrings, LocalUppyFileNonGhost } from '@uppy/core/utils'
import { canvasToBlob, getFileTypeExtension, mimeTypes } from '@uppy/core/utils'
import { isMobile } from 'is-mobile'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import { isMobile } from 'is-mobile'
import packageJson from '../package.json' with { type: 'json' }
import CameraIcon from './CameraIcon.js'
import CameraScreen from './CameraScreen.js'

View file

@ -16,8 +16,8 @@ import {
import { ProviderViews, SearchView } from '@uppy/core/provider-views'
import type { I18n, LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { useCallback, useState } from 'preact/hooks'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import { useCallback, useState } from '@uppy/core/utils/preact/hooks'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -46,7 +46,7 @@
"@vitest/browser-playwright": "^4.1.6",
"jsdom": "^29.1.1",
"msw": "^2.10.4",
"playwright": "1.60.0",
"playwright": "1.61.1",
"typescript": "^5.8.3",
"vitest": "^4.1.6"
},

View file

@ -16,7 +16,7 @@ import {
import { ProviderViews } from '@uppy/core/provider-views'
import type { LocaleStrings } from '@uppy/core/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import { type ComponentChild, h } from '@uppy/core/utils/preact'
import packageJson from '../package.json' with { type: 'json' }
import locale from './locale.js'

View file

@ -77,15 +77,15 @@
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.338.0",
"@npmcli/arborist": "^9.6.0",
"adm-zip": "^0.5.5",
"@npmcli/arborist": "^10.0.1",
"adm-zip": "^0.6.0",
"chalk": "^5.0.0",
"concat-stream": "^2.0.0",
"cssnano": "^8.0.1",
"esbuild": "^0.27.0",
"esbuild": "^0.28.1",
"mime-types": "^3.0.2",
"npm-packlist": "^11.1.0",
"pacote": "^21.5.0",
"pacote": "^22.0.0",
"postcss": "^8.5.15",
"postcss-cli": "^11.0.1",
"sass": "^1.89.2",

4271
yarn.lock

File diff suppressed because it is too large Load diff