fix: Safari/iOS const redefinition

This commit is contained in:
NGPixel 2017-07-22 10:33:31 -04:00
parent 44b5a2e0cb
commit 6a45e1ee51
6 changed files with 65 additions and 12 deletions

47
fuse.js
View File

@ -9,6 +9,9 @@
const colors = require('colors/safe') const colors = require('colors/safe')
const fsbx = require('fuse-box') const fsbx = require('fuse-box')
const nodemon = require('nodemon') const nodemon = require('nodemon')
const babel = require('babel-core')
const uglify = require('uglify-es')
const fs = require('fs-extra')
// ====================================================== // ======================================================
// Parse cmd arguments // Parse cmd arguments
@ -90,7 +93,7 @@ globalTasks.then(() => {
fsbx.VuePlugin(), fsbx.VuePlugin(),
['.scss', fsbx.SassPlugin({ outputStyle: (dev) ? 'nested' : 'compressed' }), fsbx.CSSPlugin()], ['.scss', fsbx.SassPlugin({ outputStyle: (dev) ? 'nested' : 'compressed' }), fsbx.CSSPlugin()],
fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }), fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }),
fsbx.JSONPlugin(), fsbx.JSONPlugin()
/* !dev && fsbx.QuantumPlugin({ /* !dev && fsbx.QuantumPlugin({
target: 'browser', target: 'browser',
uglify: true, uglify: true,
@ -109,7 +112,7 @@ globalTasks.then(() => {
}) })
} }
}) */ }) */
!dev && fsbx.UglifyESPlugin() // !dev && fsbx.UglifyESPlugin()
], ],
debug: false, debug: false,
log: true log: true
@ -140,6 +143,46 @@ globalTasks.then(() => {
watch: (args.d) ? ['server'] : ['server/configure.js'], watch: (args.d) ? ['server'] : ['server/configure.js'],
env: { 'NODE_ENV': 'development' } 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 => { }).catch(err => {
console.error(colors.red(' X Bundle compilation failed! ' + err.message)) console.error(colors.red(' X Bundle compilation failed! ' + err.message))

2
npm/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "wiki.js", "name": "wiki.js",
"version": "1.0.0-beta.14.1", "version": "1.0.1",
"lockfileVersion": 1, "lockfileVersion": 1,
"dependencies": { "dependencies": {
"amp": { "amp": {

View File

@ -1,6 +1,6 @@
{ {
"name": "wiki.js", "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", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js", "main": "install.js",
"scripts": { "scripts": {

View File

@ -1,6 +1,6 @@
{ {
"name": "wiki", "name": "wiki",
"version": "1.0.0", "version": "1.0.1",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown", "description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "wiki.js", "main": "wiki.js",
"scripts": { "scripts": {
@ -129,6 +129,7 @@
"@panter/vue-i18next": "~0.5.0", "@panter/vue-i18next": "~0.5.0",
"babel-cli": "~6.24.1", "babel-cli": "~6.24.1",
"babel-jest": "~20.0.3", "babel-jest": "~20.0.3",
"babel-plugin-transform-object-assign": "~6.22.0",
"babel-preset-es2015": "~6.24.1", "babel-preset-es2015": "~6.24.1",
"brace": "~0.10.0", "brace": "~0.10.0",
"colors": "~1.1.2", "colors": "~1.1.2",

View File

@ -13,6 +13,9 @@
"target": "es5" "target": "es5"
}, },
"exclude": [ "exclude": [
"node_modules" ".fusebox",
"data",
"node_modules",
"repo"
] ]
} }

View File

@ -796,6 +796,12 @@ babel-plugin-transform-es2015-unicode-regex@^6.24.1:
babel-runtime "^6.22.0" babel-runtime "^6.22.0"
regexpu-core "^2.0.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: babel-plugin-transform-regenerator@^6.24.1:
version "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" 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" esrecurse "^4.1.0"
estraverse "^4.1.1" estraverse "^4.1.1"
eslint@^4.3.0: eslint@~4.3.0:
version "4.3.0" version "4.3.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.3.0.tgz#fcd7c96376bbf34c85ee67ed0012a299642b108f" resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.3.0.tgz#fcd7c96376bbf34c85ee67ed0012a299642b108f"
dependencies: dependencies:
@ -2591,7 +2597,7 @@ functional-red-black-tree@^1.0.1:
version "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" 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" version "2.2.1"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.2.1.tgz#444dc3bd01a47b8044210d7344495cae92d3af3a" resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.2.1.tgz#444dc3bd01a47b8044210d7344495cae92d3af3a"
dependencies: dependencies:
@ -4490,7 +4496,7 @@ mongodb@2.2.27:
mongodb-core "2.1.14" mongodb-core "2.1.14"
readable-stream "2.2.7" readable-stream "2.2.7"
mongoose@*, mongoose@^4.11.1: mongoose@*, mongoose@~4.11.1:
version "4.11.3" version "4.11.3"
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.11.3.tgz#f93d427b282c2e798b0fe1532fb41a7dde6e98d3" resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.11.3.tgz#f93d427b282c2e798b0fe1532fb41a7dde6e98d3"
dependencies: dependencies:
@ -5999,7 +6005,7 @@ search-index-adder@~0.3.9:
optionalDependencies: optionalDependencies:
leveldown "^1.7.1" leveldown "^1.7.1"
search-index-searcher@^0.2.10: search-index-searcher@~0.2.10:
version "0.2.10" version "0.2.10"
resolved "https://registry.yarnpkg.com/search-index-searcher/-/search-index-searcher-0.2.10.tgz#3b52b8bb643065883997dfce57c6c792ec551cb0" resolved "https://registry.yarnpkg.com/search-index-searcher/-/search-index-searcher-0.2.10.tgz#3b52b8bb643065883997dfce57c6c792ec551cb0"
dependencies: dependencies:
@ -6936,7 +6942,7 @@ vue-resource@~1.3.4:
dependencies: dependencies:
got "^7.0.0" got "^7.0.0"
vue-template-compiler@^2.4.2: vue-template-compiler@~2.4.2:
version "2.4.2" version "2.4.2"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.4.2.tgz#5a45d843f148b098f6c1d1e35ac20c4956d30ad1" resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.4.2.tgz#5a45d843f148b098f6c1d1e35ac20c4956d30ad1"
dependencies: dependencies:
@ -6947,7 +6953,7 @@ vue-template-es2015-compiler@~1.5.3:
version "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" 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" version "2.4.2"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.2.tgz#a9855261f191c978cc0dc1150531b8d08149b58c" resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.2.tgz#a9855261f191c978cc0dc1150531b8d08149b58c"