New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@uppy/core

Package Overview
Dependencies
Maintainers
8
Versions
148
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 2.1.2 to 2.1.3

CHANGELOG.md

6

lib/BasePlugin.js

@@ -14,3 +14,7 @@ "use strict";

module.exports = class BasePlugin {
constructor(uppy, opts = {}) {
constructor(uppy, opts) {
if (opts === void 0) {
opts = {};
}
this.uppy = uppy;

@@ -17,0 +21,0 @@ this.opts = opts;

@@ -11,3 +11,9 @@ "use strict";

warn: () => {},
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args)
error: function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
}
}; // Print logs to console with namespace + timestamp,

@@ -17,5 +23,23 @@ // set by logger: Uppy.debugLogger or debug: true

const debugLogger = {
debug: (...args) => console.debug(`[Uppy] [${getTimeStamp()}]`, ...args),
warn: (...args) => console.warn(`[Uppy] [${getTimeStamp()}]`, ...args),
error: (...args) => console.error(`[Uppy] [${getTimeStamp()}]`, ...args)
debug: function () {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return console.debug(`[Uppy] [${getTimeStamp()}]`, ...args);
},
warn: function () {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
return console.warn(`[Uppy] [${getTimeStamp()}]`, ...args);
},
error: function () {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return console.error(`[Uppy] [${getTimeStamp()}]`, ...args);
}
};

@@ -22,0 +46,0 @@ module.exports = {

10

lib/UIPlugin.js

@@ -27,3 +27,7 @@ "use strict";

let latestArgs = null;
return (...args) => {
return function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
latestArgs = args;

@@ -56,4 +60,4 @@

class UIPlugin extends BasePlugin {
constructor(...args) {
super(...args);
constructor() {
super(...arguments);
Object.defineProperty(this, _updateUI, {

@@ -60,0 +64,0 @@ writable: true,

@@ -41,8 +41,10 @@ /* global AggregateError */

debugLogger
} = require('./loggers'); // Exported from here.
} = require('./loggers');
const locale = require('./locale'); // Exported from here.
class RestrictionError extends Error {
constructor(...args) {
super(...args);
constructor() {
super(...arguments);
this.isRestriction = true;

@@ -65,4 +67,4 @@ }

class AggregateRestrictionError extends AggregateError {
constructor(...args) {
super(...args);
constructor() {
super(...arguments);
this.isRestriction = true;

@@ -200,56 +202,3 @@ }

});
this.defaultLocale = {
strings: {
addBulkFilesFailed: {
0: 'Failed to add %{smart_count} file due to an internal error',
1: 'Failed to add %{smart_count} files due to internal errors'
},
youCanOnlyUploadX: {
0: 'You can only upload %{smart_count} file',
1: 'You can only upload %{smart_count} files'
},
youHaveToAtLeastSelectX: {
0: 'You have to select at least %{smart_count} file',
1: 'You have to select at least %{smart_count} files'
},
exceedsSize: '%{file} exceeds maximum allowed size of %{size}',
missingRequiredMetaField: 'Missing required meta fields',
missingRequiredMetaFieldOnFile: 'Missing required meta fields in %{fileName}',
inferiorSize: 'This file is smaller than the allowed size of %{size}',
youCanOnlyUploadFileTypes: 'You can only upload: %{types}',
noMoreFilesAllowed: 'Cannot add more files',
noDuplicates: 'Cannot add the duplicate file \'%{fileName}\', it already exists',
companionError: 'Connection with Companion failed',
authAborted: 'Authentication aborted',
companionUnauthorizeHint: 'To unauthorize to your %{provider} account, please go to %{url}',
failedToUpload: 'Failed to upload %{file}',
noInternetConnection: 'No Internet connection',
connectedToInternet: 'Connected to the Internet',
// Strings for remote providers
noFilesFound: 'You have no files or folders here',
selectX: {
0: 'Select %{smart_count}',
1: 'Select %{smart_count}'
},
allFilesFromFolderNamed: 'All files from folder %{name}',
openFolderNamed: 'Open folder %{name}',
cancel: 'Cancel',
logOut: 'Log out',
filter: 'Filter',
resetFilter: 'Reset filter',
loading: 'Loading...',
authenticateWithTitle: 'Please authenticate with %{pluginName} to select files',
authenticateWith: 'Connect to %{pluginName}',
signInWithGoogle: 'Sign in with Google',
searchImages: 'Search for images',
enterTextToSearch: 'Enter text to search for images',
backToSearch: 'Back to Search',
emptyFolderAdded: 'No files were added from empty folder',
folderAlreadyAdded: 'The folder "%{folder}" was already added',
folderAdded: {
0: 'Added %{smart_count} file from %{folder}',
1: 'Added %{smart_count} files from %{folder}'
}
}
};
this.defaultLocale = locale;
const defaultOptions = {

@@ -344,3 +293,7 @@ id: 'uppy',

emit(event, ...args) {
emit(event) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
_classPrivateFieldLooseBase(this, _emitter)[_emitter].emit(event, ...args);

@@ -577,5 +530,8 @@ }

const files = Object.values(filesObject);
const inProgressFiles = files.filter(({
progress
}) => !progress.uploadComplete && progress.uploadStarted);
const inProgressFiles = files.filter(_ref => {
let {
progress
} = _ref;
return !progress.uploadComplete && progress.uploadStarted;
});
const newFiles = files.filter(file => !file.progress.uploadStarted);

@@ -844,3 +800,7 @@ const startedFiles = files.filter(file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess);

removeFile(fileID, reason = null) {
removeFile(fileID, reason) {
if (reason === void 0) {
reason = null;
}
this.removeFiles([fileID], reason);

@@ -1231,3 +1191,11 @@ }

info(message, type = 'info', duration = 3000) {
info(message, type, duration) {
if (type === void 0) {
type = 'info';
}
if (duration === void 0) {
duration = 3000;
}
const isComplexMessage = typeof message === 'object';

@@ -1296,4 +1264,4 @@ this.setState({

[_Symbol$for2](...args) {
return _classPrivateFieldLooseBase(this, _createUpload)[_createUpload](...args);
[_Symbol$for2]() {
return _classPrivateFieldLooseBase(this, _createUpload)[_createUpload](...arguments);
}

@@ -1397,3 +1365,7 @@

function _checkRestrictions2(file, files = this.getFiles()) {
function _checkRestrictions2(file, files) {
if (files === void 0) {
files = this.getFiles();
}
const {

@@ -1530,7 +1502,8 @@ maxFileSize,

function _showOrLogErrorAndThrow2(err, {
showInformer = true,
file = null,
throwErr = true
} = {}) {
function _showOrLogErrorAndThrow2(err, _temp) {
let {
showInformer = true,
file = null,
throwErr = true
} = _temp === void 0 ? {} : _temp;
const message = typeof err === 'object' ? err.message : err;

@@ -1840,3 +1813,7 @@ const details = typeof err === 'object' && err.details ? err.details : ''; // Restriction errors should be logged, but not as errors,

function _createUpload2(fileIDs, opts = {}) {
function _createUpload2(fileIDs, opts) {
if (opts === void 0) {
opts = {};
}
// uppy.retryAll sets this to true — when retrying we want to ignore `allowNewUpload: false`

@@ -1895,3 +1872,3 @@ const {

const restoreStep = currentUpload.step || 0;
const steps = [...Array.from(_classPrivateFieldLooseBase(this, _preProcessors)[_preProcessors]), ...Array.from(_classPrivateFieldLooseBase(this, _uploaders)[_uploaders]), ...Array.from(_classPrivateFieldLooseBase(this, _postProcessors)[_postProcessors])];
const steps = [..._classPrivateFieldLooseBase(this, _preProcessors)[_preProcessors], ..._classPrivateFieldLooseBase(this, _uploaders)[_uploaders], ..._classPrivateFieldLooseBase(this, _postProcessors)[_postProcessors]];

@@ -1980,3 +1957,3 @@ try {

Uppy.VERSION = "2.1.2";
Uppy.VERSION = "2.1.3";
module.exports = Uppy;
{
"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": "2.1.2",
"version": "2.1.3",
"license": "MIT",

@@ -24,4 +24,4 @@ "main": "lib/index.js",

"@transloadit/prettier-bytes": "0.0.7",
"@uppy/store-default": "^2.0.2",
"@uppy/utils": "^4.0.3",
"@uppy/store-default": "^2.0.3",
"@uppy/utils": "^4.0.4",
"lodash.throttle": "^4.1.1",

@@ -28,0 +28,0 @@ "mime-match": "^1.0.2",

@@ -19,2 +19,4 @@ /* global AggregateError */

const locale = require('./locale')
// Exported from here.

@@ -72,56 +74,3 @@ class RestrictionError extends Error {

constructor (opts) {
this.defaultLocale = {
strings: {
addBulkFilesFailed: {
0: 'Failed to add %{smart_count} file due to an internal error',
1: 'Failed to add %{smart_count} files due to internal errors',
},
youCanOnlyUploadX: {
0: 'You can only upload %{smart_count} file',
1: 'You can only upload %{smart_count} files',
},
youHaveToAtLeastSelectX: {
0: 'You have to select at least %{smart_count} file',
1: 'You have to select at least %{smart_count} files',
},
exceedsSize: '%{file} exceeds maximum allowed size of %{size}',
missingRequiredMetaField: 'Missing required meta fields',
missingRequiredMetaFieldOnFile: 'Missing required meta fields in %{fileName}',
inferiorSize: 'This file is smaller than the allowed size of %{size}',
youCanOnlyUploadFileTypes: 'You can only upload: %{types}',
noMoreFilesAllowed: 'Cannot add more files',
noDuplicates: 'Cannot add the duplicate file \'%{fileName}\', it already exists',
companionError: 'Connection with Companion failed',
authAborted: 'Authentication aborted',
companionUnauthorizeHint: 'To unauthorize to your %{provider} account, please go to %{url}',
failedToUpload: 'Failed to upload %{file}',
noInternetConnection: 'No Internet connection',
connectedToInternet: 'Connected to the Internet',
// Strings for remote providers
noFilesFound: 'You have no files or folders here',
selectX: {
0: 'Select %{smart_count}',
1: 'Select %{smart_count}',
},
allFilesFromFolderNamed: 'All files from folder %{name}',
openFolderNamed: 'Open folder %{name}',
cancel: 'Cancel',
logOut: 'Log out',
filter: 'Filter',
resetFilter: 'Reset filter',
loading: 'Loading...',
authenticateWithTitle: 'Please authenticate with %{pluginName} to select files',
authenticateWith: 'Connect to %{pluginName}',
signInWithGoogle: 'Sign in with Google',
searchImages: 'Search for images',
enterTextToSearch: 'Enter text to search for images',
backToSearch: 'Back to Search',
emptyFolderAdded: 'No files were added from empty folder',
folderAlreadyAdded: 'The folder "%{folder}" was already added',
folderAdded: {
0: 'Added %{smart_count} file from %{folder}',
1: 'Added %{smart_count} files from %{folder}',
},
},
}
this.defaultLocale = locale

@@ -424,3 +373,3 @@ const defaultOptions = {

const startedFiles = files.filter(
file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess
file => file.progress.uploadStarted || file.progress.preprocess || file.progress.postprocess,
)

@@ -1311,6 +1260,5 @@ const uploadStartedFiles = files.filter((file) => file.progress.uploadStarted)

updateOnlineStatus () {
const online
= typeof window.navigator.onLine !== 'undefined'
? window.navigator.onLine
: true
const online = typeof window.navigator.onLine !== 'undefined'
? window.navigator.onLine
: true
if (!online) {

@@ -1618,5 +1566,5 @@ this.emit('is-offline')

const steps = [
...Array.from(this.#preProcessors),
...Array.from(this.#uploaders),
...Array.from(this.#postProcessors),
...this.#preProcessors,
...this.#uploaders,
...this.#postProcessors,
]

@@ -1623,0 +1571,0 @@ try {

@@ -479,3 +479,3 @@ /* eslint no-console: "off", no-restricted-syntax: "off" */

expect(postprocessor1.mock.calls[0][0][0].substring(0, 17)).toEqual(
fileId.substring(0, 17)
fileId.substring(0, 17),
)

@@ -485,3 +485,3 @@

expect(postprocessor2.mock.calls[0][0][0].substring(0, 17)).toEqual(
fileId.substring(0, 17)
fileId.substring(0, 17),
)

@@ -680,3 +680,3 @@ })

}).toThrow(
"Cannot add the duplicate file 'foo.jpg', it already exists"
"Cannot add the duplicate file 'foo.jpg', it already exists",
)

@@ -723,3 +723,3 @@ expect(core.getFiles().length).toEqual(1)

}).toThrow(
'Cannot add the file because onBeforeFileAdded returned false.'
'Cannot add the file because onBeforeFileAdded returned false.',
)

@@ -749,3 +749,3 @@ expect(core.getFiles().length).toEqual(0)

}).toThrow(
/Cannot add more files/
/Cannot add more files/,
)

@@ -773,3 +773,3 @@ })

}).toThrow(
/Cannot add more files/
/Cannot add more files/,
)

@@ -965,3 +965,3 @@ })

await expect(core.upload()).rejects.toThrow(
/Cannot create a new upload: already uploading\./
/Cannot create a new upload: already uploading\./,
)

@@ -1670,3 +1670,3 @@ })

}).toThrowError(
new Error('foo1.jpg exceeds maximum allowed size of 33 KB')
new Error('foo1.jpg exceeds maximum allowed size of 33 KB'),
)

@@ -1707,3 +1707,3 @@ })

reason: 'This file is smaller than the allowed size of 293 KB',
}
},
)

@@ -1714,3 +1714,3 @@ expect(validateRestrictions2).toMatchObject(

reason: 'You can only upload: image/png',
}
},
)

@@ -1788,3 +1788,3 @@ })

writable: true,
}
},
)

@@ -1791,0 +1791,0 @@ }

/* eslint-disable */
import type { Locale } from '@uppy/core'
import type { Locale } from '@uppy/core'
type CoreLocale = Locale<
| 'addBulkFilesFailed'
type CoreLocale = Locale<
| 'addBulkFilesFailed'
| 'youCanOnlyUploadX'

@@ -39,4 +39,4 @@ | 'youHaveToAtLeastSelectX'

| 'folderAdded'
>
>
export default CoreLocale
export default CoreLocale

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

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