diff --git a/README.md b/README.md index 3fa1a5520..e9d6d3455 100644 --- a/README.md +++ b/README.md @@ -25,13 +25,13 @@ const Uppy = require('uppy/lib/core') const Dashboard = require('uppy/lib/plugins/Dashboard') const Webcam = require('uppy/lib/plugins/Webcam') const GoogleDrive = require('uppy/lib/plugins/GoogleDrive') -const Tus10 = require('uppy/lib/plugins/Tus10') +const Tus = require('uppy/lib/plugins/Tus') const uppy = Uppy({ autoProceed: false }) .use(Dashboard, { trigger: '#select-files' }) .use(Webcam, { target: Dashboard }) .use(GoogleDrive, { target: Dashboard, host: 'https://server.uppy.io' }) - .use(Tus10, { endpoint: '://master.tus.io/files/' }) + .use(Tus, { endpoint: '://master.tus.io/files/' }) .run() .on('core:success', files => console.log(`Successfully uploaded these files: ${files}`)) ``` @@ -82,7 +82,7 @@ If you like, you can also use a pre-built bundle, for example from [unpkg CDN](h ``` diff --git a/examples/bundled-example/main.js b/examples/bundled-example/main.js index b2c620b46..58a2188fb 100644 --- a/examples/bundled-example/main.js +++ b/examples/bundled-example/main.js @@ -4,7 +4,7 @@ const Dashboard = require('../../src/plugins/Dashboard') const Dropbox = require('../../src/plugins/Dropbox') const Instagram = require('../../src/plugins/Instagram') // const Webcam = require('../../src/plugins/Webcam') -const Tus10 = require('../../src/plugins/Tus10') +const Tus = require('../../src/plugins/Tus') // const XHRUpload = require('../../src/plugins/XHRUpload') // const FileInput = require('../../src/plugins/FileInput') const MetaData = require('../../src/plugins/MetaData') @@ -61,7 +61,7 @@ const uppy = Uppy({ // .use(GoogleDrive, {target: Dashboard, host: 'http://localhost:3020'}) .use(Dropbox, {target: Dashboard, host: 'http://localhost:3020'}) .use(Instagram, {target: Dashboard, host: 'http://localhost:3020'}) - .use(Tus10, {endpoint: TUS_ENDPOINT, resume: true}) + .use(Tus, {endpoint: TUS_ENDPOINT, resume: true}) .use(MetaData, { fields: [ { id: 'license', name: 'License', value: 'Creative Commons', placeholder: 'specify license' }, diff --git a/examples/cdn-example/index.html b/examples/cdn-example/index.html index 2ff1ba1da..e618992f1 100644 --- a/examples/cdn-example/index.html +++ b/examples/cdn-example/index.html @@ -4,7 +4,7 @@ - + @@ -12,7 +12,7 @@ - \ No newline at end of file + diff --git a/examples/react-example/App.js b/examples/react-example/App.js index 79434741a..a23d41f6a 100644 --- a/examples/react-example/App.js +++ b/examples/react-example/App.js @@ -1,7 +1,7 @@ /* eslint-disable */ const React = require('react') const Uppy = require('uppy/lib/core') -const Tus10 = require('uppy/lib/plugins/Tus10') +const Tus = require('uppy/lib/plugins/Tus') const GoogleDrive = require('uppy/lib/plugins/GoogleDrive') const { Dashboard, DashboardModal, DragDrop, ProgressBar } = require('uppy/lib/react') @@ -19,12 +19,12 @@ module.exports = class App extends React.Component { componentWillMount () { this.uppy = new Uppy({ autoProceed: false }) - .use(Tus10, { endpoint: 'https://master.tus.io/files/' }) + .use(Tus, { endpoint: 'https://master.tus.io/files/' }) .use(GoogleDrive, { host: 'https://server.uppy.io' }) .run() this.uppy2 = new Uppy({ autoProceed: false }) - .use(Tus10, { endpoint: 'https://master.tus.io/files/' }) + .use(Tus, { endpoint: 'https://master.tus.io/files/' }) .run() } diff --git a/src/index.js b/src/index.js index 7b39766dd..74802b771 100644 --- a/src/index.js +++ b/src/index.js @@ -24,7 +24,7 @@ const Informer = require('./plugins/Informer.js') const MetaData = require('./plugins/MetaData.js') // Uploaders -const Tus10 = require('./plugins/Tus10') +const Tus = require('./plugins/Tus') const XHRUpload = require('./plugins/XHRUpload') const Transloadit = require('./plugins/Transloadit') const AwsS3 = require('./plugins/AwsS3') @@ -46,7 +46,7 @@ module.exports = { Dropbox, Instagram, FileInput, - Tus10, + Tus, XHRUpload, Transloadit, AwsS3, @@ -72,3 +72,18 @@ Object.defineProperty(module.exports, 'RestoreFiles', { return GoldenRetriever } }) + +Object.defineProperty(module.exports, 'Tus10', { + enumerable: true, + configurable: true, + get: () => { + console.warn('Uppy.Tus10 is deprecated and will be removed in v0.22. Use Uppy.Tus instead.') + Object.defineProperty(module.exports, 'Tus10', { + enumerable: true, + configurable: true, + writable: true, + value: Tus + }) + return Tus + } +}) diff --git a/Tus.js b/src/plugins/Tus.js similarity index 99% rename from Tus.js rename to src/plugins/Tus.js index 1980cb32e..8092b4aa0 100644 --- a/Tus.js +++ b/src/plugins/Tus.js @@ -49,7 +49,7 @@ function createEventTracker (emitter) { * Tus resumable file uploader * */ -module.exports = class Tus10 extends Plugin { +module.exports = class Tus extends Plugin { constructor (core, opts) { super(core, opts) this.type = 'uploader' diff --git a/src/plugins/Tus10.js b/src/plugins/Tus10.js new file mode 100644 index 000000000..b78df8554 --- /dev/null +++ b/src/plugins/Tus10.js @@ -0,0 +1,5 @@ +const Tus = require('../Tus') + +console.warn('Using `uppy/lib/plugins/Tus10` is deprecated and will be removed in v0.22. Please use `uppy/lib/plugins/Tus` instead.') + +module.exports = Tus diff --git a/website/src/docs/architecture.md b/website/src/docs/architecture.md index 18d715792..3deea7e00 100644 --- a/website/src/docs/architecture.md +++ b/website/src/docs/architecture.md @@ -12,7 +12,7 @@ Uppy file uploader consists of a lean [Core](https://github.com/transloadit/uppy ## Core -1. Core module orchestrates Uppy plugins, stores `state` with `files`, and exposes useful methods like `addFile`, `setState`, `upload` to the user and plugins. Plugins are added to Uppy with `.use(Plugin, opts)` API, like so: `.use(DragDrop, {target: 'body'})`. +1. Core module orchestrates Uppy plugins, stores `state` with `files`, and exposes useful methods like `addFile`, `setState`, `upload` to the user and plugins. Plugins are added to Uppy with `.use(Plugin, opts)` API, like so: `.use(DragDrop, {target: 'body'})`. 2. Internally Core then instantiates plugins via `new Plugin(this, opts)`, passing options to them, then places them in `plugins` object, nested by type: `uploader`, `progressindicator`, `acquirer`, etc. Core then iterates over `plugins` and calls `install` on each of them. In it’s `install` method a plugin can set event listeners to react to things happening in Uppy (upload progress, file was removed), or do anything else needed on init. @@ -141,7 +141,7 @@ a plugin can extend global state with its own state (like `{ modal: { isHidden: ### uploader -- **Tus10** — tus resumable file uploads, see http://tus.io +- **Tus** — tus resumable file uploads, see http://tus.io - **Multipart** — regular form/multipart/xhr uploads ### modifier diff --git a/website/src/docs/index.md b/website/src/docs/index.md index fb6cb0dee..b65fac7d6 100644 --- a/website/src/docs/index.md +++ b/website/src/docs/index.md @@ -13,13 +13,13 @@ Uppy consists of a core module and [various plugins](/docs/plugins/) for selecti ```js const Uppy = require('uppy/lib/core') const Dashboard = require('uppy/lib/plugins/Dashboard') -const Tus10 = require('uppy/lib/plugins/Tus10') +const Tus = require('uppy/lib/plugins/Tus')   const uppy = Uppy({ autoProceed: false }) .use(Dashboard, { trigger: '#select-files' }) - .use(Tus10, {endpoint: '//master.tus.io/files/'}) + .use(Tus, {endpoint: '//master.tus.io/files/'}) .run()   uppy.on('core:success', (files) => { @@ -62,7 +62,7 @@ If you like, you can also use a pre-built bundle, for example from [unpkg CDN](h ``` diff --git a/website/src/docs/plugins.md b/website/src/docs/plugins.md index 967788e78..d65797562 100644 --- a/website/src/docs/plugins.md +++ b/website/src/docs/plugins.md @@ -13,7 +13,7 @@ Plugins are what makes Uppy useful: they help select, manipulate and upload file - FileInput — even more plain and simple, just a button - [Provider Plugins](#Provider-Plugins) (remote sources that work through [Uppy Server](/docs/uppy-server/)): Instagram, GoogleDrive, Dropbox - **Uploaders:** - - Tus10 — uploads using the tus resumable upload protocol + - Tus — uploads using the tus resumable upload protocol - XHRUpload — classic multipart form uploads or binary uploads using XMLHTTPRequest - [AwsS3](/docs/aws-s3) — uploader for AWS S3 - **Progress:** diff --git a/website/src/docs/react.md b/website/src/docs/react.md index 96dde12a4..71ebb1b31 100644 --- a/website/src/docs/react.md +++ b/website/src/docs/react.md @@ -16,7 +16,7 @@ All other props are passed as options to the plugin. ```js const Uppy = require('uppy/lib/core') -const Tus10 = require('uppy/lib/plugins/Tus10') +const Tus = require('uppy/lib/plugins/Tus') const DragDrop = require('uppy/lib/react/DragDrop') const uppy = Uppy({ @@ -25,7 +25,7 @@ const uppy = Uppy({ autoProceed: true }) -uppy.use(Tus10, { endpoint: '/upload' }) +uppy.use(Tus, { endpoint: '/upload' }) uppy.on('core:success', (fileIDs) => { const url = uppy.getFile(fileIDs[0]).uploadURL diff --git a/website/src/docs/transloadit.md b/website/src/docs/transloadit.md index 1489b9b0f..8a9eb30b7 100644 --- a/website/src/docs/transloadit.md +++ b/website/src/docs/transloadit.md @@ -7,12 +7,12 @@ permalink: docs/transloadit/ The Transloadit plugin can be used to upload files to [Transloadit](https://transloadit.com/) for all kinds of processing, such as transcoding video, resizing images, zipping/unzipping, [and more](https://transloadit.com/services/). -The Transloadit plugin uses the Tus plugin for the uploading itself. +The Transloadit plugin uses the [Tus plugin](/docs/tus) for the uploading itself. To upload files to Transloadit directly, both the Tus and Transloadit plugins must be used: ```js // The `resume: false` option _must_ be provided to the Tus plugin. -uppy.use(Tus10, { +uppy.use(Tus, { resume: false }) uppy.use(Transloadit, { @@ -20,7 +20,7 @@ uppy.use(Transloadit, { }) ``` -NB: It is not required to use the `Tus10` plugin if [importFromUploadURLs](#importFromUploadURLs) is enabled. +NB: It is not required to use the `Tus` plugin if [importFromUploadURLs](#importFromUploadURLs) is enabled. ## Options diff --git a/website/src/docs/tus.md b/website/src/docs/tus.md index cd59a8350..35e490b82 100644 --- a/website/src/docs/tus.md +++ b/website/src/docs/tus.md @@ -1,14 +1,14 @@ --- type: docs order: 30 -title: "Tus10" +title: "Tus" permalink: docs/tus/ --- -The Tus10 plugin brings [tus.io](http://tus.io) resumable file uploading to Uppy by wrapping the [tus-js-client][]. +The Tus plugin brings [tus.io](http://tus.io) resumable file uploading to Uppy by wrapping the [tus-js-client][]. ```js -uppy.use(Tus10, { +uppy.use(Tus, { resume: true, autoRetry: true, retryDelays: [0, 1000, 3000, 5000] @@ -17,7 +17,7 @@ uppy.use(Tus10, { ## Options -The Tus10 plugin supports all of [tus-js-client][]'s options. +The Tus plugin supports all of [tus-js-client][]'s options. Additionally: ### `autoRetry: true` diff --git a/website/src/examples/bundle/app.html b/website/src/examples/bundle/app.html index 6a4a24a1e..711bd2b59 100644 --- a/website/src/examples/bundle/app.html +++ b/website/src/examples/bundle/app.html @@ -5,7 +5,7 @@ diff --git a/website/src/examples/statusbar/app.es6 b/website/src/examples/statusbar/app.es6 index 0c333f902..edac5f093 100644 --- a/website/src/examples/statusbar/app.es6 +++ b/website/src/examples/statusbar/app.es6 @@ -1,11 +1,11 @@ const Uppy = require('uppy/lib/core/Core') const FileInput = require('uppy/lib/plugins/FileInput') const StatusBar = require('uppy/lib/plugins/StatusBar') -const Tus10 = require('uppy/lib/plugins/Tus10') +const Tus = require('uppy/lib/plugins/Tus') const uppyOne = new Uppy({debug: true}) uppyOne .use(FileInput, {target: '.UppyInput'}) - .use(Tus10, {endpoint: '//master.tus.io/files/'}) + .use(Tus, {endpoint: '//master.tus.io/files/'}) .use(StatusBar, {target: '.UppyInput-Progress'}) .run()