diff --git a/package-lock.json b/package-lock.json index fe1af87..e1582df 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4442,17 +4442,100 @@ } } }, + "@rollup/plugin-babel": { + "version": "5.3.0", + "resolved": "https://registry.npm.taobao.org/@rollup/plugin-babel/download/@rollup/plugin-babel-5.3.0.tgz", + "integrity": "sha1-nLHFFG3daklorZbyCcUMYvkvmHk=", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.10.4", + "@rollup/pluginutils": "^3.1.0" + }, + "dependencies": { + "@babel/helper-module-imports": { + "version": "7.12.13", + "resolved": "https://registry.npm.taobao.org/@babel/helper-module-imports/download/@babel/helper-module-imports-7.12.13.tgz", + "integrity": "sha1-7GfkQE9BdQRj5FXMMgP2oy6T/LA=", + "dev": true, + "requires": { + "@babel/types": "^7.12.13" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.12.11", + "resolved": "https://registry.npm.taobao.org/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.12.11.tgz", + "integrity": "sha1-yaHwIZF9y1zPDU5FPjmQIpgfye0=", + "dev": true + }, + "@babel/types": { + "version": "7.13.0", + "resolved": "https://registry.npm.taobao.org/@babel/types/download/@babel/types-7.13.0.tgz", + "integrity": "sha1-dEJNKBbwFxtBAPCrNOmjdO/ff4A=", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.12.11", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + } + } + }, + "@rollup/plugin-commonjs": { + "version": "17.1.0", + "resolved": "https://registry.npm.taobao.org/@rollup/plugin-commonjs/download/@rollup/plugin-commonjs-17.1.0.tgz?cache=0&sync_timestamp=1612233915111&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40rollup%2Fplugin-commonjs%2Fdownload%2F%40rollup%2Fplugin-commonjs-17.1.0.tgz", + "integrity": "sha1-dX7Ihzff+oqpE+s5L63i5FrvKi0=", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "commondir": "^1.0.1", + "estree-walker": "^2.0.1", + "glob": "^7.1.6", + "is-reference": "^1.2.1", + "magic-string": "^0.25.7", + "resolve": "^1.17.0" + }, + "dependencies": { + "estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npm.taobao.org/estree-walker/download/estree-walker-2.0.2.tgz", + "integrity": "sha1-UvAQF4wqTBF6d1fP6UKtt9LaTKw=", + "dev": true + }, + "is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npm.taobao.org/is-reference/download/is-reference-1.2.1.tgz", + "integrity": "sha1-iy2sCzcfS8mU/eq6nrVC0DAC0Lc=", + "dev": true, + "requires": { + "@types/estree": "*" + } + } + } + }, "@rollup/plugin-node-resolve": { - "version": "7.1.3", - "resolved": "https://registry.npm.taobao.org/@rollup/plugin-node-resolve/download/@rollup/plugin-node-resolve-7.1.3.tgz", - "integrity": "sha1-gN44Tt+9e/yRARZJEPhgeBUaPso=", + "version": "11.2.0", + "resolved": "https://registry.npm.taobao.org/@rollup/plugin-node-resolve/download/@rollup/plugin-node-resolve-11.2.0.tgz", + "integrity": "sha1-pauIw1u3Yi0RX0SYTe4wURK29xQ=", "dev": true, "requires": { - "@rollup/pluginutils": "^3.0.8", - "@types/resolve": "0.0.8", + "@rollup/pluginutils": "^3.1.0", + "@types/resolve": "1.17.1", "builtin-modules": "^3.1.0", + "deepmerge": "^4.2.2", "is-module": "^1.0.0", - "resolve": "^1.14.2" + "resolve": "^1.19.0" + }, + "dependencies": { + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npm.taobao.org/resolve/download/resolve-1.20.0.tgz?cache=0&sync_timestamp=1613054741136&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fresolve%2Fdownload%2Fresolve-1.20.0.tgz", + "integrity": "sha1-YpoBP7P3B1XW8LeTXMHCxTeLGXU=", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + } } }, "@rollup/plugin-replace": { @@ -6198,9 +6281,9 @@ "dev": true }, "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npm.taobao.org/@types/resolve/download/@types/resolve-0.0.8.tgz", - "integrity": "sha1-8mB00jjgJlnjI84aE9BB7uKA4ZQ=", + "version": "1.17.1", + "resolved": "https://registry.npm.taobao.org/@types/resolve/download/@types/resolve-1.17.1.tgz", + "integrity": "sha1-Ov1q2JZ8d+Q3bFmKgt3Vj0bsRdY=", "dev": true, "requires": { "@types/node": "*" @@ -8409,9 +8492,9 @@ "dev": true }, "builtin-modules": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", - "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "version": "3.2.0", + "resolved": "https://registry.npm.taobao.org/builtin-modules/download/builtin-modules-3.2.0.tgz", + "integrity": "sha1-RdXbmefuXmvE82LgCL+RerUEmIc=", "dev": true }, "builtin-status-codes": { @@ -9227,15 +9310,6 @@ "integrity": "sha1-wdfo8eX2z8n/ZfnNNS03NIdWwzM=", "dev": true }, - "cross-env": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz", - "integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==", - "dev": true, - "requires": { - "cross-spawn": "^7.0.1" - } - }, "cross-spawn": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", @@ -10186,12 +10260,6 @@ } } }, - "email-addresses": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-3.1.0.tgz", - "integrity": "sha512-k0/r7GrWVL32kZlGwfPNgB2Y/mMXVTq/decgLczm/j34whdaspNrZO8CnXPf1laaHxI6ptUlsnAxN+UAPw+fzg==", - "dev": true - }, "emittery": { "version": "0.7.2", "resolved": "https://registry.npm.taobao.org/emittery/download/emittery-0.7.2.tgz", @@ -11895,33 +11963,6 @@ "dev": true, "optional": true }, - "filename-reserved-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-1.0.0.tgz", - "integrity": "sha1-5hz4BfDeHJhFZ9A4bcXfUO5a9+Q=", - "dev": true - }, - "filenamify": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-1.2.1.tgz", - "integrity": "sha1-qfL/0RxQO+0wABUCknI3jx8TZaU=", - "dev": true, - "requires": { - "filename-reserved-regex": "^1.0.0", - "strip-outer": "^1.0.0", - "trim-repeated": "^1.0.0" - } - }, - "filenamify-url": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/filenamify-url/-/filenamify-url-1.0.0.tgz", - "integrity": "sha1-syvYExnvWGO3MHi+1Q9GpPeXX1A=", - "dev": true, - "requires": { - "filenamify": "^1.0.0", - "humanize-url": "^1.0.0" - } - }, "filesize": { "version": "6.1.0", "resolved": "https://registry.npm.taobao.org/filesize/download/filesize-6.1.0.tgz", @@ -12396,20 +12437,6 @@ "assert-plus": "^1.0.0" } }, - "gh-pages": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-2.2.0.tgz", - "integrity": "sha512-c+yPkNOPMFGNisYg9r4qvsMIjVYikJv7ImFOhPIVPt0+AcRUamZ7zkGRLHz7FKB0xrlZ+ddSOJsZv9XAFVXLmA==", - "dev": true, - "requires": { - "async": "^2.6.1", - "commander": "^2.18.0", - "email-addresses": "^3.0.1", - "filenamify-url": "^1.0.0", - "fs-extra": "^8.1.0", - "globby": "^6.1.0" - } - }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -12945,16 +12972,6 @@ "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", "dev": true }, - "humanize-url": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/humanize-url/-/humanize-url-1.0.1.tgz", - "integrity": "sha1-9KuZ4NKIF0yk4eUEB8VfuuRk7/8=", - "dev": true, - "requires": { - "normalize-url": "^1.0.0", - "strip-url-auth": "^1.0.0" - } - }, "husky": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.3.tgz", @@ -13561,7 +13578,7 @@ }, "is-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "resolved": "https://registry.npm.taobao.org/is-module/download/is-module-1.0.0.tgz", "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, @@ -13634,23 +13651,6 @@ "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=", "dev": true }, - "is-reference": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.1.4.tgz", - "integrity": "sha512-uJA/CDPO3Tao3GTrxYn6AwkM4nUPJiGGYu5+cB8qbC7WGFlrKZbiRo7SFKxUAEpFUfiHofWCXBUNhvYJMh+6zw==", - "dev": true, - "requires": { - "@types/estree": "0.0.39" - }, - "dependencies": { - "@types/estree": { - "version": "0.0.39", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", - "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", - "dev": true - } - } - }, "is-regex": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.5.tgz", @@ -23413,12 +23413,21 @@ } }, "rollup": { - "version": "2.10.2", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.10.2.tgz", - "integrity": "sha512-tivFM8UXBlYOUqpBYD3pRktYpZvK/eiCQ190eYlrAyrpE/lzkyG2gbawroNdbwmzyUc7Y4eT297xfzv0BDh9qw==", + "version": "2.41.0", + "resolved": "https://registry.npm.taobao.org/rollup/download/rollup-2.41.0.tgz", + "integrity": "sha1-sqOYu6u/Inc43trvCZ5JSu1GiYI=", "dev": true, "requires": { - "fsevents": "~2.1.2" + "fsevents": "~2.3.1" + }, + "dependencies": { + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npm.taobao.org/fsevents/download/fsevents-2.3.2.tgz", + "integrity": "sha1-ilJveLj99GI7cJ4Ll1xSwkwC/Ro=", + "dev": true, + "optional": true + } } }, "rollup-plugin-babel": { @@ -23431,43 +23440,6 @@ "rollup-pluginutils": "^2.8.1" } }, - "rollup-plugin-commonjs": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz", - "integrity": "sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q==", - "dev": true, - "requires": { - "estree-walker": "^0.6.1", - "is-reference": "^1.1.2", - "magic-string": "^0.25.2", - "resolve": "^1.11.0", - "rollup-pluginutils": "^2.8.1" - } - }, - "rollup-plugin-node-resolve": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", - "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", - "dev": true, - "requires": { - "@types/resolve": "0.0.8", - "builtin-modules": "^3.1.0", - "is-module": "^1.0.0", - "resolve": "^1.11.1", - "rollup-pluginutils": "^2.8.1" - }, - "dependencies": { - "@types/resolve": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", - "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - } - } - }, "rollup-plugin-terser": { "version": "5.3.1", "resolved": "https://registry.npm.taobao.org/rollup-plugin-terser/download/rollup-plugin-terser-5.3.1.tgz", @@ -24747,21 +24719,6 @@ "integrity": "sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w==", "dev": true }, - "strip-outer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", - "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, - "strip-url-auth": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/strip-url-auth/-/strip-url-auth-1.0.1.tgz", - "integrity": "sha1-IrD6OkE4WzO+PzMVUbu4N/oM164=", - "dev": true - }, "style-loader": { "version": "1.3.0", "resolved": "https://registry.npm.taobao.org/style-loader/download/style-loader-1.3.0.tgz", @@ -25297,15 +25254,6 @@ "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0=", "dev": true }, - "trim-repeated": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.2" - } - }, "trim-trailing-lines": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.3.tgz", @@ -27201,6 +27149,28 @@ "workbox-window": "^5.1.4" }, "dependencies": { + "@rollup/plugin-node-resolve": { + "version": "7.1.3", + "resolved": "https://registry.npm.taobao.org/@rollup/plugin-node-resolve/download/@rollup/plugin-node-resolve-7.1.3.tgz", + "integrity": "sha1-gN44Tt+9e/yRARZJEPhgeBUaPso=", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8", + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.14.2" + } + }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npm.taobao.org/@types/resolve/download/@types/resolve-0.0.8.tgz", + "integrity": "sha1-8mB00jjgJlnjI84aE9BB7uKA4ZQ=", + "dev": true, + "requires": { + "@types/node": "*" + } + }, "rollup": { "version": "1.32.1", "resolved": "https://registry.npm.taobao.org/rollup/download/rollup-1.32.1.tgz", diff --git a/package.json b/package.json index f1a0d8e..d77ccad 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "module": "dist/hotkeys.esm.js", "scripts": { "lint": "eslint --ext .js src website", - "build": "node scripts/build.js && npm run doc && npm run lint", + "build:lib": "node scripts/build.js", + "build": "npm run build:lib && npm run doc && npm run lint", "watch": "node scripts/watch.js", "pretest": "npm run build", "test": "jest --coverage --detectOpenHandles", @@ -72,10 +73,10 @@ "react": "16.13.1", "react-dom": "16.13.1", "rimraf": "3.0.2", - "rollup": "2.10.2", - "rollup-plugin-babel": "4.4.0", - "rollup-plugin-commonjs": "10.1.0", - "rollup-plugin-node-resolve": "5.2.0", + "rollup": "2.41.0", + "@rollup/plugin-babel": "5.3.0", + "@rollup/plugin-commonjs": "17.1.0", + "@rollup/plugin-node-resolve": "11.2.0", "uglify-js": "3.8.1", "zlib": "1.0.5" }, diff --git a/scripts/build.js b/scripts/build.js index 4e34343..2bb04ed 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -1,9 +1,9 @@ const fs = require('fs'); const path = require('path'); const rollup = require('rollup'); -const babel = require('rollup-plugin-babel'); -const nodeResolve = require('rollup-plugin-node-resolve'); -const commonjs = require('rollup-plugin-commonjs'); +const babel = require('@rollup/plugin-babel'); +const nodeResolve = require('@rollup/plugin-node-resolve'); +const commonjs = require('@rollup/plugin-commonjs'); const banner = require('bannerjs'); const zlib = require('zlib'); // const pkg = require('../package.json'); @@ -14,9 +14,10 @@ require('colors-cli/toxic'); const inputOptions = { input: 'src/index.js', plugins: [ - nodeResolve(), // so Rollup can find `ms` + nodeResolve.default(), // so Rollup can find `ms` commonjs(), // so Rollup can convert `ms` to an ES module - babel({ + babel.default({ + babelHelpers: 'bundled', exclude: 'node_modules/**', // 只编译我们的源代码 presets: [[ '@babel/preset-env', { @@ -61,6 +62,7 @@ async function build() { const common = await bundle.generate({ format: 'cjs', name: 'hotkeys', + exports: 'auto', banner: banner.multibanner(), }); const commonMinified = `${banner.onebanner()}\n${uglify.minify(common.output[0].code, uglifyOption).code}`; diff --git a/scripts/watch.js b/scripts/watch.js index 9396c8b..4107d12 100644 --- a/scripts/watch.js +++ b/scripts/watch.js @@ -1,8 +1,8 @@ const path = require('path'); const rollup = require('rollup'); -const babel = require('rollup-plugin-babel'); -const nodeResolve = require('rollup-plugin-node-resolve'); -const commonjs = require('rollup-plugin-commonjs'); +const babel = require('@rollup/plugin-babel'); +const nodeResolve = require('@rollup/plugin-node-resolve'); +const commonjs = require('@rollup/plugin-commonjs'); const banner = require('bannerjs'); require('colors-cli/toxic'); @@ -12,6 +12,7 @@ const watchOptions = { nodeResolve(), // so Rollup can find `ms` commonjs(), // so Rollup can convert `ms` to an ES module babel({ + babelHelpers: 'bundled', exclude: 'node_modules/**', // 只编译我们的源代码 presets: [[ '@babel/preset-env', {