@nlabs/lex 1.28.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LexConfig.js +15 -9
- package/dist/commands/build.js +111 -43
- package/dist/commands/bulid.test.js +1 -19
- package/dist/commands/clean.js +12 -11
- package/dist/commands/compile.js +23 -17
- package/dist/commands/config.js +17 -11
- package/dist/commands/copy.js +14 -8
- package/dist/commands/create.js +17 -11
- package/dist/commands/dev.js +16 -10
- package/dist/commands/index.js +25 -24
- package/dist/commands/init.js +17 -11
- package/dist/commands/link.js +12 -11
- package/dist/commands/lint.js +16 -10
- package/dist/commands/migrate.js +15 -9
- package/dist/commands/publish.js +16 -10
- package/dist/commands/test.js +16 -10
- package/dist/commands/update.js +15 -9
- package/dist/commands/upgrade.js +18 -12
- package/dist/commands/versions.js +11 -10
- package/dist/create/changelog.js +20 -14
- package/dist/lex.js +3 -21
- package/dist/utils.js +22 -16
- package/package.json +57 -52
- package/webpack.config.js +26 -31
package/dist/lex.js
CHANGED
|
@@ -1,26 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
9
|
-
var __reExport = (target, module2, desc) => {
|
|
10
|
-
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(module2))
|
|
12
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
13
|
-
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return target;
|
|
16
|
-
};
|
|
17
|
-
var __toModule = (module2) => {
|
|
18
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
19
|
-
};
|
|
20
|
-
var import_commander = __toModule(require("commander"));
|
|
21
|
-
var import_commands = __toModule(require("./commands"));
|
|
2
|
+
var import_commander = require("commander");
|
|
3
|
+
var import_commands = require("./commands");
|
|
22
4
|
const packageConfig = require("../package.json");
|
|
23
|
-
import_commander.program.command("build").option("-c, --config <path>", "Custom Webpack configuration file path (ie. webpack.config.js).").option("-l, --lexConfig <path>", "Lex configuration file path (lex.config.js).").option("-m, --mode <type>", 'Webpack mode ("production" or "development"). Default: "development".', /^(development|production)$/i, "development").option("-q, --quiet", "No Lex notifications printed in the console.").option("-r, --remove", "Removes all files from the output directory before compiling.").option("-s, --static", "Creates static HTML files when building app.").option("-t, --typescript", "Transpile as Typescript.").option("-v, --variables <name>", `Environment variables to set in "process.env". (ie. "{NODE_ENV: 'production'}").`).option("-w, --watch", "Watch for changes.").option("--sourcePath <path>", "Source path").option("--outputPath <path>", "Output path").option("--outputChunkFilename <filename>", "The output filename for additional chunks.").option("--outputFilename <filename>", 'The output filename of the bundle. Default: "[name].js".').option("--outputJsonpFunction <func>", 'The name of the JSONP function used for chunk loading. Default: "webpackJsonp".').option("--outputLibrary <library>", "Expose the exports of the entry point as library.").option("--outputLibraryTarget <target>", 'The type for exposing the exports of the entry point as library. Default: "var".').option("--outputPathinfo <hasInfo>", "The output filename for additional chunks. Default: false").option("--outputPublicPath <path>", 'The public path for the assets. Default: "/"').option("--outputSourceMapFilename <filename>", 'The output filename for the SourceMap. Default: "[name].map"').option("--buildDelimiter <delimiter>", 'Display custom text after build output. Default: "=== Build done ==="').action((cmd) => (0, import_commands.build)(cmd, process.exit).then(() => {
|
|
5
|
+
import_commander.program.command("build").option("-c, --config <path>", "Custom Webpack configuration file path (ie. webpack.config.js).").option("-l, --lexConfig <path>", "Lex configuration file path (lex.config.js).").option("-m, --mode <type>", 'Webpack mode ("production" or "development"). Default: "development".', /^(development|production)$/i, "development").option("-q, --quiet", "No Lex notifications printed in the console.").option("-r, --remove", "Removes all files from the output directory before compiling.").option("-s, --static", "Creates static HTML files when building app.").option("-t, --typescript", "Transpile as Typescript.").option("-v, --variables <name>", `Environment variables to set in "process.env". (ie. "{NODE_ENV: 'production'}").`).option("-w, --watch", "Watch for changes.").option("--bundler <name>", 'Bundler to use ("webpack" or "esbuild"). Default: "webpack".', /^(webpack|esbuild)$/i, "webpack").option("--sourcePath <path>", "Source path").option("--outputPath <path>", "Output path").option("--outputChunkFilename <filename>", "The output filename for additional chunks.").option("--outputFilename <filename>", 'The output filename of the bundle. Default: "[name].js".').option("--outputJsonpFunction <func>", 'The name of the JSONP function used for chunk loading. Default: "webpackJsonp".').option("--outputLibrary <library>", "Expose the exports of the entry point as library.").option("--outputLibraryTarget <target>", 'The type for exposing the exports of the entry point as library. Default: "var".').option("--outputPathinfo <hasInfo>", "The output filename for additional chunks. Default: false").option("--outputPublicPath <path>", 'The public path for the assets. Default: "/"').option("--outputSourceMapFilename <filename>", 'The output filename for the SourceMap. Default: "[name].map"').option("--buildDelimiter <delimiter>", 'Display custom text after build output. Default: "=== Build done ==="').action((cmd) => (0, import_commands.build)(cmd, process.exit).then(() => {
|
|
24
6
|
}));
|
|
25
7
|
import_commander.program.command("clean").option("-q, --quiet", "No Lex notifications printed in the console.").option("-s, --snapshots", 'Remove all "__snapshots__" directories.').action((cmd) => (0, import_commands.clean)(cmd, process.exit).then(() => {
|
|
26
8
|
}));
|
package/dist/utils.js
CHANGED
|
@@ -20,22 +20,27 @@ var __spreadValues = (a, b) => {
|
|
|
20
20
|
};
|
|
21
21
|
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
22
22
|
var __export = (target, all) => {
|
|
23
|
-
__markAsModule(target);
|
|
24
23
|
for (var name in all)
|
|
25
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
26
25
|
};
|
|
27
|
-
var __reExport = (target, module2, desc) => {
|
|
26
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
28
27
|
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
29
28
|
for (let key of __getOwnPropNames(module2))
|
|
30
|
-
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
29
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
31
30
|
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
32
31
|
}
|
|
33
32
|
return target;
|
|
34
33
|
};
|
|
35
|
-
var
|
|
36
|
-
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default",
|
|
34
|
+
var __toESM = (module2, isNodeMode) => {
|
|
35
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
37
36
|
};
|
|
38
|
-
|
|
37
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
38
|
+
return (module2, temp) => {
|
|
39
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
40
|
+
};
|
|
41
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
42
|
+
var utils_exports = {};
|
|
43
|
+
__export(utils_exports, {
|
|
39
44
|
checkLinkedModules: () => checkLinkedModules,
|
|
40
45
|
copyFileSync: () => copyFileSync,
|
|
41
46
|
copyFiles: () => copyFiles,
|
|
@@ -55,16 +60,16 @@ __export(exports, {
|
|
|
55
60
|
setPackageJson: () => setPackageJson,
|
|
56
61
|
updateTemplateName: () => updateTemplateName
|
|
57
62
|
});
|
|
58
|
-
var import_boxen =
|
|
59
|
-
var import_chalk =
|
|
60
|
-
var import_find_file_up =
|
|
61
|
-
var import_fs_extra =
|
|
62
|
-
var import_glob =
|
|
63
|
-
var import_isEmpty =
|
|
64
|
-
var import_ora =
|
|
65
|
-
var import_path =
|
|
66
|
-
var import_rimraf =
|
|
67
|
-
var import_LexConfig =
|
|
63
|
+
var import_boxen = __toESM(require("boxen"));
|
|
64
|
+
var import_chalk = __toESM(require("chalk"));
|
|
65
|
+
var import_find_file_up = __toESM(require("find-file-up"));
|
|
66
|
+
var import_fs_extra = __toESM(require("fs-extra"));
|
|
67
|
+
var import_glob = __toESM(require("glob"));
|
|
68
|
+
var import_isEmpty = __toESM(require("lodash/isEmpty"));
|
|
69
|
+
var import_ora = __toESM(require("ora"));
|
|
70
|
+
var import_path = __toESM(require("path"));
|
|
71
|
+
var import_rimraf = __toESM(require("rimraf"));
|
|
72
|
+
var import_LexConfig = require("./LexConfig");
|
|
68
73
|
const cwd = process.cwd();
|
|
69
74
|
const log = (message, type = "info", quiet = false) => {
|
|
70
75
|
if (!quiet) {
|
|
@@ -283,6 +288,7 @@ const updateTemplateName = (filePath, replace, replaceCaps) => {
|
|
|
283
288
|
data = data.replace(/Sample/g, replaceCaps);
|
|
284
289
|
import_fs_extra.default.writeFileSync(filePath, data, "utf8");
|
|
285
290
|
};
|
|
291
|
+
module.exports = __toCommonJS(utils_exports);
|
|
286
292
|
// Annotate the CommonJS export names for ESM import in node:
|
|
287
293
|
0 && (module.exports = {
|
|
288
294
|
checkLinkedModules,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nlabs/lex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
4
4
|
"description": "Lex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -45,99 +45,104 @@
|
|
|
45
45
|
"watch": "NODE_ENV=development rm -rf dist && yarn compile -w"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@hot-loader/react-dom": "17.0.
|
|
48
|
+
"@hot-loader/react-dom": "17.0.2",
|
|
49
49
|
"@nlabs/gothamjs": "^0.8.2",
|
|
50
50
|
"@nlabs/webpack-plugin-static-site": "^0.1.1",
|
|
51
|
-
"acorn": "^8.
|
|
51
|
+
"acorn": "^8.7.0",
|
|
52
52
|
"acorn-dynamic-import": "^4.0.0",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"assert": "^2.0.0",
|
|
54
|
+
"boxen": "5.1.2",
|
|
55
|
+
"caniuse-lite": "1.0.30001305",
|
|
55
56
|
"chalk": "^4.1.2",
|
|
56
57
|
"commander": "^8.2.0",
|
|
57
|
-
"compare-versions": "^
|
|
58
|
-
"compression-webpack-plugin": "^
|
|
58
|
+
"compare-versions": "^4.1.3",
|
|
59
|
+
"compression-webpack-plugin": "^9.2.0",
|
|
59
60
|
"config-webpack-plugin": "^1.1.0",
|
|
60
|
-
"copy-webpack-plugin": "^
|
|
61
|
-
"core-js": "^3.
|
|
61
|
+
"copy-webpack-plugin": "^10.2.4",
|
|
62
|
+
"core-js": "^3.21.0",
|
|
62
63
|
"crypto-browserify": "^3.12.0",
|
|
63
|
-
"css-loader": "^6.
|
|
64
|
-
"cssnano": "^5.0.
|
|
65
|
-
"dotenv-webpack": "^7.0
|
|
64
|
+
"css-loader": "^6.6.0",
|
|
65
|
+
"cssnano": "^5.0.16",
|
|
66
|
+
"dotenv-webpack": "^7.1.0",
|
|
66
67
|
"download-npm-package": "^3.1.12",
|
|
67
68
|
"esbuild-jest": "^0.5.0",
|
|
68
|
-
"esbuild-loader": "^2.
|
|
69
|
-
"execa": "
|
|
70
|
-
"exports-loader": "^3.
|
|
69
|
+
"esbuild-loader": "^2.18.0",
|
|
70
|
+
"execa": "5",
|
|
71
|
+
"exports-loader": "^3.1.0",
|
|
71
72
|
"favicons-webpack-plugin": "^5.0.2",
|
|
72
73
|
"file-loader": "^6.2.0",
|
|
73
74
|
"find-file-up": "^2.0.1",
|
|
74
75
|
"fs-extra": "^10.0.0",
|
|
75
|
-
"glob": "^7.
|
|
76
|
-
"graphql-tag": "^2.12.
|
|
77
|
-
"html-loader": "^
|
|
78
|
-
"html-webpack-plugin": "^5.
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"jest
|
|
76
|
+
"glob": "^7.2.0",
|
|
77
|
+
"graphql-tag": "^2.12.6",
|
|
78
|
+
"html-loader": "^3.1.0",
|
|
79
|
+
"html-webpack-plugin": "^5.5.0",
|
|
80
|
+
"https-browserify": "^1.0.0",
|
|
81
|
+
"imports-loader": "^3.1.1",
|
|
82
|
+
"jest": "^27.4.7",
|
|
83
|
+
"jest-cli": "^27.4.7",
|
|
82
84
|
"jest-transform-graphql": "^2.1.0",
|
|
83
85
|
"json-d-ts": "^1.0.1",
|
|
84
|
-
"latest-version": "
|
|
86
|
+
"latest-version": "5.1.0",
|
|
85
87
|
"lodash": "^4.17.21",
|
|
86
|
-
"luxon": "^2.0
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"ora": "
|
|
88
|
+
"luxon": "^2.3.0",
|
|
89
|
+
"net": "^1.0.2",
|
|
90
|
+
"npm-check-updates": "^12.2.1",
|
|
91
|
+
"ora": "5.4.1",
|
|
92
|
+
"os-browserify": "^0.3.0",
|
|
90
93
|
"path-browserify": "^1.0.1",
|
|
91
94
|
"postcss-browser-reporter": "^0.6.0",
|
|
92
|
-
"postcss-cli": "^
|
|
93
|
-
"postcss-custom-properties": "^
|
|
95
|
+
"postcss-cli": "^9.1.0",
|
|
96
|
+
"postcss-custom-properties": "^12.1.4",
|
|
94
97
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
95
98
|
"postcss-for": "^2.1.1",
|
|
96
99
|
"postcss-hash": "^3.0.0",
|
|
97
100
|
"postcss-import": "14.0.2",
|
|
98
|
-
"postcss-loader": "^6.
|
|
99
|
-
"postcss-nesting": "^
|
|
101
|
+
"postcss-loader": "^6.2.1",
|
|
102
|
+
"postcss-nesting": "^10.1.2",
|
|
100
103
|
"postcss-percentage": "^0.0.0",
|
|
101
|
-
"postcss-preset-env": "^
|
|
104
|
+
"postcss-preset-env": "^7.3.0",
|
|
102
105
|
"postcss-simple-vars": "^6.0.3",
|
|
103
|
-
"postcss-svgo": "5.0.
|
|
106
|
+
"postcss-svgo": "5.0.3",
|
|
104
107
|
"postcss-url": "10.1.3",
|
|
105
108
|
"process": "^0.11.10",
|
|
106
109
|
"react": "^17.0.2",
|
|
107
110
|
"react-dom": "^17.0.2",
|
|
108
111
|
"regenerator-runtime": "^0.13.9",
|
|
109
|
-
"resolve": "^1.
|
|
112
|
+
"resolve": "^1.22.0",
|
|
110
113
|
"rimraf": "^3.0.2",
|
|
111
114
|
"semver": "^7.3.5",
|
|
112
|
-
"source-map-loader": "^3.0.
|
|
113
|
-
"source-map-support": "^0.5.
|
|
115
|
+
"source-map-loader": "^3.0.1",
|
|
116
|
+
"source-map-support": "^0.5.21",
|
|
114
117
|
"speed-measure-webpack-plugin": "^1.5.0",
|
|
115
118
|
"static-site-generator-webpack-plugin": "^3.4.2",
|
|
116
119
|
"stream-browserify": "^3.0.0",
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
120
|
+
"stream-http": "^3.2.0",
|
|
121
|
+
"style-loader": "^3.3.1",
|
|
122
|
+
"svg-spritemap-webpack-plugin": "^4.4.0",
|
|
123
|
+
"svgo": "2.8.0",
|
|
124
|
+
"tls": "^0.0.1",
|
|
125
|
+
"typescript": "^4.5.5",
|
|
121
126
|
"url-loader": "^4.1.1",
|
|
122
127
|
"util": "^0.12.4",
|
|
123
|
-
"webpack": "5.
|
|
124
|
-
"webpack-bundle-analyzer": "^4.
|
|
125
|
-
"webpack-cli": "^4.
|
|
128
|
+
"webpack": "5.68.0",
|
|
129
|
+
"webpack-bundle-analyzer": "^4.5.0",
|
|
130
|
+
"webpack-cli": "^4.9.2",
|
|
126
131
|
"webpack-merge": "^5.8.0",
|
|
127
132
|
"webpack-nano": "^1.1.1",
|
|
128
|
-
"webpack-plugin-serve": "^1.
|
|
133
|
+
"webpack-plugin-serve": "^1.6.0"
|
|
129
134
|
},
|
|
130
135
|
"devDependencies": {
|
|
131
|
-
"@nlabs/execa-mock": "^1.
|
|
132
|
-
"@types/jest": "^27.0
|
|
133
|
-
"@types/luxon": "^2.0.
|
|
134
|
-
"@types/node": "^
|
|
136
|
+
"@nlabs/execa-mock": "^1.31.0",
|
|
137
|
+
"@types/jest": "^27.4.0",
|
|
138
|
+
"@types/luxon": "^2.0.9",
|
|
139
|
+
"@types/node": "^17.0.14",
|
|
135
140
|
"@types/ora": "^3.2.0",
|
|
136
|
-
"@types/react": "^17.0.
|
|
141
|
+
"@types/react": "^17.0.38",
|
|
137
142
|
"@types/webpack": "^5.28.0",
|
|
138
|
-
"eslint": "^
|
|
139
|
-
"eslint-config-styleguidejs": "^1.5.
|
|
143
|
+
"eslint": "^8.8.0",
|
|
144
|
+
"eslint-config-styleguidejs": "^1.5.4",
|
|
140
145
|
"lerna": "^4.0.0"
|
|
141
146
|
},
|
|
142
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "4f93d9421e7f03819a61e71c6e51af5597dbf4ce"
|
|
143
148
|
}
|
package/webpack.config.js
CHANGED
|
@@ -12,7 +12,6 @@ const fs = require('fs');
|
|
|
12
12
|
const glob = require('glob');
|
|
13
13
|
const HtmlWebPackPlugin = require('html-webpack-plugin');
|
|
14
14
|
const isEmpty = require('lodash/isEmpty');
|
|
15
|
-
const ObsoletePlugin = require('obsolete-webpack-plugin');
|
|
16
15
|
const path = require('path');
|
|
17
16
|
const SVGSpritemapPlugin = require('svg-spritemap-webpack-plugin');
|
|
18
17
|
const webpack = require('webpack');
|
|
@@ -23,8 +22,7 @@ const {WebpackPluginServe} = require('webpack-plugin-serve');
|
|
|
23
22
|
const {getNodePath, relativeFilePath} = require('./dist/utils');
|
|
24
23
|
|
|
25
24
|
const {ProgressPlugin, ProvidePlugin} = webpack;
|
|
26
|
-
const
|
|
27
|
-
const isProduction = environment === 'production';
|
|
25
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
28
26
|
const lexConfig = JSON.parse(process.env.LEX_CONFIG) || {};
|
|
29
27
|
|
|
30
28
|
const {
|
|
@@ -36,7 +34,7 @@ const {
|
|
|
36
34
|
libraryName,
|
|
37
35
|
libraryTarget,
|
|
38
36
|
preset,
|
|
39
|
-
targetEnvironment,
|
|
37
|
+
targetEnvironment = 'es2015',
|
|
40
38
|
webpack: webpackCustom
|
|
41
39
|
} = lexConfig;
|
|
42
40
|
|
|
@@ -49,27 +47,18 @@ const plugins = [
|
|
|
49
47
|
dependencies: true,
|
|
50
48
|
percentBy: null
|
|
51
49
|
}),
|
|
52
|
-
new
|
|
53
|
-
new DotenvPlugin({path: path.resolve(process.cwd(), '.env'), systemvars: true}),
|
|
54
|
-
new CompressionWebpackPlugin({algorithm: 'gzip'}),
|
|
55
|
-
new ObsoletePlugin({
|
|
56
|
-
name: 'obsolete',
|
|
57
|
-
promptOnNonTargetBrowser: true,
|
|
58
|
-
template: `
|
|
59
|
-
<div style="background-color: rgb(32, 41, 69); opacity: 0.8; height: 100%; width: 100%; margin: 0; padding: 0; position: absolute; text-align: center; left: 0; right: 0; bottom: 0; top: 0;">
|
|
60
|
-
<div style="color: white; font-size: 20px; margin-top: 10%">
|
|
61
|
-
Your browser is not supported.<br/><br/>
|
|
62
|
-
Please use a recent
|
|
63
|
-
<a href="https://www.microsoft.com/en-us/edge" style="color:white">Edge</a>,
|
|
64
|
-
<a href="https://www.mozilla.org/en-US/firefox/new/" style="color:white">Firefox</a>,
|
|
65
|
-
<a href="https://www.google.com/chrome/" style="color:white">Chrome</a> or
|
|
66
|
-
Safari.
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
69
|
-
`
|
|
70
|
-
})
|
|
50
|
+
new DotenvPlugin({path: path.resolve(process.cwd(), '.env'), systemvars: false})
|
|
71
51
|
];
|
|
72
52
|
|
|
53
|
+
const isWeb = (preset || targetEnvironment) === 'web';
|
|
54
|
+
|
|
55
|
+
if(isWeb) {
|
|
56
|
+
plugins.push(
|
|
57
|
+
new CompressionWebpackPlugin({algorithm: 'gzip'}),
|
|
58
|
+
new ProvidePlugin({process: 'process/browser'})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
73
62
|
// Add svg files
|
|
74
63
|
const globOptions = {
|
|
75
64
|
cwd: sourceFullPath,
|
|
@@ -131,7 +120,7 @@ let outputFilename = outputFile;
|
|
|
131
120
|
|
|
132
121
|
if(outputFile) {
|
|
133
122
|
outputFilename = outputFile;
|
|
134
|
-
} else if(outputHash || isProduction) {
|
|
123
|
+
} else if(outputHash || (isWeb && isProduction)) {
|
|
135
124
|
outputFilename = '[name].[hash].js';
|
|
136
125
|
} else {
|
|
137
126
|
outputFilename = '[name].js';
|
|
@@ -154,6 +143,7 @@ const aliasPaths = {
|
|
|
154
143
|
'@nlabs/arkhamjs': relativeFilePath('node_modules/@nlabs/arkhamjs', process.cwd()),
|
|
155
144
|
'@nlabs/arkhamjs-utils-react': relativeFilePath('node_modules/@nlabs/arkhamjs-utils-react', process.cwd()),
|
|
156
145
|
'core-js': getNodePath('core-js'),
|
|
146
|
+
process: relativeFilePath('node_modules/process', process.cwd()),
|
|
157
147
|
react: relativeFilePath('node_modules/react', process.cwd()),
|
|
158
148
|
'react-dom': relativeFilePath('node_modules/react-dom', process.cwd()),
|
|
159
149
|
'regenerator-runtime': getNodePath('regenerator-runtime')
|
|
@@ -173,12 +163,12 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
173
163
|
const webpackConfig = {
|
|
174
164
|
bail: true,
|
|
175
165
|
cache: !isProduction,
|
|
176
|
-
devtool: isProduction ? 'cheap-module-source-map' : 'eval-cheap-module-source-map',
|
|
166
|
+
devtool: isProduction ? 'inline-cheap-module-source-map' : 'eval-cheap-module-source-map',
|
|
177
167
|
entry: {
|
|
178
168
|
index: `${sourceFullPath}/${lexConfig.entryJs}`
|
|
179
169
|
},
|
|
180
170
|
ignoreWarnings: [/Failed to parse source map/],
|
|
181
|
-
mode:
|
|
171
|
+
mode: isProduction ? 'production' : 'development',
|
|
182
172
|
module: {
|
|
183
173
|
rules: [
|
|
184
174
|
{
|
|
@@ -204,7 +194,7 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
204
194
|
loader: esbuildLoaderPath,
|
|
205
195
|
options: {
|
|
206
196
|
loader: 'tsx',
|
|
207
|
-
target:
|
|
197
|
+
target: targetEnvironment
|
|
208
198
|
},
|
|
209
199
|
test: /\.(ts|tsx|js)$/
|
|
210
200
|
},
|
|
@@ -288,11 +278,11 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
288
278
|
}
|
|
289
279
|
]
|
|
290
280
|
},
|
|
291
|
-
optimization:
|
|
281
|
+
optimization: (isProduction && isWeb) ? {
|
|
292
282
|
minimizer: [
|
|
293
283
|
new ESBuildMinifyPlugin({
|
|
294
284
|
css: true,
|
|
295
|
-
target:
|
|
285
|
+
target: targetEnvironment
|
|
296
286
|
})
|
|
297
287
|
],
|
|
298
288
|
runtimeChunk: 'single',
|
|
@@ -307,7 +297,7 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
307
297
|
}
|
|
308
298
|
},
|
|
309
299
|
usedExports: true
|
|
310
|
-
},
|
|
300
|
+
} : {},
|
|
311
301
|
output: {
|
|
312
302
|
filename: outputFilename,
|
|
313
303
|
library: libraryName,
|
|
@@ -321,7 +311,12 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
321
311
|
alias,
|
|
322
312
|
extensions: ['*', '.mjs', '.js', '.ts', '.tsx', '.jsx', '.json', '.gql', '.graphql'],
|
|
323
313
|
fallback: {
|
|
314
|
+
assert: require.resolve('assert/'),
|
|
324
315
|
crypto: require.resolve('crypto-browserify'),
|
|
316
|
+
fs: require.resolve('fs-extra'),
|
|
317
|
+
http: require.resolve('stream-http'),
|
|
318
|
+
https: require.resolve('https-browserify'),
|
|
319
|
+
os: require.resolve('os-browserify/browser'),
|
|
325
320
|
path: require.resolve('path-browserify'),
|
|
326
321
|
process: require.resolve('process/browser'),
|
|
327
322
|
stream: require.resolve('stream-browserify'),
|
|
@@ -336,7 +331,7 @@ module.exports = (webpackEnv, webpackOptions) => {
|
|
|
336
331
|
// stats: {
|
|
337
332
|
// warningsFilter: [/Failed to parse source map/]
|
|
338
333
|
// },
|
|
339
|
-
target:
|
|
334
|
+
target: isWeb ? 'web' : 'node'
|
|
340
335
|
};
|
|
341
336
|
|
|
342
337
|
// Add development plugins
|