Bläddra i källkod

doc, deps: clean up polyfill inconsistencies (#3020)

Antoine du Hamel 3 år sedan
förälder
incheckning
31438b0474

+ 1 - 4
README.md

@@ -164,12 +164,9 @@ We still provide a bundle which should work on IE11, but we are not running test
 Here's a list of polyfills you'll need to include to make Uppy work in older browsers, such as IE11:
 
 - [abortcontroller-polyfill](https://github.com/mo/abortcontroller-polyfill)
-- [es6-promise](https://github.com/stefanpenner/es6-promise)
-- [math-log2](https://github.com/sindresorhus/math-log2)
+- [core-js](https://github.com/zloirock/core-js)
 - [md-gum-polyfill](https://github.com/mozdevs/mediaDevices-getUserMedia-polyfill)
 - [resize-observer-polyfill](https://github.com/que-etc/resize-observer-polyfill)
-- [symbol-es6](https://github.com/rousan/symbol-es6)
-- [url-polyfill](https://github.com/lifaon74/url-polyfill)
 - [whatwg-fetch](https://github.com/github/fetch)
 
 If you're using a bundler, you need import them before Uppy:

+ 1 - 3
examples/dev/package.json

@@ -9,9 +9,7 @@
     "@babel/core": "^7.4.4",
     "aliasify": "^2.1.0",
     "babelify": "^10.0.0",
-    "es6-promise": "^4.2.8",
-    "watchify": "^3.11.0",
-    "whatwg-fetch": "^3.0.0"
+    "watchify": "^3.11.0"
   },
   "devDependencies": {
     "browser-sync": "^2.27.4"

+ 13 - 25
package-lock.json

@@ -258,9 +258,7 @@
         "@babel/core": "^7.4.4",
         "aliasify": "^2.1.0",
         "babelify": "^10.0.0",
-        "es6-promise": "^4.2.8",
-        "watchify": "^3.11.0",
-        "whatwg-fetch": "^3.0.0"
+        "watchify": "^3.11.0"
       },
       "devDependencies": {
         "browser-sync": "^2.27.4"
@@ -31529,7 +31527,8 @@
     "node_modules/es6-promise": {
       "version": "4.2.8",
       "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
-      "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
+      "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
+      "dev": true
     },
     "node_modules/es6-promisify": {
       "version": "5.0.0",
@@ -77360,16 +77359,13 @@
         "@uppy/transloadit": "file:../transloadit",
         "@uppy/url": "file:../url",
         "@uppy/utils": "file:../utils",
-        "@uppy/webcam": "file:../webcam",
-        "es6-promise": "4.2.5",
-        "whatwg-fetch": "3.6.2"
+        "@uppy/webcam": "file:../webcam"
+      },
+      "devDependencies": {
+        "core-js": "^3.15.2",
+        "whatwg-fetch": "^3.6.2"
       }
     },
-    "packages/@uppy/robodog/node_modules/es6-promise": {
-      "version": "4.2.5",
-      "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz",
-      "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg=="
-    },
     "packages/@uppy/screen-capture": {
       "version": "1.0.21",
       "license": "MIT",
@@ -89836,9 +89832,7 @@
         "aliasify": "^2.1.0",
         "babelify": "^10.0.0",
         "browser-sync": "^2.27.4",
-        "es6-promise": "^4.2.8",
-        "watchify": "^3.11.0",
-        "whatwg-fetch": "^3.0.0"
+        "watchify": "^3.11.0"
       },
       "dependencies": {
         "browserify": {
@@ -91075,15 +91069,8 @@
         "@uppy/url": "file:../url",
         "@uppy/utils": "file:../utils",
         "@uppy/webcam": "file:../webcam",
-        "es6-promise": "4.2.5",
-        "whatwg-fetch": "3.6.2"
-      },
-      "dependencies": {
-        "es6-promise": {
-          "version": "4.2.5",
-          "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz",
-          "integrity": "sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg=="
-        }
+        "core-js": "^3.15.2",
+        "whatwg-fetch": "^3.6.2"
       }
     },
     "@uppy/screen-capture": {
@@ -104422,7 +104409,8 @@
     "es6-promise": {
       "version": "4.2.8",
       "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz",
-      "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w=="
+      "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==",
+      "dev": true
     },
     "es6-promisify": {
       "version": "5.0.0",

+ 5 - 3
packages/@uppy/robodog/package.json

@@ -40,8 +40,10 @@
     "@uppy/transloadit": "file:../transloadit",
     "@uppy/url": "file:../url",
     "@uppy/utils": "file:../utils",
-    "@uppy/webcam": "file:../webcam",
-    "es6-promise": "4.2.5",
-    "whatwg-fetch": "3.6.2"
+    "@uppy/webcam": "file:../webcam"
+  },
+  "devDependencies": {
+    "core-js": "^3.15.2",
+    "whatwg-fetch": "^3.6.2"
   }
 }

+ 2 - 5
website/src/_posts/2021-XX-XX.md

@@ -15,12 +15,9 @@ support older browser (such as IE 11), you can add some polyfills to your bundle
 to make it work:
 
 - [abortcontroller-polyfill](https://github.com/mo/abortcontroller-polyfill)
-- [es6-promise](https://github.com/stefanpenner/es6-promise)
-- [math-log2](https://github.com/sindresorhus/math-log2)
+- [core-js](https://github.com/zloirock/core-js)
 - [md-gum-polyfill](https://github.com/mozdevs/mediaDevices-getUserMedia-polyfill)
 - [resize-observer-polyfill](https://github.com/que-etc/resize-observer-polyfill)
-- [symbol-es6](https://github.com/rousan/symbol-es6)
-- [url-polyfill](https://github.com/lifaon74/url-polyfill)
 - [whatwg-fetch](https://github.com/github/fetch)
 
 If you're using a bundler, you need import them before Uppy:
@@ -29,7 +26,7 @@ If you're using a bundler, you need import them before Uppy:
 import 'core-js'
 import 'whatwg-fetch'
 import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
-// Order matters: AbortController needs fetch which needs Promise.
+// Order matters: AbortController needs fetch which needs Promise (provided by core-js).
 
 import 'md-gum-polyfill'
 import ResizeObserver from 'resize-observer-polyfill'

+ 5 - 9
website/src/docs/index.md

@@ -156,29 +156,25 @@ We still run end to end tests with IE10, but we are not actively supporting it o
 
 ### Polyfills
 
-Uppy heavily uses Promises. If your target environment [does not support Promises](https://caniuse.com/#feat=promises), use a polyfill like `es6-promise` before initialising Uppy.
+Uppy heavily uses Promises. If your target environment [does not support Promises](https://caniuse.com/#feat=promises), use a polyfill like `core-js` before initialising Uppy.
 
 When using remote providers like Google Drive or Dropbox, the Fetch API is used. If your target environment does not support the [Fetch API](https://caniuse.com/#feat=fetch), use a polyfill like `whatwg-fetch` before initialising Uppy. The Fetch API polyfill must be loaded _after_ the Promises polyfill, because Fetch uses Promises.
 
 With a module bundler, you can use the required polyfills like so:
 
 ```shell
-npm install es6-promise whatwg-fetch abortcontroller-polyfill math-log2 md-gum-polyfill resize-observer-polyfill symbol-es6 url-polyfill
+npm install core-js whatwg-fetch abortcontroller-polyfill md-gum-polyfill resize-observer-polyfill
 ```
 
 ```js
-import 'es6-promise/auto'
+import 'core-js'
 import 'whatwg-fetch'
 import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
-// Order matters: AbortController needs fetch which needs Promise.
+// Order matters: AbortController needs fetch which needs Promise (provided by core-js).
 
-import mathLog2 from 'math-log2'
 import 'md-gum-polyfill'
 import ResizeObserver from 'resize-observer-polyfill'
-import 'symbol-es6'
-import 'url-polyfill'
 
-Math.log2 ??= mathLog2
 window.ResizeObserver ??= ResizeObserver
 
 export { default } from '@uppy/core'
@@ -188,5 +184,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
-<script src="https://releases.transloadit.com/uppy/v1.30.0/uppy.min.js"></script>
+<script src="https://releases.transloadit.com/uppy/v1.30.0/uppy.legacy.min.js"></script>
 ```