Socket
Socket
Sign inDemoInstall

@uppy/core

Package Overview
Dependencies
Maintainers
5
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/core - npm Package Compare versions

Comparing version 4.0.0-beta.3 to 4.0.0-beta.4

17

CHANGELOG.md
# @uppy/core
## 4.0.0-beta.4
Released: 2024-04-29
Included in: Uppy v4.0.0-beta.4
- @uppy/core: Release: uppy@3.24.2 (github-actions[bot] / #5084)
- @uppy/core: fix `setOptions` not re-rendereing plugin UI (Antoine du Hamel / #5082)
## 4.0.0-beta.3

@@ -27,2 +35,11 @@

## 3.11.0
Released: 2024-04-29
Included in: Uppy v3.25.0
- @uppy/core: add instance ID to generated IDs (Merlijn Vos / #5080)
- @uppy/core: reference updated i18n in Restricter (Merlijn Vos / #5118)
## 3.10.1

@@ -29,0 +46,0 @@

2

lib/BasePlugin.d.ts

@@ -12,3 +12,3 @@ /**

import type { Body, Meta } from '@uppy/utils/lib/UppyFile';
import type { State, UnknownPlugin, Uppy } from './Uppy';
import type { State, UnknownPlugin, Uppy } from './Uppy.js';
export type PluginOpts = {

@@ -15,0 +15,0 @@ locale?: Locale;

import type { Meta, Body, UppyFile } from '@uppy/utils/lib/UppyFile';
import type { DeprecatedUppyEventMap, Uppy, UppyEventMap, _UppyEventMap } from './Uppy';
import type { DeprecatedUppyEventMap, Uppy, UppyEventMap, _UppyEventMap } from './Uppy.js';
/**

@@ -4,0 +4,0 @@ * Create a wrapper around an event emitter with a `remove` method to remove

import { vi } from 'vitest';
import UIPlugin from '../UIPlugin.ts';
import type Uppy from '../Uppy.ts';
import type Uppy from '../Uppy.js';
type mock = ReturnType<typeof vi.fn>;

@@ -5,0 +5,0 @@ export default class TestSelector1 extends UIPlugin<any, any, any> {

import { vi } from 'vitest';
import UIPlugin from '../UIPlugin.ts';
import type Uppy from '../Uppy.ts';
import type Uppy from '../Uppy.js';
type mock = ReturnType<typeof vi.fn>;

@@ -5,0 +5,0 @@ export default class TestSelector2 extends UIPlugin<any, any, any> {

import UIPlugin from '../UIPlugin.ts';
import type Uppy from '../Uppy.ts';
import type Uppy from '../Uppy.js';
export default class InvalidPluginWithoutName extends UIPlugin<any, any, any> {

@@ -4,0 +4,0 @@ type: string;

import UIPlugin from '../UIPlugin.ts';
import type Uppy from '../Uppy.ts';
import type Uppy from '../Uppy.js';
export default class InvalidPluginWithoutType extends UIPlugin<any, any, any> {

@@ -4,0 +4,0 @@ id: string;

@@ -1,5 +0,4 @@

import Translator from '@uppy/utils/lib/Translator';
import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile';
import type { I18n } from '@uppy/utils/lib/Translator';
import type { State, NonNullableUppyOptions } from './Uppy';
import type { State, NonNullableUppyOptions } from './Uppy.js';
export type Restrictions = {

@@ -39,5 +38,5 @@ maxFileSize: number | null;

declare class Restricter<M extends Meta, B extends Body> {
i18n: Translator['translate'];
getI18n: () => I18n;
getOpts: () => NonNullableUppyOptions<M, B>;
constructor(getOpts: () => NonNullableUppyOptions<M, B>, i18n: I18n);
constructor(getOpts: () => NonNullableUppyOptions<M, B>, getI18n: () => I18n);
validateAggregateRestrictions(existingFiles: ValidateableFile<M, B>[], addingFiles: ValidateableFile<M, B>[]): void;

@@ -44,0 +43,0 @@ validateSingleFile(file: ValidateableFile<M, B>): void;

@@ -32,4 +32,4 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

class Restricter {
constructor(getOpts, i18n) {
this.i18n = i18n;
constructor(getOpts, getI18n) {
this.getI18n = getI18n;
this.getOpts = () => {

@@ -54,3 +54,3 @@ var _opts$restrictions;

if (nonGhostFiles.length + addingFiles.length > maxNumberOfFiles) {
throw new RestrictionError(`${this.i18n('youCanOnlyUploadX', {
throw new RestrictionError(`${this.getI18n()('youCanOnlyUploadX', {
smart_count: maxNumberOfFiles

@@ -70,3 +70,3 @@ })}`);

if (totalFilesSize > maxTotalFileSize) {
throw new RestrictionError(this.i18n('exceedsSize', {
throw new RestrictionError(this.getI18n()('exceedsSize', {
size: prettierBytes(maxTotalFileSize),

@@ -102,3 +102,3 @@ file: addingFile.name

const allowedFileTypesString = allowedFileTypes.join(', ');
throw new RestrictionError(this.i18n('youCanOnlyUploadFileTypes', {
throw new RestrictionError(this.getI18n()('youCanOnlyUploadFileTypes', {
types: allowedFileTypesString

@@ -113,3 +113,3 @@ }), {

if (maxFileSize && file.size != null && file.size > maxFileSize) {
throw new RestrictionError(this.i18n('exceedsSize', {
throw new RestrictionError(this.getI18n()('exceedsSize', {
size: prettierBytes(maxFileSize),

@@ -124,3 +124,3 @@ file: file.name

if (minFileSize && file.size != null && file.size < minFileSize) {
throw new RestrictionError(this.i18n('inferiorSize', {
throw new RestrictionError(this.getI18n()('inferiorSize', {
size: prettierBytes(minFileSize)

@@ -143,3 +143,3 @@ }), {

if (minNumberOfFiles && Object.keys(files).length < minNumberOfFiles) {
throw new RestrictionError(this.i18n('youHaveToAtLeastSelectX', {
throw new RestrictionError(this.getI18n()('youHaveToAtLeastSelectX', {
smart_count: minNumberOfFiles

@@ -150,3 +150,3 @@ }));

getMissingRequiredMetaFields(file) {
const error = new RestrictionError(this.i18n('missingRequiredMetaFieldOnFile', {
const error = new RestrictionError(this.getI18n()('missingRequiredMetaFieldOnFile', {
fileName: file.name

@@ -153,0 +153,0 @@ }));

import { type ComponentChild } from 'preact';
import type { Body, Meta } from '@uppy/utils/lib/UppyFile';
import BasePlugin from './BasePlugin.ts';
import type { PluginOpts } from './BasePlugin.ts';
import type { State } from './Uppy.ts';
import type { PluginOpts } from './BasePlugin.js';
import type { State } from './Uppy.js';
/**

@@ -7,0 +7,0 @@ * UIPlugin is the extended version of BasePlugin to incorporate rendering with Preact.

@@ -1,3 +0,3 @@

/// <reference types="react" />
/// <reference types="lodash" />
import type { h } from 'preact';
import Translator from '@uppy/utils/lib/Translator';

@@ -12,4 +12,4 @@ import DefaultStore from '@uppy/store-default';

import { RestrictionError } from './Restricter.ts';
import type BasePlugin from './BasePlugin.ts';
import type { Restrictions, ValidateableFile } from './Restricter.ts';
import type BasePlugin from './BasePlugin.js';
import type { Restrictions, ValidateableFile } from './Restricter.js';
type Processor = (fileIDs: string[], uploadID: string) => Promise<unknown> | void;

@@ -39,3 +39,3 @@ type FileRemoveReason = 'user' | 'cancel-all' | 'unmount';

files: UppyFile<M, B>[];
icon: () => JSX.Element;
icon: () => h.JSX.Element;
provider: CompanionClientProvider;

@@ -55,3 +55,3 @@ storage: {

title: string;
icon: () => JSX.Element;
icon: () => h.JSX.Element;
provider: CompanionClientSearchProvider;

@@ -58,0 +58,0 @@ };

@@ -24,3 +24,3 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; }

const packageJson = {
"version": "4.0.0-beta.3"
"version": "4.0.0-beta.4"
};

@@ -287,3 +287,3 @@ import locale from "./locale.js";

});
_classPrivateFieldLooseBase(this, _restricter)[_restricter] = new Restricter(() => this.opts, this.i18n);
_classPrivateFieldLooseBase(this, _restricter)[_restricter] = new Restricter(() => this.opts, () => this.i18n);
_classPrivateFieldLooseBase(this, _storeUnsubscribe)[_storeUnsubscribe] = this.store.subscribe((prevState, nextState, patch) => {

@@ -1291,3 +1291,3 @@ this.emit('state-update', prevState, nextState, patch);

const fileExtension = getFileNameAndExtension(fileName).extension;
const id = getSafeFileId(file);
const id = getSafeFileId(file, this.getID());
const meta = file.meta || {};

@@ -1294,0 +1294,0 @@ meta.name = fileName;

{
"name": "@uppy/core",
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"version": "4.0.0-beta.3",
"version": "4.0.0-beta.4",
"license": "MIT",

@@ -28,7 +28,7 @@ "main": "lib/index.js",

"@uppy/store-default": "^4.0.0-beta.1",
"@uppy/utils": "^6.0.0-beta.3",
"@uppy/utils": "^6.0.0-beta.4",
"lodash": "^4.17.21",
"mime-match": "^1.0.2",
"namespace-emitter": "^2.0.1",
"nanoid": "^4.0.0",
"nanoid": "^5.0.0",
"preact": "^10.5.13"

@@ -35,0 +35,0 @@ },

@@ -19,3 +19,3 @@ /* eslint-disable class-methods-use-this */

import type { Body, Meta } from '@uppy/utils/lib/UppyFile'
import type { State, UnknownPlugin, Uppy } from './Uppy'
import type { State, UnknownPlugin, Uppy } from './Uppy.js'

@@ -22,0 +22,0 @@ export type PluginOpts = {

@@ -7,3 +7,3 @@ import type { Meta, Body, UppyFile } from '@uppy/utils/lib/UppyFile'

_UppyEventMap,
} from './Uppy'
} from './Uppy.js'

@@ -10,0 +10,0 @@ /**

import { vi } from 'vitest' // eslint-disable-line import/no-extraneous-dependencies
import UIPlugin from '../UIPlugin.ts'
import type Uppy from '../Uppy.ts'
import type Uppy from '../Uppy.js'

@@ -5,0 +5,0 @@ type mock = ReturnType<typeof vi.fn>

import { vi } from 'vitest' // eslint-disable-line import/no-extraneous-dependencies
import UIPlugin from '../UIPlugin.ts'
import type Uppy from '../Uppy.ts'
import type Uppy from '../Uppy.js'

@@ -5,0 +5,0 @@ type mock = ReturnType<typeof vi.fn>

import UIPlugin from '../UIPlugin.ts'
import type Uppy from '../Uppy.ts'
import type Uppy from '../Uppy.js'

@@ -4,0 +4,0 @@ export default class InvalidPluginWithoutName extends UIPlugin<any, any, any> {

import UIPlugin from '../UIPlugin.ts'
import type Uppy from '../Uppy.ts'
import type Uppy from '../Uppy.js'

@@ -4,0 +4,0 @@ export default class InvalidPluginWithoutType extends UIPlugin<any, any, any> {

@@ -6,6 +6,5 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

import match from 'mime-match'
import Translator from '@uppy/utils/lib/Translator'
import type { Body, Meta, UppyFile } from '@uppy/utils/lib/UppyFile'
import type { I18n } from '@uppy/utils/lib/Translator'
import type { State, NonNullableUppyOptions } from './Uppy'
import type { State, NonNullableUppyOptions } from './Uppy.js'

@@ -62,8 +61,11 @@ export type Restrictions = {

class Restricter<M extends Meta, B extends Body> {
i18n: Translator['translate']
getI18n: () => I18n
getOpts: () => NonNullableUppyOptions<M, B>
constructor(getOpts: () => NonNullableUppyOptions<M, B>, i18n: I18n) {
this.i18n = i18n
constructor(
getOpts: () => NonNullableUppyOptions<M, B>,
getI18n: () => I18n,
) {
this.getI18n = getI18n
this.getOpts = (): NonNullableUppyOptions<M, B> => {

@@ -93,3 +95,3 @@ const opts = getOpts()

throw new RestrictionError(
`${this.i18n('youCanOnlyUploadX', {
`${this.getI18n()('youCanOnlyUploadX', {
smart_count: maxNumberOfFiles,

@@ -114,3 +116,3 @@ })}`,

throw new RestrictionError(
this.i18n('exceedsSize', {
this.getI18n()('exceedsSize', {
size: prettierBytes(maxTotalFileSize),

@@ -148,3 +150,3 @@ file: addingFile.name,

throw new RestrictionError(
this.i18n('youCanOnlyUploadFileTypes', {
this.getI18n()('youCanOnlyUploadFileTypes', {
types: allowedFileTypesString,

@@ -160,3 +162,3 @@ }),

throw new RestrictionError(
this.i18n('exceedsSize', {
this.getI18n()('exceedsSize', {
size: prettierBytes(maxFileSize),

@@ -172,3 +174,3 @@ file: file.name,

throw new RestrictionError(
this.i18n('inferiorSize', {
this.getI18n()('inferiorSize', {
size: prettierBytes(minFileSize),

@@ -195,3 +197,5 @@ }),

throw new RestrictionError(
this.i18n('youHaveToAtLeastSelectX', { smart_count: minNumberOfFiles }),
this.getI18n()('youHaveToAtLeastSelectX', {
smart_count: minNumberOfFiles,
}),
)

@@ -206,3 +210,3 @@ }

const error = new RestrictionError<M, B>(
this.i18n('missingRequiredMetaFieldOnFile', { fileName: file.name }),
this.getI18n()('missingRequiredMetaFieldOnFile', { fileName: file.name }),
)

@@ -209,0 +213,0 @@ const { requiredMetaFields } = this.getOpts().restrictions

@@ -8,4 +8,4 @@ /* eslint-disable class-methods-use-this */

import BasePlugin from './BasePlugin.ts'
import type { PluginOpts } from './BasePlugin.ts'
import type { State } from './Uppy.ts'
import type { PluginOpts } from './BasePlugin.js'
import type { State } from './Uppy.js'

@@ -12,0 +12,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc