@uppy/core
Advanced tools
Comparing version
# @uppy/core | ||
## 3.0.0-beta.4 | ||
Released: 2022-08-16 | ||
Included in: Uppy v3.0.0-beta.5 | ||
- @uppy/core,@uppy/react: Fix all breaking todo comments for 3.0 (Merlijn Vos / #3907) | ||
## 3.0.0-beta.2 | ||
@@ -4,0 +11,0 @@ |
@@ -83,5 +83,3 @@ /** | ||
throw new Error('Extend the render method to add your plugin to a DOM element'); | ||
} // TODO: remove in the next major version. It's not feasible to | ||
// try to use plugins with other frameworks. | ||
// eslint-disable-next-line class-methods-use-this | ||
} // eslint-disable-next-line class-methods-use-this | ||
@@ -88,0 +86,0 @@ |
export { default } from './Uppy.js'; | ||
export { default as Uppy } from './Uppy.js'; | ||
export { default as UIPlugin } from './UIPlugin.js'; | ||
export { default as BasePlugin } from './BasePlugin.js'; | ||
export { debugLogger } from './loggers.js'; // TODO: remove all the following in the next major | ||
/* eslint-disable import/first */ | ||
import Uppy from './Uppy.js'; | ||
import UIPlugin from './UIPlugin.js'; | ||
import BasePlugin from './BasePlugin.js'; | ||
import { debugLogger } from './loggers.js'; // Backward compatibility: we want those to keep being accessible as static | ||
// properties of `Uppy` to avoid a breaking change. | ||
Uppy.Uppy = Uppy; | ||
Uppy.UIPlugin = UIPlugin; | ||
Uppy.BasePlugin = BasePlugin; | ||
Uppy.debugLogger = debugLogger; | ||
export { Uppy }; | ||
export { debugLogger } from './loggers.js'; |
/* eslint-disable max-classes-per-file, class-methods-use-this */ | ||
/* global AggregateError */ | ||
import prettierBytes from '@transloadit/prettier-bytes'; | ||
@@ -24,14 +22,2 @@ import match from 'mime-match'; | ||
if (typeof AggregateError === 'undefined') { | ||
// eslint-disable-next-line no-global-assign | ||
// TODO: remove this "polyfill" in the next major. | ||
globalThis.AggregateError = class AggregateError extends Error { | ||
constructor(errors, message) { | ||
super(message); | ||
this.errors = errors; | ||
} | ||
}; | ||
} | ||
class Restricter { | ||
@@ -137,9 +123,7 @@ constructor(getOpts, i18n) { | ||
requiredMetaFields | ||
} = this.getOpts().restrictions; // TODO: migrate to Object.hasOwn in the next major. | ||
const own = Object.prototype.hasOwnProperty; | ||
} = this.getOpts().restrictions; | ||
const missingFields = []; | ||
for (const field of requiredMetaFields) { | ||
if (!own.call(file.meta, field) || file.meta[field] === '') { | ||
if (!Object.hasOwn(file.meta, field) || file.meta[field] === '') { | ||
missingFields.push(field); | ||
@@ -146,0 +130,0 @@ } |
@@ -25,3 +25,3 @@ let _Symbol$for, _Symbol$for2; | ||
const packageJson = { | ||
"version": "3.0.0-beta.3" | ||
"version": "3.0.0-beta.4" | ||
}; | ||
@@ -154,7 +154,2 @@ import locale from './locale.js'; | ||
autoProceed: false, | ||
/** | ||
* @deprecated The method should not be used | ||
*/ | ||
allowMultipleUploads: true, | ||
allowMultipleUploadBatches: true, | ||
@@ -287,13 +282,2 @@ debug: false, | ||
/** | ||
* Back compat for when uppy.state is used instead of uppy.getState(). | ||
* | ||
* @deprecated | ||
*/ | ||
get state() { | ||
// Here, state is a non-enumerable property. | ||
return this.getState(); | ||
} | ||
/** | ||
* Shorthand to set state for a specific file. | ||
@@ -516,16 +500,9 @@ */ | ||
// TODO: directly return the Restriction error in next major version. | ||
// we create RestrictionError's just to discard immediately, which doesn't make sense. | ||
try { | ||
_classPrivateFieldLooseBase(this, _restricter)[_restricter].validate(file, files); | ||
return { | ||
result: true | ||
}; | ||
} catch (err) { | ||
return { | ||
result: false, | ||
reason: err.message | ||
}; | ||
return err; | ||
} | ||
return null; | ||
} | ||
@@ -876,7 +853,2 @@ | ||
return _classPrivateFieldLooseBase(this, _runUpload)[_runUpload](uploadID); | ||
} // todo remove in next major. what is the point of the reset method when we have cancelAll or vice versa? | ||
reset() { | ||
this.cancelAll(...arguments); | ||
} | ||
@@ -883,0 +855,0 @@ |
{ | ||
"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": "3.0.0-beta.3", | ||
"version": "3.0.0-beta.4", | ||
"license": "MIT", | ||
@@ -24,5 +24,5 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@transloadit/prettier-bytes": "0.0.7", | ||
"@uppy/store-default": "^3.0.0-beta.2", | ||
"@uppy/utils": "^5.0.0-beta", | ||
"@transloadit/prettier-bytes": "0.0.9", | ||
"@uppy/store-default": "^3.0.0-beta.3", | ||
"@uppy/utils": "^5.0.0-beta.1", | ||
"lodash.throttle": "^4.1.1", | ||
@@ -36,4 +36,3 @@ "mime-match": "^1.0.2", | ||
"@jest/globals": "^27.4.2" | ||
}, | ||
"stableVersion": "2.3.0" | ||
} | ||
} |
@@ -78,4 +78,2 @@ /** | ||
// TODO: remove in the next major version. It's not feasible to | ||
// try to use plugins with other frameworks. | ||
// eslint-disable-next-line class-methods-use-this | ||
@@ -82,0 +80,0 @@ update () {} |
export { default } from './Uppy.js' | ||
export { default as Uppy } from './Uppy.js' | ||
export { default as UIPlugin } from './UIPlugin.js' | ||
export { default as BasePlugin } from './BasePlugin.js' | ||
export { debugLogger } from './loggers.js' | ||
// TODO: remove all the following in the next major | ||
/* eslint-disable import/first */ | ||
import Uppy from './Uppy.js' | ||
import UIPlugin from './UIPlugin.js' | ||
import BasePlugin from './BasePlugin.js' | ||
import { debugLogger } from './loggers.js' | ||
// Backward compatibility: we want those to keep being accessible as static | ||
// properties of `Uppy` to avoid a breaking change. | ||
Uppy.Uppy = Uppy | ||
Uppy.UIPlugin = UIPlugin | ||
Uppy.BasePlugin = BasePlugin | ||
Uppy.debugLogger = debugLogger | ||
export { Uppy } |
/* eslint-disable max-classes-per-file, class-methods-use-this */ | ||
/* global AggregateError */ | ||
import prettierBytes from '@transloadit/prettier-bytes' | ||
@@ -20,13 +19,2 @@ import match from 'mime-match' | ||
if (typeof AggregateError === 'undefined') { | ||
// eslint-disable-next-line no-global-assign | ||
// TODO: remove this "polyfill" in the next major. | ||
globalThis.AggregateError = class AggregateError extends Error { | ||
constructor (errors, message) { | ||
super(message) | ||
this.errors = errors | ||
} | ||
} | ||
} | ||
class Restricter { | ||
@@ -112,8 +100,6 @@ constructor (getOpts, i18n) { | ||
const { requiredMetaFields } = this.getOpts().restrictions | ||
// TODO: migrate to Object.hasOwn in the next major. | ||
const own = Object.prototype.hasOwnProperty | ||
const missingFields = [] | ||
for (const field of requiredMetaFields) { | ||
if (!own.call(file.meta, field) || file.meta[field] === '') { | ||
if (!Object.hasOwn(file.meta, field) || file.meta[field] === '') { | ||
missingFields.push(field) | ||
@@ -120,0 +106,0 @@ } |
@@ -58,6 +58,2 @@ /* eslint-disable max-classes-per-file */ | ||
autoProceed: false, | ||
/** | ||
* @deprecated The method should not be used | ||
*/ | ||
allowMultipleUploads: true, | ||
allowMultipleUploadBatches: true, | ||
@@ -187,12 +183,2 @@ debug: false, | ||
/** | ||
* Back compat for when uppy.state is used instead of uppy.getState(). | ||
* | ||
* @deprecated | ||
*/ | ||
get state () { | ||
// Here, state is a non-enumerable property. | ||
return this.getState() | ||
} | ||
/** | ||
* Shorthand to set state for a specific file. | ||
@@ -395,10 +381,8 @@ */ | ||
validateRestrictions (file, files = this.getFiles()) { | ||
// TODO: directly return the Restriction error in next major version. | ||
// we create RestrictionError's just to discard immediately, which doesn't make sense. | ||
try { | ||
this.#restricter.validate(file, files) | ||
return { result: true } | ||
} catch (err) { | ||
return { result: false, reason: err.message } | ||
return err | ||
} | ||
return null | ||
} | ||
@@ -849,7 +833,2 @@ | ||
// todo remove in next major. what is the point of the reset method when we have cancelAll or vice versa? | ||
reset (...args) { | ||
this.cancelAll(...args) | ||
} | ||
logout () { | ||
@@ -856,0 +835,0 @@ this.iteratePlugins(plugin => { |
@@ -220,4 +220,2 @@ import * as UppyUtils from '@uppy/utils' | ||
export type RetryAllCallback = (fileIDs: string[]) => void; | ||
// TODO: reverse the order in the next major version | ||
export type RestrictionFailedCallback<TMeta> = (file: UppyFile<TMeta> | undefined, error: Error) => void; | ||
@@ -353,4 +351,2 @@ | ||
reset(): void | ||
getID(): string | ||
@@ -357,0 +353,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 '..' | ||
@@ -5,0 +6,0 @@ import type { UploadedUppyFile, FailedUppyFile, PluginOptions, UppyFile, SuccessResponse } from '..' |
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
367112
-2.35%6394
-1.59%+ Added
- Removed
Updated