refactor(core): merge @uppy/utils into core (#6352)

This PR merges @uppy/utils into `@uppy/core`

for more context see #6351 

this PR should be reviewed after #6351 gets merged
This commit is contained in:
Prakash 2026-06-23 17:49:09 +05:30 committed by GitHub
commit 2bda51c066
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
345 changed files with 245 additions and 1015 deletions

View file

@ -2,11 +2,7 @@
"extends": ["//"],
"tasks": {
"build": {
"dependsOn": [
"@uppy/core#build",
"@uppy/dashboard#build",
"@uppy/utils#build"
],
"dependsOn": ["@uppy/core#build", "@uppy/dashboard#build"],
"inputs": [
"projects/uppy/angular/src/**/*.{js,ts,jsx,tsx}",
"package.json",

View file

@ -40,7 +40,6 @@
"./package.json": "./package.json"
},
"dependencies": {
"@uppy/utils": "workspace:^",
"preact": "^10.29.2"
},
"devDependencies": {

View file

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

View file

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

View file

@ -1,4 +1,4 @@
import type { I18n } from '@uppy/utils'
import type { I18n } from '@uppy/core/utils'
import type { h } from 'preact'
interface PermissionsScreenProps {

View file

@ -1,4 +1,4 @@
import type { I18n } from '@uppy/utils'
import type { I18n } from '@uppy/core/utils'
interface RecordButtonProps {
recording: boolean

View file

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

View file

@ -1,4 +1,4 @@
import type { I18n } from '@uppy/utils'
import type { I18n } from '@uppy/core/utils'
interface SubmitButtonProps {
onSubmit: () => void

View file

@ -7,9 +7,6 @@
"include": ["./src/**/*.*"],
"exclude": ["./src/**/*.test.ts"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -6,9 +6,6 @@
},
"include": ["./package.json", "./src/**/*.*"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -38,8 +38,7 @@
"./package.json": "./package.json"
},
"dependencies": {
"@uppy/companion-client": "workspace:^",
"@uppy/utils": "workspace:^"
"@uppy/companion-client": "workspace:^"
},
"devDependencies": {
"@aws-sdk/client-s3": "^3.362.0",

View file

@ -1,5 +1,8 @@
import type { Body, Meta, UppyFile } from '@uppy/core'
import type { RateLimitedQueue, WrapPromiseFunctionType } from '@uppy/utils'
import type {
RateLimitedQueue,
WrapPromiseFunctionType,
} from '@uppy/core/utils'
import type AwsS3Multipart from './index.js'
import type {
AwsS3MultipartOptions,

View file

@ -1,6 +1,6 @@
import type { Uppy } from '@uppy/core'
import type { Body, Meta, UppyFile } from '@uppy/utils'
import { AbortController } from '@uppy/utils'
import type { Body, Meta, UppyFile } from '@uppy/core/utils'
import { AbortController } from '@uppy/core/utils'
import type { HTTPCommunicationQueue } from './HTTPCommunicationQueue.js'
const MB = 1024 * 1024

View file

@ -12,14 +12,14 @@ import type {
Meta,
RequestOptions,
UppyFile,
} from '@uppy/utils'
} from '@uppy/core/utils'
import {
createAbortError,
filterFilesToEmitUploadStarted,
filterFilesToUpload,
getAllowedMetaFields,
RateLimitedQueue,
} from '@uppy/utils'
} from '@uppy/core/utils'
import packageJson from '../package.json' with { type: 'json' }
import createSignedURL from './createSignedURL.js'
import { HTTPCommunicationQueue } from './HTTPCommunicationQueue.js'

View file

@ -1,5 +1,5 @@
import type { Body } from '@uppy/utils'
import { createAbortError } from '@uppy/utils'
import type { Body } from '@uppy/core/utils'
import { createAbortError } from '@uppy/core/utils'
import type { AwsS3Part } from './index.js'

View file

@ -10,9 +10,6 @@
{
"path": "../companion-client/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -10,9 +10,6 @@
{
"path": "../companion-client/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -36,7 +36,6 @@
"dependencies": {
"@uppy/companion-client": "workspace:^",
"@uppy/provider-views": "workspace:^",
"@uppy/utils": "workspace:^",
"preact": "^10.29.2"
},
"peerDependencies": {

View file

@ -13,9 +13,8 @@ import type {
UppyFile,
} from '@uppy/core'
import { UIPlugin, type Uppy } from '@uppy/core'
import type { LocaleStrings } from '@uppy/core/utils'
import { ProviderViews } from '@uppy/provider-views'
import type { LocaleStrings } from '@uppy/utils'
// biome-ignore lint/style/useImportType: h is not a type
import { type ComponentChild, h } from 'preact'
import packageJson from '../package.json' with { type: 'json' }

View file

@ -13,9 +13,6 @@
{
"path": "../provider-views/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -12,9 +12,6 @@
{
"path": "../provider-views/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -36,7 +36,6 @@
"./package.json": "./package.json"
},
"dependencies": {
"@uppy/utils": "workspace:^",
"namespace-emitter": "^2.0.1",
"p-retry": "^6.1.0"
},

View file

@ -9,7 +9,7 @@ import {
type CompanionClientProvider,
getSocketHost,
type RequestOptions,
} from '@uppy/utils'
} from '@uppy/core/utils'
import type { CompanionPluginOptions } from './index.js'
import RequestClient, { authErrorStatusCode } from './RequestClient.js'

View file

@ -5,13 +5,13 @@ import type {
RemoteUppyFile,
RequestOptions,
UppyFile,
} from '@uppy/utils'
} from '@uppy/core/utils'
import {
ErrorWithCause,
fetchWithNetworkError,
getSocketHost,
UserFacingApiError,
} from '@uppy/utils'
} from '@uppy/core/utils'
import pRetry, { AbortError } from 'p-retry'
import packageJson from '../package.json' with { type: 'json' }
import AuthError from './AuthError.js'

View file

@ -1,5 +1,5 @@
import type { Body, Meta, Uppy } from '@uppy/core'
import type { CompanionClientSearchProvider } from '@uppy/utils'
import type { CompanionClientSearchProvider } from '@uppy/core/utils'
import RequestClient, { type Opts } from './RequestClient.js'
const getName = (id: string): string => {

View file

@ -7,9 +7,6 @@
"include": ["./src/**/*.*"],
"exclude": ["./src/**/*.test.ts"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -6,9 +6,6 @@
},
"include": ["./package.json", "./src/**/*.*"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -18,12 +18,6 @@
},
{
"path": "../image-editor/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}
]
}

View file

@ -17,12 +17,6 @@
},
{
"path": "../image-editor/tsconfig.build.json"
},
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}
]
}

View file

@ -32,7 +32,6 @@
},
"dependencies": {
"@transloadit/prettier-bytes": "^1.1.0",
"@uppy/utils": "workspace:^",
"compressorjs": "^1.3.0",
"preact": "^10.29.2",
"promise-queue": "^2.2.5"

View file

@ -1,7 +1,7 @@
import fs from 'node:fs'
import path from 'node:path'
import Core from '@uppy/core'
import { getFileNameAndExtension } from '@uppy/utils'
import { getFileNameAndExtension } from '@uppy/core/utils'
import { describe, expect, it } from 'vitest'
import CompressorPlugin from './index.js'

View file

@ -1,8 +1,8 @@
import { prettierBytes } from '@transloadit/prettier-bytes'
import type { DefinePluginOpts, PluginOpts } from '@uppy/core'
import { BasePlugin, type Uppy } from '@uppy/core'
import type { Body, LocalUppyFile, Meta, UppyFile } from '@uppy/utils'
import { getFileNameAndExtension, RateLimitedQueue } from '@uppy/utils'
import type { Body, LocalUppyFile, Meta, UppyFile } from '@uppy/core/utils'
import { getFileNameAndExtension, RateLimitedQueue } from '@uppy/core/utils'
import CompressorJS from 'compressorjs'
import locale from './locale.js'

View file

@ -7,9 +7,6 @@
"include": ["./src/**/*.*"],
"exclude": ["./src/**/*.test.ts"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -7,9 +7,6 @@
},
"include": ["./package.json", "./src/**/*.*"],
"references": [
{
"path": "../utils/tsconfig.build.json"
},
{
"path": "../core/tsconfig.build.json"
}

View file

@ -39,11 +39,11 @@
"./css/style.css": "./dist/style.css",
"./css/style.scss": "./src/style.scss",
"./store-default": "./lib/store/index.js",
"./utils": "./lib/utils/index.js",
"./package.json": "./package.json"
},
"dependencies": {
"@transloadit/prettier-bytes": "^1.1.0",
"@uppy/utils": "workspace:^",
"lodash": "^4.18.1",
"mime-match": "^1.0.2",
"namespace-emitter": "^2.0.1",
@ -52,6 +52,7 @@
},
"devDependencies": {
"@types/deep-freeze": "^0",
"@types/lodash": "^4.14.199",
"@types/node": "^20.19.0",
"cssnano": "^8.0.1",
"deep-freeze": "^0.0.1",

View file

@ -7,9 +7,14 @@
* See `Plugin` for the extended version with Preact rendering for interfaces.
*/
import type { Body, I18n, Meta, OptionalPluralizeLocale } from '@uppy/utils'
import { Translator } from '@uppy/utils'
import type { State, UnknownPlugin, Uppy } from './Uppy.js'
import type {
Body,
I18n,
Meta,
OptionalPluralizeLocale,
} from './utils/index.js'
import { Translator } from './utils/index.js'
export type PluginOpts = {
locale?: OptionalPluralizeLocale

View file

@ -1,5 +1,5 @@
import type { Body, Meta, UppyFile } from '@uppy/utils'
import type { _UppyEventMap, Uppy, UppyEventMap } from './Uppy.js'
import type { Body, Meta, UppyFile } from './utils/index.js'
/**
* Create a wrapper around an event emitter with a `remove` method to remove

View file

@ -1,8 +1,8 @@
import { prettierBytes } from '@transloadit/prettier-bytes'
import type { Body, I18n, Meta, UppyFile } from '@uppy/utils'
// @ts-expect-error untyped
import match from 'mime-match'
import type { NonNullableUppyOptions, State } from './Uppy.js'
import type { Body, I18n, Meta, UppyFile } from './utils/index.js'
export type Restrictions = {
maxFileSize: number | null

View file

@ -1,9 +1,9 @@
import type { Body, Meta } from '@uppy/utils'
import { findDOMElement, getTextDirection } from '@uppy/utils'
import { render } from 'preact'
import type { PluginOpts } from './BasePlugin.js'
import BasePlugin from './BasePlugin.js'
import type { State } from './Uppy.js'
import type { Body, Meta } from './utils/index.js'
import { findDOMElement, getTextDirection } from './utils/index.js'
/**
* Defer a frequent call to the microtask queue.

View file

@ -3,7 +3,6 @@ import fs from 'node:fs'
import path from 'node:path'
import { prettierBytes } from '@transloadit/prettier-bytes'
import type { Body, Meta } from '@uppy/core'
import type { Locale } from '@uppy/utils'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import BasePlugin, {
type DefinePluginOpts,
@ -21,6 +20,7 @@ import InvalidPluginWithoutType from './mocks/invalidPluginWithoutType.js'
import { RestrictionError } from './Restricter.js'
import UIPlugin from './UIPlugin.js'
import type { State } from './Uppy.js'
import type { Locale } from './utils/index.js'
const sampleImage = fs.readFileSync(
path.join(__dirname, '../../compressor/fixtures/image.jpg'),

View file

@ -1,28 +1,5 @@
/* global AggregateError */
import type {
Body,
CompanionClientProvider,
CompanionClientSearchProvider,
CompanionFile,
FileProgressNotStarted,
FileProgressStarted,
I18n,
Locale,
LocalUppyFile,
Meta,
MinimalRequiredUppyFile,
OptionalPluralizeLocale,
RemoteUppyFile,
UppyFile,
UppyFileId,
} from '@uppy/utils'
import {
getFileNameAndExtension,
getFileType,
getSafeFileId,
Translator,
} from '@uppy/utils'
import throttle from 'lodash/throttle.js'
// @ts-expect-error untyped
import ee from 'namespace-emitter'
@ -41,6 +18,29 @@ import {
} from './Restricter.js'
import DefaultStore, { type Store } from './store/index.js'
import supportsUploadProgress from './supportsUploadProgress.js'
import type {
Body,
CompanionClientProvider,
CompanionClientSearchProvider,
CompanionFile,
FileProgressNotStarted,
FileProgressStarted,
I18n,
Locale,
LocalUppyFile,
Meta,
MinimalRequiredUppyFile,
OptionalPluralizeLocale,
RemoteUppyFile,
UppyFile,
UppyFileId,
} from './utils/index.js'
import {
getFileNameAndExtension,
getFileType,
getSafeFileId,
Translator,
} from './utils/index.js'
type Processor = (
fileIDs: string[],

View file

@ -1,9 +1,3 @@
export type {
Body,
Meta,
MinimalRequiredUppyFile,
UppyFile,
} from '@uppy/utils'
export type { DefinePluginOpts, PluginOpts } from './BasePlugin.js'
export { default as BasePlugin } from './BasePlugin.js'
export { default as EventManager } from './EventManager.js'
@ -34,3 +28,9 @@ export type {
UppyOptions,
} from './Uppy.js'
export { default, default as Uppy } from './Uppy.js'
export type {
Body,
Meta,
MinimalRequiredUppyFile,
UppyFile,
} from './utils/index.js'

View file

@ -1,4 +1,4 @@
import { getTimeStamp } from '@uppy/utils'
import { getTimeStamp } from './utils/index.js'
// Swallow all logs, except errors.
// default if logger is not set or debug: false

View file

@ -1,8 +1,13 @@
import type { Body, InternalMetadata, LocaleStrings, Meta } from '@uppy/utils'
import { expectTypeOf, test } from 'vitest'
import BasePlugin from './BasePlugin.js'
import UIPlugin, { type UIPluginOptions } from './UIPlugin.js'
import Uppy, { type UnknownPlugin } from './Uppy.js'
import type {
Body,
InternalMetadata,
LocaleStrings,
Meta,
} from './utils/index.js'
interface Opts extends UIPluginOptions {
foo: string

Some files were not shown because too many files have changed in this diff Show more