Jelajahi Sumber

Move `Tus` plugin to `@uppy/tus`.

Steps taken:

```bash
cp -R package-template packages/@uppy/tus
vim packages/@uppy/tus/{README.md,package.json}
vim src/plugins/Transloadit/index.js src/indeex.js # Update requires
vim packages/@uppy/tus/src/index.js # Remove whatwg-fetch import
vim packages/@uppy/tus/package.json # Add dependencies
```
Renée Kooi 6 tahun lalu
induk
melakukan
67e57c9899

+ 21 - 0
packages/@uppy/tus/LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2018 Transloadit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 46 - 0
packages/@uppy/tus/README.md

@@ -0,0 +1,46 @@
+# @uppy/tus
+
+<img src="https://uppy.io/images/logos/uppy-dog-head-arrow.svg" width="120" alt="Uppy logo: a superman puppy in a pink suit" align="right">
+
+<a href="https://www.npmjs.com/package/@uppy/tus"><img src="https://img.shields.io/npm/v/@uppy/tus.svg?style=flat-square"></a>
+<a href="https://travis-ci.org/transloadit/uppy"><img src="https://img.shields.io/travis/transloadit/uppy/master.svg?style=flat-square" alt="Build Status"></a>
+
+The Tus plugin brings [tus.io][] resumable file uploading to Uppy by wrapping the [tus-js-client][].
+
+Uppy is being developed by the folks at [Transloadit](https://transloadit.com), a versatile file encoding service.
+
+## Example
+
+```js
+const Uppy = require('@uppy/core')
+const Tus = require('@uppy/tus')
+
+const uppy = Uppy()
+uppy.use(Tus, {
+  endpoint: 'https://master.tus.io/files/', // use your tus endpoint here
+  resume: true,
+  autoRetry: true,
+  retryDelays: [0, 1000, 3000, 5000]
+})
+```
+
+## Installation
+
+```bash
+$ npm install @uppy/tus --save
+```
+
+We recommend installing from npm and then using a module bundler such as [Webpack](http://webpack.github.io/), [Browserify](http://browserify.org/) or [Rollup.js](http://rollupjs.org/).
+
+Alternatively, you can also use this plugin in a pre-built bundle from Transloadit's CDN: Edgly. In that case `Uppy` will attach itself to the global `window.Uppy` object. See the [main Uppy documentation](https://uppy.io/docs/#Installation) for instructions.
+
+## Documentation
+
+Documentation for this plugin can be found on the [Uppy website](https://uppy.io/docs/tus).
+
+## License
+
+[The MIT License](./LICENSE).
+
+[tus.io]: https://tus.io
+[tus-js-client]: https://github.com/tus/tus-js-client

+ 33 - 0
packages/@uppy/tus/package.json

@@ -0,0 +1,33 @@
+{
+  "name": "@uppy/tus",
+  "description": "Resumable uploads for Uppy using Tus.io",
+  "version": "0.25.5",
+  "license": "MIT",
+  "main": "lib/index.js",
+  "jsnext:main": "src/index.js",
+  "types": "types/index.d.ts",
+  "keywords": [
+    "file uploader",
+    "uppy",
+    "uppy-plugin",
+    "upload",
+    "resumable",
+    "tus"
+  ],
+  "homepage": "https://uppy.io",
+  "bugs": {
+    "url": "https://github.com/transloadit/uppy/issues"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git+https://github.com/transloadit/uppy.git"
+  },
+  "dependencies": {
+    "@uppy/server-utils": "^0.25.5",
+    "@uppy/utils": "^0.25.5",
+    "tus-js-client": "^1.5.1"
+  },
+  "peerDependencies": {
+    "@uppy/core": "^0.25.5"
+  }
+}

+ 0 - 1
src/plugins/Tus.js → packages/@uppy/tus/src/index.js

@@ -5,7 +5,6 @@ const emitSocketProgress = require('@uppy/utils/lib/emitSocketProgress')
 const getSocketHost = require('@uppy/utils/lib/getSocketHost')
 const settle = require('@uppy/utils/lib/settle')
 const limitPromises = require('@uppy/utils/lib/limitPromises')
-require('whatwg-fetch')
 
 // Extracted from https://github.com/tus/tus-js-client/blob/master/lib/upload.js#L13
 // excepted we removed 'fingerprint' key to avoid adding more dependencies

+ 0 - 0
packages/@uppy/tus/types/index.d.ts


+ 1 - 1
src/index.js

@@ -25,7 +25,7 @@ const ProgressBar = require('./plugins/ProgressBar')
 const Informer = require('./plugins/Informer')
 
 // Uploaders
-const Tus = require('./plugins/Tus')
+const Tus = require('@uppy/tus')
 const XHRUpload = require('./plugins/XHRUpload')
 const Transloadit = require('./plugins/Transloadit')
 const AwsS3 = require('./plugins/AwsS3')

+ 1 - 1
src/plugins/Transloadit/index.js

@@ -1,6 +1,6 @@
 const Translator = require('@uppy/utils/lib/Translator')
 const Plugin = require('@uppy/core/lib/Plugin')
-const Tus = require('../Tus')
+const Tus = require('@uppy/tus')
 const Client = require('./Client')
 const StatusSocket = require('./Socket')