diff --git a/.eslintrc.js b/.eslintrc.js index 62b99a4a3d..ca87a3fbc8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -197,8 +197,8 @@ module.exports = { // Packages that have switched to ESM sources: 'packages/@uppy/audio/src/**/*.js', - 'packages/@uppy/aws-s3/src/**/*.js', 'packages/@uppy/aws-s3-multipart/src/**/*.js', + 'packages/@uppy/aws-s3/src/**/*.js', 'packages/@uppy/box/src/**/*.js', 'packages/@uppy/companion-client/src/**/*.js', 'packages/@uppy/compressor/src/**/*.js', @@ -222,16 +222,17 @@ module.exports = { 'packages/@uppy/provider-views/src/**/*.js', 'packages/@uppy/react/src/**/*.js', 'packages/@uppy/redux-dev-tools/src/**/*.js', + 'packages/@uppy/remote-sources/src/**/*.js', 'packages/@uppy/screen-capture/src/**/*.js', 'packages/@uppy/status-bar/src/**/*.js', 'packages/@uppy/store-default/src/**/*.js', 'packages/@uppy/store-redux/src/**/*.js', - 'packages/@uppy/svelte/src/**/*.js', 'packages/@uppy/svelte/rollup.config.js', + 'packages/@uppy/svelte/src/**/*.js', 'packages/@uppy/thumbnail-generator/src/**/*.js', + 'packages/@uppy/transloadit/src/**/*.js', 'packages/@uppy/tus/src/**/*.js', 'packages/@uppy/unsplash/src/**/*.js', - 'packages/@uppy/transloadit/src/**/*.js', 'packages/@uppy/url/src/**/*.js', 'packages/@uppy/utils/src/**/*.js', 'packages/@uppy/vue/src/**/*.js', diff --git a/.github/workflows/release-beta-candidate.yml b/.github/workflows/release-beta-candidate.yml index 1187a6ee9d..aafc5fbf11 100644 --- a/.github/workflows/release-beta-candidate.yml +++ b/.github/workflows/release-beta-candidate.yml @@ -14,13 +14,8 @@ jobs: - name: Checkout sources uses: actions/checkout@v3 with: - branch: release - - name: Rebase - run: | - git fetch origin ${{ env.BETA_BRANCH }} --depth=1 - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git rebase FETCH_HEAD + branch: release-beta + fetch-depth: 3 # the prepare commit, the merge commit, and the base ones. - name: Get yarn cache directory path id: yarn-cache-dir-path run: echo "::set-output name=dir::$(corepack yarn config get cacheFolder)" @@ -56,6 +51,8 @@ jobs: echo "This is a release candidate for the following packages:" >> commitMessage echo >> commitMessage jq -r 'map("- `"+.ident+"`: "+.oldVersion+" -> "+.newVersion) | join("\n") ' < releases.json >> commitMessage + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" git commit -n --amend --file commitMessage - name: Open Pull Request id: pr_opening diff --git a/BUNDLE-README.md b/BUNDLE-README.md index f11f0ad103..53105fa168 100644 --- a/BUNDLE-README.md +++ b/BUNDLE-README.md @@ -1,7 +1,7 @@ # Uppy Hi, thanks for trying out the bundled version of the Uppy File Uploader. You can use -this from a CDN (``) or bundle it with your webapp. +this from a CDN (``) or bundle it with your webapp. Note that the recommended way to use Uppy is to install it with yarn/npm and use a bundler like Webpack so that you can create a smaller custom build with only the diff --git a/CHANGELOG.md b/CHANGELOG.md index c597d1b62a..4aa30d8253 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,40 @@ Please add your entries in this format: In the current stage we aim to release a new version at least every month. +## 3.0.0-beta.1 + +Released: 2022-06-09 + +| Package | Version | Package | Version | +| ------------------------- | ------------ | ------------------------- | ------------ | +| uppy | 3.0.0-beta.1 | @uppy/google-drive | 3.0.0-beta.1 | +| @uppy/audio | 1.0.0-beta.1 | @uppy/informer | 3.0.0-beta.1 | +| @uppy/box | 2.0.0-beta.1 | @uppy/instagram | 3.0.0-beta.1 | +| @uppy/compressor | 1.0.0-beta.1 | @uppy/locales | 3.0.0-beta.1 | +| @uppy/drop-target | 2.0.0-beta.1 | @uppy/onedrive | 3.0.0-beta.1 | +| @uppy/image-editor | 2.0.0-beta.1 | @uppy/progress-bar | 3.0.0-beta.1 | +| @uppy/remote-sources | 1.0.0-beta.1 | @uppy/provider-views | 3.0.0-beta.1 | +| @uppy/svelte | 2.0.0-beta.1 | @uppy/react | 3.0.0-beta.1 | +| @uppy/vue | 1.0.0-beta.1 | @uppy/redux-dev-tools | 3.0.0-beta.1 | +| @uppy/zoom | 2.0.0-beta.1 | @uppy/robodog | 3.0.0-beta.1 | +| @uppy/aws-s3 | 3.0.0-beta.1 | @uppy/screen-capture | 3.0.0-beta.1 | +| @uppy/aws-s3-multipart | 3.0.0-beta.1 | @uppy/status-bar | 3.0.0-beta.1 | +| @uppy/companion-client | 3.0.0-beta.1 | @uppy/store-default | 3.0.0-beta.1 | +| @uppy/core | 3.0.0-beta.1 | @uppy/store-redux | 3.0.0-beta.1 | +| @uppy/dashboard | 3.0.0-beta.1 | @uppy/thumbnail-generator | 3.0.0-beta.1 | +| @uppy/drag-drop | 3.0.0-beta.1 | @uppy/transloadit | 3.0.0-beta.1 | +| @uppy/dropbox | 3.0.0-beta.1 | @uppy/tus | 3.0.0-beta.1 | +| @uppy/facebook | 3.0.0-beta.1 | @uppy/unsplash | 3.0.0-beta.1 | +| @uppy/file-input | 3.0.0-beta.1 | @uppy/url | 3.0.0-beta.1 | +| @uppy/form | 3.0.0-beta.1 | @uppy/webcam | 3.0.0-beta.1 | +| @uppy/golden-retriever | 3.0.0-beta.1 | @uppy/xhr-upload | 3.0.0-beta.1 | + +- meta: improve release process for beta branch (Antoine du Hamel / #3809) +- uppy: refactor to ESM (Antoine du Hamel / #3807) +- @uppy/core,@uppy/dashboard: fix types for some events (Antoine du Hamel / #3812) +- example: update Vue2 example (Antoine du Hamel / #3802) + + ## 3.0.0-beta Released: 2022-05-30 @@ -50,6 +84,47 @@ Released: 2022-05-30 - @uppy/transloadit: remove IE 10 hack (Antoine du Hamel / #3777) +## 2.12.1 + +Released: 2022-06-09 + +| Package | Version | Package | Version | +| ----------------- | ------- | ----------------- | ------- | +| @uppy/transloadit | 2.3.1 | uppy | 2.12.1 | +| @uppy/robodog | 2.8.1 | | | + +- @uppy/transloadit: fix `COMPANION_PATTERN` export (Antoine du Hamel / #3820) +- meta: fix URL generation in the release script (Antoine du Hamel) + + +## 2.12.0 + +Released: 2022-06-07 + +| Package | Version | Package | Version | +| ---------------------- | ------- | ---------------------- | ------- | +| @uppy/aws-s3 | 2.2.1 | @uppy/tus | 2.4.1 | +| @uppy/aws-s3-multipart | 2.4.1 | @uppy/url | 2.2.0 | +| @uppy/companion-client | 2.2.1 | @uppy/xhr-upload | 2.1.2 | +| @uppy/core | 2.3.1 | @uppy/robodog | 2.8.0 | +| @uppy/react | 2.2.2 | uppy | 2.12.0 | +| @uppy/remote-sources | 0.1.0 | | | + +- @uppy/remote-sources: Add @uppy/remote-sources preset/plugin (Artur Paikin / #3676) +- @uppy/react: Reset uppy instance when React component is unmounted (Tomasz Pęksa / #3814) +- @uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/tus: queue socket token requests for remote files (Merlijn Vos / #3797) +- @uppy/xhr-upload: replace `ev.target.status` with `xhr.status` (Wes Sankey / #3782) +- @uppy/core: fix `TypeError` when file was deleted (Antoine du Hamel / #3811) +- @uppy/robodog: fix linter warnings (Antoine du Hamel / #3808) +- meta: fix GHA workflow for prereleases (Antoine du Hamel) +- @uppy/aws-s3-multipart: allow `companionHeaders` to be modified with `setOptions` (Paulo Lemos Neto / #3770) +- @uppy/url: enable passing optional meta data to `addFile` (Brad Edelman / #3788) +- @uppy/url: fix `getFileNameFromUrl` (Brad Edelman / #3804) +- @uppy/tus: make onShouldRetry type optional (Merlijn Vos / #3800) +- doc: fix React examples (Antoine du Hamel / #3799) +- meta: add GHA workflow for prereleases (Antoine du Hamel) + + ## 2.11.0 Released: 2022-05-30 diff --git a/README.md b/README.md index 1ffccec54e..fda9163953 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ const uppy = new Uppy({ autoProceed: false }) $ npm install @uppy/core @uppy/dashboard @uppy/tus ``` -Add CSS [uppy.min.css](https://releases.transloadit.com/uppy/v3.0.0-beta/uppy.min.css), either to your HTML page’s `` or include in JS, if your bundler of choice supports it. +Add CSS [uppy.min.css](https://releases.transloadit.com/uppy/v3.0.0-beta.1/uppy.min.css), either to your HTML page’s `` or include in JS, if your bundler of choice supports it. Alternatively, you can also use a pre-built bundle from Transloadit’s CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. @@ -75,10 +75,10 @@ Alternatively, you can also use a pre-built bundle from Transloadit’s CDN: Edg ```html - + - +
@@ -184,7 +184,7 @@ If you’re using Uppy from CDN, those polyfills are already included in the leg bundle, so no need to include anything additionally: ```html - + ``` ## FAQ diff --git a/examples/cdn-example/index.html b/examples/cdn-example/index.html index dd1d71bc22..69d497efb5 100644 --- a/examples/cdn-example/index.html +++ b/examples/cdn-example/index.html @@ -4,11 +4,11 @@ - + - + + + + ``` Then, a global `Robodog` variable will be available. For usage instructions, please see the [main Robodog documentation](https://uppy.io/docs/robodog). diff --git a/packages/@uppy/robodog/package.json b/packages/@uppy/robodog/package.json index f0f33c7e63..025adcc928 100644 --- a/packages/@uppy/robodog/package.json +++ b/packages/@uppy/robodog/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/robodog", "description": "Transloadit SDK for browsers based on Uppy", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "jsnext:main": "src/index.js", diff --git a/packages/@uppy/robodog/src/TransloaditResultsPlugin.js b/packages/@uppy/robodog/src/TransloaditResultsPlugin.js index 6ad2795555..7bad3aca70 100644 --- a/packages/@uppy/robodog/src/TransloaditResultsPlugin.js +++ b/packages/@uppy/robodog/src/TransloaditResultsPlugin.js @@ -26,9 +26,9 @@ class TransloaditResultsPlugin extends BasePlugin { assemblies.forEach((assembly) => { Object.keys(assembly.results).forEach((stepName) => { const results = assembly.results[stepName] - results.forEach((result) => { + results.forEach((resultObject) => { assemblyResults.push({ - ...result, + ...resultObject, assemblyId: assembly.assembly_id, stepName, }) diff --git a/packages/@uppy/robodog/src/addProviders.js b/packages/@uppy/robodog/src/addProviders.js index 0f00dc22e3..adab8a4643 100644 --- a/packages/@uppy/robodog/src/addProviders.js +++ b/packages/@uppy/robodog/src/addProviders.js @@ -1,3 +1,4 @@ +/* eslint-disable global-require */ const Transloadit = require('@uppy/transloadit') const has = require('@uppy/utils/lib/hasProperty') @@ -39,6 +40,7 @@ function addRemoteProvider (uppy, name, opts) { companionAllowedHosts: Transloadit.COMPANION_PATTERN, } + // eslint-disable-next-line no-shadow remoteProviderOptionNames.forEach((name) => { if (has(opts, name)) providerOptions[name] = opts[name] }) @@ -68,6 +70,7 @@ function addLocalProvider (uppy, name, opts) { const Provider = localProviders[name] const providerOptions = {} + // eslint-disable-next-line no-shadow localProviderOptionNames.forEach((name) => { if (has(opts, name)) providerOptions[name] = opts[name] }) diff --git a/packages/@uppy/robodog/src/form.js b/packages/@uppy/robodog/src/form.js index 68cf15ef68..16a32c6c11 100644 --- a/packages/@uppy/robodog/src/form.js +++ b/packages/@uppy/robodog/src/form.js @@ -24,6 +24,7 @@ function mergeDefaultLocale (defaults, userProvided = {}) { function form (target, opts) { if (!opts) throw new TypeError('robodog.form: must provide an options object') + // eslint-disable-next-line no-param-reassign opts = { ...opts, locale: mergeDefaultLocale(defaultLocaleStrings, opts.locale), diff --git a/packages/@uppy/robodog/src/index.js b/packages/@uppy/robodog/src/index.js index eae67f0152..ebd27836fb 100644 --- a/packages/@uppy/robodog/src/index.js +++ b/packages/@uppy/robodog/src/index.js @@ -8,5 +8,7 @@ module.exports = { form, pick, upload, + // We need to keep the require here because we're using `babel-plugin-inline-package-json`. + // eslint-disable-next-line global-require VERSION: require('../package.json').version, } diff --git a/packages/@uppy/screen-capture/package.json b/packages/@uppy/screen-capture/package.json index 742703790b..117f6e974c 100644 --- a/packages/@uppy/screen-capture/package.json +++ b/packages/@uppy/screen-capture/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/screen-capture", "description": "Uppy plugin that captures video from display or application.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/status-bar/package.json b/packages/@uppy/status-bar/package.json index c2c9d0b4c1..21ebc200cc 100644 --- a/packages/@uppy/status-bar/package.json +++ b/packages/@uppy/status-bar/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/status-bar", "description": "A progress bar for Uppy, with many bells and whistles.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/store-default/package.json b/packages/@uppy/store-default/package.json index 77b7565ecc..fd4b78a841 100644 --- a/packages/@uppy/store-default/package.json +++ b/packages/@uppy/store-default/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/store-default", "description": "The default simple object-based store for Uppy.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/store-redux/package.json b/packages/@uppy/store-redux/package.json index a60d394537..d31adc6086 100644 --- a/packages/@uppy/store-redux/package.json +++ b/packages/@uppy/store-redux/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/store-redux", "description": "Make Uppy use your existing Redux store.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/svelte/package.json b/packages/@uppy/svelte/package.json index 31dd624979..7d9d110684 100644 --- a/packages/@uppy/svelte/package.json +++ b/packages/@uppy/svelte/package.json @@ -3,7 +3,7 @@ "svelte": "src/index.js", "module": "dist/index.mjs", "main": "dist/index.js", - "version": "3.0.0-beta", + "version": "2.0.0-beta.1", "scripts": { "build": "rollup -c", "prepublishOnly": "yarn run build", diff --git a/packages/@uppy/thumbnail-generator/package.json b/packages/@uppy/thumbnail-generator/package.json index 0a46318080..bfad4041f7 100644 --- a/packages/@uppy/thumbnail-generator/package.json +++ b/packages/@uppy/thumbnail-generator/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/thumbnail-generator", "description": "Uppy plugin that generates small previews of images to show on your upload UI.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/transloadit/CHANGELOG.md b/packages/@uppy/transloadit/CHANGELOG.md index 6b3fb128c5..e3f6e03317 100644 --- a/packages/@uppy/transloadit/CHANGELOG.md +++ b/packages/@uppy/transloadit/CHANGELOG.md @@ -7,6 +7,13 @@ Included in: Uppy v3.0.0-beta - @uppy/transloadit: remove IE 10 hack (Antoine du Hamel / #3777) +## 2.3.1 + +Released: 2022-06-09 +Included in: Uppy v2.12.1 + +- @uppy/transloadit: fix `COMPANION_PATTERN` export (Antoine du Hamel / #3820) + ## 2.3.0 Released: 2022-05-30 diff --git a/packages/@uppy/transloadit/package.json b/packages/@uppy/transloadit/package.json index 1f099d3aa2..43385a5bd6 100644 --- a/packages/@uppy/transloadit/package.json +++ b/packages/@uppy/transloadit/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/transloadit", "description": "The Transloadit plugin can be used to upload files to Transloadit for all kinds of processing, such as transcoding video, resizing images, zipping/unzipping, and more", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/transloadit/src/index.js b/packages/@uppy/transloadit/src/index.js index 4f8ebcd9e1..f5398854b7 100644 --- a/packages/@uppy/transloadit/src/index.js +++ b/packages/@uppy/transloadit/src/index.js @@ -835,12 +835,14 @@ export default class Transloadit extends BasePlugin { } export { - COMPANION, ALLOWED_COMPANION_PATTERN, + COMPANION, + ALLOWED_COMPANION_PATTERN as COMPANION_PATTERN, } -// Backward compatibility: we want `COMPANION` and `ALLOWED_COMPANION_PATTERN` +// Backward compatibility: we want `COMPANION` and `COMPANION_PATTERN` // to keep being accessible as static properties of `Transloadit` to avoid a // breaking change. -Transloadit.COMPANION = COMPANION // TODO: remove this line on the next major Transloadit.ALLOWED_COMPANION_PATTERN = ALLOWED_COMPANION_PATTERN // TODO: remove this line on the next major +Transloadit.COMPANION = COMPANION // TODO: remove this line on the next major +Transloadit.COMPANION_PATTERN = ALLOWED_COMPANION_PATTERN // TODO: remove this line on the next major diff --git a/packages/@uppy/tus/CHANGELOG.md b/packages/@uppy/tus/CHANGELOG.md index 1663929eba..fccc63d9a9 100644 --- a/packages/@uppy/tus/CHANGELOG.md +++ b/packages/@uppy/tus/CHANGELOG.md @@ -1,5 +1,13 @@ # @uppy/tus +## 2.4.1 + +Released: 2022-06-07 +Included in: Uppy v2.12.0 + +- @uppy/aws-s3-multipart,@uppy/aws-s3,@uppy/tus: queue socket token requests for remote files (Merlijn Vos / #3797) +- @uppy/tus: make onShouldRetry type optional (Merlijn Vos / #3800) + ## 2.4.0 Released: 2022-05-30 diff --git a/packages/@uppy/tus/package.json b/packages/@uppy/tus/package.json index d490cc32c2..8e50bf4da9 100644 --- a/packages/@uppy/tus/package.json +++ b/packages/@uppy/tus/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/tus", "description": "Resumable uploads for Uppy using Tus.io", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/tus/src/index.js b/packages/@uppy/tus/src/index.js index 00abd40167..57f9c3bdfc 100644 --- a/packages/@uppy/tus/src/index.js +++ b/packages/@uppy/tus/src/index.js @@ -57,6 +57,8 @@ export default class Tus extends BasePlugin { #retryDelayIterator + #queueRequestSocketToken + /** * @param {Uppy} uppy * @param {TusOptions} opts @@ -97,6 +99,7 @@ export default class Tus extends BasePlugin { this.handleResetProgress = this.handleResetProgress.bind(this) this.handleUpload = this.handleUpload.bind(this) + this.#queueRequestSocketToken = this.requests.wrapPromiseFunction(this.#requestSocketToken) } handleResetProgress () { @@ -427,43 +430,48 @@ export default class Tus extends BasePlugin { }) } - /** - * @param {UppyFile} file for use with upload - * @returns {Promise} - */ - async uploadRemote (file) { - this.resetUploaderReferences(file.id) - + #requestSocketToken = async (file) => { + const Client = file.remote.providerOptions.provider ? Provider : RequestClient + const client = new Client(this.uppy, file.remote.providerOptions) const opts = { ...this.opts } + if (file.tus) { // Install file-specific upload overrides. Object.assign(opts, file.tus) } - this.uppy.emit('upload-started', file) - this.uppy.log(file.remote.url) + const res = await client.post(file.remote.url, { + ...file.remote.body, + endpoint: opts.endpoint, + uploadUrl: opts.uploadUrl, + protocol: 'tus', + size: file.data.size, + headers: opts.headers, + metadata: file.meta, + }) + return res.token + } - if (file.serverToken) { - await this.connectToServerSocket(file) - return - } + /** + * @param {UppyFile} file for use with upload + * @returns {Promise} + */ + async uploadRemote (file) { + this.resetUploaderReferences(file.id) - const Client = file.remote.providerOptions.provider ? Provider : RequestClient - const client = new Client(this.uppy, file.remote.providerOptions) + // Don't double-emit upload-started for Golden Retriever-restored files that were already started + if (!file.progress.uploadStarted || !file.isRestored) { + this.uppy.emit('upload-started', file) + } try { - // !! cancellation is NOT supported at this stage yet - const res = await client.post(file.remote.url, { - ...file.remote.body, - endpoint: opts.endpoint, - uploadUrl: opts.uploadUrl, - protocol: 'tus', - size: file.data.size, - headers: opts.headers, - metadata: file.meta, - }) - this.uppy.setFileState(file.id, { serverToken: res.token }) - await this.connectToServerSocket(this.uppy.getFile(file.id)) + if (file.serverToken) { + return this.connectToServerSocket(file) + } + const serverToken = await this.#queueRequestSocketToken(file) + + this.uppy.setFileState(file.id, { serverToken }) + return this.connectToServerSocket(this.uppy.getFile(file.id)) } catch (err) { this.uppy.emit('upload-error', file, err) throw err @@ -482,7 +490,7 @@ export default class Tus extends BasePlugin { return new Promise((resolve, reject) => { const token = file.serverToken const host = getSocketHost(file.remote.companionUrl) - const socket = new Socket({ target: `${host}/api/${token}`, autoOpen: false }) + const socket = new Socket({ target: `${host}/api/${token}` }) this.uploaderSockets[file.id] = socket this.uploaderEvents[file.id] = new EventTracker(this.uppy) @@ -591,7 +599,6 @@ export default class Tus extends BasePlugin { }) queuedRequest = this.requests.run(() => { - socket.open() if (file.isPaused) { socket.send('pause', {}) } diff --git a/packages/@uppy/tus/types/index.d.ts b/packages/@uppy/tus/types/index.d.ts index 6753d750c4..19c954b9a8 100644 --- a/packages/@uppy/tus/types/index.d.ts +++ b/packages/@uppy/tus/types/index.d.ts @@ -20,7 +20,7 @@ export interface TusOptions extends PluginOptions, TusUploadOptions { limit?: number useFastRemoteRetry?: boolean withCredentials?: boolean - onShouldRetry: (err: Error | undefined, retryAttempt: number, options: TusOptions, next: Next) => boolean + onShouldRetry?: (err: Error | undefined, retryAttempt: number, options: TusOptions, next: Next) => boolean } declare class Tus extends BasePlugin {} diff --git a/packages/@uppy/unsplash/package.json b/packages/@uppy/unsplash/package.json index 7dbaafc0a8..8579843d11 100644 --- a/packages/@uppy/unsplash/package.json +++ b/packages/@uppy/unsplash/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/unsplash", "description": "Import files from Unsplash, the free stock photography resource, into Uppy", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/url/CHANGELOG.md b/packages/@uppy/url/CHANGELOG.md index e8d2aeda2d..2532c69320 100644 --- a/packages/@uppy/url/CHANGELOG.md +++ b/packages/@uppy/url/CHANGELOG.md @@ -1,5 +1,13 @@ # @uppy/url +## 2.2.0 + +Released: 2022-06-07 +Included in: Uppy v2.12.0 + +- @uppy/url: enable passing optional meta data to `addFile` (Brad Edelman / #3788) +- @uppy/url: fix `getFileNameFromUrl` (Brad Edelman / #3804) + ## 2.1.1 Released: 2022-05-30 diff --git a/packages/@uppy/url/package.json b/packages/@uppy/url/package.json index a735198688..1f9e64c2b7 100644 --- a/packages/@uppy/url/package.json +++ b/packages/@uppy/url/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/url", "description": "The Url plugin lets users import files from the Internet. Paste any URL and it’ll be added!", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/url/src/Url.jsx b/packages/@uppy/url/src/Url.jsx index c5551123f6..00a4c84044 100644 --- a/packages/@uppy/url/src/Url.jsx +++ b/packages/@uppy/url/src/Url.jsx @@ -48,7 +48,8 @@ function checkIfCorrectURL (url) { } function getFileNameFromUrl (url) { - return url.substring(url.lastIndexOf('/') + 1) + const { pathname } = new URL(url) + return pathname.substring(pathname.lastIndexOf('/') + 1) } /** * Url @@ -104,7 +105,7 @@ export default class Url extends UIPlugin { }) } - async addFile (protocollessUrl) { + async addFile (protocollessUrl, optionalMeta = undefined) { const url = this.addProtocolToURL(protocollessUrl) if (!this.checkIfCorrectURL(url)) { this.uppy.log(`[URL] Incorrect URL entered: ${url}`) @@ -116,6 +117,7 @@ export default class Url extends UIPlugin { const meta = await this.getMeta(url) const tagFile = { + meta: optionalMeta, source: this.id, name: this.getFileNameFromUrl(url), type: meta.type, diff --git a/packages/@uppy/url/types/index.d.ts b/packages/@uppy/url/types/index.d.ts index 5494abe291..c923bf0f8f 100644 --- a/packages/@uppy/url/types/index.d.ts +++ b/packages/@uppy/url/types/index.d.ts @@ -1,4 +1,4 @@ -import type { PluginOptions, UIPlugin, PluginTarget } from '@uppy/core' +import type { PluginOptions, UIPlugin, PluginTarget, IndexedObject } from '@uppy/core' import type { RequestClientOptions } from '@uppy/companion-client' import UrlLocale from './generatedLocale' @@ -9,7 +9,7 @@ export interface UrlOptions extends PluginOptions, RequestClientOptions { } declare class Url extends UIPlugin { - public addFile(url: string): undefined | string | never + public addFile(url: string, meta?: IndexedObject): undefined | string | never } export default Url diff --git a/packages/@uppy/vue/package.json b/packages/@uppy/vue/package.json index 1befc3e7e1..0273ea1661 100644 --- a/packages/@uppy/vue/package.json +++ b/packages/@uppy/vue/package.json @@ -1,6 +1,6 @@ { "name": "@uppy/vue", - "version": "3.0.0-beta", + "version": "1.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/webcam/package.json b/packages/@uppy/webcam/package.json index 77bfeb0d8c..fe9daf2778 100644 --- a/packages/@uppy/webcam/package.json +++ b/packages/@uppy/webcam/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/webcam", "description": "Uppy plugin that takes photos or records videos using the device's camera.", - "version": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "style": "dist/style.min.css", diff --git a/packages/@uppy/xhr-upload/CHANGELOG.md b/packages/@uppy/xhr-upload/CHANGELOG.md index 0fe3127c60..db69dad3eb 100644 --- a/packages/@uppy/xhr-upload/CHANGELOG.md +++ b/packages/@uppy/xhr-upload/CHANGELOG.md @@ -1,5 +1,12 @@ # @uppy/xhr-upload +## 2.1.2 + +Released: 2022-06-07 +Included in: Uppy v2.12.0 + +- @uppy/xhr-upload: replace `ev.target.status` with `xhr.status` (Wes Sankey / #3782) + ## 2.1.1 Released: 2022-05-30 diff --git a/packages/@uppy/xhr-upload/package.json b/packages/@uppy/xhr-upload/package.json index 9b86b3a193..66157c2d45 100644 --- a/packages/@uppy/xhr-upload/package.json +++ b/packages/@uppy/xhr-upload/package.json @@ -1,7 +1,7 @@ { "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": "3.0.0-beta", + "version": "3.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/@uppy/xhr-upload/src/index.js b/packages/@uppy/xhr-upload/src/index.js index 688b4ef98f..4e1e9d8611 100644 --- a/packages/@uppy/xhr-upload/src/index.js +++ b/packages/@uppy/xhr-upload/src/index.js @@ -251,7 +251,7 @@ export default class XHRUpload extends BasePlugin { } }) - xhr.addEventListener('load', (ev) => { + xhr.addEventListener('load', () => { this.uppy.log(`[XHRUpload] ${id} finished`) timer.done() queuedRequest.done() @@ -260,12 +260,12 @@ export default class XHRUpload extends BasePlugin { this.uploaderEvents[file.id] = null } - if (opts.validateStatus(ev.target.status, xhr.responseText, xhr)) { + if (opts.validateStatus(xhr.status, xhr.responseText, xhr)) { const body = opts.getResponseData(xhr.responseText, xhr) const uploadURL = body[opts.responseUrlFieldName] const uploadResp = { - status: ev.target.status, + status: xhr.status, body, uploadURL, } @@ -282,7 +282,7 @@ export default class XHRUpload extends BasePlugin { const error = buildResponseError(xhr, opts.getResponseError(xhr.responseText, xhr)) const response = { - status: ev.target.status, + status: xhr.status, body, } diff --git a/packages/@uppy/zoom/package.json b/packages/@uppy/zoom/package.json index 5dbef188b9..a3aa16fc38 100644 --- a/packages/@uppy/zoom/package.json +++ b/packages/@uppy/zoom/package.json @@ -1,7 +1,7 @@ { "name": "@uppy/zoom", "description": "Import files from zoom, into Uppy.", - "version": "3.0.0-beta", + "version": "2.0.0-beta.1", "license": "MIT", "main": "lib/index.js", "types": "types/index.d.ts", diff --git a/packages/uppy/index.mjs b/packages/uppy/index.mjs index c7a0875183..66303203af 100644 --- a/packages/uppy/index.mjs +++ b/packages/uppy/index.mjs @@ -29,6 +29,7 @@ export { default as Facebook } from '@uppy/facebook' export { default as GoogleDrive } from '@uppy/google-drive' export { default as Instagram } from '@uppy/instagram' export { default as OneDrive } from '@uppy/onedrive' +export { default as RemoteSources } from '@uppy/remote-sources' export { default as ScreenCapture } from '@uppy/screen-capture' export { default as Unsplash } from '@uppy/unsplash' export { default as Url } from '@uppy/url' diff --git a/packages/uppy/package.json b/packages/uppy/package.json index d817481585..8e24b826e2 100644 --- a/packages/uppy/package.json +++ b/packages/uppy/package.json @@ -1,7 +1,7 @@ { "name": "uppy", "description": "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", + "version": "3.0.0-beta.1", "license": "MIT", "main": "index.mjs", "module": "index.mjs", diff --git a/private/dev/Dashboard.js b/private/dev/Dashboard.js index 3e882be118..e8014e1ac6 100644 --- a/private/dev/Dashboard.js +++ b/private/dev/Dashboard.js @@ -2,15 +2,7 @@ /* eslint-disable import/no-extraneous-dependencies */ import Uppy from '@uppy/core' import Dashboard from '@uppy/dashboard' -import Instagram from '@uppy/instagram' -import Facebook from '@uppy/facebook' -import OneDrive from '@uppy/onedrive' -import Dropbox from '@uppy/dropbox' -import Box from '@uppy/box' -import GoogleDrive from '@uppy/google-drive' -import Unsplash from '@uppy/unsplash' -import Zoom from '@uppy/zoom' -import Url from '@uppy/url' +import RemoteSources from '@uppy/remote-sources' import Webcam from '@uppy/webcam' import ScreenCapture from '@uppy/screen-capture' import GoldenRetriever from '@uppy/golden-retriever' @@ -83,15 +75,19 @@ export default () => { proudlyDisplayPoweredByUppy: true, note: '2 files, images and video only', }) - .use(GoogleDrive, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Instagram, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Dropbox, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Box, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Facebook, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(OneDrive, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Zoom, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Url, { target: Dashboard, companionUrl: COMPANION_URL }) - .use(Unsplash, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(GoogleDrive, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Instagram, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Dropbox, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Box, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Facebook, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(OneDrive, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Zoom, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Url, { target: Dashboard, companionUrl: COMPANION_URL }) + // .use(Unsplash, { target: Dashboard, companionUrl: COMPANION_URL }) + .use(RemoteSources, { + companionUrl: COMPANION_URL, + sources: ['Box', 'Dropbox', 'Facebook', 'GoogleDrive', 'Instagram', 'OneDrive', 'Unsplash', 'Url'], + }) .use(Webcam, { target: Dashboard, showVideoSourceDropdown: true, diff --git a/private/release/choose-semverness.js b/private/release/choose-semverness.js index 965d20526a..ffce822874 100755 --- a/private/release/choose-semverness.js +++ b/private/release/choose-semverness.js @@ -4,6 +4,7 @@ import { createWriteStream, mkdirSync, readFileSync } from 'node:fs' import { spawnSync } from 'node:child_process' import prompts from 'prompts' +import { TARGET_BRANCH } from './config.js' const ROOT = new URL('../../', import.meta.url) const PACKAGES_FOLDER = new URL('./packages/', ROOT) @@ -87,7 +88,7 @@ export default async function pickSemverness ( `\nHere are the commits that landed on ${name} since previous release:\n${stdout}\n`, ) console.log( - `Check the web UI at https://github.com/transloadit/uppy/tree/main/${encodeURI( + `Check the web UI at https://github.com/transloadit/uppy/tree/${TARGET_BRANCH}/${encodeURI( location, )}.`, ) @@ -147,7 +148,7 @@ export default async function pickSemverness ( `Here are the commits that landed on @uppy/robodog since previous release:\n\n${stdout}\n`, ) console.log( - `Check the web UI at https://github.com/transloadit/uppy/tree/main/${encodeURI( + `Check the web UI at https://github.com/transloadit/uppy/tree/${TARGET_BRANCH}/${encodeURI( location, )}.`, ) diff --git a/website/src/docs/index.md b/website/src/docs/index.md index d964be5e09..21021d7c62 100644 --- a/website/src/docs/index.md +++ b/website/src/docs/index.md @@ -19,12 +19,12 @@ Here’s the simplest example html page with Uppy (it uses a CDN bundle, while w Uppy - +
- + + ``` 2\. Add CSS to ``: ```html - + ``` 3\. Initialize at the bottom of the closing `` tag: @@ -181,5 +181,5 @@ export * from '@uppy/core' If you’re using Uppy from CDN, those polyfills are already included in the bundle, no need to include anything additionally: ```html - + ``` diff --git a/website/src/docs/locales.md b/website/src/docs/locales.md index 0e51331bf8..ea429c8237 100644 --- a/website/src/docs/locales.md +++ b/website/src/docs/locales.md @@ -34,8 +34,8 @@ const uppy = new Uppy({ Add a ` - + + + - - + + ``` Please note that while you may be able to get 2.0 to work in IE11 this way, we do not officially support it anymore. diff --git a/website/src/docs/react-dragdrop.md b/website/src/docs/react-dragdrop.md index cc5cbaa183..69def48a5d 100644 --- a/website/src/docs/react-dragdrop.md +++ b/website/src/docs/react-dragdrop.md @@ -44,20 +44,25 @@ The `` component supports all [DragDrop](/docs/drag-drop/) options a import React from 'react' import { DragDrop } from '@uppy/react' - +export default function MyComponent (props) { + const { uppy } = props + return ( + + ) +} ``` diff --git a/website/src/docs/react-fileinput.md b/website/src/docs/react-fileinput.md index 732f270d05..33b5180425 100644 --- a/website/src/docs/react-fileinput.md +++ b/website/src/docs/react-fileinput.md @@ -44,10 +44,15 @@ The `` component supports all [FileInput](/docs/file-input/) option import React from 'react' import { FileInput } from '@uppy/react' - +export default function MyComponent (props) { + const { uppy } = props + return ( + + ) +} ``` diff --git a/website/src/docs/react-progressbar.md b/website/src/docs/react-progressbar.md index d138aabcfa..54da753196 100644 --- a/website/src/docs/react-progressbar.md +++ b/website/src/docs/react-progressbar.md @@ -44,11 +44,17 @@ The `` component supports all [`@uppy/progress-bar`][] options as import React from 'react' import { ProgressBar } from '@uppy/react' - +export default function MyComponent (props) { + const { uppy } = props + return ( + + ) +} ``` [`@uppy/progress-bar`]: /docs/progress-bar/ diff --git a/website/src/docs/react-statusbar.md b/website/src/docs/react-statusbar.md index a46c9eee9f..4260de6c50 100644 --- a/website/src/docs/react-statusbar.md +++ b/website/src/docs/react-statusbar.md @@ -44,12 +44,18 @@ The `` component supports all [`@uppy/status-bar`][] options as pro import React from 'react' import { StatusBar } from '@uppy/react' - +export default function MyComponent (props) { + const { uppy } = props + return ( + + ) +} ``` [`@uppy/status-bar`]: /docs/status-bar/ diff --git a/website/src/docs/remote-sources.md b/website/src/docs/remote-sources.md new file mode 100644 index 0000000000..c902e43ad0 --- /dev/null +++ b/website/src/docs/remote-sources.md @@ -0,0 +1,78 @@ +--- +type: docs +order: 10 +title: "Remote Sources" +module: "@uppy/remote-sources" +permalink: docs/remote-sources/ +category: "Miscellaneous" +tagline: "Uppy plugin that includes all remote sources that Uppy+Companion offer, like Instagram, Google Drive, Dropox, Box, Unsplash, Url etc" +--- + +`@uppy/remote-sources` is a preset plugin to add all the available remote sources, such Instagram, Google Drive, Dropbox, and others to Uppy Dashboard in one package. + +> Note: Remote Sources requires Dashboard and automatically installs all its plugins to it. + +```js +import Uppy from '@uppy/core' +import Dashbaord from '@uppy/dashboard' +import RemoteSources from '@uppy/compressor' + +const uppy = new Uppy() +uppy.use(Dashboard) +uppy.use(RemoteSources, { + companionUrl: 'https://your-companion-url', +}) +``` + +## Installation + +This plugin is published as the `@uppy/remote-sources` package. + +```shell +npm install @uppy/remote-sources +``` + +In the [CDN package](/docs/#With-a-script-tag), the plugin class is available on the `Uppy` global object: + +```js +const { RemoteSources } = Uppy +``` + +## Options + +### `id` + +A unique identifier for this plugin (`string`, default: `RemoteSources`). + +### `sources` + +List of remote sources that will be enabled (`array`, default: `['Box', 'Dropbox', 'Facebook', 'GoogleDrive','Instagram', 'OneDrive', 'Unsplash', 'Url']`). + +You don’t need to specify them manually or change them, but if you want to alter the order in which they appear in the Dashboard, or disable some sources, this option is for you. + +```js +uppy.use(RemoteSources, { + companionUrl: 'https://your-companion-url', + sources: ['Instagram', 'GoogleDrive', 'Unsplash', 'Url'], +}) +``` + +### `companionUrl` + +URL to a [Companion](/docs/companion) instance (`string`, default: `null`). + +### `companionHeaders` + +Custom headers that should be sent along to [Companion](/docs/companion) on every request (`object`, default: `{}`). + +### `companionAllowedHosts` + +The valid and authorized URL(s) from which OAuth responses should be accepted (`string | RegExp | Array`, Default: `companionUrl`) + +This value can be a `String`, a `Regex` pattern, or an `Array` of both. + +This is useful when you have your [Companion](/docs/companion) running on several hosts. Otherwise, the default value, which is `companionUrl`, should do fine. + +### `companionCookiesRule` + +This option correlates to the [RequestCredentials value](https://developer.mozilla.org/en-US/docs/Web/API/Request/credentials), which tells the plugin whether to send cookies to [Companion](/docs/companion) (`string`, default: `same-origin`). diff --git a/website/src/docs/robodog-form.md b/website/src/docs/robodog-form.md index 422fac8e36..8fdaa9e362 100644 --- a/website/src/docs/robodog-form.md +++ b/website/src/docs/robodog-form.md @@ -150,7 +150,7 @@ Make sure to also include the Uppy css file in your `` tag in case you wan ```html - + ``` @@ -162,7 +162,7 @@ Notice how the form is submitted to the inexistant `/uploads` route once all tra Testing Robodog - +
@@ -172,7 +172,7 @@ Notice how the form is submitted to the inexistant `/uploads` route once all tra
- + + + ``` diff --git a/website/src/examples/dashboard/app.es6 b/website/src/examples/dashboard/app.es6 index 1f8d6b4aca..b2efd04f29 100644 --- a/website/src/examples/dashboard/app.es6 +++ b/website/src/examples/dashboard/app.es6 @@ -242,7 +242,7 @@ function loadLocaleFromCDN (localeName) { const head = document.getElementsByTagName('head')[0] const js = document.createElement('script') js.type = 'text/javascript' - js.src = `https://releases.transloadit.com/uppy/locales/v3.0.0-beta/${localeName}.min.js` + js.src = `https://releases.transloadit.com/uppy/locales/v3.0.0-beta.1/${localeName}.min.js` head.appendChild(js) } diff --git a/website/src/examples/i18n/app.html b/website/src/examples/i18n/app.html index d102e1200f..7c52e50b66 100644 --- a/website/src/examples/i18n/app.html +++ b/website/src/examples/i18n/app.html @@ -1,7 +1,7 @@ - +
@@ -12,9 +12,9 @@
Uploaded files:
- - - + + + +// const robodog = require('@uppy/robodog') const TRANSLOADIT_EXAMPLE_KEY = '35c1aed03f5011e982b6afe82599b6a0' diff --git a/website/src/examples/markdown-snippets/app.html b/website/src/examples/markdown-snippets/app.html index 0903529379..073e90e8d2 100644 --- a/website/src/examples/markdown-snippets/app.html +++ b/website/src/examples/markdown-snippets/app.html @@ -1,6 +1,6 @@ + -->

Create a new snippet

diff --git a/website/themes/uppy/layout/index.ejs b/website/themes/uppy/layout/index.ejs index 2562bff240..b582202f05 100644 --- a/website/themes/uppy/layout/index.ejs +++ b/website/themes/uppy/layout/index.ejs @@ -187,9 +187,9 @@

© <%- date(Date.now(), 'YYYY') %> Transloadit

- - - + + +