Browse Source

uppy: remove legacy bundle

IE11 is long dead, Uppy doesn't use any web API that is not already supported by every major browsers, maintaining the legacy bundle is more work than it's worth, let's get rid of it!
Antoine du Hamel 1 year ago
parent
commit
c5e1b14d1d
8 changed files with 5 additions and 150 deletions
  1. 2 38
      README.md
  2. 0 2
      babel.config.js
  3. 0 24
      bin/build-bundle.mjs
  4. 0 19
      examples/cdn-example/index.html
  5. 0 1
      package.json
  6. 0 18
      packages/uppy/bundle-legacy.mjs
  7. 0 8
      packages/uppy/package.json
  8. 3 40
      yarn.lock

+ 2 - 38
README.md

@@ -141,47 +141,11 @@ The ⓒ mark means that [`@uppy/companion`](https://uppy.io/docs/companion), a s
 ## React
 ## React
 
 
 * [React](https://uppy.io/docs/react/) — components to integrate Uppy UI plugins with React apps
 * [React](https://uppy.io/docs/react/) — components to integrate Uppy UI plugins with React apps
-* [React Native](https://uppy.io//docs/react/native/) — basic Uppy component for React Native with Expo
+* [React Native](./examples/react-native-expo/) — basic Uppy component for React Native with Expo
 
 
 ## Browser Support
 ## Browser Support
 
 
-We aim to support recent versions of Chrome, Firefox, Safari and Edge.
-
-We still provide a bundle which should work on IE11, but we are not running tests on it.
-
-### Polyfills
-
-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)
-* [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)
-* [whatwg-fetch](https://github.com/github/fetch)
-
-If you’re using a bundler, you need to import them before Uppy:
-
-```js
-import 'core-js'
-import 'whatwg-fetch'
-import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
-// Order matters: AbortController needs fetch which needs Promise (provided by core-js).
-
-import 'md-gum-polyfill'
-import ResizeObserver from 'resize-observer-polyfill'
-
-window.ResizeObserver ??= ResizeObserver
-
-export { default } from '@uppy/core'
-export * from '@uppy/core'
-```
-
-If you’re using Uppy from CDN, those polyfills are already included in the legacy
-bundle, so no need to include anything additionally:
-
-```html
-<script src="https://releases.transloadit.com/uppy/v3.21.0/uppy.legacy.min.js"></script>
-```
+We aim to support recent versions of Chrome, Firefox, and Safari.
 
 
 ## FAQ
 ## FAQ
 
 

+ 0 - 2
babel.config.js

@@ -15,8 +15,6 @@ module.exports = (api) => {
         loose: true,
         loose: true,
         targets,
         targets,
         useBuiltIns: false, // Don't add polyfills automatically.
         useBuiltIns: false, // Don't add polyfills automatically.
-        // We can uncomment the following line if we start adding polyfills to the non-legacy dist files.
-        // corejs: { version: '3.24', proposals: true },
         modules: false,
         modules: false,
       }],
       }],
     ],
     ],

+ 0 - 24
bin/build-bundle.mjs

@@ -5,7 +5,6 @@ import path from 'node:path'
 import chalk from 'chalk'
 import chalk from 'chalk'
 
 
 import esbuild from 'esbuild'
 import esbuild from 'esbuild'
-import babel from 'esbuild-plugin-babel'
 
 
 const UPPY_ROOT = new URL('../', import.meta.url)
 const UPPY_ROOT = new URL('../', import.meta.url)
 const PACKAGES_ROOT = new URL('./packages/', UPPY_ROOT)
 const PACKAGES_ROOT = new URL('./packages/', UPPY_ROOT)
@@ -45,29 +44,6 @@ const methods = [
     './packages/uppy/dist/uppy.min.js',
     './packages/uppy/dist/uppy.min.js',
     { standalone: 'Uppy', format: 'iife' },
     { standalone: 'Uppy', format: 'iife' },
   ),
   ),
-  buildBundle(
-    './packages/uppy/bundle-legacy.mjs',
-    './packages/uppy/dist/uppy.legacy.min.js',
-    {
-      standalone: 'Uppy (with polyfills)',
-      target: 'es5',
-      plugins:[babel({
-        config:{
-          compact: false,
-          highlightCode: false,
-          inputSourceMap: true,
-
-          browserslistEnv: 'legacy',
-          presets: [['@babel/preset-env',  {
-            loose: false,
-            targets: { ie:11 },
-            useBuiltIns: 'entry',
-            corejs: { version: '3.24', proposals: true },
-          }]],
-        },
-      })],
-    },
-  ),
 ]
 ]
 
 
 // Build minified versions of all the locales
 // Build minified versions of all the locales

+ 0 - 19
examples/cdn-example/index.html

@@ -30,24 +30,5 @@
         console.log(`${fileCount} files uploaded`)
         console.log(`${fileCount} files uploaded`)
       })
       })
     </script>
     </script>
-
-    <!-- To support older browsers, you can use the legacy bundle which adds a global `Uppy` object.  -->
-    <script
-      nomodule
-      src="https://releases.transloadit.com/uppy/v3.21.0/uppy.legacy.min.js"
-    ></script>
-    <script nomodule>
-      {
-        const { Dashboard, Webcam, Tus } = Uppy
-        const uppy = new Uppy.Uppy({ debug: true, autoProceed: false })
-          .use(Dashboard, { trigger: '#uppyModalOpener' })
-          .use(Webcam, { target: Dashboard })
-          .use(Tus, { endpoint: 'https://tusd.tusdemo.net/files/' })
-
-        uppy.on('success', function (fileCount) {
-          console.log(`${fileCount} files uploaded`)
-        })
-      }
-    </script>
   </body>
   </body>
 </html>
 </html>

+ 0 - 1
package.json

@@ -61,7 +61,6 @@
     "babel-plugin-inline-package-json": "^2.0.0",
     "babel-plugin-inline-package-json": "^2.0.0",
     "chalk": "^5.0.0",
     "chalk": "^5.0.0",
     "concat-stream": "^2.0.0",
     "concat-stream": "^2.0.0",
-    "core-js": "~3.24.0",
     "cssnano": "^5.0.6",
     "cssnano": "^5.0.6",
     "dotenv": "^16.0.0",
     "dotenv": "^16.0.0",
     "esbuild": "^0.17.1",
     "esbuild": "^0.17.1",

+ 0 - 18
packages/uppy/bundle-legacy.mjs

@@ -1,18 +0,0 @@
-// adding this directive to make sure the output file is using strict mode:
-
-'use strict'
-
-import 'core-js'
-import 'whatwg-fetch'
-import 'abortcontroller-polyfill/dist/polyfill-patch-fetch'
-// Order matters: AbortController needs fetch which needs Promise.
-
-import 'md-gum-polyfill'
-import ResizeObserver from 'resize-observer-polyfill'
-
-if (typeof window.ResizeObserver !== 'function') window.ResizeObserver = ResizeObserver
-
-// Needed for Babel
-import 'regenerator-runtime/runtime'
-
-import './bundle.mjs'

+ 0 - 8
packages/uppy/package.json

@@ -66,13 +66,5 @@
     "@uppy/webcam": "workspace:^",
     "@uppy/webcam": "workspace:^",
     "@uppy/xhr-upload": "workspace:^",
     "@uppy/xhr-upload": "workspace:^",
     "@uppy/zoom": "workspace:^"
     "@uppy/zoom": "workspace:^"
-  },
-  "devDependencies": {
-    "abortcontroller-polyfill": "^1.7.3",
-    "core-js": "~3.24.0",
-    "md-gum-polyfill": "^1.0.0",
-    "regenerator-runtime": "0.13.9",
-    "resize-observer-polyfill": "^1.5.1",
-    "whatwg-fetch": "^3.6.2"
   }
   }
 }
 }

+ 3 - 40
yarn.lock

@@ -4022,7 +4022,7 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"@babel/runtime@npm:7.22.6":
+"@babel/runtime@npm:7.22.6, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2":
   version: 7.22.6
   version: 7.22.6
   resolution: "@babel/runtime@npm:7.22.6"
   resolution: "@babel/runtime@npm:7.22.6"
   dependencies:
   dependencies:
@@ -4031,15 +4031,6 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"@babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.9.2":
-  version: 7.22.5
-  resolution: "@babel/runtime@npm:7.22.5"
-  dependencies:
-    regenerator-runtime: ^0.13.11
-  checksum: 12a50b7de2531beef38840d17af50c55a094253697600cee255311222390c68eed704829308d4fd305e1b3dfbce113272e428e9d9d45b1730e0fede997eaceb1
-  languageName: node
-  linkType: hard
-
 "@babel/template@npm:7.22.5, @babel/template@npm:^7.0.0, @babel/template@npm:^7.22.5, @babel/template@npm:^7.3.3":
 "@babel/template@npm:7.22.5, @babel/template@npm:^7.0.0, @babel/template@npm:^7.22.5, @babel/template@npm:^7.3.3":
   version: 7.22.5
   version: 7.22.5
   resolution: "@babel/template@npm:7.22.5"
   resolution: "@babel/template@npm:7.22.5"
@@ -8686,7 +8677,6 @@ __metadata:
     babel-plugin-inline-package-json: ^2.0.0
     babel-plugin-inline-package-json: ^2.0.0
     chalk: ^5.0.0
     chalk: ^5.0.0
     concat-stream: ^2.0.0
     concat-stream: ^2.0.0
-    core-js: ~3.24.0
     cssnano: ^5.0.6
     cssnano: ^5.0.6
     dotenv: ^16.0.0
     dotenv: ^16.0.0
     esbuild: ^0.17.1
     esbuild: ^0.17.1
@@ -10520,7 +10510,7 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"abortcontroller-polyfill@npm:^1.1.9, abortcontroller-polyfill@npm:^1.7.3":
+"abortcontroller-polyfill@npm:^1.1.9":
   version: 1.7.3
   version: 1.7.3
   resolution: "abortcontroller-polyfill@npm:1.7.3"
   resolution: "abortcontroller-polyfill@npm:1.7.3"
   checksum: 55739d7f0c9bd6afa2aabb3148778967c4dd4dcff91f6b9259df38da34f9882d3f7730b0954e9767a19cc16a8dd9a58915da4e8a50220300d45af3817d7557b1
   checksum: 55739d7f0c9bd6afa2aabb3148778967c4dd4dcff91f6b9259df38da34f9882d3f7730b0954e9767a19cc16a8dd9a58915da4e8a50220300d45af3817d7557b1
@@ -13200,13 +13190,6 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"core-js@npm:~3.24.0":
-  version: 3.24.1
-  resolution: "core-js@npm:3.24.1"
-  checksum: 6fb5bf0fd9e9f3e69d95616dd03332fea6758a715d2628c108b5faf17b48b0f580e90c4febb0a523c4665b0991a810de16289f86187fe79d70cc722dbd3edf0e
-  languageName: node
-  linkType: hard
-
 "core-util-is@npm:1.0.2":
 "core-util-is@npm:1.0.2":
   version: 1.0.2
   version: 1.0.2
   resolution: "core-util-is@npm:1.0.2"
   resolution: "core-util-is@npm:1.0.2"
@@ -21587,13 +21570,6 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"md-gum-polyfill@npm:^1.0.0":
-  version: 1.0.0
-  resolution: "md-gum-polyfill@npm:1.0.0"
-  checksum: d3302bb993fe89b1823166f922055c251318932419306aff62d615c6a7fd58a6a6eb483f00b2c1946b6f755481a6065c1b74d84af4826b54f00bcc8e67f4f788
-  languageName: node
-  linkType: hard
-
 "md5-file@npm:^3.2.3":
 "md5-file@npm:^3.2.3":
   version: 3.2.3
   version: 3.2.3
   resolution: "md5-file@npm:3.2.3"
   resolution: "md5-file@npm:3.2.3"
@@ -26632,14 +26608,7 @@ __metadata:
   languageName: node
   languageName: node
   linkType: hard
   linkType: hard
 
 
-"regenerator-runtime@npm:0.13.9, regenerator-runtime@npm:^0.13.2, regenerator-runtime@npm:^0.13.7":
-  version: 0.13.9
-  resolution: "regenerator-runtime@npm:0.13.9"
-  checksum: 65ed455fe5afd799e2897baf691ca21c2772e1a969d19bb0c4695757c2d96249eb74ee3553ea34a91062b2a676beedf630b4c1551cc6299afb937be1426ec55e
-  languageName: node
-  linkType: hard
-
-"regenerator-runtime@npm:^0.13.11":
+"regenerator-runtime@npm:^0.13.11, regenerator-runtime@npm:^0.13.2, regenerator-runtime@npm:^0.13.7":
   version: 0.13.11
   version: 0.13.11
   resolution: "regenerator-runtime@npm:0.13.11"
   resolution: "regenerator-runtime@npm:0.13.11"
   checksum: 27481628d22a1c4e3ff551096a683b424242a216fee44685467307f14d58020af1e19660bf2e26064de946bad7eff28950eae9f8209d55723e2d9351e632bbb4
   checksum: 27481628d22a1c4e3ff551096a683b424242a216fee44685467307f14d58020af1e19660bf2e26064de946bad7eff28950eae9f8209d55723e2d9351e632bbb4
@@ -30889,12 +30858,6 @@ __metadata:
     "@uppy/webcam": "workspace:^"
     "@uppy/webcam": "workspace:^"
     "@uppy/xhr-upload": "workspace:^"
     "@uppy/xhr-upload": "workspace:^"
     "@uppy/zoom": "workspace:^"
     "@uppy/zoom": "workspace:^"
-    abortcontroller-polyfill: ^1.7.3
-    core-js: ~3.24.0
-    md-gum-polyfill: ^1.0.0
-    regenerator-runtime: 0.13.9
-    resize-observer-polyfill: ^1.5.1
-    whatwg-fetch: ^3.6.2
   languageName: unknown
   languageName: unknown
   linkType: soft
   linkType: soft