diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fbb6471ee..95ae12f095 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -95,30 +95,5 @@ jobs: env: # https://docs.cypress.io/guides/references/advanced-installation#Skipping-installation CYPRESS_INSTALL_BINARY: 0 - # Need to do a bunch of work to generate the locale typings 🙃 - - name: Prepare type declarations - run: | - corepack yarn run build:lib - corepack yarn run build:companion - corepack yarn run build:locale-pack - - name: Run type tests - run: corepack yarn run test:type - - name: Drop manual tyoes - # For backward compatiblity reasons, Uppy plugins ship a manual crafted d.ts file. - # We don't want to remove that file to not break users. - # However, we want to validate the types based on the types inferred from source. - run: | - node --input-type=module <<'EOF' - import { existsSync } from 'node:fs'; - import { opendir, readFile, writeFile } from 'node:fs/promises'; - for await (const dirent of await opendir('./packages/@uppy')) { - if (existsSync(`./packages/@uppy/${dirent.name}/tsconfig.build.json`)) { - const pjsonPath = `./packages/@uppy/${dirent.name}/package.json` - const pjson = JSON.parse(await readFile(pjsonPath)); - delete pjson.types - await writeFile(pjsonPath, JSON.stringify(pjson)) - } - } - EOF - name: Attempt building TS packages run: corepack yarn run build:ts diff --git a/package.json b/package.json index 02cc374564..2b3b52a5a5 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,6 @@ "stylelint-config-standard": "^34.0.0", "stylelint-config-standard-scss": "^10.0.0", "tar": "^6.1.0", - "tsd": "^0.28.0", "typescript": "~5.1", "vitest": "^0.34.5", "vue-template-compiler": "workspace:*" @@ -153,7 +152,6 @@ "test:locale-packs": "yarn locale-packs:unused && yarn locale-packs:warnings", "test:locale-packs:unused": "yarn workspace @uppy-dev/locale-pack test unused", "test:locale-packs:warnings": "yarn workspace @uppy-dev/locale-pack test warnings", - "test:type": "yarn workspaces foreach -piv --include '@uppy/*' --exclude '@uppy/{angular,react-native,locales,companion,provider-views,robodog,svelte}' exec tsd", "test:unit": "yarn run build:lib && yarn test:watch", "test:watch": "vitest --environment jsdom --dir packages/@uppy", "test": "npm-run-all lint test:locale-packs:unused test:unit test:type test:companion", diff --git a/packages/@uppy/audio/package.json b/packages/@uppy/audio/package.json index fbe6ff2438..2273490d1f 100644 --- a/packages/@uppy/audio/package.json +++ b/packages/@uppy/audio/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/audio/types/index.d.ts b/packages/@uppy/audio/types/index.d.ts deleted file mode 100644 index 27a65e61e2..0000000000 --- a/packages/@uppy/audio/types/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type AudioLocale from './generatedLocale' - -export interface AudioOptions extends UIPluginOptions { - target?: PluginTarget - showAudioSourceDropdown?: boolean - locale?: AudioLocale -} - -declare class Audio extends UIPlugin {} - -export default Audio diff --git a/packages/@uppy/audio/types/index.test-d.ts b/packages/@uppy/audio/types/index.test-d.ts deleted file mode 100644 index cf9da1c108..0000000000 --- a/packages/@uppy/audio/types/index.test-d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Uppy from '@uppy/core' -import Audio from '..' - -{ - const uppy = new Uppy() - - uppy.use(Audio, { - target: 'body', - }) -} diff --git a/packages/@uppy/aws-s3-multipart/package.json b/packages/@uppy/aws-s3-multipart/package.json index b1b557a6e4..f7d9934bfe 100644 --- a/packages/@uppy/aws-s3-multipart/package.json +++ b/packages/@uppy/aws-s3-multipart/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "aws s3", diff --git a/packages/@uppy/aws-s3-multipart/types/chunk.d.ts b/packages/@uppy/aws-s3-multipart/types/chunk.d.ts deleted file mode 100644 index a01c6b5289..0000000000 --- a/packages/@uppy/aws-s3-multipart/types/chunk.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export interface Chunk { - getData: () => Blob - onProgress: (ev: ProgressEvent) => void - onComplete: (etag: string) => void - shouldUseMultipart: boolean - setAsUploaded?: () => void -} diff --git a/packages/@uppy/aws-s3-multipart/types/index.d.ts b/packages/@uppy/aws-s3-multipart/types/index.d.ts deleted file mode 100644 index 40adc5b8ea..0000000000 --- a/packages/@uppy/aws-s3-multipart/types/index.d.ts +++ /dev/null @@ -1,178 +0,0 @@ -import type { BasePlugin, PluginOptions, UppyFile } from '@uppy/core' - -type MaybePromise = T | Promise - -export type AwsS3UploadParameters = - | { - method: 'POST' - url: string - fields: Record - expires?: number - headers?: Record - } - | { - method?: 'PUT' - url: string - fields?: Record - expires?: number - headers?: Record - } - -export interface AwsS3Part { - PartNumber?: number - Size?: number - ETag?: string -} -/** - * @deprecated use {@link AwsS3UploadParameters} instead - */ -export interface AwsS3SignedPart { - url: string - headers?: Record -} -export interface AwsS3STSResponse { - credentials: { - AccessKeyId: string - SecretAccessKey: string - SessionToken: string - Expiration?: string - } - bucket: string - region: string -} - -type AWSS3NonMultipartWithCompanionMandatory = { - getUploadParameters?: never -} - -type AWSS3NonMultipartWithoutCompanionMandatory = { - getUploadParameters: (file: UppyFile) => MaybePromise -} -type AWSS3NonMultipartWithCompanion = AWSS3WithCompanion & - AWSS3NonMultipartWithCompanionMandatory & { - shouldUseMultipart: false - createMultipartUpload?: never - listParts?: never - signPart?: never - abortMultipartUpload?: never - completeMultipartUpload?: never - } - -type AWSS3NonMultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3NonMultipartWithoutCompanionMandatory & { - shouldUseMultipart: false - createMultipartUpload?: never - listParts?: never - signPart?: never - abortMultipartUpload?: never - completeMultipartUpload?: never - } - -type AWSS3MultipartWithoutCompanionMandatory = { - getChunkSize?: (file: UppyFile) => number - createMultipartUpload: ( - file: UppyFile, - ) => MaybePromise<{ uploadId: string; key: string }> - listParts: ( - file: UppyFile, - opts: { uploadId: string; key: string; signal: AbortSignal }, - ) => MaybePromise - abortMultipartUpload: ( - file: UppyFile, - opts: { uploadId: string; key: string; signal: AbortSignal }, - ) => MaybePromise - completeMultipartUpload: ( - file: UppyFile, - opts: { - uploadId: string - key: string - parts: AwsS3Part[] - signal: AbortSignal - }, - ) => MaybePromise<{ location?: string }> -} & ( - | { - signPart: ( - file: UppyFile, - opts: { - uploadId: string - key: string - partNumber: number - body: Blob - signal: AbortSignal - }, - ) => MaybePromise - } - | { - /** @deprecated Use signPart instead */ - prepareUploadParts: ( - file: UppyFile, - partData: { - uploadId: string - key: string - parts: [{ number: number; chunk: Blob }] - }, - ) => MaybePromise<{ - presignedUrls: Record - headers?: Record> - }> - } -) -type AWSS3MultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3MultipartWithoutCompanionMandatory & { - shouldUseMultipart?: true - getUploadParameters?: never - } - -type AWSS3MultipartWithCompanion = AWSS3WithCompanion & - Partial & { - shouldUseMultipart?: true - getUploadParameters?: never - } - -type AWSS3MaybeMultipartWithCompanion = AWSS3WithCompanion & - Partial & - AWSS3NonMultipartWithCompanionMandatory & { - shouldUseMultipart: (file: UppyFile) => boolean - } - -type AWSS3MaybeMultipartWithoutCompanion = AWSS3WithoutCompanion & - AWSS3MultipartWithoutCompanionMandatory & - AWSS3NonMultipartWithoutCompanionMandatory & { - shouldUseMultipart: (file: UppyFile) => boolean - } - -type AWSS3WithCompanion = { - companionUrl: string - companionHeaders?: Record - companionCookiesRule?: string - getTemporarySecurityCredentials?: true -} -type AWSS3WithoutCompanion = { - companionUrl?: never - companionHeaders?: never - companionCookiesRule?: never - getTemporarySecurityCredentials?: (options?: { - signal?: AbortSignal - }) => MaybePromise -} - -interface _AwsS3MultipartOptions extends PluginOptions { - allowedMetaFields?: string[] | null - limit?: number - retryDelays?: number[] | null -} - -export type AwsS3MultipartOptions = _AwsS3MultipartOptions & - ( - | AWSS3NonMultipartWithCompanion - | AWSS3NonMultipartWithoutCompanion - | AWSS3MultipartWithCompanion - | AWSS3MultipartWithoutCompanion - | AWSS3MaybeMultipartWithCompanion - | AWSS3MaybeMultipartWithoutCompanion - ) - -declare class AwsS3Multipart extends BasePlugin {} - -export default AwsS3Multipart diff --git a/packages/@uppy/aws-s3-multipart/types/index.test-d.ts b/packages/@uppy/aws-s3-multipart/types/index.test-d.ts deleted file mode 100644 index 1287eca958..0000000000 --- a/packages/@uppy/aws-s3-multipart/types/index.test-d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { expectError, expectType } from 'tsd' -import Uppy from '@uppy/core' -import type { UppyFile } from '@uppy/core' -import AwsS3Multipart from '..' -import type { AwsS3Part } from '..' - -{ - const uppy = new Uppy() - uppy.use(AwsS3Multipart, { - shouldUseMultipart: true, - createMultipartUpload(file) { - expectType(file) - return { uploadId: '', key: '' } - }, - listParts(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - return [] - }, - signPart(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - expectType(opts.body) - expectType(opts.signal) - return { url: '' } - }, - abortMultipartUpload(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - }, - completeMultipartUpload(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - expectType(opts.parts[0]) - return {} - }, - }) -} - -{ - const uppy = new Uppy() - expectError(uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: 100 })) - expectError( - uppy.use(AwsS3Multipart, { - companionUrl: '', - getChunkSize: () => 'not a number', - }), - ) - uppy.use(AwsS3Multipart, { companionUrl: '', getChunkSize: () => 100 }) - uppy.use(AwsS3Multipart, { - companionUrl: '', - getChunkSize: (file) => file.size, - }) -} diff --git a/packages/@uppy/aws-s3/package.json b/packages/@uppy/aws-s3/package.json index c807b8e2a3..407726d83b 100644 --- a/packages/@uppy/aws-s3/package.json +++ b/packages/@uppy/aws-s3/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "aws s3", diff --git a/packages/@uppy/aws-s3/types/index.d.ts b/packages/@uppy/aws-s3/types/index.d.ts deleted file mode 100644 index 7a146aec15..0000000000 --- a/packages/@uppy/aws-s3/types/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { AwsS3MultipartOptions } from '@uppy/aws-s3-multipart' -import type { BasePlugin, Locale, PluginOptions, UppyFile } from '@uppy/core' - -type MaybePromise = T | Promise - -export type AwsS3UploadParameters = - | { - method?: 'POST' - url: string - fields?: Record - expires?: number - headers?: Record - } - | { - method: 'PUT' - url: string - fields?: Record - expires?: number - headers?: Record - } - -interface LegacyAwsS3Options extends PluginOptions { - shouldUseMultipart?: never - companionUrl?: string | null - companionHeaders?: Record - allowedMetaFields?: Array | null - getUploadParameters?: (file: UppyFile) => MaybePromise - limit?: number - /** @deprecated this option will not be supported in future versions of this plugin */ - getResponseData?: (responseText: string, response: XMLHttpRequest) => void - locale?: Locale - timeout?: number -} - -export type AwsS3Options = LegacyAwsS3Options | AwsS3MultipartOptions - -declare class AwsS3 extends BasePlugin {} - -export default AwsS3 diff --git a/packages/@uppy/aws-s3/types/index.test-d.ts b/packages/@uppy/aws-s3/types/index.test-d.ts deleted file mode 100644 index 0ebb2a3eac..0000000000 --- a/packages/@uppy/aws-s3/types/index.test-d.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { Uppy, type UppyFile } from '@uppy/core' -import { expectType, expectError } from 'tsd' -import type { AwsS3Part } from '@uppy/aws-s3-multipart' -import AwsS3 from '..' - -{ - const uppy = new Uppy() - uppy.use(AwsS3, { - getUploadParameters(file) { - expectType(file) - return { method: 'POST', url: '' } - }, - }) - expectError( - uppy.use(AwsS3, { - shouldUseMultipart: false, - getUploadParameters(file) { - expectType(file) - return { method: 'POST', url: '' } - }, - }), - ) - uppy.use(AwsS3, { - shouldUseMultipart: false, - getUploadParameters(file) { - expectType(file) - return { method: 'POST', url: '', fields: {} } - }, - }) - expectError( - uppy.use(AwsS3, { - shouldUseMultipart: true, - getUploadParameters(file) { - expectType(file) - return { method: 'PUT', url: '' } - }, - }), - ) - uppy.use(AwsS3, { - shouldUseMultipart: () => Math.random() > 0.5, - getUploadParameters(file) { - expectType(file) - return { method: 'PUT', url: '' } - }, - createMultipartUpload(file) { - expectType(file) - return { uploadId: '', key: '' } - }, - listParts(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - return [] - }, - signPart(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - expectType(opts.body) - expectType(opts.signal) - return { url: '' } - }, - abortMultipartUpload(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - }, - completeMultipartUpload(file, opts) { - expectType(file) - expectType(opts.uploadId) - expectType(opts.key) - expectType(opts.parts[0]) - return {} - }, - }) -} diff --git a/packages/@uppy/box/package.json b/packages/@uppy/box/package.json index a386b89851..97e8d781cc 100644 --- a/packages/@uppy/box/package.json +++ b/packages/@uppy/box/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/box/types/index.d.ts b/packages/@uppy/box/types/index.d.ts deleted file mode 100644 index 4700dcf8cc..0000000000 --- a/packages/@uppy/box/types/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -interface BoxOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class Box extends UIPlugin {} - -export default Box diff --git a/packages/@uppy/box/types/index.test-d.ts b/packages/@uppy/box/types/index.test-d.ts deleted file mode 100644 index 8f838ddf85..0000000000 --- a/packages/@uppy/box/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Box from '..' - -{ - const uppy = new Uppy() - uppy.use(Box, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/companion-client/package.json b/packages/@uppy/companion-client/package.json index ea976dc582..5e5c918950 100644 --- a/packages/@uppy/companion-client/package.json +++ b/packages/@uppy/companion-client/package.json @@ -4,7 +4,6 @@ "version": "3.6.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/companion-client/types/index.d.ts b/packages/@uppy/companion-client/types/index.d.ts deleted file mode 100644 index 350a4abb18..0000000000 --- a/packages/@uppy/companion-client/types/index.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -import type { Uppy } from '@uppy/core' - -/** - * Async storage interface, similar to `localStorage`. This can be used to - * implement custom storages for authentication tokens. - */ -export interface TokenStorage { - setItem: (key: string, value: string) => Promise - getItem: (key: string) => Promise - removeItem: (key: string) => Promise -} - -type CompanionHeaders = Record - -type CompanionKeys = { - key: string - credentialsName: string -} - -export interface RequestClientOptions { - companionUrl: string - companionHeaders?: CompanionHeaders - companionCookiesRule?: RequestCredentials - companionKeysParams?: CompanionKeys -} - -type RequestOptions = { - skipPostResponse?: boolean - signal?: AbortSignal -} - -export class RequestClient { - constructor(uppy: Uppy, opts: RequestClientOptions) - - readonly hostname: string - - setCompanionHeaders(headers: CompanionHeaders): void - - get(path: string, options?: RequestOptions): Promise - - /** @deprecated use option bag instead */ - get(path: string, skipPostResponse: boolean): Promise - - post( - path: string, - data: Record, - options?: RequestOptions, - ): Promise - - /** @deprecated use option bag instead */ - post( - path: string, - data: Record, - skipPostResponse: boolean, - ): Promise - - delete( - path: string, - data?: Record, - options?: RequestOptions, - ): Promise - - /** @deprecated use option bag instead */ - delete( - path: string, - data: Record, - skipPostResponse: boolean, - ): Promise -} - -/** - * Options for Providers that can be passed in by Uppy users through - * Plugin constructors. - */ -export interface PublicProviderOptions extends RequestClientOptions { - companionAllowedHosts?: string | RegExp | Array -} - -/** - * Options for Providers, including internal options that Plugins can set. - */ -export interface ProviderOptions extends PublicProviderOptions { - provider: string - name?: string - pluginId: string -} - -export class Provider extends RequestClient { - constructor(uppy: Uppy, opts: ProviderOptions) - - checkAuth(): Promise - - authUrl(): string - - fileUrl(id: string): string - - list(directory: string): Promise - - logout(redirect?: string): Promise - - static initPlugin( - plugin: unknown, - opts: Record, - defaultOpts?: Record, - ): void -} - -export interface SocketOptions { - target: string - autoOpen?: boolean -} - -export class Socket { - readonly isOpen: boolean - - constructor(opts: SocketOptions) - - open(): void - - close(): void - - send(action: string, payload: unknown): void - - on(action: string, handler: (param: any) => void): void - - once(action: string, handler: (param: any) => void): void - - emit(action: string, payload: (param: any) => void): void -} diff --git a/packages/@uppy/companion-client/types/index.test-d.ts b/packages/@uppy/companion-client/types/index.test-d.ts deleted file mode 100644 index ff27504bb1..0000000000 --- a/packages/@uppy/companion-client/types/index.test-d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// import { RequestClient, Provider, Socket } from '..' -// TODO tests diff --git a/packages/@uppy/compressor/package.json b/packages/@uppy/compressor/package.json index 8605a56ce8..40873c6f46 100644 --- a/packages/@uppy/compressor/package.json +++ b/packages/@uppy/compressor/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/compressor/types/index.d.ts b/packages/@uppy/compressor/types/index.d.ts deleted file mode 100644 index 5562d4badc..0000000000 --- a/packages/@uppy/compressor/types/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { PluginOptions, BasePlugin } from '@uppy/core' -import { UppyFile } from '@uppy/utils' -import type CompressorLocale from './generatedLocale' - -export interface CompressorOptions extends PluginOptions { - quality?: number - limit?: number - locale?: CompressorLocale -} - -export type CompressorCompleteCallback = ( - files: UppyFile[], -) => void - -declare module '@uppy/core' { - export interface UppyEventMap { - 'compressor:complete': CompressorCompleteCallback - } -} - -declare class Compressor extends BasePlugin {} - -export default Compressor diff --git a/packages/@uppy/compressor/types/index.test-d.ts b/packages/@uppy/compressor/types/index.test-d.ts deleted file mode 100644 index b807c85763..0000000000 --- a/packages/@uppy/compressor/types/index.test-d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import Uppy from '@uppy/core' -import Compressor from '..' - -{ - const uppy = new Uppy() - uppy.use(Compressor) -} diff --git a/packages/@uppy/core/package.json b/packages/@uppy/core/package.json index 3420883041..1e6795b88e 100644 --- a/packages/@uppy/core/package.json +++ b/packages/@uppy/core/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "sideEffects": [ "*.css" diff --git a/packages/@uppy/core/types/index.d.ts b/packages/@uppy/core/types/index.d.ts deleted file mode 100644 index 7c0b39ea3a..0000000000 --- a/packages/@uppy/core/types/index.d.ts +++ /dev/null @@ -1,430 +0,0 @@ -// This references the old types on purpose, to make sure to not create breaking changes for TS consumers. -// eslint-disable-next-line @typescript-eslint/triple-slash-reference -/// -import * as UppyUtils from '@uppy/utils' - -// Utility types -type OmitKey = Pick> - -type UploadHandler = (fileIDs: string[]) => Promise - -export interface IndexedObject { - [key: string]: T - [key: number]: T -} - -// These are defined in @uppy/utils instead of core so it can be used there without creating import cycles -export type UppyFile< - TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record, -> = UppyUtils.UppyFile - -export type FileProgress = UppyUtils.FileProgress - -export type FileRemoveReason = 'removed-by-user' | 'cancel-all' - -// Replace the `meta` property type with one that allows omitting internal metadata addFile() will add that -type UppyFileWithoutMeta< - TMeta extends IndexedObject, - TBody extends IndexedObject, -> = OmitKey, 'meta'> - -type LocaleStrings = { - [K in TNames]?: string | { [n: number]: string } -} - -type LogLevel = 'info' | 'warning' | 'error' - -type CancelOptions = { reason: 'user' | 'unmount' } - -export type Store = UppyUtils.Store - -export type InternalMetadata = UppyUtils.InternalMetadata - -export interface UploadedUppyFile< - TMeta extends IndexedObject, - TBody extends IndexedObject, -> extends UppyFile { - uploadURL: string -} - -export interface FailedUppyFile< - TMeta extends IndexedObject, - TBody extends IndexedObject, -> extends UppyFile { - error: string -} - -export interface AddFileOptions< - TMeta extends IndexedObject = IndexedObject, - TBody extends IndexedObject = IndexedObject, -> extends Partial> { - // `.data` is the only required property here. - data: Blob | File - meta?: Partial & TMeta -} - -export interface PluginOptions { - id?: string -} - -export interface UIPluginOptions extends PluginOptions { - replaceTargetContent?: boolean -} - -export interface DefaultPluginOptions extends PluginOptions { - [prop: string]: any -} - -export class BasePlugin { - id: string - - // eslint-disable-next-line no-use-before-define - uppy: Uppy - - type: string - - // eslint-disable-next-line no-use-before-define - constructor(uppy: Uppy, opts?: TOptions) - - setOptions(update: Partial): void - - getPluginState(): Record - - setPluginState(update: IndexedObject): Record - - install(): void - - uninstall(): void -} - -export class UIPlugin< - TOptions extends UIPluginOptions = DefaultPluginOptions, -> extends BasePlugin { - id: string - - // eslint-disable-next-line no-use-before-define - uppy: Uppy - - type: string - - // eslint-disable-next-line no-use-before-define - constructor(uppy: Uppy, opts?: TOptions) - - update(state?: Record): void - - getTargetPlugin(target: PluginTarget): UIPlugin | undefined - - // eslint-disable-next-line no-use-before-define - mount(target: PluginTarget, plugin: UIPlugin): void - - render(state: Record): void - - addTarget(plugin: TPlugin): void - - unmount(): void - - onMount(): void - - onUnmount(): void -} - -export type PluginTarget = - | string - | Element - | typeof BasePlugin - | typeof UIPlugin - | BasePlugin - -export interface Locale { - strings: LocaleStrings - pluralize?: (n: number) => number -} - -export interface Logger { - debug: (...args: any[]) => void - warn: (...args: any[]) => void - error: (...args: any[]) => void -} - -export interface Restrictions { - maxFileSize?: number | null - minFileSize?: number | null - maxTotalFileSize?: number | null - maxNumberOfFiles?: number | null - minNumberOfFiles?: number | null - allowedFileTypes?: string[] | null -} - -export interface UppyOptions< - TMeta extends IndexedObject = Record, -> { - id?: string - autoProceed?: boolean - /** - * @deprecated Use allowMultipleUploadBatches - */ - allowMultipleUploads?: boolean - allowMultipleUploadBatches?: boolean - logger?: Logger - debug?: boolean - restrictions?: Restrictions - meta?: TMeta - onBeforeFileAdded?: ( - currentFile: UppyFile, - files: { [key: string]: UppyFile }, - ) => UppyFile | boolean | undefined - onBeforeUpload?: (files: { - [key: string]: UppyFile - }) => { [key: string]: UppyFile } | boolean - locale?: Locale - store?: Store - infoTimeout?: number -} - -export interface UploadResult< - TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record, -> { - successful: UploadedUppyFile[] - failed: FailedUppyFile[] -} - -export interface State< - TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record, -> extends IndexedObject { - capabilities?: { resumableUploads?: boolean } - currentUploads: Record - error?: string - files: { - [key: string]: UploadedUppyFile | FailedUppyFile - } - info?: Array<{ - isHidden: boolean - type: LogLevel - message: string - details: string | null - }> - plugins?: IndexedObject - totalProgress: number -} - -export interface ErrorResponse { - status: number - body: any -} - -export interface SuccessResponse { - uploadURL?: string - status?: number - body?: any - bytesUploaded?: number -} - -export type GenericEventCallback = () => void -export type FileAddedCallback> = ( - file: UppyFile, -) => void -export type FilesAddedCallback> = ( - files: UppyFile[], -) => void -export type FileRemovedCallback> = ( - file: UppyFile, - reason: FileRemoveReason, -) => void -export type UploadCallback = (data: { id: string; fileIDs: string[] }) => void -export type ProgressCallback = (progress: number) => void -export type PreProcessCompleteCallback> = ( - file: UppyFile | undefined, -) => void -export type UploadPauseCallback = ( - fileID: UppyFile['id'] | undefined, - isPaused: boolean, -) => void -export type UploadProgressCallback> = ( - file: UppyFile | undefined, - progress: FileProgress, -) => void -export type UploadSuccessCallback> = ( - file: UppyFile | undefined, - response: SuccessResponse, -) => void -export type UploadCompleteCallback> = ( - result: UploadResult, -) => void -export type ErrorCallback = (error: Error) => void -export type UploadErrorCallback> = ( - file: UppyFile | undefined, - error: Error, - response?: ErrorResponse, -) => void -export type UploadRetryCallback = (fileID: string) => void -export type PauseAllCallback = (fileIDs: string[]) => void -export type ResumeAllCallback = (fileIDs: string[]) => void -export type RetryAllCallback = (fileIDs: string[]) => void -export type RestrictionFailedCallback> = ( - file: UppyFile | undefined, - error: Error, -) => void - -export interface UppyEventMap< - TMeta extends IndexedObject = Record, -> { - 'cancel-all': GenericEventCallback - complete: UploadCompleteCallback - error: ErrorCallback - 'file-added': FileAddedCallback - 'file-removed': FileRemovedCallback - 'files-added': FilesAddedCallback - 'info-hidden': GenericEventCallback - 'info-visible': GenericEventCallback - 'pause-all': PauseAllCallback - 'preprocess-complete': PreProcessCompleteCallback - progress: ProgressCallback - 'reset-progress': GenericEventCallback - 'resume-all': ResumeAllCallback - 'restriction-failed': RestrictionFailedCallback - 'retry-all': RetryAllCallback - 'upload-error': UploadErrorCallback - 'upload-pause': UploadPauseCallback - 'upload-progress': UploadProgressCallback - 'upload-retry': UploadRetryCallback - 'upload-success': UploadSuccessCallback - upload: UploadCallback -} - -export class Uppy< - TMeta extends IndexedObject = Record, - TBody extends IndexedObject = Record, -> { - constructor(opts?: UppyOptions) - - on( - event: K, - callback: UppyEventMap[K], - ): this - - once( - event: K, - callback: UppyEventMap[K], - ): this - - off( - event: K, - callback: UppyEventMap[K], - ): this - - /** - * For use by plugins only. - */ - emit(event: string, ...args: any[]): void - - updateAll(state: Record): void - - setOptions(update: Partial): void - - setState(patch: Record): void - - getState(): State - - setFileState(fileID: string, state: Record): void - - resetProgress(): void - - addPreProcessor(fn: UploadHandler): void - - removePreProcessor(fn: UploadHandler): void - - addPostProcessor(fn: UploadHandler): void - - removePostProcessor(fn: UploadHandler): void - - addUploader(fn: UploadHandler): void - - removeUploader(fn: UploadHandler): void - - setMeta(data: TMeta): void - - setFileMeta(fileID: string, data: TMeta): void - - getFile(fileID: string): UppyFile - - getFiles(): Array> - - getObjectOfFilesPerState(): { - newFiles: Array - startedFiles: Array - uploadStartedFiles: Array - pausedFiles: Array - completeFiles: Array - erroredFiles: Array - inProgressFiles: Array - inProgressNotPausedFiles: Array - processingFiles: Array - isUploadStarted: boolean - isAllComplete: boolean - isAllErrored: boolean - isAllPaused: boolean - isUploadInProgress: boolean - isSomeGhost: boolean - } - - addFile(file: AddFileOptions): string - - addFiles(files: AddFileOptions[]): void - - removeFile(fileID: string, reason?: FileRemoveReason): void - - pauseResume(fileID: string): boolean - - pauseAll(): void - - resumeAll(): void - - retryAll(): Promise> - - cancelAll(options?: CancelOptions): void - - retryUpload(fileID: string): Promise> - - getID(): string - - use< - TOptions extends PluginOptions, - TInstance extends UIPlugin | BasePlugin, - >( - pluginClass: new (uppy: this, opts?: TOptions) => TInstance, - opts?: TOptions, - ): this - - getPlugin( - name: string, - ): TPlugin | undefined - - iteratePlugins(callback: (plugin: UIPlugin | BasePlugin) => void): void - - removePlugin(instance: UIPlugin | BasePlugin): void - - close(options?: CancelOptions): void - - logout(): void - - info( - message: string | { message: string; details: string }, - type?: LogLevel, - duration?: number, - ): void - - hideInfo(): void - - log(msg: string, type?: LogLevel): void - - restore(uploadID: string): Promise> - - addResultData(uploadID: string, data: Record): void - - upload(): Promise> -} - -export default Uppy diff --git a/packages/@uppy/core/types/index.test-d.ts b/packages/@uppy/core/types/index.test-d.ts deleted file mode 100644 index 4ff053cab9..0000000000 --- a/packages/@uppy/core/types/index.test-d.ts +++ /dev/null @@ -1,167 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ -import { expectError, expectType } from 'tsd' -import DefaultStore from '@uppy/store-default' -// eslint-disable-next-line import/no-named-as-default -import Uppy, { UIPlugin } from '..' -import type { - UploadedUppyFile, - FailedUppyFile, - PluginOptions, - UppyFile, - SuccessResponse, -} from '..' - -type anyObject = Record - -{ - const uppy = new Uppy() - uppy.addFile({ - data: new Blob([new ArrayBuffer(1024)], { - type: 'application/octet-stream', - }), - }) - - uppy.upload().then((result) => { - expectType>(result.successful[0]) - expectType>(result.failed[0]) - }) -} - -{ - const store = new DefaultStore() - new Uppy({ store }) // eslint-disable-line no-new -} - -{ - const uppy = new Uppy() - // this doesn't exist but type checking works anyway :) - const f = uppy.getFile('virtual') - if (f && f.progress && f.progress.uploadStarted === null) { - f.progress.uploadStarted = Date.now() - } - - if (f && f.response && f.response.status === 200) { - expectType(f.response.body) - } - expectType(f.response!.status) // eslint-disable-line @typescript-eslint/no-non-null-assertion -} - -{ - type Meta = Record - type ResponseBody = { - averageColor: string - } - const uppy = new Uppy() - const f = uppy.getFile('virtual') - expectType(f.response!.body) // eslint-disable-line @typescript-eslint/no-non-null-assertion -} - -{ - const uppy = new Uppy() - uppy.addFile({ - name: 'empty.json', - data: new Blob(['null'], { type: 'application/json' }), - meta: { path: 'path/to/file' }, - }) -} - -{ - interface SomeOptions extends PluginOptions { - types: 'are checked' - } - class SomePlugin extends UIPlugin {} - const typedUppy = new Uppy() - - expectError(typedUppy.use(SomePlugin, { types: 'error' })) - - typedUppy.use(SomePlugin, { types: 'are checked' }) -} - -{ - // Meta signature - type Meta = { myCustomMetadata: string } - /* eslint-disable @typescript-eslint/no-empty-function */ - const uppy = new Uppy() - // can emit events with internal event types - uppy.emit('upload') - uppy.emit('complete', () => {}) - uppy.emit('error', () => {}) - - // can emit events with custom event types - uppy.emit('dashboard:modal-closed', () => {}) - - // can register listeners for internal events - uppy.on('upload', () => {}) - uppy.on('complete', () => {}) - uppy.on('error', () => {}) - uppy.once('upload', () => {}) - uppy.once('complete', () => {}) - uppy.once('error', () => {}) - /* eslint-enable @typescript-eslint/no-empty-function */ - - // Normal event signature - uppy.on('complete', (result) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const successResults = result.successful - }) - - uppy.on('complete', (result) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const meta = result.successful[0].meta.myCustomMetadata - }) - - // Separate event handlers - const handleUpload = (file?: UppyFile) => { - const meta = file?.meta.myCustomMetadata - } - - uppy.off('upload-success', handleUpload) - - interface CustomResponse extends SuccessResponse { - body?: { someValue: string } - } - - const onUploadSuccess = async ( - file: UppyFile | undefined, - response: CustomResponse, - ) => { - const res = response.body?.someValue - } - uppy.on('upload-success', onUploadSuccess) -} - -{ - const uppy = new Uppy() - uppy.setOptions({ - restrictions: { - allowedFileTypes: ['.png'], - }, - }) - expectError(uppy.setOptions({ restrictions: false })) - expectError(uppy.setOptions({ unknownKey: false })) -} - -{ - interface TestOptions extends PluginOptions { - testOption: string - } - class TestPlugin extends UIPlugin {} - - const strict = new Uppy().use(TestPlugin, { testOption: 'hello' }) - - /* eslint-disable @typescript-eslint/no-non-null-assertion */ - strict - .getPlugin('TestPlugin')! - .setOptions({ testOption: 'world' }) - - expectError( - strict.getPlugin('TestPlugin')!.setOptions({ testOption: 0 }), - ) - - expectError( - strict - .getPlugin('TestPlugin')! - .setOptions({ unknownKey: false }), - ) - /* eslint-enable @typescript-eslint/no-non-null-assertion */ -} diff --git a/packages/@uppy/dashboard/package.json b/packages/@uppy/dashboard/package.json index 5257e50cd2..cd449f1b3b 100644 --- a/packages/@uppy/dashboard/package.json +++ b/packages/@uppy/dashboard/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/dashboard/types/index.d.ts b/packages/@uppy/dashboard/types/index.d.ts deleted file mode 100644 index ef4a94ed94..0000000000 --- a/packages/@uppy/dashboard/types/index.d.ts +++ /dev/null @@ -1,115 +0,0 @@ -import type { - IndexedObject, - PluginTarget, - UIPlugin, - UIPluginOptions, - UppyFile, -} from '@uppy/core' -import type { StatusBarLocale } from '@uppy/status-bar' -import type { ThumbnailOptions } from '@uppy/thumbnail-generator' -import DashboardLocale from './generatedLocale' - -type FieldRenderOptions = { - value: string - onChange: (newVal: string) => void - fieldCSSClasses: { text: string } - required: boolean - form: string -} - -type PreactRender = ( - node: any, - params: Record | null, - ...children: any[] -) => any - -interface MetaField { - id: string - name: string - placeholder?: string - render?: (field: FieldRenderOptions, h: PreactRender) => any -} - -type Options = UIPluginOptions & ThumbnailOptions - -export interface DashboardOptions extends Options { - animateOpenClose?: boolean - browserBackButtonClose?: boolean - closeAfterFinish?: boolean - singleFileFullScreen?: boolean - closeModalOnClickOutside?: boolean - disableInformer?: boolean - disablePageScrollWhenModalOpen?: boolean - disableStatusBar?: boolean - disableThumbnailGenerator?: boolean - height?: string | number - hideCancelButton?: boolean - hidePauseResumeButton?: boolean - hideProgressAfterFinish?: boolean - hideRetryButton?: boolean - hideUploadButton?: boolean - inline?: boolean - locale?: DashboardLocale & StatusBarLocale - metaFields?: MetaField[] | ((file: UppyFile) => MetaField[]) - note?: string | null - plugins?: string[] - fileManagerSelectionType?: 'files' | 'folders' | 'both' - proudlyDisplayPoweredByUppy?: boolean - showLinkToFileUploadResult?: boolean - showProgressDetails?: boolean - showSelectedFiles?: boolean - showRemoveButtonAfterComplete?: boolean - showNativePhotoCameraButton?: boolean - showNativeVideoCameraButton?: boolean - target?: PluginTarget - theme?: 'auto' | 'dark' | 'light' - trigger?: string - width?: string | number - autoOpenFileEditor?: boolean - disabled?: boolean - disableLocalFiles?: boolean - onRequestCloseModal?: () => void - doneButtonHandler?: () => void - onDragOver?: (event: DragEvent) => void - onDragLeave?: (event: DragEvent) => void - onDrop?: (event: DragEvent) => void -} - -declare class Dashboard extends UIPlugin { - addTarget(plugin: UIPlugin): HTMLElement - - hideAllPanels(): void - - openModal(): void - - closeModal(): void - - isModalOpen(): boolean - - render(state: Record): void - - install(): void - - uninstall(): void -} - -export default Dashboard - -// Events - -export type DashboardFileEditStartCallback> = ( - file?: UppyFile, -) => void -export type DashboardFileEditCompleteCallback< - TMeta extends IndexedObject, -> = (file?: UppyFile) => void -export type DashboardShowPlanelCallback = (id: string) => void -declare module '@uppy/core' { - export interface UppyEventMap { - 'dashboard:modal-open': GenericEventCallback - 'dashboard:modal-closed': GenericEventCallback - 'dashboard:show-panel': DashboardShowPlanelCallback - 'dashboard:file-edit-start': DashboardFileEditStartCallback - 'dashboard:file-edit-complete': DashboardFileEditCompleteCallback - } -} diff --git a/packages/@uppy/dashboard/types/index.test-d.ts b/packages/@uppy/dashboard/types/index.test-d.ts deleted file mode 100644 index dffa10cdc8..0000000000 --- a/packages/@uppy/dashboard/types/index.test-d.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { expectType, expectError } from 'tsd' -import Uppy from '@uppy/core' -import Dashboard from '..' - -{ - const uppy = new Uppy() - uppy.use(Dashboard, { - target: 'body', - }) - - const plugin = uppy.getPlugin('Dashboard') ?? ({} as never) - plugin.openModal() - expectType(plugin.isModalOpen()) - plugin.closeModal() -} - -{ - const uppy = new Uppy() - uppy.use(Dashboard, { - width: '100%', - height: 700, - metaFields: [ - { id: 'caption', name: 'Caption' }, - { - id: 'license', - name: 'License', - placeholder: 'Creative Commons, Apache 2.0, ...', - }, - { - id: 'public', - name: 'Public', - render({ value, onChange }, h) { - expectType(value) - expectType<(val: string) => void>(onChange) - // `h` should be the Preact `h` - expectError(h([], 'error')) - /* Currently `h` typings are limited because of a JSX type conflict between React and Preact. - return h('input', { - type: 'checkbox', - checked: value === 'yes', - onChange: (event) => { - expectType(event) - onChange((event.target as HTMLInputElement).checked ? 'yes' : 'no') - } - }) - */ - }, - }, - ], - onDragOver: (event) => event.clientX, - onDrop: (event) => event.clientX, - onDragLeave: (event) => event.clientX, - }) - - uppy.on('dashboard:file-edit-start', (file) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const fileName = file?.name - }) - uppy.on('dashboard:show-panel', (id) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const pluginId = id - }) -} - -{ - const uppy = new Uppy() - uppy.use(Dashboard, { - locale: { - strings: { - // Dashboard string - addMoreFiles: 'yaddayadda', - // StatusBar string - uploading: '^^^^', - }, - }, - }) - expectError( - uppy.use(Dashboard, { - locale: { - strings: { - somethingThatDoesNotExist: 'wrong', - }, - }, - }), - ) - const wrongType = 1234 - expectError( - uppy.use(Dashboard, { - locale: { - strings: { - addMoreFiles: wrongType, - }, - }, - }), - ) -} -{ - const uppy = new Uppy() - expectError(uppy.use(Dashboard, { height: {} })) -} diff --git a/packages/@uppy/drag-drop/package.json b/packages/@uppy/drag-drop/package.json index 5a1a4b3750..b0aca3c33e 100644 --- a/packages/@uppy/drag-drop/package.json +++ b/packages/@uppy/drag-drop/package.json @@ -6,7 +6,6 @@ "main": "lib/index.js", "style": "dist/style.min.css", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/drag-drop/types/index.d.ts b/packages/@uppy/drag-drop/types/index.d.ts deleted file mode 100644 index 79083e05fa..0000000000 --- a/packages/@uppy/drag-drop/types/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import DragDropLocale from './generatedLocale' - -export interface DragDropOptions extends UIPluginOptions { - target?: PluginTarget - inputName?: string - allowMultipleFiles?: boolean - width?: string | number - height?: string | number - note?: string - locale?: DragDropLocale - onDragOver?: (event: DragEvent) => void - onDragLeave?: (event: DragEvent) => void - onDrop?: (event: DragEvent) => void -} - -declare class DragDrop extends UIPlugin {} - -export default DragDrop diff --git a/packages/@uppy/drag-drop/types/index.test-d.ts b/packages/@uppy/drag-drop/types/index.test-d.ts deleted file mode 100644 index 68559c722e..0000000000 --- a/packages/@uppy/drag-drop/types/index.test-d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Uppy from '@uppy/core' - -import DragDrop from '..' - -{ - const uppy = new Uppy() - - uppy.use(DragDrop, { - target: 'body', - inputName: 'test', - allowMultipleFiles: true, - width: 100, - height: '100', - note: 'note', - locale: { - strings: { - dropHereOr: 'test', - browse: 'test', - }, - }, - onDragOver: (event) => event.clientX, - onDragLeave: (event) => event.clientY, - onDrop: (event) => event, - }) -} diff --git a/packages/@uppy/drop-target/package.json b/packages/@uppy/drop-target/package.json index 4539ca6ccb..f7b3815166 100644 --- a/packages/@uppy/drop-target/package.json +++ b/packages/@uppy/drop-target/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/drop-target/types/index.d.ts b/packages/@uppy/drop-target/types/index.d.ts deleted file mode 100644 index 419a1bf898..0000000000 --- a/packages/@uppy/drop-target/types/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import type { PluginOptions, BasePlugin } from '@uppy/core' - -interface DropTargetOptions extends PluginOptions { - target: string | Element - onDragOver?: (event: MouseEvent) => void - onDrop?: (event: MouseEvent) => void - onDragLeave?: (event: MouseEvent) => void -} - -declare class DropTarget extends BasePlugin {} - -export default DropTarget diff --git a/packages/@uppy/drop-target/types/index.test-d.ts b/packages/@uppy/drop-target/types/index.test-d.ts deleted file mode 100644 index c3897de059..0000000000 --- a/packages/@uppy/drop-target/types/index.test-d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import Uppy from '@uppy/core' -import DropTarget from '..' - -{ - const uppy = new Uppy() - - uppy.use(DropTarget, { - target: 'body', - onDragOver: (event) => event.clientX, - onDrop: (event) => event.clientX, - onDragLeave: (event) => event.clientX, - }) -} diff --git a/packages/@uppy/dropbox/package.json b/packages/@uppy/dropbox/package.json index 02559a0d22..63d9f0182c 100644 --- a/packages/@uppy/dropbox/package.json +++ b/packages/@uppy/dropbox/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/dropbox/types/index.d.ts b/packages/@uppy/dropbox/types/index.d.ts deleted file mode 100644 index b9b6d5093e..0000000000 --- a/packages/@uppy/dropbox/types/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -export interface DropboxOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class Dropbox extends UIPlugin {} - -export default Dropbox diff --git a/packages/@uppy/dropbox/types/index.test-d.ts b/packages/@uppy/dropbox/types/index.test-d.ts deleted file mode 100644 index f57c21d540..0000000000 --- a/packages/@uppy/dropbox/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Dropbox from '..' - -{ - const uppy = new Uppy() - uppy.use(Dropbox, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/facebook/package.json b/packages/@uppy/facebook/package.json index 571548c9c1..02f3f8dfe6 100644 --- a/packages/@uppy/facebook/package.json +++ b/packages/@uppy/facebook/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/facebook/types/index.d.ts b/packages/@uppy/facebook/types/index.d.ts deleted file mode 100644 index 922e6f5f85..0000000000 --- a/packages/@uppy/facebook/types/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -export interface FacebookOptions - extends UIPluginOptions, - PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class Facebook extends UIPlugin {} - -export default Facebook diff --git a/packages/@uppy/facebook/types/index.test-d.ts b/packages/@uppy/facebook/types/index.test-d.ts deleted file mode 100644 index 2b8754a641..0000000000 --- a/packages/@uppy/facebook/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Facebook from '..' - -{ - const uppy = new Uppy() - uppy.use(Facebook, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/file-input/package.json b/packages/@uppy/file-input/package.json index 783d02dca3..9817e74bcd 100644 --- a/packages/@uppy/file-input/package.json +++ b/packages/@uppy/file-input/package.json @@ -6,7 +6,6 @@ "main": "lib/index.js", "style": "dist/style.min.css", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "upload", diff --git a/packages/@uppy/file-input/types/index.d.ts b/packages/@uppy/file-input/types/index.d.ts deleted file mode 100644 index d5f4019fe5..0000000000 --- a/packages/@uppy/file-input/types/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import FileInputLocale from './generatedLocale' - -export interface FileInputOptions extends UIPluginOptions { - target?: PluginTarget - pretty?: boolean - inputName?: string - locale?: FileInputLocale -} - -declare class FileInput extends UIPlugin {} - -export default FileInput diff --git a/packages/@uppy/file-input/types/index.test-d.ts b/packages/@uppy/file-input/types/index.test-d.ts deleted file mode 100644 index 8718ae5358..0000000000 --- a/packages/@uppy/file-input/types/index.test-d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// import FileInput from '..' -// TODO implement diff --git a/packages/@uppy/form/package.json b/packages/@uppy/form/package.json index ca9832138f..872b290dd3 100644 --- a/packages/@uppy/form/package.json +++ b/packages/@uppy/form/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "type": "module", - "types": "types/index.d.ts", "keywords": [ "file uploader", "uppy", diff --git a/packages/@uppy/form/types/index.d.ts b/packages/@uppy/form/types/index.d.ts deleted file mode 100644 index 1ce5199d61..0000000000 --- a/packages/@uppy/form/types/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { PluginOptions, PluginTarget, BasePlugin } from '@uppy/core' - -export interface FormOptions extends PluginOptions { - target?: PluginTarget - resultName?: string - getMetaFromForm?: boolean - addResultToForm?: boolean - submitOnSuccess?: boolean - triggerUploadOnSubmit?: boolean -} - -declare class Form extends BasePlugin {} - -export default Form diff --git a/packages/@uppy/form/types/index.test-d.ts b/packages/@uppy/form/types/index.test-d.ts deleted file mode 100644 index 18afb0f187..0000000000 --- a/packages/@uppy/form/types/index.test-d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// import Form from '..' -// TODO implement diff --git a/packages/@uppy/golden-retriever/package.json b/packages/@uppy/golden-retriever/package.json index 1e37fa3da5..e548650d65 100644 --- a/packages/@uppy/golden-retriever/package.json +++ b/packages/@uppy/golden-retriever/package.json @@ -4,7 +4,6 @@ "version": "3.1.1", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/golden-retriever/types/index.d.ts b/packages/@uppy/golden-retriever/types/index.d.ts deleted file mode 100644 index 38eff203e3..0000000000 --- a/packages/@uppy/golden-retriever/types/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { PluginOptions, BasePlugin } from '@uppy/core' - -interface GoldenRetrieverOptions extends PluginOptions { - expires?: number - serviceWorker?: boolean - indexedDB?: any -} - -declare class GoldenRetriever extends BasePlugin {} - -export default GoldenRetriever diff --git a/packages/@uppy/golden-retriever/types/index.test-d.ts b/packages/@uppy/golden-retriever/types/index.test-d.ts deleted file mode 100644 index fc7ea56e8e..0000000000 --- a/packages/@uppy/golden-retriever/types/index.test-d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// import GoldenRetriever from '..' -// TODO implements diff --git a/packages/@uppy/google-drive/package.json b/packages/@uppy/google-drive/package.json index 1bf720e3e6..fe91f03342 100644 --- a/packages/@uppy/google-drive/package.json +++ b/packages/@uppy/google-drive/package.json @@ -4,7 +4,6 @@ "version": "3.3.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/google-drive/types/index.d.ts b/packages/@uppy/google-drive/types/index.d.ts deleted file mode 100644 index 223b546175..0000000000 --- a/packages/@uppy/google-drive/types/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -export interface GoogleDriveOptions - extends UIPluginOptions, - PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class GoogleDrive extends UIPlugin {} - -export default GoogleDrive diff --git a/packages/@uppy/google-drive/types/index.test-d.ts b/packages/@uppy/google-drive/types/index.test-d.ts deleted file mode 100644 index 8e2f4c20e2..0000000000 --- a/packages/@uppy/google-drive/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy, { UIPlugin, type UIPluginOptions } from '@uppy/core' -import GoogleDrive from '..' - -class SomePlugin extends UIPlugin {} - -const uppy = new Uppy() -uppy.use(GoogleDrive, { companionUrl: '' }) -uppy.use(GoogleDrive, { target: SomePlugin, companionUrl: '' }) -uppy.use(GoogleDrive, { - target: document.querySelector('#gdrive') || (undefined as never), - companionUrl: '', -}) diff --git a/packages/@uppy/image-editor/package.json b/packages/@uppy/image-editor/package.json index 2b4c3a3cf1..15dea2f8f6 100644 --- a/packages/@uppy/image-editor/package.json +++ b/packages/@uppy/image-editor/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/image-editor/types/index.d.ts b/packages/@uppy/image-editor/types/index.d.ts deleted file mode 100644 index 1597b1bc8f..0000000000 --- a/packages/@uppy/image-editor/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -import type { - IndexedObject, - PluginTarget, - UIPlugin, - UIPluginOptions, - UppyFile, -} from '@uppy/core' -import type Cropper from 'cropperjs' -import ImageEditorLocale from './generatedLocale' - -type Actions = { - revert: boolean - rotate: boolean - granularRotate: boolean - flip: boolean - zoomIn: boolean - zoomOut: boolean - cropSquare: boolean - cropWidescreen: boolean - cropWidescreenVertical: boolean -} - -interface UppyCropperOptions extends Cropper.Options { - croppedCanvasOptions: Cropper.GetCroppedCanvasOptions -} - -export interface ImageEditorOptions extends UIPluginOptions { - cropperOptions?: UppyCropperOptions - actions?: Actions - quality?: number - target?: PluginTarget - locale?: ImageEditorLocale -} - -declare class ImageEditor extends UIPlugin {} - -export default ImageEditor - -// Events - -export type FileEditorStartCallback> = ( - file: UppyFile, -) => void -export type FileEditorCompleteCallback> = ( - updatedFile: UppyFile, -) => void -export type FileEditorCancelCallback> = ( - file: UppyFile, -) => void - -declare module '@uppy/core' { - export interface UppyEventMap> { - 'file-editor:start': FileEditorStartCallback - 'file-editor:complete': FileEditorCompleteCallback - 'file-editor:cancel': FileEditorCancelCallback - } -} diff --git a/packages/@uppy/image-editor/types/index.test-d.ts b/packages/@uppy/image-editor/types/index.test-d.ts deleted file mode 100644 index de8641a686..0000000000 --- a/packages/@uppy/image-editor/types/index.test-d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// TODO implement - -import Uppy from '@uppy/core' -import ImageEditor from '..' - -{ - const uppy = new Uppy() - - uppy.use(ImageEditor) - - uppy.on('file-editor:start', (file) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const fileName = file.name - }) - uppy.on('file-editor:complete', (file) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const fileName = file.name - }) - uppy.on('file-editor:cancel', (file) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const fileName = file.name - }) -} diff --git a/packages/@uppy/informer/package.json b/packages/@uppy/informer/package.json index f7b89ecac8..3cf3c7f987 100644 --- a/packages/@uppy/informer/package.json +++ b/packages/@uppy/informer/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/informer/types/index.d.ts b/packages/@uppy/informer/types/index.d.ts deleted file mode 100644 index 2cb17c3c16..0000000000 --- a/packages/@uppy/informer/types/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' - -interface InformerOptions extends UIPluginOptions { - target?: PluginTarget -} - -declare class Informer extends UIPlugin {} - -export default Informer diff --git a/packages/@uppy/informer/types/index.test-d.ts b/packages/@uppy/informer/types/index.test-d.ts deleted file mode 100644 index 50c9151921..0000000000 --- a/packages/@uppy/informer/types/index.test-d.ts +++ /dev/null @@ -1,2 +0,0 @@ -// import Informer from '..' -// TODO implement diff --git a/packages/@uppy/instagram/package.json b/packages/@uppy/instagram/package.json index 46145628ad..80ed3eeebb 100644 --- a/packages/@uppy/instagram/package.json +++ b/packages/@uppy/instagram/package.json @@ -4,7 +4,6 @@ "version": "3.1.3", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/instagram/types/index.d.ts b/packages/@uppy/instagram/types/index.d.ts deleted file mode 100644 index 84981fcb11..0000000000 --- a/packages/@uppy/instagram/types/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -export interface InstagramOptions - extends UIPluginOptions, - PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class Instagram extends UIPlugin {} - -export default Instagram diff --git a/packages/@uppy/instagram/types/index.test-d.ts b/packages/@uppy/instagram/types/index.test-d.ts deleted file mode 100644 index c5cf3579a2..0000000000 --- a/packages/@uppy/instagram/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Instagram from '..' - -{ - const uppy = new Uppy() - uppy.use(Instagram, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/onedrive/package.json b/packages/@uppy/onedrive/package.json index add65ad8e4..b5fb45deb6 100644 --- a/packages/@uppy/onedrive/package.json +++ b/packages/@uppy/onedrive/package.json @@ -4,7 +4,6 @@ "version": "3.1.4", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/onedrive/types/index.d.ts b/packages/@uppy/onedrive/types/index.d.ts deleted file mode 100644 index 6473fcce9e..0000000000 --- a/packages/@uppy/onedrive/types/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - PublicProviderOptions, - TokenStorage, -} from '@uppy/companion-client' - -export interface OneDriveOptions - extends UIPluginOptions, - PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class OneDrive extends UIPlugin {} - -export default OneDrive diff --git a/packages/@uppy/onedrive/types/index.test-d.ts b/packages/@uppy/onedrive/types/index.test-d.ts deleted file mode 100644 index 8e7101c102..0000000000 --- a/packages/@uppy/onedrive/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import OneDrive from '..' - -{ - const uppy = new Uppy() - uppy.use(OneDrive, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/progress-bar/package.json b/packages/@uppy/progress-bar/package.json index a7d7925619..d818a86d59 100644 --- a/packages/@uppy/progress-bar/package.json +++ b/packages/@uppy/progress-bar/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/progress-bar/types/index.d.ts b/packages/@uppy/progress-bar/types/index.d.ts deleted file mode 100644 index 9f6eedc62e..0000000000 --- a/packages/@uppy/progress-bar/types/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' - -export interface ProgressBarOptions extends UIPluginOptions { - target?: PluginTarget - hideAfterFinish?: boolean - fixed?: boolean -} - -declare class ProgressBar extends UIPlugin {} - -export default ProgressBar diff --git a/packages/@uppy/progress-bar/types/index.test-d.ts b/packages/@uppy/progress-bar/types/index.test-d.ts deleted file mode 100644 index bf81a156e5..0000000000 --- a/packages/@uppy/progress-bar/types/index.test-d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Uppy from '@uppy/core' -import ProgressBar from '..' - -{ - const uppy = new Uppy() - uppy.use(ProgressBar, { - target: 'body', - hideAfterFinish: true, - fixed: true, - }) -} diff --git a/packages/@uppy/provider-views/package.json b/packages/@uppy/provider-views/package.json index 8dbb2d0240..8c194dd64a 100644 --- a/packages/@uppy/provider-views/package.json +++ b/packages/@uppy/provider-views/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/provider-views/types/index.d.ts b/packages/@uppy/provider-views/types/index.d.ts deleted file mode 100644 index 3930476062..0000000000 --- a/packages/@uppy/provider-views/types/index.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { UIPlugin } from '@uppy/core' -import type { Provider } from '@uppy/companion-client' - -interface ProviderViewOptions { - provider: Provider - viewType?: 'list' | 'grid' - showTitles?: boolean - showFilter?: boolean - showBreadcrumbs?: boolean -} - -interface OnFirstRenderer { - onFirstRender: () => any -} - -declare class ProviderView { - constructor(plugin: UIPlugin & OnFirstRenderer, opts: ProviderViewOptions) - // @todo add other provider view methods -} - -export default ProviderView diff --git a/packages/@uppy/react/package.json b/packages/@uppy/react/package.json index 7c253eb821..daa11dd41a 100644 --- a/packages/@uppy/react/package.json +++ b/packages/@uppy/react/package.json @@ -4,7 +4,6 @@ "version": "3.2.1", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/react/types/index.d.ts b/packages/@uppy/react/types/index.d.ts deleted file mode 100644 index d64be3577f..0000000000 --- a/packages/@uppy/react/types/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { default as Dashboard } from '../src/Dashboard' -export { default as DashboardModal } from '../src/DashboardModal' -export { default as DragDrop } from '../src/DragDrop' -export { default as ProgressBar } from '../src/ProgressBar' -export { default as StatusBar } from '../src/StatusBar' -export { default as FileInput } from '../src/FileInput' -export { default as useUppy } from '../src/useUppy' diff --git a/packages/@uppy/react/types/index.test-d.tsx b/packages/@uppy/react/types/index.test-d.tsx deleted file mode 100644 index d408d306a9..0000000000 --- a/packages/@uppy/react/types/index.test-d.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import * as React from 'react' -import Uppy from '@uppy/core' -import { expectType, expectError } from 'tsd' -import * as components from '../' - -const { useUppy } = components - -const uppy = new Uppy() - -{ - function TestComponent() { - return ( - - ) - } -} - -{ - expectError() -} - -// inline option should be removed from proptypes because it is always overridden -// by the component -{ - expectError() - expectError() -} - -{ - const el = ( - - ) -} - -{ - const el = ( - { - alert('no') - }} - /> - ) - - // use onRequestClose instead. - expectError() -} - -{ - function TestHook() { - expectType(useUppy(() => uppy)) - expectType(useUppy(() => new Uppy())) - expectError(useUppy(uppy)) - } -} diff --git a/packages/@uppy/redux-dev-tools/package.json b/packages/@uppy/redux-dev-tools/package.json index d546010a11..394202f68d 100644 --- a/packages/@uppy/redux-dev-tools/package.json +++ b/packages/@uppy/redux-dev-tools/package.json @@ -4,7 +4,6 @@ "version": "3.0.3", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/redux-dev-tools/types/index.d.ts b/packages/@uppy/redux-dev-tools/types/index.d.ts deleted file mode 100644 index 4673033464..0000000000 --- a/packages/@uppy/redux-dev-tools/types/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { UIPlugin, UIPluginOptions } from '@uppy/core' - -type ReduxDevToolsOptions = UIPluginOptions - -declare class ReduxDevTools extends UIPlugin {} - -export default ReduxDevTools diff --git a/packages/@uppy/redux-dev-tools/types/index.test-d.ts b/packages/@uppy/redux-dev-tools/types/index.test-d.ts deleted file mode 100644 index 9b23ae8bf0..0000000000 --- a/packages/@uppy/redux-dev-tools/types/index.test-d.ts +++ /dev/null @@ -1 +0,0 @@ -// import ReduxDevTools from '..' diff --git a/packages/@uppy/remote-sources/package.json b/packages/@uppy/remote-sources/package.json index 3826c498c0..004ed283f6 100644 --- a/packages/@uppy/remote-sources/package.json +++ b/packages/@uppy/remote-sources/package.json @@ -4,7 +4,6 @@ "version": "1.1.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/remote-sources/types/index.d.ts b/packages/@uppy/remote-sources/types/index.d.ts deleted file mode 100644 index 3ac7afd332..0000000000 --- a/packages/@uppy/remote-sources/types/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { PluginOptions, BasePlugin, PluginTarget } from '@uppy/core' -import type { RequestClientOptions } from '@uppy/companion-client' - -interface RemoteTargetOptions extends PluginOptions, RequestClientOptions { - target?: PluginTarget - sources?: Array - title?: string - companionUrl: string -} - -declare class RemoteTarget extends BasePlugin {} - -export default RemoteTarget diff --git a/packages/@uppy/remote-sources/types/index.test-d.ts b/packages/@uppy/remote-sources/types/index.test-d.ts deleted file mode 100644 index 2a551ea846..0000000000 --- a/packages/@uppy/remote-sources/types/index.test-d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Uppy from '@uppy/core' -import RemoteSources from '..' - -{ - const uppy = new Uppy() - uppy.use(RemoteSources, { - sources: ['Instagram', 'Url'], - companionUrl: '', - companionCookiesRule: 'same-origin', - }) -} diff --git a/packages/@uppy/screen-capture/package.json b/packages/@uppy/screen-capture/package.json index 46292ce3d3..f31e5d8d93 100644 --- a/packages/@uppy/screen-capture/package.json +++ b/packages/@uppy/screen-capture/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/screen-capture/types/index.d.ts b/packages/@uppy/screen-capture/types/index.d.ts deleted file mode 100644 index d9e56f3a04..0000000000 --- a/packages/@uppy/screen-capture/types/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' - -// https://developer.mozilla.org/en-US/docs/Web/API/MediaTrackConstraints#Properties_of_shared_screen_tracks -// TODO: use the global DisplayMediaStreamConstraints once typescript includes it by default -interface DisplayMediaStreamConstraints { - audio?: boolean | MediaTrackConstraints - video?: - | boolean - | (MediaTrackConstraints & { - cursor?: 'always' | 'motion' | 'never' - displaySurface?: 'application' | 'browser' | 'monitor' | 'window' - logicalSurface?: boolean - }) -} - -export interface ScreenCaptureOptions extends UIPluginOptions { - target?: PluginTarget - displayMediaConstraints?: DisplayMediaStreamConstraints - userMediaConstraints?: MediaStreamConstraints - preferredVideoMimeType?: string -} - -declare class ScreenCapture extends UIPlugin {} - -export default ScreenCapture diff --git a/packages/@uppy/screen-capture/types/index.test-d.ts b/packages/@uppy/screen-capture/types/index.test-d.ts deleted file mode 100644 index 6662c04c7f..0000000000 --- a/packages/@uppy/screen-capture/types/index.test-d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { expectError } from 'tsd' -import Uppy from '@uppy/core' -import ScreenCapture from '..' - -new Uppy().use(ScreenCapture) -new Uppy().use(ScreenCapture, {}) -new Uppy().use(ScreenCapture, { preferredVideoMimeType: 'video/mp4' }) -expectError(new Uppy().use(ScreenCapture, { preferredVideoMimeType: 10 })) - -new Uppy().use(ScreenCapture, { - displayMediaConstraints: { - video: { displaySurface: 'window' }, - }, -}) -expectError( - new Uppy().use(ScreenCapture, { - displayMediaConstraints: { - video: { displaySurface: 'some nonsense' }, - }, - }), -) diff --git a/packages/@uppy/status-bar/package.json b/packages/@uppy/status-bar/package.json index 659f589840..5eb8098fe7 100644 --- a/packages/@uppy/status-bar/package.json +++ b/packages/@uppy/status-bar/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/status-bar/types/index.d.ts b/packages/@uppy/status-bar/types/index.d.ts deleted file mode 100644 index 558344dfee..0000000000 --- a/packages/@uppy/status-bar/types/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import GeneratedLocale from './generatedLocale' - -export type StatusBarLocale = GeneratedLocale - -export interface StatusBarOptions extends UIPluginOptions { - target?: PluginTarget - showProgressDetails?: boolean - hideUploadButton?: boolean - hideAfterFinish?: boolean - hideRetryButton?: boolean - hidePauseResumeButton?: boolean - hideCancelButton?: boolean - doneButtonHandler?: () => void - locale?: StatusBarLocale -} - -declare class StatusBar extends UIPlugin {} - -export default StatusBar diff --git a/packages/@uppy/status-bar/types/index.test-d.ts b/packages/@uppy/status-bar/types/index.test-d.ts deleted file mode 100644 index f22087e975..0000000000 --- a/packages/@uppy/status-bar/types/index.test-d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import Uppy from '@uppy/core' -import StatusBar from '..' - -{ - const uppy = new Uppy() - uppy.use(StatusBar, { - target: 'body', - showProgressDetails: true, - hideUploadButton: false, - hideAfterFinish: false, - hideRetryButton: false, - hidePauseResumeButton: false, - hideCancelButton: false, - doneButtonHandler: () => { - // something - }, - locale: { - strings: { - uploading: '', - upload: '', - complete: '', - uploadFailed: '', - paused: '', - retry: '', - retryUpload: '', - cancel: '', - pause: '', - resume: '', - done: '', - filesUploadedOfTotal: '', - dataUploadedOfTotal: '', - xTimeLeft: '', - uploadXFiles: '', - uploadXNewFiles: '', - xMoreFilesAdded: '', - }, - }, - }) -} diff --git a/packages/@uppy/store-default/package.json b/packages/@uppy/store-default/package.json index 26117d830c..a40861b046 100644 --- a/packages/@uppy/store-default/package.json +++ b/packages/@uppy/store-default/package.json @@ -4,7 +4,6 @@ "version": "3.0.5", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/store-default/types/index.d.ts b/packages/@uppy/store-default/types/index.d.ts deleted file mode 100644 index 4a7ce1ee49..0000000000 --- a/packages/@uppy/store-default/types/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Store } from '@uppy/utils' - -type State = Record -type StateChangeListener = ( - prevState: State, - nextState: State, - patch: State, -) => void - -export default class DefaultStore implements Store { - constructor() - - getState(): State - - setState(patch: State): void - - subscribe(listener: StateChangeListener): () => void -} diff --git a/packages/@uppy/store-default/types/index.test-d.ts b/packages/@uppy/store-default/types/index.test-d.ts deleted file mode 100644 index d467046d89..0000000000 --- a/packages/@uppy/store-default/types/index.test-d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import DefaultStore from '..' - -const store = new DefaultStore() - -store.setState({ a: 'b' }) -store.getState() diff --git a/packages/@uppy/store-redux/package.json b/packages/@uppy/store-redux/package.json index afffb077a7..d048251160 100644 --- a/packages/@uppy/store-redux/package.json +++ b/packages/@uppy/store-redux/package.json @@ -4,7 +4,6 @@ "version": "3.0.5", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/store-redux/types/index.d.ts b/packages/@uppy/store-redux/types/index.d.ts deleted file mode 100644 index 78488001ca..0000000000 --- a/packages/@uppy/store-redux/types/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import type { Store } from '@uppy/utils' -import type { Reducer, Middleware, Store as Redux } from 'redux' - -type State = Record -type StateChangeListener = ( - prevState: State, - nextState: State, - patch: State, -) => void - -interface ReduxStoreOptions { - store: Redux - id?: string - selector?: (state: any) => State -} - -export class ReduxStore implements Store { - constructor(opts: ReduxStoreOptions) - - getState(): State - - setState(patch: State): void - - subscribe(listener: StateChangeListener): () => void -} - -export const reducer: Reducer -export const middleware: Middleware -export const STATE_UPDATE: string - -export default ReduxStore diff --git a/packages/@uppy/store-redux/types/index.test-d.ts b/packages/@uppy/store-redux/types/index.test-d.ts deleted file mode 100644 index 352c236753..0000000000 --- a/packages/@uppy/store-redux/types/index.test-d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// eslint-disable-next-line import/no-extraneous-dependencies -import { createStore, combineReducers } from 'redux' -// eslint-disable-next-line import/no-named-as-default -import ReduxStore, { reducer as uppy } from '..' - -const reducer = combineReducers({ uppy }) - -const store = new ReduxStore({ - store: createStore(reducer), -}) - -store.setState({ a: 1 }) -store.getState() diff --git a/packages/@uppy/thumbnail-generator/package.json b/packages/@uppy/thumbnail-generator/package.json index 7e857640c4..00aa12bdcf 100644 --- a/packages/@uppy/thumbnail-generator/package.json +++ b/packages/@uppy/thumbnail-generator/package.json @@ -4,7 +4,6 @@ "version": "3.0.6", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/thumbnail-generator/types/index.d.ts b/packages/@uppy/thumbnail-generator/types/index.d.ts deleted file mode 100644 index 6e82cdb1f1..0000000000 --- a/packages/@uppy/thumbnail-generator/types/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import type { - IndexedObject, - UIPlugin, - UIPluginOptions, - UppyFile, -} from '@uppy/core' - -import ThumbnailGeneratorLocale from './generatedLocale' - -export interface ThumbnailOptions extends UIPluginOptions { - thumbnailWidth?: number - thumbnailHeight?: number - thumbnailType?: string - waitForThumbnailsBeforeUpload?: boolean - lazy?: boolean -} - -interface Options extends ThumbnailOptions { - locale?: ThumbnailGeneratorLocale -} - -declare class ThumbnailGenerator extends UIPlugin {} - -export default ThumbnailGenerator - -// Events - -export type ThumbnailGeneratedCallback> = ( - file: UppyFile, - preview: string, -) => void - -declare module '@uppy/core' { - export interface UppyEventMap { - 'thumbnail:generated': ThumbnailGeneratedCallback - } -} diff --git a/packages/@uppy/thumbnail-generator/types/index.test-d.ts b/packages/@uppy/thumbnail-generator/types/index.test-d.ts deleted file mode 100644 index 9082860ec8..0000000000 --- a/packages/@uppy/thumbnail-generator/types/index.test-d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Uppy from '@uppy/core' -import ThumbnailGenerator from '..' - -{ - const uppy = new Uppy() - uppy.use(ThumbnailGenerator, { - thumbnailWidth: 100, - thumbnailHeight: 100, - thumbnailType: 'type', - waitForThumbnailsBeforeUpload: true, - lazy: true, - locale: { - strings: { - generatingThumbnails: '', - }, - }, - }) - - uppy.on('thumbnail:generated', (file, preview) => { - const img = document.createElement('img') - img.src = preview - img.width = 100 - document.body.appendChild(img) - }) -} diff --git a/packages/@uppy/transloadit/package.json b/packages/@uppy/transloadit/package.json index 79f3dbf2ee..90d1cbcbb0 100644 --- a/packages/@uppy/transloadit/package.json +++ b/packages/@uppy/transloadit/package.json @@ -4,7 +4,6 @@ "version": "3.4.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/transloadit/types/index.d.ts b/packages/@uppy/transloadit/types/index.d.ts deleted file mode 100644 index 7f4841e79a..0000000000 --- a/packages/@uppy/transloadit/types/index.d.ts +++ /dev/null @@ -1,194 +0,0 @@ -import type { PluginOptions, UppyFile, BasePlugin } from '@uppy/core' -import TransloaditLocale from './generatedLocale' - -export interface FileInfo { - id: string - name: string - basename: string - ext: string - size: number - mime: string - type: string - field: string - md5hash: string - is_tus_file: boolean - original_md5hash: string - original_id: string - original_name: string - original_basename: string - original_path: string - url: string - ssl_url: string - tus_upload_url: string - meta: Record -} - -export interface Result extends FileInfo { - cost: number - execTime: number - queue: string - queueTime: number - localId: string | null -} - -export interface Assembly { - ok?: string - message?: string - assembly_id: string - parent_id?: string - account_id: string - template_id?: string - instance: string - assembly_url: string - assembly_ssl_url: string - uppyserver_url: string - companion_url: string - websocket_url: string - tus_url: string - bytes_received: number - bytes_expected: number - upload_duration: number - client_agent?: string - client_ip?: string - client_referer?: string - transloadit_client: string - start_date: string - upload_meta_data_extracted: boolean - warnings: any[] - is_infinite: boolean - has_dupe_jobs: boolean - execution_start: string - execution_duration: number - queue_duration: number - jobs_queue_duration: number - notify_start?: any - notify_url?: string - notify_status?: any - notify_response_code?: any - notify_duration?: any - last_job_completed?: string - fields: Record - running_jobs: any[] - bytes_usage: number - executing_jobs: any[] - started_jobs: string[] - parent_assembly_status: any - params: string - template?: any - merged_params: string - uploads: FileInfo[] - results: Record - build_id: string - error?: string - stderr?: string - stdout?: string - reason?: string -} - -interface AssemblyParameters { - auth: { - key: string - expires?: string - } - template_id?: string - steps?: { [step: string]: Record } - fields?: { [name: string]: number | string } - notify_url?: string -} - -interface AssemblyOptions { - params?: AssemblyParameters - fields?: { [name: string]: number | string } | string[] - signature?: string -} - -interface Options extends PluginOptions { - service?: string - errorReporting?: boolean - waitForEncoding?: boolean - waitForMetadata?: boolean - importFromUploadURLs?: boolean - alwaysRunAssembly?: boolean - locale?: TransloaditLocale - limit?: number -} - -export type TransloaditOptions = Options & - ( - | { - assemblyOptions?: - | AssemblyOptions - | ((file?: UppyFile) => Promise | AssemblyOptions) - /** @deprecated use `assemblyOptions` instead */ - getAssemblyOptions?: never - /** @deprecated use `assemblyOptions` instead */ - params?: never - /** @deprecated use `assemblyOptions` instead */ - fields?: never - /** @deprecated use `assemblyOptions` instead */ - signature?: never - } - | { - /** @deprecated use `assemblyOptions` instead */ - getAssemblyOptions?: ( - file?: UppyFile, - ) => AssemblyOptions | Promise - assemblyOptions?: never - /** @deprecated use `assemblyOptions` instead */ - params?: never - /** @deprecated use `assemblyOptions` instead */ - fields?: never - /** @deprecated use `assemblyOptions` instead */ - signature?: never - } - | { - /** @deprecated use `assemblyOptions` instead */ - params?: AssemblyParameters - /** @deprecated use `assemblyOptions` instead */ - fields?: { [name: string]: number | string } | string[] - /** @deprecated use `assemblyOptions` instead */ - signature?: string - /** @deprecated use `assemblyOptions` instead */ - getAssemblyOptions?: never - assemblyOptions?: never - } - ) - -export default class Transloadit extends BasePlugin { - /** @deprecated use `import { COMPANION_URL } from '@uppy/transloadit'` instead. */ - static COMPANION: string - - /** @deprecated use `import { COMPANION_ALLOWED_HOSTS } from '@uppy/transloadit'` instead. */ - static COMPANION_PATTERN: RegExp -} - -export const COMPANION_URL: string -export const COMPANION_ALLOWED_HOSTS: RegExp - -// Events - -export type TransloaditAssemblyCreatedCallback = ( - assembly: Assembly, - fileIDs: string[], -) => void -export type TransloaditUploadedCallback = ( - file: FileInfo, - assembly: Assembly, -) => void -export type TransloaditAssemblyExecutingCallback = (assembly: Assembly) => void -export type TransloaditResultCallback = ( - stepName: string, - result: Result, - assembly: Assembly, -) => void -export type TransloaditCompleteCallback = (assembly: Assembly) => void - -declare module '@uppy/core' { - export interface UppyEventMap { - 'transloadit:assembly-created': TransloaditAssemblyCreatedCallback - 'transloadit:upload': TransloaditUploadedCallback - 'transloadit:assembly-executing': TransloaditAssemblyExecutingCallback - 'transloadit:result': TransloaditResultCallback - 'transloadit:complete': TransloaditCompleteCallback - } -} diff --git a/packages/@uppy/transloadit/types/index.test-d.ts b/packages/@uppy/transloadit/types/index.test-d.ts deleted file mode 100644 index 5cd5d5b5d0..0000000000 --- a/packages/@uppy/transloadit/types/index.test-d.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { expectError, expectType } from 'tsd' -import Uppy from '@uppy/core' -import type { UppyFile } from '@uppy/core' -import Transloadit, { COMPANION_ALLOWED_HOSTS, COMPANION_URL } from '..' - -expectType(Transloadit.COMPANION) -expectType(COMPANION_URL) -expectType(Transloadit.COMPANION_PATTERN) -expectType(COMPANION_ALLOWED_HOSTS) - -const validParams = { - auth: { key: 'not so secret key' }, -} - -{ - const uppy = new Uppy() - uppy.use(Transloadit, { - getAssemblyOptions(file) { - expectType(file) - return { params: validParams } - }, - waitForEncoding: false, - waitForMetadata: true, - importFromUploadURLs: false, - }) - // Access to both transloadit events and core events - uppy.on('transloadit:assembly-created', (assembly) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const status = assembly.ok - }) - - uppy.on('complete', (result) => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const success = result.successful - }) -} - -{ - const uppy = new Uppy() - uppy.use(Transloadit, { - async assemblyOptions(file) { - expectType(file) - return { params: validParams } - }, - }) -} - -{ - const uppy = new Uppy() - uppy.use(Transloadit, { - assemblyOptions: { params: validParams }, - }) -} - -{ - const uppy = new Uppy() - expectError( - uppy.use(Transloadit, { - getAssemblyOptions() { - return { params: validParams } - }, - assemblyOptions: { params: validParams }, - }), - ) -} - -{ - const uppy = new Uppy() - expectError( - uppy.use(Transloadit, { - params: validParams, - assemblyOptions: { params: validParams }, - }), - ) -} - -{ - const uppy = new Uppy() - // must be bools - expectError( - uppy.use(Transloadit, { waitForEncoding: null, params: validParams }), - ) - expectError( - uppy.use(Transloadit, { waitForMetadata: null, params: validParams }), - ) -} - -{ - const uppy = new Uppy() - // params.auth.key must be string - expectError(uppy.use(Transloadit, { params: {} })) - expectError(uppy.use(Transloadit, { params: { auth: {} } })) - expectError( - uppy.use(Transloadit, { - params: { - auth: { key: null }, - }, - }), - ) - expectError( - uppy.use(Transloadit, { - params: { - auth: { key: 'abc' }, - steps: 'test', - }, - }), - ) - uppy.use(Transloadit, { - params: { - auth: { key: 'abc' }, - steps: { name: {} }, - }, - }) -} diff --git a/packages/@uppy/tus/package.json b/packages/@uppy/tus/package.json index 92fa228aff..bacc1b44c0 100644 --- a/packages/@uppy/tus/package.json +++ b/packages/@uppy/tus/package.json @@ -4,7 +4,6 @@ "version": "3.4.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/tus/types/index.d.ts b/packages/@uppy/tus/types/index.d.ts deleted file mode 100644 index ab929bb433..0000000000 --- a/packages/@uppy/tus/types/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core' -import type { UploadOptions, HttpRequest } from 'tus-js-client' - -type TusUploadOptions = Pick< - UploadOptions, - Exclude< - keyof UploadOptions, - | 'fingerprint' - | 'metadata' - | 'onBeforeRequest' - | 'onProgress' - | 'onChunkComplete' - | 'onShouldRetry' - | 'onSuccess' - | 'onError' - | 'uploadUrl' - | 'uploadSize' - > -> - -type Next = ( - err: Error | undefined, - retryAttempt?: number, - options?: TusOptions, -) => boolean - -export interface TusOptions extends PluginOptions, TusUploadOptions { - allowedMetaFields?: string[] | null - limit?: number - withCredentials?: boolean - onShouldRetry?: ( - err: Error | undefined, - retryAttempt: number, - options: TusOptions, - next: Next, - ) => boolean - onBeforeRequest?: (req: HttpRequest, file: UppyFile) => Promise -} - -declare class Tus extends BasePlugin {} - -export default Tus diff --git a/packages/@uppy/tus/types/index.test-d.ts b/packages/@uppy/tus/types/index.test-d.ts deleted file mode 100644 index ba4d89efb5..0000000000 --- a/packages/@uppy/tus/types/index.test-d.ts +++ /dev/null @@ -1 +0,0 @@ -// import Tus from '../' diff --git a/packages/@uppy/unsplash/package.json b/packages/@uppy/unsplash/package.json index 4b23b687f8..2435990ab2 100644 --- a/packages/@uppy/unsplash/package.json +++ b/packages/@uppy/unsplash/package.json @@ -4,7 +4,6 @@ "version": "3.2.3", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/unsplash/types/index.d.ts b/packages/@uppy/unsplash/types/index.d.ts deleted file mode 100644 index 978ca1c5fd..0000000000 --- a/packages/@uppy/unsplash/types/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { RequestClientOptions } from '@uppy/companion-client' -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' - -interface UnsplashOptions extends UIPluginOptions, RequestClientOptions { - target?: PluginTarget - title?: string -} - -declare class Unsplash extends UIPlugin {} - -export default Unsplash diff --git a/packages/@uppy/unsplash/types/index.test-d.ts b/packages/@uppy/unsplash/types/index.test-d.ts deleted file mode 100644 index 8223d50fc2..0000000000 --- a/packages/@uppy/unsplash/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Unsplash from '..' - -{ - const uppy = new Uppy() - uppy.use(Unsplash, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/@uppy/url/package.json b/packages/@uppy/url/package.json index c5ebf33111..17b8f4ca23 100644 --- a/packages/@uppy/url/package.json +++ b/packages/@uppy/url/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/url/types/index.d.ts b/packages/@uppy/url/types/index.d.ts deleted file mode 100644 index fa9734c88c..0000000000 --- a/packages/@uppy/url/types/index.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import type { RequestClientOptions } from '@uppy/companion-client' -import type { - IndexedObject, - PluginTarget, - UIPlugin, - UIPluginOptions, -} from '@uppy/core' -import UrlLocale from './generatedLocale' - -export interface UrlOptions extends UIPluginOptions, RequestClientOptions { - target?: PluginTarget - title?: string - locale?: UrlLocale -} - -declare class Url extends UIPlugin { - public addFile( - url: string, - meta?: IndexedObject, - ): undefined | string | never -} - -export default Url diff --git a/packages/@uppy/url/types/index.test-d.ts b/packages/@uppy/url/types/index.test-d.ts deleted file mode 100644 index b21c2584bb..0000000000 --- a/packages/@uppy/url/types/index.test-d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Uppy from '@uppy/core' -import Url from '..' - -{ - const uppy = new Uppy() - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - uppy - .use(Url, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - locale: { - strings: { - import: '', - enterUrlToImport: '', - failedToFetch: '', - enterCorrectUrl: '', - }, - }, - }) - .getPlugin('Url')! - .addFile('https://via.placeholder.com/150') -} diff --git a/packages/@uppy/utils/package.json b/packages/@uppy/utils/package.json index 496fad47a8..bf40c6ffb9 100644 --- a/packages/@uppy/utils/package.json +++ b/packages/@uppy/utils/package.json @@ -3,7 +3,6 @@ "description": "Shared utility functions for Uppy Core and plugins maintained by the Uppy team.", "version": "5.6.0", "license": "MIT", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/utils/types/index.d.ts b/packages/@uppy/utils/types/index.d.ts deleted file mode 100644 index b216156497..0000000000 --- a/packages/@uppy/utils/types/index.d.ts +++ /dev/null @@ -1,392 +0,0 @@ -declare module '@uppy/utils/lib/Translator' { - namespace Translator { - export interface Locale { - strings?: { - [key: string]: string | { [plural: number]: string } - } - pluralize?: (n: number) => number - } - } - - class Translator { - constructor(opts: Translator.Locale | Translator.Locale[]) - - translate(key: string, options: Record): string - - translateArray(key: string, options: Record): any[] - } - - export default Translator -} - -declare module '@uppy/utils/lib/EventManager' { - namespace EventManager { - export type EventHandler = (...args: any[]) => void - export interface Emitter { - on: (event: string, handler: EventHandler) => void - off: (event: string, handler: EventHandler) => void - } - } - - class EventManager { - constructor(emitter: EventManager.Emitter) - - on(event: string, handler: EventManager.EventHandler): void - - remove(): void - } - - export default EventManager -} - -declare module '@uppy/utils/lib/ProgressTimeout' { - class ProgressTimeout { - constructor(timeout: number, timeoutHandler: () => void) - - progress(): void - - done(): void - } - export default ProgressTimeout -} - -declare module '@uppy/utils/lib/RateLimitedQueue' { - namespace RateLimitedQueue { - export type AbortFunction = () => void - export interface AbortablePromise extends Promise { - abort(): void - abortOn(signal: AbortSignal): this - } - export type QueueEntry = { - abort: () => void - done: () => void - } - export type QueueOptions = { - priority?: number - } - } - - export class RateLimitedQueue { - constructor(limit: number) - - readonly isPaused: boolean - - run( - fn: () => RateLimitedQueue.AbortFunction, - queueOptions?: RateLimitedQueue.QueueOptions, - ): RateLimitedQueue.QueueEntry - - rateLimit(duration: number): void - - pause(duration?: number): void - - resume(): void - - wrapPromiseFunction( - fn: () => (...args: any[]) => Promise, - queueOptions?: RateLimitedQueue.QueueOptions, - ): (...args: any[]) => RateLimitedQueue.AbortablePromise - } - - export const internalRateLimitedQueue: symbol -} - -declare module '@uppy/utils/lib/canvasToBlob' { - function canvasToBlob( - canvas: HTMLCanvasElement, - type: string, - quality?: number, - ): Promise - export default canvasToBlob -} - -declare module '@uppy/utils/lib/dataURItoBlob' { - function dataURItoBlob( - dataURI: string, - opts: { mimeType?: string; name?: string }, - ): Blob - export default dataURItoBlob -} - -declare module '@uppy/utils/lib/dataURItoFile' { - function dataURItoFile( - dataURI: string, - opts: { mimeType?: string; name?: string }, - ): File - export default dataURItoFile -} - -declare module '@uppy/utils/lib/emitSocketProgress' { - import type { UppyFile } from '@uppy/utils' - - interface ProgressData { - progress: number - bytesUploaded: number - bytesTotal: number - } - - function emitSocketProgress( - uploader: unknown, - progressData: ProgressData, - file: UppyFile, - ): void - export default emitSocketProgress -} - -declare module '@uppy/utils/lib/findAllDOMElements' { - function findAllDOMElements(element: string | HTMLElement): HTMLElement[] - export default findAllDOMElements -} - -declare module '@uppy/utils/lib/findDOMElement' { - function findDOMElement(element: string | HTMLElement): HTMLElement | null - export default findDOMElement -} - -declare module '@uppy/utils/lib/generateFileID' { - import type { UppyFile } from '@uppy/utils' - - function generateFileID(file: UppyFile): string - export default generateFileID -} - -declare module '@uppy/utils/lib/getBytesRemaining' { - function getBytesRemaining(progress: { - bytesTotal: number - bytesUploaded: number - }): number - export default getBytesRemaining -} - -declare module '@uppy/utils/lib/getETA' { - function getETA(progress: unknown): number - export default getETA -} - -declare module '@uppy/utils/lib/getFileNameAndExtension' { - function getFileNameAndExtension(filename: string): { - name: string - extension: string | undefined - } - export default getFileNameAndExtension -} - -declare module '@uppy/utils/lib/getFileType' { - import type { UppyFile } from '@uppy/utils' - - function getFileType(file: UppyFile): string - export default getFileType -} - -declare module '@uppy/utils/lib/getFileTypeExtension' { - function getFileTypeExtension(mime: string): string - export default getFileTypeExtension -} - -declare module '@uppy/utils/lib/getSocketHost' { - function getSocketHost(url: string): string - export default getSocketHost -} - -declare module '@uppy/utils/lib/getSpeed' { - function getSpeed(progress: { - bytesUploaded: number - uploadStarted: number - }): number - export default getSpeed -} - -declare module '@uppy/utils/lib/getTimeStamp' { - function getTimeStamp(): string - export default getTimeStamp -} - -declare module '@uppy/utils/lib/isDOMElement' { - function isDOMElement(element: any): boolean - export default isDOMElement -} - -declare module '@uppy/utils/lib/isObjectURL' { - function isObjectURL(url: string): boolean - export default isObjectURL -} - -declare module '@uppy/utils/lib/isDragDropSupported' { - function isDragDropSupported(): boolean - export default isDragDropSupported -} - -declare module '@uppy/utils/lib/isPreviewSupported' { - function isPreviewSupported(mime: string): boolean - export default isPreviewSupported -} - -declare module '@uppy/utils/lib/isTouchDevice' { - function isTouchDevice(): boolean - export default isTouchDevice -} - -declare module '@uppy/utils/lib/prettyETA' { - function prettyETA(seconds: number): string - export default prettyETA -} - -declare module '@uppy/utils/lib/secondsToTime' { - function secondsToTime(seconds: number): string - export default secondsToTime -} - -declare module '@uppy/utils/lib/settle' { - function settle( - promises: Promise[], - ): Promise<{ successful: T[]; failed: any[] }> - export default settle -} - -declare module '@uppy/utils/lib/toArray' { - function toArray(list: any): any[] - export default toArray -} - -declare module '@uppy/utils/lib/AbortController' { - import type { ErrorOptions } from '@uppy/utils/lib/ErrorWithCause' - - export const AbortController: typeof globalThis.AbortController - export const AbortSignal: typeof globalThis.AbortSignal - export function createAbortError( - message?: string, - options?: ErrorOptions, - ): DOMException -} - -declare module '@uppy/utils/lib/getDroppedFiles' { - function getDroppedFiles( - dataTransfer: DataTransfer, - options?: Record, - ): Promise - export default getDroppedFiles -} - -declare module '@uppy/utils/lib/getTextDirection' { - function getTextDirection(element: Node): string | undefined - export default getTextDirection -} - -declare module '@uppy/utils/lib/isNetworkError' { - export default function isNetworkError(xhr: any): boolean -} - -declare module '@uppy/utils/lib/NetworkError' { - class NetworkError extends Error { - readonly cause: any - - readonly isNetworkError: true - - readonly request?: XMLHttpRequest - - constructor(error: any, xhr?: XMLHttpRequest) - } - - export default NetworkError -} - -declare module '@uppy/utils/lib/FOCUSABLE_ELEMENTS' { - const exports: string[] - export default exports -} - -declare module '@uppy/utils/lib/truncateString' { - export default function truncateString( - string: string, - maxLength: number, - ): string -} - -declare module '@uppy/utils/lib/remoteFileObjToLocal' { - export default function remoteFileObjToLocal( - file: object, - ): Record -} - -declare module '@uppy/utils/lib/fetchWithNetworkError' { - export default function fetchWithNetworkError( - ...options: unknown[] - ): Promise -} - -declare module '@uppy/utils/lib/ErrorWithCause' { - interface ErrorOptions { - cause?: unknown - } - - export default class ErrorWithCause extends Error { - cause: any - - isNetworkError?: true - - constructor(message: string, options?: ErrorOptions) - } -} - -declare module '@uppy/utils/lib/delay' { - export default function delay( - ms: number, - opts?: { signal: AbortSignal }, - ): Promise -} - -declare module '@uppy/utils/lib/hasProperty' { - export default function has(object: any, key: string): boolean -} - -declare module '@uppy/utils/lib/mimeTypes' { - const exports: Record - export default exports -} - -declare module '@uppy/utils' { - interface IndexedObject { - [key: string]: T - [key: number]: T - } - export type InternalMetadata = { name: string; type?: string } - export interface FileProgress { - uploadStarted: number | null - uploadComplete: boolean - percentage: number - bytesUploaded: number - bytesTotal: number - } - export interface UppyFile< - TMeta = IndexedObject, - TBody = IndexedObject, - > { - data: Blob | File - extension: string - id: string - isPaused?: boolean - isRemote: boolean - meta: InternalMetadata & TMeta - name: string - preview?: string - progress?: FileProgress - remote?: { - host: string - url: string - body?: Record - } - size: number - source?: string - type?: string - response?: { - body: TBody - status: number - uploadURL: string | undefined - } - } - export interface Store { - getState(): Record - setState(patch: Record): void - subscribe(listener: any): () => void - } -} diff --git a/packages/@uppy/utils/types/index.test-d.ts b/packages/@uppy/utils/types/index.test-d.ts deleted file mode 100644 index ae1640dc05..0000000000 --- a/packages/@uppy/utils/types/index.test-d.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Can't get this to work correctly with `tsd` right now 🙃 -/* -import Translator = require('@uppy/utils/lib/Translator') - -const emptyLocale = { - strings: {}, - pluralize (n: number) { return n === 1 ? 0 : 1 } -} - -const overrideLocale = { - strings: { - key: 'value' - } -} - -{ - new Translator(emptyLocale) -} - -{ - new Translator([emptyLocale, overrideLocale]) -} -*/ diff --git a/packages/@uppy/vue/package.json b/packages/@uppy/vue/package.json index f8375c3ba3..f1471d002c 100644 --- a/packages/@uppy/vue/package.json +++ b/packages/@uppy/vue/package.json @@ -3,7 +3,6 @@ "version": "1.1.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "dependencies": { "shallow-equal": "^1.2.1" }, diff --git a/packages/@uppy/vue/types/dashboard-modal.d.ts b/packages/@uppy/vue/types/dashboard-modal.d.ts deleted file mode 100644 index 553219ee60..0000000000 --- a/packages/@uppy/vue/types/dashboard-modal.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' -import type DashboardPlugin from '@uppy/dashboard' - -interface Data { - plugin: DashboardPlugin -} -interface Props { - uppy: Uppy - props: Record - plugins: Array - open: boolean -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> -export default exports diff --git a/packages/@uppy/vue/types/dashboard.d.ts b/packages/@uppy/vue/types/dashboard.d.ts deleted file mode 100644 index e108769ce5..0000000000 --- a/packages/@uppy/vue/types/dashboard.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' -import type DashboardPlugin from '@uppy/dashboard' - -interface Data { - plugin: DashboardPlugin -} -interface Props { - uppy: Uppy - props: Record - plugins: Array -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> -export default exports diff --git a/packages/@uppy/vue/types/drag-drop.d.ts b/packages/@uppy/vue/types/drag-drop.d.ts deleted file mode 100644 index 929ba0989e..0000000000 --- a/packages/@uppy/vue/types/drag-drop.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' - -interface Data { - plugin: UIPlugin | BasePlugin -} -interface Props { - uppy: Uppy - props: Record -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> - -export default exports diff --git a/packages/@uppy/vue/types/file-input.d.ts b/packages/@uppy/vue/types/file-input.d.ts deleted file mode 100644 index 956f6b7a77..0000000000 --- a/packages/@uppy/vue/types/file-input.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' - -interface Data { - plugin: UIPlugin | BasePlugin -} -interface Props { - uppy: Uppy - props: Record -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> -export default exports diff --git a/packages/@uppy/vue/types/index.d.ts b/packages/@uppy/vue/types/index.d.ts deleted file mode 100644 index 0bbdbf9d51..0000000000 --- a/packages/@uppy/vue/types/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { default as Dashboard } from './dashboard' -export { default as DashboardModal } from './dashboard-modal' -export { default as DragDrop } from './drag-drop' -export { default as FileInput } from './file-input' -export { default as ProgressBar } from './progress-bar' -export { default as StatusBar } from './status-bar' diff --git a/packages/@uppy/vue/types/index.test-d.ts b/packages/@uppy/vue/types/index.test-d.ts deleted file mode 100644 index 8bb9f41869..0000000000 --- a/packages/@uppy/vue/types/index.test-d.ts +++ /dev/null @@ -1 +0,0 @@ -// import { Dashboard, DashboardModal, DragDrop, FileInput, StatusBar, ProgressBar } from '.' diff --git a/packages/@uppy/vue/types/progress-bar.d.ts b/packages/@uppy/vue/types/progress-bar.d.ts deleted file mode 100644 index 956f6b7a77..0000000000 --- a/packages/@uppy/vue/types/progress-bar.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' - -interface Data { - plugin: UIPlugin | BasePlugin -} -interface Props { - uppy: Uppy - props: Record -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> -export default exports diff --git a/packages/@uppy/vue/types/status-bar.d.ts b/packages/@uppy/vue/types/status-bar.d.ts deleted file mode 100644 index 956f6b7a77..0000000000 --- a/packages/@uppy/vue/types/status-bar.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Vue from 'vue' -import type { Uppy, UIPlugin, BasePlugin } from '@uppy/core' - -interface Data { - plugin: UIPlugin | BasePlugin -} -interface Props { - uppy: Uppy - props: Record -} -interface Methods { - installPlugin(): void - uninstallPlugin(uppy: Uppy): void -} -declare const exports: import('vue/types/vue').ExtendedVue< - Vue, - Data, - Methods, - unknown, - Props -> -export default exports diff --git a/packages/@uppy/webcam/package.json b/packages/@uppy/webcam/package.json index 0977d1c2cc..3beadbb17a 100644 --- a/packages/@uppy/webcam/package.json +++ b/packages/@uppy/webcam/package.json @@ -5,7 +5,6 @@ "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/webcam/types/index.d.ts b/packages/@uppy/webcam/types/index.d.ts deleted file mode 100644 index 1fc6c987c0..0000000000 --- a/packages/@uppy/webcam/types/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import WebcamLocale from './generatedLocale' - -export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture' - -export interface WebcamOptions extends UIPluginOptions { - target?: PluginTarget - onBeforeSnapshot?: () => Promise - countdown?: number | boolean - mirror?: boolean - /** - * @deprecated Use `videoConstraints.facingMode` instead. - */ - facingMode?: string - showVideoSourceDropdown?: boolean - modes?: WebcamMode[] - locale?: WebcamLocale - title?: string - videoConstraints?: MediaTrackConstraints - showRecordingLength?: boolean - preferredImageMimeType?: string - preferredVideoMimeType?: string - mobileNativeCamera?: boolean -} - -declare class Webcam extends UIPlugin {} - -export default Webcam diff --git a/packages/@uppy/webcam/types/index.test-d.ts b/packages/@uppy/webcam/types/index.test-d.ts deleted file mode 100644 index c9c89daa4b..0000000000 --- a/packages/@uppy/webcam/types/index.test-d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { expectError } from 'tsd' -import Uppy from '@uppy/core' -import Webcam from '..' - -new Uppy().use(Webcam, { - modes: ['video-only'], -}) - -new Uppy().use(Webcam, { - modes: ['video-only'], - videoConstraints: { - width: { min: 420, ideal: 420, max: 1920 }, - height: { min: 420, ideal: 420, max: 1080 }, - }, -}) - -expectError( - new Uppy().use(Webcam, { - modes: ['video-only'], - videoConstraints: { - width: 'not a number har har', - }, - }), -) diff --git a/packages/@uppy/xhr-upload/package.json b/packages/@uppy/xhr-upload/package.json index ee75f65595..f2d0edadab 100644 --- a/packages/@uppy/xhr-upload/package.json +++ b/packages/@uppy/xhr-upload/package.json @@ -4,7 +4,6 @@ "version": "3.5.0", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/xhr-upload/types/index.d.ts b/packages/@uppy/xhr-upload/types/index.d.ts deleted file mode 100644 index 27ecbfd9ce..0000000000 --- a/packages/@uppy/xhr-upload/types/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import type { PluginOptions, BasePlugin, UppyFile } from '@uppy/core' -import XHRUploadLocale from './generatedLocale' - -export type Headers = { - [name: string]: string | number -} - -export interface XHRUploadOptions extends PluginOptions { - limit?: number - bundle?: boolean - formData?: boolean - headers?: Headers | ((file: UppyFile) => Headers) - allowedMetaFields?: string[] | null - fieldName?: string - timeout?: number - responseUrlFieldName?: string - endpoint: string - method?: 'GET' | 'POST' | 'PUT' | 'HEAD' | 'get' | 'post' | 'put' | 'head' - locale?: XHRUploadLocale - responseType?: string - withCredentials?: boolean - validateStatus?: ( - statusCode: number, - responseText: string, - response: unknown, - ) => boolean - getResponseData?: (responseText: string, response: unknown) => any - getResponseError?: (responseText: string, xhr: unknown) => Error -} - -declare class XHRUpload extends BasePlugin {} - -export default XHRUpload diff --git a/packages/@uppy/xhr-upload/types/index.test-d.ts b/packages/@uppy/xhr-upload/types/index.test-d.ts deleted file mode 100644 index 134d165354..0000000000 --- a/packages/@uppy/xhr-upload/types/index.test-d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Uppy from '@uppy/core' -import XHRUpload from '..' - -new Uppy().use(XHRUpload, { - bundle: false, - formData: true, - endpoint: 'xyz', -}) - -new Uppy().use(XHRUpload, { - endpoint: '/upload', - method: 'post', -}) - -new Uppy().use(XHRUpload, { - endpoint: '/upload', - method: 'PUT', -}) diff --git a/packages/@uppy/zoom/package.json b/packages/@uppy/zoom/package.json index 5bdcae4d54..21983ec707 100644 --- a/packages/@uppy/zoom/package.json +++ b/packages/@uppy/zoom/package.json @@ -4,7 +4,6 @@ "version": "2.1.3", "license": "MIT", "main": "lib/index.js", - "types": "types/index.d.ts", "type": "module", "keywords": [ "file uploader", diff --git a/packages/@uppy/zoom/types/index.d.ts b/packages/@uppy/zoom/types/index.d.ts deleted file mode 100644 index 6f649d33ae..0000000000 --- a/packages/@uppy/zoom/types/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import type { PluginTarget, UIPlugin, UIPluginOptions } from '@uppy/core' -import type { - TokenStorage, - PublicProviderOptions, -} from '@uppy/companion-client' - -interface ZoomOptions extends UIPluginOptions, PublicProviderOptions { - target?: PluginTarget - title?: string - storage?: TokenStorage -} - -declare class Zoom extends UIPlugin {} - -export default Zoom diff --git a/packages/@uppy/zoom/types/index.test-d.ts b/packages/@uppy/zoom/types/index.test-d.ts deleted file mode 100644 index 79a9690ebe..0000000000 --- a/packages/@uppy/zoom/types/index.test-d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Uppy from '@uppy/core' -import Zoom from '..' - -{ - const uppy = new Uppy() - uppy.use(Zoom, { - companionUrl: '', - companionCookiesRule: 'same-origin', - target: 'body', - title: 'title', - }) -} diff --git a/packages/uppy/package.json b/packages/uppy/package.json index 415502ed86..0cb3d49f95 100644 --- a/packages/uppy/package.json +++ b/packages/uppy/package.json @@ -7,7 +7,6 @@ "module": "index.mjs", "unpkg": "dist/uppy.min.js", "style": "dist/uppy.min.css", - "types": "types/index.d.ts", "keywords": [ "file uploader", "drag-drop", diff --git a/packages/uppy/types/index.d.ts b/packages/uppy/types/index.d.ts deleted file mode 100644 index 76500aab0a..0000000000 --- a/packages/uppy/types/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for uppy -// Project: https://uppy.io -// Definitions by: taoqf - -// Core -export { default as Uppy } from '@uppy/core' - -// Stores -export { default as DefaultStore } from '@uppy/store-default' -export { default as ReduxStore } from '@uppy/store-redux' - -// UI plugins -export { default as Dashboard } from '@uppy/dashboard' -export { default as DragDrop } from '@uppy/drag-drop' -export { default as DropTarget } from '@uppy/drop-target' -export { default as FileInput } from '@uppy/file-input' -export { default as Informer } from '@uppy/informer' -export { default as ProgressBar } from '@uppy/progress-bar' -export { default as StatusBar } from '@uppy/status-bar' - -// Acquirers -export { default as Dropbox } from '@uppy/dropbox' -export { default as Box } from '@uppy/box' -export { default as GoogleDrive } from '@uppy/google-drive' -export { default as Instagram } from '@uppy/instagram' -export { default as Url } from '@uppy/url' -export { default as Webcam } from '@uppy/webcam' -export { default as ScreenCapture } from '@uppy/screen-capture' - -// Uploaders -export { default as AwsS3 } from '@uppy/aws-s3' -export { default as AwsS3Multipart } from '@uppy/aws-s3-multipart' -export { default as Transloadit } from '@uppy/transloadit' -export { default as Tus } from '@uppy/tus' -export { default as XHRUpload } from '@uppy/xhr-upload' - -// Miscellaneous -export { default as Form } from '@uppy/form' -export { default as GoldenRetriever } from '@uppy/golden-retriever' -export { default as ReduxDevTools } from '@uppy/redux-dev-tools' -export { default as ThumbnailGenerator } from '@uppy/thumbnail-generator' diff --git a/packages/uppy/types/index.test-d.ts b/packages/uppy/types/index.test-d.ts deleted file mode 100644 index e960a60285..0000000000 --- a/packages/uppy/types/index.test-d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import * as Uppy from '..' -// eslint-disable-next-line import/newline-after-import -;(() => { - const uppy = new Uppy.Uppy({ autoProceed: false }) - uppy.use(Uppy.Dashboard, { trigger: '#up_load_file_01' }) - uppy.use(Uppy.DragDrop, { target: '#ttt' }) - uppy.use(Uppy.XHRUpload, { - bundle: true, - endpoint: 'xxx', - fieldName: 'up_load_file', - }) - uppy.on('upload-success', (fileCount, { body, uploadURL }) => { - console.log(fileCount, body, uploadURL, ` files uploaded`) - }) -})() -;(() => { - const uppy = new Uppy.Uppy({ autoProceed: false }) - .use(Uppy.Dashboard, { trigger: '#select-files' }) - .use(Uppy.GoogleDrive, { - target: Uppy.Dashboard, - companionUrl: 'https://companion.uppy.io', - }) - .use(Uppy.Instagram, { - target: Uppy.Dashboard, - companionUrl: 'https://companion.uppy.io', - }) - .use(Uppy.Webcam, { target: Uppy.Dashboard }) - .use(Uppy.ScreenCapture) - .use(Uppy.Tus, { endpoint: 'https://tusd.tusdemo.net/files/' }) - - uppy.on('complete', (result) => { - console.log('Upload result:', result) - }) -})() -;(() => { - const uppy = new Uppy.Uppy() - uppy.use(Uppy.DragDrop, { target: '.UppyDragDrop' }) - uppy.use(Uppy.Tus, { endpoint: '//tusd.tusdemo.net/files/' }) -})() diff --git a/yarn.lock b/yarn.lock index f494016e3c..9c4cf782bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5488,15 +5488,6 @@ __metadata: languageName: node linkType: hard -"@jest/schemas@npm:^29.6.3": - version: 29.6.3 - resolution: "@jest/schemas@npm:29.6.3" - dependencies: - "@sinclair/typebox": ^0.27.8 - checksum: 910040425f0fc93cd13e68c750b7885590b8839066dfa0cd78e7def07bbb708ad869381f725945d66f2284de5663bbecf63e8fdd856e2ae6e261ba30b1687e93 - languageName: node - linkType: hard - "@jest/source-map@npm:^29.4.3": version: 29.4.3 resolution: "@jest/source-map@npm:29.4.3" @@ -7538,13 +7529,6 @@ __metadata: languageName: node linkType: hard -"@sinclair/typebox@npm:^0.27.8": - version: 0.27.8 - resolution: "@sinclair/typebox@npm:0.27.8" - checksum: 00bd7362a3439021aa1ea51b0e0d0a0e8ca1351a3d54c606b115fdcc49b51b16db6e5f43b4fe7a28c38688523e22a94d49dd31168868b655f0d4d50f032d07a1 - languageName: node - linkType: hard - "@sindresorhus/is@npm:^4.0.0": version: 4.6.0 resolution: "@sindresorhus/is@npm:4.6.0" @@ -7778,13 +7762,6 @@ __metadata: languageName: node linkType: hard -"@tsd/typescript@npm:~5.0.2": - version: 5.0.4 - resolution: "@tsd/typescript@npm:5.0.4" - checksum: 5e4fd1ed623f35681fb7b0ede97ec0102701412f18b8f045f30dce3e3f35731aca4975afa4551818461e69b4350f78052ddace5617b1d4cb339a5c66fbad624e - languageName: node - linkType: hard - "@tufjs/canonical-json@npm:1.0.0": version: 1.0.0 resolution: "@tufjs/canonical-json@npm:1.0.0" @@ -8220,7 +8197,7 @@ __metadata: languageName: node linkType: hard -"@types/minimist@npm:^1.2.0, @types/minimist@npm:^1.2.2": +"@types/minimist@npm:^1.2.2": version: 1.2.2 resolution: "@types/minimist@npm:1.2.2" checksum: b8da83c66eb4aac0440e64674b19564d9d86c80ae273144db9681e5eeff66f238ade9515f5006ffbfa955ceff8b89ad2bd8ec577d7caee74ba101431fb07045d @@ -8755,7 +8732,6 @@ __metadata: stylelint-config-standard: ^34.0.0 stylelint-config-standard-scss: ^10.0.0 tar: ^6.1.0 - tsd: ^0.28.0 typescript: ~5.1 vitest: ^0.34.5 vue-template-compiler: "workspace:*" @@ -12267,17 +12243,6 @@ __metadata: languageName: node linkType: hard -"camelcase-keys@npm:^6.2.2": - version: 6.2.2 - resolution: "camelcase-keys@npm:6.2.2" - dependencies: - camelcase: ^5.3.1 - map-obj: ^4.0.0 - quick-lru: ^4.0.1 - checksum: 43c9af1adf840471e54c68ab3e5fe8a62719a6b7dbf4e2e86886b7b0ff96112c945736342b837bd2529ec9d1c7d1934e5653318478d98e0cf22c475c04658e2a - languageName: node - linkType: hard - "camelcase-keys@npm:^7.0.0": version: 7.0.2 resolution: "camelcase-keys@npm:7.0.2" @@ -14163,13 +14128,6 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^29.6.3": - version: 29.6.3 - resolution: "diff-sequences@npm:29.6.3" - checksum: f4914158e1f2276343d98ff5b31fc004e7304f5470bf0f1adb2ac6955d85a531a6458d33e87667f98f6ae52ebd3891bb47d420bb48a5bd8b7a27ee25b20e33aa - languageName: node - linkType: hard - "diff@npm:^5.0.0": version: 5.1.0 resolution: "diff@npm:5.1.0" @@ -15371,22 +15329,6 @@ __metadata: languageName: node linkType: hard -"eslint-formatter-pretty@npm:^4.1.0": - version: 4.1.0 - resolution: "eslint-formatter-pretty@npm:4.1.0" - dependencies: - "@types/eslint": ^7.2.13 - ansi-escapes: ^4.2.1 - chalk: ^4.1.0 - eslint-rule-docs: ^1.1.5 - log-symbols: ^4.0.0 - plur: ^4.0.0 - string-width: ^4.2.0 - supports-hyperlinks: ^2.0.0 - checksum: e8e0cd3843513fff32a70b036dd349fdab81d73b5e522f23685181c907a1faf2b2ebcae1688dc71d0fc026184011792f7e39b833d349df18fe2baea00d017901 - languageName: node - linkType: hard - "eslint-import-resolver-node@npm:^0.3.7": version: 0.3.7 resolution: "eslint-import-resolver-node@npm:0.3.7" @@ -15652,13 +15594,6 @@ __metadata: languageName: node linkType: hard -"eslint-rule-docs@npm:^1.1.5": - version: 1.1.235 - resolution: "eslint-rule-docs@npm:1.1.235" - checksum: b163596f9a05568e287b2c78f51a280092122a2e43c45fa2c200f0bd3f61877af186c641dab97620978bec96d9e2cfb621e51728044d9efe42ddc24f5a594b26 - languageName: node - linkType: hard - "eslint-scope@npm:5.1.1, eslint-scope@npm:^5.1.1": version: 5.1.1 resolution: "eslint-scope@npm:5.1.1" @@ -17557,7 +17492,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.0.1, globby@npm:^11.1.0": +"globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -18579,13 +18514,6 @@ __metadata: languageName: node linkType: hard -"irregular-plurals@npm:^3.2.0": - version: 3.3.0 - resolution: "irregular-plurals@npm:3.3.0" - checksum: 1282d8adfb00a9718655ce21e5b096d4b31d2115c817a30e1e3254648ae4ac0f84d706cd0cad2a93c64f4bb5c5572ea8f63fcc9766f005a5362031c56d9e77b5 - languageName: node - linkType: hard - "is-accessor-descriptor@npm:^0.1.6": version: 0.1.6 resolution: "is-accessor-descriptor@npm:0.1.6" @@ -19525,18 +19453,6 @@ __metadata: languageName: node linkType: hard -"jest-diff@npm:^29.0.3": - version: 29.6.4 - resolution: "jest-diff@npm:29.6.4" - dependencies: - chalk: ^4.0.0 - diff-sequences: ^29.6.3 - jest-get-type: ^29.6.3 - pretty-format: ^29.6.3 - checksum: e205c45ab6dbcc660dc2a682cddb20f6a3cbbbdecd2821cce2050619f96dbd7560ee25f7f51d42c302596aeaddbea54390b78be3ab639340d24d67e4d270a8b0 - languageName: node - linkType: hard - "jest-diff@npm:^29.5.0": version: 29.5.0 resolution: "jest-diff@npm:29.5.0" @@ -19599,13 +19515,6 @@ __metadata: languageName: node linkType: hard -"jest-get-type@npm:^29.6.3": - version: 29.6.3 - resolution: "jest-get-type@npm:29.6.3" - checksum: 88ac9102d4679d768accae29f1e75f592b760b44277df288ad76ce5bf038c3f5ce3719dea8aa0f035dac30e9eb034b848ce716b9183ad7cc222d029f03e92205 - languageName: node - linkType: hard - "jest-haste-map@npm:^26.5.2": version: 26.6.2 resolution: "jest-haste-map@npm:26.6.2" @@ -21631,7 +21540,7 @@ __metadata: languageName: node linkType: hard -"map-obj@npm:^4.0.0, map-obj@npm:^4.1.0": +"map-obj@npm:^4.1.0": version: 4.3.0 resolution: "map-obj@npm:4.3.0" checksum: fbc554934d1a27a1910e842bc87b177b1a556609dd803747c85ece420692380827c6ae94a95cce4407c054fa0964be3bf8226f7f2cb2e9eeee432c7c1985684e @@ -21887,26 +21796,6 @@ __metadata: languageName: node linkType: hard -"meow@npm:^9.0.0": - version: 9.0.0 - resolution: "meow@npm:9.0.0" - dependencies: - "@types/minimist": ^1.2.0 - camelcase-keys: ^6.2.2 - decamelize: ^1.2.0 - decamelize-keys: ^1.1.0 - hard-rejection: ^2.1.0 - minimist-options: 4.1.0 - normalize-package-data: ^3.0.0 - read-pkg-up: ^7.0.1 - redent: ^3.0.0 - trim-newlines: ^3.0.0 - type-fest: ^0.18.0 - yargs-parser: ^20.2.3 - checksum: 99799c47247f4daeee178e3124f6ef6f84bde2ba3f37652865d5d8f8b8adcf9eedfc551dd043e2455cd8206545fd848e269c0c5ab6b594680a0ad4d3617c9639 - languageName: node - linkType: hard - "merge-descriptors@npm:1.0.1": version: 1.0.1 resolution: "merge-descriptors@npm:1.0.1" @@ -23708,7 +23597,7 @@ __metadata: languageName: node linkType: hard -"normalize-package-data@npm:^3.0.0, normalize-package-data@npm:^3.0.2": +"normalize-package-data@npm:^3.0.2": version: 3.0.3 resolution: "normalize-package-data@npm:3.0.3" dependencies: @@ -25204,15 +25093,6 @@ __metadata: languageName: node linkType: hard -"plur@npm:^4.0.0": - version: 4.0.0 - resolution: "plur@npm:4.0.0" - dependencies: - irregular-plurals: ^3.2.0 - checksum: fea2e903efca67cc5c7a8952fca3db46ae8d9e9353373b406714977e601a5d3b628bcb043c3ad2126c6ff0e73d8020bf43af30a72dd087eff1ec240eb13b90e1 - languageName: node - linkType: hard - "pluralize@npm:^8.0.0": version: 8.0.0 resolution: "pluralize@npm:8.0.0" @@ -25956,17 +25836,6 @@ __metadata: languageName: node linkType: hard -"pretty-format@npm:^29.6.3": - version: 29.6.3 - resolution: "pretty-format@npm:29.6.3" - dependencies: - "@jest/schemas": ^29.6.3 - ansi-styles: ^5.0.0 - react-is: ^18.0.0 - checksum: 4e1c0db48e65571c22e80ff92123925ff8b3a2a89b71c3a1683cfde711004d492de32fe60c6bc10eea8bf6c678e5cbe544ac6c56cb8096e1eb7caf856928b1c4 - languageName: node - linkType: hard - "pretty-format@npm:^3.8.0": version: 3.8.0 resolution: "pretty-format@npm:3.8.0" @@ -26255,13 +26124,6 @@ __metadata: languageName: node linkType: hard -"quick-lru@npm:^4.0.1": - version: 4.0.1 - resolution: "quick-lru@npm:4.0.1" - checksum: bea46e1abfaa07023e047d3cf1716a06172c4947886c053ede5c50321893711577cb6119360f810cc3ffcd70c4d7db4069c3cee876b358ceff8596e062bd1154 - languageName: node - linkType: hard - "quick-lru@npm:^5.1.1": version: 5.1.1 resolution: "quick-lru@npm:5.1.1" @@ -26552,7 +26414,7 @@ __metadata: languageName: node linkType: hard -"read-pkg-up@npm:^7.0.0, read-pkg-up@npm:^7.0.1": +"read-pkg-up@npm:^7.0.1": version: 7.0.1 resolution: "read-pkg-up@npm:7.0.1" dependencies: @@ -26688,16 +26550,6 @@ __metadata: languageName: node linkType: hard -"redent@npm:^3.0.0": - version: 3.0.0 - resolution: "redent@npm:3.0.0" - dependencies: - indent-string: ^4.0.0 - strip-indent: ^3.0.0 - checksum: fa1ef20404a2d399235e83cc80bd55a956642e37dd197b4b612ba7327bf87fa32745aeb4a1634b2bab25467164ab4ed9c15be2c307923dd08b0fe7c52431ae6b - languageName: node - linkType: hard - "redent@npm:^4.0.0": version: 4.0.0 resolution: "redent@npm:4.0.0" @@ -29600,16 +29452,6 @@ __metadata: languageName: node linkType: hard -"supports-hyperlinks@npm:^2.0.0": - version: 2.2.0 - resolution: "supports-hyperlinks@npm:2.2.0" - dependencies: - has-flag: ^4.0.0 - supports-color: ^7.0.0 - checksum: aef04fb41f4a67f1bc128f7c3e88a81b6cf2794c800fccf137006efe5bafde281da3e42e72bf9206c2fcf42e6438f37e3a820a389214d0a88613ca1f2d36076a - languageName: node - linkType: hard - "supports-hyperlinks@npm:^3.0.0": version: 3.0.0 resolution: "supports-hyperlinks@npm:3.0.0" @@ -30223,13 +30065,6 @@ __metadata: languageName: node linkType: hard -"trim-newlines@npm:^3.0.0": - version: 3.0.1 - resolution: "trim-newlines@npm:3.0.1" - checksum: b530f3fadf78e570cf3c761fb74fef655beff6b0f84b29209bac6c9622db75ad1417f4a7b5d54c96605dcd72734ad44526fef9f396807b90839449eb543c6206 - languageName: node - linkType: hard - "trim-newlines@npm:^4.0.2": version: 4.1.1 resolution: "trim-newlines@npm:4.1.1" @@ -30274,23 +30109,6 @@ __metadata: languageName: node linkType: hard -"tsd@npm:^0.28.0": - version: 0.28.1 - resolution: "tsd@npm:0.28.1" - dependencies: - "@tsd/typescript": ~5.0.2 - eslint-formatter-pretty: ^4.1.0 - globby: ^11.0.1 - jest-diff: ^29.0.3 - meow: ^9.0.0 - path-exists: ^4.0.0 - read-pkg-up: ^7.0.0 - bin: - tsd: dist/cli.js - checksum: ca0f0d2ba3063a252ac3ecf5799c6dc8c4c35726f0d0683e6577992a9916cfe3e476f9fdbb67bf57ce8e46ef9cd0189bb847d336d1c01679232f1b91828b0fa6 - languageName: node - linkType: hard - "tslib@npm:2.6.1": version: 2.6.1 resolution: "tslib@npm:2.6.1" @@ -30411,13 +30229,6 @@ __metadata: languageName: node linkType: hard -"type-fest@npm:^0.18.0": - version: 0.18.1 - resolution: "type-fest@npm:0.18.1" - checksum: e96dcee18abe50ec82dab6cbc4751b3a82046da54c52e3b2d035b3c519732c0b3dd7a2fa9df24efd1a38d953d8d4813c50985f215f1957ee5e4f26b0fe0da395 - languageName: node - linkType: hard - "type-fest@npm:^0.20.2": version: 0.20.2 resolution: "type-fest@npm:0.20.2" @@ -32516,7 +32327,7 @@ __metadata: languageName: node linkType: hard -"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3, yargs-parser@npm:^20.2.9": +"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.9": version: 20.2.9 resolution: "yargs-parser@npm:20.2.9" checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3