@uppy/xhr-upload
Advanced tools
Comparing version 2.1.1 to 3.0.0-beta
@@ -1,31 +0,17 @@ | ||
"use strict"; | ||
var _nonSecure = require("nanoid/non-secure"); | ||
var _companionClient = require("@uppy/companion-client"); | ||
var _RateLimitedQueue = require("@uppy/utils/lib/RateLimitedQueue"); | ||
const BasePlugin = require("@uppy/core/lib/BasePlugin"); | ||
const emitSocketProgress = require("@uppy/utils/lib/emitSocketProgress"); | ||
const getSocketHost = require("@uppy/utils/lib/getSocketHost"); | ||
const settle = require("@uppy/utils/lib/settle"); | ||
const EventTracker = require("@uppy/utils/lib/EventTracker"); | ||
const ProgressTimeout = require("@uppy/utils/lib/ProgressTimeout"); | ||
const NetworkError = require("@uppy/utils/lib/NetworkError"); | ||
const isNetworkError = require("@uppy/utils/lib/isNetworkError"); | ||
import BasePlugin from '@uppy/core/lib/BasePlugin'; | ||
import { nanoid } from 'nanoid/non-secure'; | ||
import { Provider, RequestClient, Socket } from '@uppy/companion-client'; | ||
import emitSocketProgress from '@uppy/utils/lib/emitSocketProgress'; | ||
import getSocketHost from '@uppy/utils/lib/getSocketHost'; | ||
import settle from '@uppy/utils/lib/settle'; | ||
import EventTracker from '@uppy/utils/lib/EventTracker'; | ||
import ProgressTimeout from '@uppy/utils/lib/ProgressTimeout'; | ||
import { RateLimitedQueue, internalRateLimitedQueue } from '@uppy/utils/lib/RateLimitedQueue'; | ||
import NetworkError from '@uppy/utils/lib/NetworkError'; | ||
import isNetworkError from '@uppy/utils/lib/isNetworkError'; | ||
const packageJson = { | ||
"version": "2.1.1" | ||
"version": "3.0.0-beta" | ||
}; | ||
import locale from './locale.js'; | ||
const locale = require("./locale.js"); | ||
function buildResponseError(xhr, err) { | ||
@@ -67,3 +53,3 @@ let error = err; // No error message | ||
class XHRUpload extends BasePlugin { | ||
export default class XHRUpload extends BasePlugin { | ||
// eslint-disable-next-line global-require | ||
@@ -136,6 +122,6 @@ constructor(uppy, opts) { | ||
if (_RateLimitedQueue.internalRateLimitedQueue in this.opts) { | ||
this.requests = this.opts[_RateLimitedQueue.internalRateLimitedQueue]; | ||
if (internalRateLimitedQueue in this.opts) { | ||
this.requests = this.opts[internalRateLimitedQueue]; | ||
} else { | ||
this.requests = new _RateLimitedQueue.RateLimitedQueue(this.opts.limit); | ||
this.requests = new RateLimitedQueue(this.opts.limit); | ||
} | ||
@@ -243,3 +229,3 @@ | ||
}); | ||
const id = (0, _nonSecure.nanoid)(); | ||
const id = nanoid(); | ||
xhr.upload.addEventListener('loadstart', () => { | ||
@@ -365,3 +351,3 @@ this.uppy.log(`[XHRUpload] ${id} started`); | ||
}); | ||
const Client = file.remote.providerOptions.provider ? _companionClient.Provider : _companionClient.RequestClient; | ||
const Client = file.remote.providerOptions.provider ? Provider : RequestClient; | ||
const client = new Client(this.uppy, file.remote.providerOptions); | ||
@@ -381,3 +367,3 @@ client.post(file.remote.url, { ...file.remote.body, | ||
const host = getSocketHost(file.remote.companionUrl); | ||
const socket = new _companionClient.Socket({ | ||
const socket = new Socket({ | ||
target: `${host}/api/${token}`, | ||
@@ -615,3 +601,3 @@ autoOpen: false | ||
if (this.opts.limit === 0 && !this.opts[_RateLimitedQueue.internalRateLimitedQueue]) { | ||
if (this.opts.limit === 0 && !this.opts[internalRateLimitedQueue]) { | ||
this.uppy.log('[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0', 'warning'); | ||
@@ -672,4 +658,2 @@ } | ||
} | ||
XHRUpload.VERSION = packageJson.version; | ||
module.exports = XHRUpload; | ||
XHRUpload.VERSION = packageJson.version; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
module.exports = { | ||
export default { | ||
strings: { | ||
@@ -5,0 +3,0 @@ // Shown in the Informer if an upload is being canceled because it stalled for too long. |
{ | ||
"name": "@uppy/xhr-upload", | ||
"description": "Plain and simple classic HTML multipart form uploads with Uppy, as well as uploads using the HTTP PUT method.", | ||
"version": "2.1.1", | ||
"version": "3.0.0-beta", | ||
"license": "MIT", | ||
@@ -28,4 +28,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@uppy/companion-client": "^2.2.0", | ||
"@uppy/utils": "^4.1.0", | ||
"@uppy/companion-client": "^3.0.0-beta", | ||
"@uppy/utils": "^5.0.0-beta", | ||
"nanoid": "^3.1.25" | ||
@@ -38,4 +38,5 @@ }, | ||
"peerDependencies": { | ||
"@uppy/core": "^2.3.0" | ||
} | ||
"@uppy/core": "^3.0.0-beta" | ||
}, | ||
"stableVersion": "2.1.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
93723
14
1269
1
+ Added@transloadit/prettier-bytes@0.3.5(transitive)
+ Added@types/retry@0.12.2(transitive)
+ Added@uppy/companion-client@3.8.2(transitive)
+ Added@uppy/core@3.13.1(transitive)
+ Added@uppy/store-default@3.2.2(transitive)
+ Added@uppy/utils@5.9.0(transitive)
+ Addedis-network-error@1.1.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addednanoid@4.0.2(transitive)
+ Addedp-retry@6.2.1(transitive)
+ Addedretry@0.13.1(transitive)
- Removed@transloadit/prettier-bytes@0.0.7(transitive)
- Removed@uppy/companion-client@2.2.2(transitive)
- Removed@uppy/core@2.3.4(transitive)
- Removed@uppy/store-default@2.1.1(transitive)
- Removed@uppy/utils@4.1.3(transitive)
- Removedlodash.throttle@4.1.1(transitive)
Updated@uppy/utils@^5.0.0-beta