Upgrade babel 7.

pull/69/head
jaywcjlove 6 years ago
parent e469a29d9c
commit 084ef71c60

@ -1,6 +1,9 @@
{ {
"presets": [ "presets": [
"env", "@babel/preset-env",
"react" "@babel/preset-react"
],
"plugins": [
"@babel/plugin-transform-runtime"
] ]
} }

14193
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,7 +1,7 @@
{ {
"name": "hotkeys-js", "name": "hotkeys-js",
"description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.", "description": "A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies.",
"version": "3.6.3", "version": "3.6.4",
"main": "index.js", "main": "index.js",
"module": "dist/hotkeys.esm.js", "module": "dist/hotkeys.esm.js",
"scripts": { "scripts": {
@ -44,12 +44,13 @@
}, },
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"autoprefixer": "^8.6.1", "autoprefixer": "^8.6.1",
"babel-core": "^6.26.3",
"babel-eslint": "^8.2.3", "babel-eslint": "^8.2.3",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"bannerjs": "^1.0.5", "bannerjs": "^1.0.5",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"colors-cli": "^1.0.13", "colors-cli": "^1.0.13",
@ -61,20 +62,20 @@
"gh-pages": "^1.2.0", "gh-pages": "^1.2.0",
"highlight.js": "^9.12.0", "highlight.js": "^9.12.0",
"husky": "^1.0.0-rc.8", "husky": "^1.0.0-rc.8",
"jest": "^22.4.4", "jest": "^24.7.1",
"less": "^3.0.4", "less": "^3.0.4",
"parcel-bundler": "^1.12.3", "parcel-bundler": "^1.12.3",
"parcel-plugin-markdown-string": "^1.3.1", "parcel-plugin-markdown-string": "^1.3.5",
"postcss-modules": "^1.1.0", "postcss-modules": "^1.1.0",
"puppeteer": "^1.14.0", "puppeteer": "^1.14.0",
"react": "^16.7.0", "react": "^16.7.0",
"react-dom": "^16.7.0", "react-dom": "^16.7.0",
"react-markdown": "^3.3.2", "react-markdown": "^3.3.2",
"rimraf": "^2.6.3", "rimraf": "^2.6.3",
"rollup": "^0.57.1", "rollup": "^1.11.0",
"rollup-plugin-babel": "^3.0.4", "rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.1.3", "rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-node-resolve": "^3.3.0", "rollup-plugin-node-resolve": "^4.2.3",
"uglify-js": "^3.4.0", "uglify-js": "^3.4.0",
"zlib": "^1.0.5" "zlib": "^1.0.5"
} }

@ -31,7 +31,6 @@ async function build() {
pure_getters: true, pure_getters: true,
unsafe: true, unsafe: true,
unsafe_comps: true, unsafe_comps: true,
warnings: false,
}, },
output: { output: {
ascii_only: true, ascii_only: true,
@ -48,14 +47,14 @@ async function build() {
banner: banner.multibanner(), banner: banner.multibanner(),
}); });
const umdMinified = `${banner.onebanner()}\n${uglify.minify(umd.code, uglifyOption).code}`; const umdMinified = `${banner.onebanner()}\n${uglify.minify(umd.output[0].code, uglifyOption).code}`;
const common = await bundle.generate({ const common = await bundle.generate({
format: 'cjs', format: 'cjs',
name: 'hotkeys', name: 'hotkeys',
banner: banner.multibanner(), banner: banner.multibanner(),
}); });
const commonMinified = `${banner.onebanner()}\n${uglify.minify(common.code, uglifyOption).code}`; const commonMinified = `${banner.onebanner()}\n${uglify.minify(common.output[0].code, uglifyOption).code}`;
const es = await bundle.generate({ const es = await bundle.generate({
format: 'es', format: 'es',
@ -63,11 +62,11 @@ async function build() {
banner: banner.multibanner(), banner: banner.multibanner(),
}); });
write('dist/hotkeys.js', umd.code) write('dist/hotkeys.js', umd.output[0].code)
.then(() => write('dist/hotkeys.min.js', umdMinified, true)) .then(() => write('dist/hotkeys.min.js', umdMinified, true))
.then(() => write('dist/hotkeys.common.js', common.code)) .then(() => write('dist/hotkeys.common.js', common.output[0].code))
.then(() => write('dist/hotkeys.common.min.js', commonMinified, true)) .then(() => write('dist/hotkeys.common.min.js', commonMinified, true))
.then(() => write('dist/hotkeys.esm.js', es.code)); .then(() => write('dist/hotkeys.esm.js', es.output[0].code));
} }
build(); build();
@ -96,5 +95,8 @@ function write(dest, code, zip) {
} }
function getSize(code) { function getSize(code) {
return `${(code.length / 1024).toFixed(2)}kb`; if (code) {
return `${(code.toString().length / 1024).toFixed(2)}kb`;
}
return '';
} }

@ -1,8 +1,12 @@
{ {
"presets": [ "presets": [
["env", { [
"@babel/preset-env",
{
"modules": false "modules": false
}] }
]
], ],
"plugins": ["external-helpers"] "plugins": [
]
} }
Loading…
Cancel
Save