From 6a45e1ee5157f7ee658b1753c7068e79fbdf383f Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sat, 22 Jul 2017 10:33:31 -0400 Subject: [PATCH] fix: Safari/iOS const redefinition --- fuse.js | 47 +++++++++++++++++++++++++++++++++++++++++-- npm/package-lock.json | 2 +- npm/package.json | 2 +- package.json | 3 ++- tsconfig.json | 5 ++++- yarn.lock | 18 +++++++++++------ 6 files changed, 65 insertions(+), 12 deletions(-) diff --git a/fuse.js b/fuse.js index ea6a7309..76143cbd 100644 --- a/fuse.js +++ b/fuse.js @@ -9,6 +9,9 @@ const colors = require('colors/safe') const fsbx = require('fuse-box') const nodemon = require('nodemon') +const babel = require('babel-core') +const uglify = require('uglify-es') +const fs = require('fs-extra') // ====================================================== // Parse cmd arguments @@ -90,7 +93,7 @@ globalTasks.then(() => { fsbx.VuePlugin(), ['.scss', fsbx.SassPlugin({ outputStyle: (dev) ? 'nested' : 'compressed' }), fsbx.CSSPlugin()], fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }), - fsbx.JSONPlugin(), + fsbx.JSONPlugin() /* !dev && fsbx.QuantumPlugin({ target: 'browser', uglify: true, @@ -109,7 +112,7 @@ globalTasks.then(() => { }) } }) */ - !dev && fsbx.UglifyESPlugin() + // !dev && fsbx.UglifyESPlugin() ], debug: false, log: true @@ -140,6 +143,46 @@ globalTasks.then(() => { watch: (args.d) ? ['server'] : ['server/configure.js'], env: { 'NODE_ENV': 'development' } }) + } else { + console.info(colors.yellow.bold('\nTranspiling vendor bundle...')) + let appCode = babel.transform(fs.readFileSync('./assets/js/app.js', 'utf8'), { + babelrc: false, + compact: false, + filename: 'app.js', + plugins: ['transform-object-assign'] + }).code + let vendorCode = babel.transform(fs.readFileSync('./assets/js/vendor.js', 'utf8'), { + babelrc: false, + comments: false, + compact: false, + filename: 'vendor.js', + plugins: [ + 'transform-es2015-arrow-functions', + 'transform-es2015-block-scoped-functions', + 'transform-es2015-block-scoping', + 'transform-es2015-classes', + 'transform-es2015-computed-properties', + 'transform-es2015-destructuring', + 'transform-es2015-duplicate-keys', + 'transform-es2015-for-of', + 'transform-es2015-function-name', + 'transform-es2015-literals', + 'transform-es2015-object-super', + 'transform-es2015-parameters', + 'transform-es2015-shorthand-properties', + 'transform-es2015-spread', + 'transform-es2015-sticky-regex', + 'transform-es2015-template-literals', + 'transform-es2015-typeof-symbol', + 'transform-es2015-unicode-regex' + ] + }).code + console.info(colors.yellow.bold('Minifing bundles...')) + fs.writeFileSync('./assets/js/vendor.js', uglify.minify(vendorCode).code, 'utf8') + fs.writeFileSync('./assets/js/app.js', uglify.minify(appCode).code, 'utf8') + fs.writeFileSync('./assets/js/configure.js', uglify.minify(fs.readFileSync('./assets/js/configure.js', 'utf8')).code, 'utf8') + console.info(colors.green.bold('\nBUILD SUCCEEDED.')) + return true } }).catch(err => { console.error(colors.red(' X Bundle compilation failed! ' + err.message)) diff --git a/npm/package-lock.json b/npm/package-lock.json index e23c24d1..568100e2 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,6 +1,6 @@ { "name": "wiki.js", - "version": "1.0.0-beta.14.1", + "version": "1.0.1", "lockfileVersion": 1, "dependencies": { "amp": { diff --git a/npm/package.json b/npm/package.json index 840b26e6..af5d0c70 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "wiki.js", - "version": "1.0.0", + "version": "1.0.1", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "main": "install.js", "scripts": { diff --git a/package.json b/package.json index e9390304..b47b4a0a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wiki", - "version": "1.0.0", + "version": "1.0.1", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "main": "wiki.js", "scripts": { @@ -129,6 +129,7 @@ "@panter/vue-i18next": "~0.5.0", "babel-cli": "~6.24.1", "babel-jest": "~20.0.3", + "babel-plugin-transform-object-assign": "~6.22.0", "babel-preset-es2015": "~6.24.1", "brace": "~0.10.0", "colors": "~1.1.2", diff --git a/tsconfig.json b/tsconfig.json index dc25199f..20c43b30 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,6 +13,9 @@ "target": "es5" }, "exclude": [ - "node_modules" + ".fusebox", + "data", + "node_modules", + "repo" ] } diff --git a/yarn.lock b/yarn.lock index 52a14f18..60ff1355 100644 --- a/yarn.lock +++ b/yarn.lock @@ -796,6 +796,12 @@ babel-plugin-transform-es2015-unicode-regex@^6.24.1: babel-runtime "^6.22.0" regexpu-core "^2.0.0" +babel-plugin-transform-object-assign@~6.22.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-assign/-/babel-plugin-transform-object-assign-6.22.0.tgz#f99d2f66f1a0b0d498e346c5359684740caa20ba" + dependencies: + babel-runtime "^6.22.0" + babel-plugin-transform-regenerator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz#b8da305ad43c3c99b4848e4fe4037b770d23c418" @@ -2043,7 +2049,7 @@ eslint-scope@^3.7.1: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint@^4.3.0: +eslint@~4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.3.0.tgz#fcd7c96376bbf34c85ee67ed0012a299642b108f" dependencies: @@ -2591,7 +2597,7 @@ functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" -fuse-box@^2.2.1: +fuse-box@~2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.2.1.tgz#444dc3bd01a47b8044210d7344495cae92d3af3a" dependencies: @@ -4490,7 +4496,7 @@ mongodb@2.2.27: mongodb-core "2.1.14" readable-stream "2.2.7" -mongoose@*, mongoose@^4.11.1: +mongoose@*, mongoose@~4.11.1: version "4.11.3" resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.11.3.tgz#f93d427b282c2e798b0fe1532fb41a7dde6e98d3" dependencies: @@ -5999,7 +6005,7 @@ search-index-adder@~0.3.9: optionalDependencies: leveldown "^1.7.1" -search-index-searcher@^0.2.10: +search-index-searcher@~0.2.10: version "0.2.10" resolved "https://registry.yarnpkg.com/search-index-searcher/-/search-index-searcher-0.2.10.tgz#3b52b8bb643065883997dfce57c6c792ec551cb0" dependencies: @@ -6936,7 +6942,7 @@ vue-resource@~1.3.4: dependencies: got "^7.0.0" -vue-template-compiler@^2.4.2: +vue-template-compiler@~2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.4.2.tgz#5a45d843f148b098f6c1d1e35ac20c4956d30ad1" dependencies: @@ -6947,7 +6953,7 @@ vue-template-es2015-compiler@~1.5.3: version "1.5.3" resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.3.tgz#22787de4e37ebd9339b74223bc467d1adee30545" -vue@^2.4.2: +vue@~2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.2.tgz#a9855261f191c978cc0dc1150531b8d08149b58c"