diff --git a/.travis.yml b/.travis.yml index 22b54e2f..b7316fff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,18 +21,10 @@ matrix: env: BROWSER='"firefox_61"' OPENPGPJSTEST='browserstack' - node_js: "10" env: BROWSER='"chrome_68"' OPENPGPJSTEST='browserstack' LIGHTWEIGHT=1 - - node_js: "9" - env: BROWSER='"chrome_49"' OPENPGPJSTEST='browserstack' COMPAT=1 - node_js: "10" env: BROWSER='"chrome_68"' OPENPGPJSTEST='browserstack' - - node_js: "9" - env: BROWSER='"safari_9_1"' OPENPGPJSTEST='browserstack' COMPAT=1 - - node_js: "9" - env: BROWSER='"safari_10_1"' OPENPGPJSTEST='browserstack' COMPAT=1 - node_js: "9" env: BROWSER='"safari_11_1"' OPENPGPJSTEST='browserstack' - - node_js: "9" - env: BROWSER='{"os":"ios", "os_version":"10.3", "device":"iPhone 7 Plus", "real_mobile":true}' OPENPGPJSTEST='browserstack' COMPAT=1 - node_js: "9" env: BROWSER='{"os":"ios", "os_version":"11.3", "device":"iPhone 8 Plus", "real_mobile":true}' OPENPGPJSTEST='browserstack' allow_failures: diff --git a/README.md b/README.md index 77e75cf7..80002b2a 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,6 @@ OpenPGP.js [![Build Status](https://travis-ci.org/openpgpjs/openpgpjs.svg?branch * The `dist/openpgp.min.js` bundle works well with recent versions of Chrome, Firefox, Safari and Edge. It also works in Node.js 8+. -* The `dist/compat/openpgp.min.js` bundle also works with Internet Explorer 11 and old versions of Safari. Please note that this bundle overwrites the global `Promise` with a polyfill version even in some cases where it already exists, which may cause issues. It also adds some built-in prototype functions if they don't exist, such as `Array.prototype.includes`. - -* If you wish, you could even load one or the other depending on which browser the user is using. - * Currently, Chrome, Safari and Edge have partial implementations of the [Streams specification](https://streams.spec.whatwg.org/), and Firefox has a partial implementation behind feature flags. Chrome is the only diff --git a/package-lock.json b/package-lock.json index 5c9fd873..7575ccc1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -760,12 +760,6 @@ "safe-buffer": "~5.1.1" } }, - "core-js": { - "version": "2.5.3", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", - "integrity": "sha1-isw4NFgk8W2DZbfJtCWRaOjtYD4=", - "dev": true - }, "core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", diff --git a/package.json b/package.json index b5a8c3e0..d6ab7c93 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "buffer": "^5.0.8", "chai": "^4.1.2", "chai-as-promised": "^7.1.1", - "core-js": "^2.5.3", "elliptic": "github:openpgpjs/elliptic#ab7d8268c60b6abeb175841c578c224ac5b2d279", "email-addresses": "3.1.0", "eslint": "^4.17.0", diff --git a/rollup.config.js b/rollup.config.js index a108b024..4a0e830f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -9,19 +9,6 @@ import pkg from './package.json'; const nodeDependencies = Object.keys(pkg.dependencies); -const compat = [ - 'whatwg-fetch', - 'core-js/fn/array/fill', - 'core-js/fn/array/find', - 'core-js/fn/array/includes', - 'core-js/fn/array/from', - 'core-js/fn/promise', - 'core-js/fn/typed/uint8-array', - 'core-js/fn/string/repeat', - 'core-js/fn/symbol', - 'core-js/fn/object/assign' -]; - const banner = `/*! OpenPGP.js v${pkg.version} - ` + `${new Date().toISOString().split('T')[0]} - ` + @@ -48,7 +35,7 @@ export default [ browser: true }), commonjs({ - ignore: builtinModules.concat(nodeDependencies).concat(compat) + ignore: builtinModules.concat(nodeDependencies) }), replace({ 'OpenPGP.js VERSION': `OpenPGP.js ${pkg.version}`, @@ -68,9 +55,7 @@ export default [ ], plugins: [ resolve(), - commonjs({ - ignore: compat - }), + commonjs(), replace({ 'OpenPGP.js VERSION': `OpenPGP.js ${pkg.version}`, }) @@ -89,7 +74,7 @@ export default [ browser: true }), commonjs({ - ignore: builtinModules.concat(nodeDependencies).concat(compat).concat('elliptic') + ignore: builtinModules.concat(nodeDependencies).concat('elliptic') }), replace({ 'OpenPGP.js VERSION': `OpenPGP.js ${pkg.version}`, @@ -121,7 +106,7 @@ export default [ browser: true }), commonjs({ - ignore: builtinModules.concat(nodeDependencies).concat(compat).concat(['../..', '../../..']) + ignore: builtinModules.concat(nodeDependencies).concat(['../..', '../../..']) }) ] } diff --git a/src/polyfills.js b/src/polyfills.js index 630b286f..1642ee31 100644 --- a/src/polyfills.js +++ b/src/polyfills.js @@ -1,51 +1,7 @@ /** - * @fileoverview Old browser polyfills - * All are listed as dev dependencies because Node does not need them - * and for browser babel will take care of it * @module polyfills */ -if (typeof globalThis !== 'undefined') { - /******************************************************************** - * NOTE: This list is duplicated in Gruntfile.js, * - * so that these polyfills are only included in the compat bundle. * - ********************************************************************/ - - try { - if (typeof globalThis.fetch === 'undefined') { - require('whatwg-fetch'); - } - if (typeof Array.prototype.fill === 'undefined') { - require('core-js/fn/array/fill'); - } - if (typeof Array.prototype.find === 'undefined') { - require('core-js/fn/array/find'); - } - if (typeof Array.prototype.includes === 'undefined') { - require('core-js/fn/array/includes'); - } - if (typeof Array.from === 'undefined') { - require('core-js/fn/array/from'); - } - - // No if-statement on Promise because of IE11. Otherwise Promise is undefined in the service worker. - require('core-js/fn/promise'); - - if (typeof Uint8Array.from === 'undefined') { - require('core-js/fn/typed/uint8-array'); - } - if (typeof String.prototype.repeat === 'undefined') { - require('core-js/fn/string/repeat'); - } - if (typeof Symbol === 'undefined') { - require('core-js/fn/symbol'); - } - if (typeof Object.assign === 'undefined') { - require('core-js/fn/object/assign'); - } - } catch (e) {} -} - if (typeof TextEncoder === 'undefined') { const nodeUtil = require('util') || {}; globalThis.TextEncoder = nodeUtil.TextEncoder; diff --git a/test/unittests.js b/test/unittests.js index 8897b008..3aaa9c16 100644 --- a/test/unittests.js +++ b/test/unittests.js @@ -1,11 +1,3 @@ -// Old browser polyfills -if (typeof Symbol === 'undefined') { - require('core-js/fn/symbol'); -} -if (typeof Promise === 'undefined') { - require('core-js/fn/promise'); -} - (typeof window !== 'undefined' ? window : global).resolves = function(val) { return new Promise(function(res) { res(val); }); };