diff --git a/gulp/babel.config.js b/gulp/babel.config.js index 8554ebd1..7394b09f 100644 --- a/gulp/babel.config.js +++ b/gulp/babel.config.js @@ -14,18 +14,18 @@ module.exports = function (api) { ], ]; const plugins = [ - // "closure-elimination", + "closure-elimination", // var is faster than let and const! - // [ - // "@babel/plugin-transform-block-scoping", - // { - // throwIfClosureRequired: false, - // }, - // ], + [ + "@babel/plugin-transform-block-scoping", + { + throwIfClosureRequired: false, + }, + ], [ "@babel/plugin-transform-classes", { - loose: false, + loose: true, }, ], ]; @@ -33,10 +33,9 @@ module.exports = function (api) { presets, plugins, highlightCode: true, - sourceType: "module", + sourceType: "unambiguous", sourceMaps: false, parserOpts: {}, - // only: ["../src/js"], generatorOpts: { retainLines: false, compact: true, diff --git a/gulp/buildutils.js b/gulp/buildutils.js index ea253773..8b5e389b 100644 --- a/gulp/buildutils.js +++ b/gulp/buildutils.js @@ -29,7 +29,7 @@ module.exports = { try { return execSync("git describe --tag --exact-match").toString("ascii"); } catch (e) { - throw new Error('Current git HEAD is not a version tag'); + throw new Error("Current git HEAD is not a version tag"); } }, diff --git a/gulp/package.json b/gulp/package.json index 6e168c00..e8dd8562 100644 --- a/gulp/package.json +++ b/gulp/package.json @@ -17,6 +17,7 @@ "@types/filesystem": "^0.0.29", "@types/node": "^12.7.5", "ajv": "^6.10.2", + "are-you-es5": "^2.1.2", "audiosprite": "^0.7.2", "babel-core": "^6.26.3", "babel-loader": "^8.1.0", diff --git a/gulp/webpack.production.config.js b/gulp/webpack.production.config.js index 7c566399..de498f88 100644 --- a/gulp/webpack.production.config.js +++ b/gulp/webpack.production.config.js @@ -8,6 +8,8 @@ const TerserPlugin = require("terser-webpack-plugin"); const StringReplacePlugin = require("string-replace-webpack-plugin"); const UnusedFilesPlugin = require("unused-files-webpack-plugin").UnusedFilesWebpackPlugin; +const { checkModules, buildExcludeRegexp } = require("are-you-es5"); + module.exports = ({ environment, es6 = false, @@ -19,6 +21,12 @@ module.exports = ({ wegameVersion = false, steamDemo = false, }) => { + const moduleExclusionResult = checkModules({ + path: path.join(__dirname, ".."), + checkAllNodeModules: true, + ignoreBabelAndWebpackPackages: true, + }); + const globalDefs = { assert: "false && window.assert", assertAlways: "window.assert", @@ -60,7 +68,6 @@ module.exports = ({ // Display bailout reasons optimizationBailout: true, }, - // devtool: "source-map", devtool: false, resolve: { alias: { @@ -206,10 +213,7 @@ module.exports = ({ }, { test: /\.js$/, - exclude: { - and: [/rusha/], - // // not: [/semver/, /query-string/, /yallist/], - }, + exclude: buildExcludeRegexp(moduleExclusionResult.es6Modules), use: [ // "thread-loader", { @@ -239,10 +243,7 @@ module.exports = ({ }, { test: /\.worker\.js$/, - exclude: { - and: [/rusha/], - // // not: [/semver/, /query-string/, /yallist/], - }, + exclude: buildExcludeRegexp(moduleExclusionResult.es6Modules), use: [ { loader: "worker-loader", diff --git a/gulp/yarn.lock b/gulp/yarn.lock index b57cec43..e56c45e5 100644 --- a/gulp/yarn.lock +++ b/gulp/yarn.lock @@ -1240,6 +1240,11 @@ acorn@^6.0.1, acorn@^6.0.2, acorn@^6.0.7, acorn@^6.4.1: resolved "https://registry.npmjs.org/acorn/-/acorn-6.4.1.tgz" integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== +acorn@^6.0.6: + version "6.4.2" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6" + integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ== + after@0.8.2: version "0.8.2" resolved "https://registry.npmjs.org/after/-/after-0.8.2.tgz" @@ -1465,6 +1470,16 @@ archy@^1.0.0: resolved "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz" integrity sha1-+cjBN1fMHde8N5rHeyxipcKGjEA= +are-you-es5@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/are-you-es5/-/are-you-es5-2.1.2.tgz#d75511a174a3f842d70cc784aec0bcaff5a57547" + integrity sha512-gkT2bLCfzyJJr3lYoxZKScdD/Yp5zzghi+3KawONTvH/7rrgU3RMXYvGQnOTlqEFVgZFpEGj/6bZ6sF/9YtddA== + dependencies: + acorn "^6.0.6" + array-flatten "^2.1.0" + commander "^2.19.0" + find-up "^4.1.0" + argparse@^1.0.7: version "1.0.10" resolved "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz" @@ -1534,6 +1549,11 @@ array-find-index@^1.0.1: resolved "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz" integrity sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E= +array-flatten@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099" + integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ== + array-initial@^1.0.0: version "1.1.0" resolved "https://registry.npmjs.org/array-initial/-/array-initial-1.1.0.tgz" diff --git a/src/js/core/background_resources_loader.js b/src/js/core/background_resources_loader.js index 41c98a7f..2081a9f0 100644 --- a/src/js/core/background_resources_loader.js +++ b/src/js/core/background_resources_loader.js @@ -38,7 +38,6 @@ export function getLogoSprite() { const essentialMainMenuSprites = [getLogoSprite()]; -console.warn("UI: ", G_ALL_UI_IMAGES); const essentialMainMenuSounds = [ SOUNDS.uiClick, SOUNDS.uiError,