From fefcb1c311553a84282b45d1baf1f48a1d64bde2 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 15 Dec 2023 23:13:16 +0100 Subject: [PATCH 1/6] meta: fix `"e2e"` script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2679b8ce8..3ccf573d0 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ "format": "prettier -w .", "release": "PACKAGES=$(yarn workspaces list --json) yarn workspace @uppy-dev/release interactive", "size": "echo 'JS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.js | gzip | wc -c && echo 'CSS Bundle mingz:' && cat ./packages/uppy/dist/uppy.min.css | gzip | wc -c", - "e2e": "build:clean && yarn build && yarn e2e:skip-build", + "e2e": "yarn build:clean && yarn build && yarn e2e:skip-build", "e2e:skip-build": "npm-run-all --parallel watch:js:lib e2e:client start:companion:with-loadbalancer e2e:cypress", "e2e:ci": "start-server-and-test 'npm-run-all --parallel e2e:client start:companion:with-loadbalancer' '1234|3020' e2e:headless", "e2e:client": "yarn workspace e2e client:start", From c7bb57b7f8a690fa79a711fd3f5346b963be71a0 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 18 Dec 2023 15:18:20 +0100 Subject: [PATCH 2/6] dev: remove extensions from Vite aliases This started causing issues as we are transitioning to TS. By removing the file extension, Vite is able to pick up the correct file. --- private/dev/vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/private/dev/vite.config.js b/private/dev/vite.config.js index f5d28d3e0..3dbfb648d 100644 --- a/private/dev/vite.config.js +++ b/private/dev/vite.config.js @@ -36,7 +36,7 @@ const config = { replacement: `${PACKAGES_ROOT}@uppy/$1/src/index`, }, { - find: /^@uppy\/([^/]+)\/lib\/(.+)$/, + find: /^@uppy\/([^/]+)\/lib\/(.+?)(\.js)?$/, replacement: `${PACKAGES_ROOT}@uppy/$1/src/$2`, }, // { From aa6eb0a3189c453c92e2b04c74c3600ae4d85383 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Thu, 28 Dec 2023 18:57:58 +0800 Subject: [PATCH 3/6] meta: fix `yarn build:clean` (#4840) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3ccf573d0..26e7b4528 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "start:companion": "bash bin/companion.sh", "start:companion:with-loadbalancer": "e2e/start-companion-with-load-balancer.mjs", "build:bundle": "yarn node ./bin/build-bundle.mjs", - "build:clean": "git clean -e node_modules -xfd packages e2e .parcel-cache coverage", + "build:clean": "git clean -e node_modules -Xfd packages e2e .parcel-cache coverage", "build:companion": "yarn workspace @uppy/companion build", "build:css": "yarn node ./bin/build-css.js", "build:svelte": "yarn workspace @uppy/svelte build", From f76d76bafdb1784b6c83d7c9ec9b83fb9b723f21 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Dec 2023 17:03:15 +0100 Subject: [PATCH 4/6] @uppy/utils: improve `preprocess` and `postprocess` types (#4841) --- packages/@uppy/utils/src/FileProgress.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/@uppy/utils/src/FileProgress.ts b/packages/@uppy/utils/src/FileProgress.ts index 33235981e..b21a2b1f0 100644 --- a/packages/@uppy/utils/src/FileProgress.ts +++ b/packages/@uppy/utils/src/FileProgress.ts @@ -1,10 +1,24 @@ +export interface DeterminateFileProcessing { + mode: 'determinate' + message: string + value: number +} +export interface IndeterminateFileProcessing { + mode: 'indeterminate' + message?: undefined + value?: 0 +} +export type FileProcessingInfo = + | IndeterminateFileProcessing + | DeterminateFileProcessing + interface FileProgressBase { progress?: number uploadComplete: boolean percentage: number bytesTotal: number - preprocess?: { mode: string; message?: string; value?: number } - postprocess?: { mode: string; message?: string; value?: number } + preprocess?: FileProcessingInfo + postprocess?: FileProcessingInfo } // FileProgress is either started or not started. We want to make sure TS doesn't From 725bdc5a16689646aab4db440e46454d1251ddba Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Thu, 28 Dec 2023 17:06:39 +0100 Subject: [PATCH 5/6] @uppy/core: fix types (#4842) --- packages/@uppy/core/src/BasePlugin.ts | 6 +++++- packages/@uppy/core/src/UIPlugin.ts | 9 ++++++++- packages/@uppy/core/src/Uppy.ts | 3 ++- packages/@uppy/core/src/index.ts | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/@uppy/core/src/BasePlugin.ts b/packages/@uppy/core/src/BasePlugin.ts index 513efba49..0e2391f2b 100644 --- a/packages/@uppy/core/src/BasePlugin.ts +++ b/packages/@uppy/core/src/BasePlugin.ts @@ -15,7 +15,11 @@ import type { I18n, Locale } from '@uppy/utils/lib/Translator' import type { Body, Meta } from '@uppy/utils/lib/UppyFile' import type { Uppy } from '.' -export type PluginOpts = { locale?: Locale; [key: string]: unknown } +export type PluginOpts = { + locale?: Locale + id?: string + [key: string]: unknown +} export default class BasePlugin< Opts extends PluginOpts, diff --git a/packages/@uppy/core/src/UIPlugin.ts b/packages/@uppy/core/src/UIPlugin.ts index fd404d48c..163148cec 100644 --- a/packages/@uppy/core/src/UIPlugin.ts +++ b/packages/@uppy/core/src/UIPlugin.ts @@ -32,6 +32,11 @@ function debounce any>( } } +export interface UIPluginOptions extends PluginOpts { + replaceTargetContent?: boolean + direction?: 'ltr' | 'rtl' +} + /** * UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact. * Use this for plugins that need a user interface. @@ -39,7 +44,7 @@ function debounce any>( * For plugins without an user interface, see BasePlugin. */ class UIPlugin< - Opts extends PluginOpts & { direction?: 'ltr' | 'rtl' }, + Opts extends UIPluginOptions, M extends Meta, B extends Body, > extends BasePlugin { @@ -51,6 +56,8 @@ class UIPlugin< parent: unknown + title: string + getTargetPlugin(target: unknown): UIPlugin | undefined { let targetPlugin if (typeof target === 'object' && target instanceof UIPlugin) { diff --git a/packages/@uppy/core/src/Uppy.ts b/packages/@uppy/core/src/Uppy.ts index 6611b331b..ee1fce858 100644 --- a/packages/@uppy/core/src/Uppy.ts +++ b/packages/@uppy/core/src/Uppy.ts @@ -98,7 +98,7 @@ export interface State } currentUploads: Record> allowNewUpload: boolean - recoveredState: null + recoveredState: null | State error: string | null files: { [key: string]: UppyFile @@ -254,6 +254,7 @@ export interface _UppyEventMap { progress: ProgressCallback 'reset-progress': GenericEventCallback restored: GenericEventCallback + 'restore-confirmed': GenericEventCallback 'restriction-failed': RestrictionFailedCallback 'resume-all': GenericEventCallback 'retry-all': RetryAllCallback diff --git a/packages/@uppy/core/src/index.ts b/packages/@uppy/core/src/index.ts index 6fc0e7586..d218db2de 100644 --- a/packages/@uppy/core/src/index.ts +++ b/packages/@uppy/core/src/index.ts @@ -3,3 +3,5 @@ export { default as Uppy } from './Uppy.ts' export { default as UIPlugin } from './UIPlugin.ts' export { default as BasePlugin } from './BasePlugin.ts' export { debugLogger } from './loggers.ts' + +export type { UIPluginOptions } from './UIPlugin.ts' From 57e6a7ea0f77e533e6a49004c53572dea765c9d4 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 29 Dec 2023 11:44:16 +0100 Subject: [PATCH 6/6] meta: fix linting of `.tsx` files (#4843) Those should be linted as `.ts` files, except with JSX support. --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6110795d3..4d4fc571e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -444,7 +444,7 @@ module.exports = { }, }, { - files: ['**/*.ts', '**/*.md/*.ts', '**/*.md/*.typescript'], + files: ['**/*.ts', '**/*.md/*.ts', '**/*.md/*.typescript', '**/*.tsx', '**/*.md/*.tsx'], excludedFiles: ['examples/angular-example/**/*.ts', 'packages/@uppy/angular/**/*.ts'], parser: '@typescript-eslint/parser', settings: {