From 9e554233a001beeb150743b385e21dabb3c1af93 Mon Sep 17 00:00:00 2001 From: German Bisurgi Date: Fri, 16 Oct 2020 12:55:01 +0200 Subject: [PATCH 1/3] fixed babel transpiling bug. (Babel were not working at all since 30.06.2020 after trying to merge webpack configs). Also introduced the use of polyfills when required (corejs 3). Set Hints false (too much output) --- config/webpack.common.js | 9 +++++- config/webpack.prod.js | 28 ---------------- package-lock.json | 69 ++++++++++++++++++++++++++++++++++++---- package.json | 6 +++- 4 files changed, 76 insertions(+), 36 deletions(-) diff --git a/config/webpack.common.js b/config/webpack.common.js index ba32d80f..6d9e2fb9 100644 --- a/config/webpack.common.js +++ b/config/webpack.common.js @@ -36,7 +36,11 @@ module.exports = { loader: 'babel-loader', options: { presets: [ - '@babel/preset-env' + ['@babel/preset-env', { + useBuiltIns: 'usage', + corejs: 3, + debug: false + }] ] } } @@ -60,6 +64,9 @@ module.exports = { pattern: './src/**/*.css' }) ], + performance: { + hints: false + }, devServer: { contentBase: helpers.root('.'), historyApiFallback: true, diff --git a/config/webpack.prod.js b/config/webpack.prod.js index c490a46a..44559832 100644 --- a/config/webpack.prod.js +++ b/config/webpack.prod.js @@ -5,32 +5,6 @@ const commonConfig = require('./webpack.common.js') const helpers = require('./helpers') module.exports = () => { - commonConfig.module.rules = [ - { - enforce: 'pre', - test: /\.js$/, - exclude: /node_modules/, - loader: 'eslint-loader' - }, - { - test: /\.css$/, - use: [ - 'style-loader', - { - loader: 'postcss-loader', - options: { - sourceMap: true, - plugins: [ - require('cssnano')({ - preset: 'default' - }) - ] - } - } - ] - } - ] - return webpackMerge(commonConfig, { mode: 'production', output: { @@ -39,11 +13,9 @@ module.exports = () => { filename: '[name].js', libraryTarget: 'umd' }, - optimization: { minimize: true }, - plugins: [ new RemoveStrictPlugin(), // I have put this in to avoid IE throwing error Assignment to read-only properties is not allowed in strict mode // This doesn't seem to actually be minimising the CSS! diff --git a/package-lock.json b/package-lock.json index 4e1d88bd..fc0cdb50 100644 --- a/package-lock.json +++ b/package-lock.json @@ -867,6 +867,58 @@ "@babel/helper-plugin-utils": "^7.8.3" } }, + "@babel/plugin-transform-runtime": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.12.1.tgz", + "integrity": "sha512-Ac/H6G9FEIkS2tXsZjL4RAdS3L3WHxci0usAnz7laPWUmFiGtj7tIASChqKZMHTSQTQY6xDbOq+V1/vIq3QrWg==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.12.1", + "@babel/helper-plugin-utils": "^7.10.4", + "resolve": "^1.8.1", + "semver": "^5.5.1" + }, + "dependencies": { + "@babel/helper-module-imports": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.12.1.tgz", + "integrity": "sha512-ZeC1TlMSvikvJNy1v/wPIazCu3NdOwgYZLIkmIyAsGhqkNpiDoQQRmaCK8YP4Pq3GPTLPV9WXaPCJKvx06JxKA==", + "dev": true, + "requires": { + "@babel/types": "^7.12.1" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz", + "integrity": "sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz", + "integrity": "sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw==", + "dev": true + }, + "@babel/types": { + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.12.1.tgz", + "integrity": "sha512-BzSY3NJBKM4kyatSOWh3D/JJ2O3CVzBybHWxtgxnggaxEuaSTTDqeiSb/xk9lrkw2Tbqyivw5ZU4rT+EfznQsA==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.10.4", + "lodash": "^4.17.19", + "to-fast-properties": "^2.0.0" + } + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "@babel/plugin-transform-shorthand-properties": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz", @@ -1044,9 +1096,9 @@ } }, "@babel/runtime": { - "version": "7.9.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.9.6.tgz", - "integrity": "sha512-64AF1xY3OAkFHqOb9s4jpgk1Mm5vDZ4L3acHvAml+53nO1XbXLuDodsVpO4OIUsmemlUHMxNdYMNJmsvOwLrvQ==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.12.1.tgz", + "integrity": "sha512-J5AIf3vPj3UwXaAzb5j1xM4WAQDX3EMgemF8rjCP3SoW09LfRKAXQKt6CoVYl230P6iWdRcBbnLDDdnqWxZSCA==", "dev": true, "requires": { "regenerator-runtime": "^0.13.4" @@ -3426,6 +3478,11 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, + "core-js": { + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz", + "integrity": "sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA==" + }, "core-js-compat": { "version": "3.6.5", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.6.5.tgz", @@ -11674,9 +11731,9 @@ } }, "regenerator-runtime": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz", - "integrity": "sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA==", + "version": "0.13.7", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.7.tgz", + "integrity": "sha512-a54FxoJDIr27pgf7IgeQGxmqUNYrcV338lf/6gH456HZ/PhX+5BcwHXG9ajESmwe6WRO0tAzRUrRmNONWgkrew==", "dev": true }, "regenerator-transform": { diff --git a/package.json b/package.json index 55c61e1c..3636fd3e 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,9 @@ }, "devDependencies": { "@babel/core": "^7.9.6", + "@babel/plugin-transform-runtime": "^7.12.1", "@babel/preset-env": "^7.9.6", + "@babel/runtime": "^7.12.1", "ace-builds": "^1.4.11", "babel-loader": "^8.1.0", "clean-webpack-plugin": "^3.0.0", @@ -92,5 +94,7 @@ "webpack-dev-server": "^3.11.0", "webpack-merge": "^4.2.2" }, - "dependencies": {} + "dependencies": { + "core-js": "^3.6.5" + } } From 87f243a8e4f68247d3b5a02e557dcdee906cfc06 Mon Sep 17 00:00:00 2001 From: German Bisurgi Date: Fri, 16 Oct 2020 12:55:30 +0200 Subject: [PATCH 2/3] added js polyfill assigns (for docs, no library) --- docs/polyfills/assign.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/polyfills/assign.js diff --git a/docs/polyfills/assign.js b/docs/polyfills/assign.js new file mode 100644 index 00000000..50339ab6 --- /dev/null +++ b/docs/polyfills/assign.js @@ -0,0 +1,29 @@ +if (typeof Object.assign !== 'function') { + // Must be writable: true, enumerable: false, configurable: true + Object.defineProperty(Object, 'assign', { + value: function assign (target, varArgs) { // .length of function is 2 + 'use strict' + if (target === null || target === undefined) { + throw new TypeError('Cannot convert undefined or null to object') + } + + var to = Object(target) + + for (var index = 1; index < arguments.length; index++) { + var nextSource = arguments[index] + + if (nextSource !== null && nextSource !== undefined) { + for (var nextKey in nextSource) { + // Avoid bugs when hasOwnProperty is shadowed + if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { + to[nextKey] = nextSource[nextKey] + } + } + } + } + return to + }, + writable: true, + configurable: true + }) +} From 08a1170b5c1348ec6e8c5e70fba2afcd7ed6a9d9 Mon Sep 17 00:00:00 2001 From: German Bisurgi Date: Fri, 16 Oct 2020 13:00:12 +0200 Subject: [PATCH 3/3] added assign polyfil to doc page. used var instead of const and let and es15 normal functions to allow IE 11 to use the docs page --- docs/index.html | 125 ++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/docs/index.html b/docs/index.html index 4eb736a3..d0c1c777 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,6 +4,7 @@ JSON Editor Interactive Example + @@ -122,7 +123,7 @@

Schema