@nlabs/lex 1.27.0 → 1.30.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/commands/build.js +5 -4
- package/dist/commands/compile.js +1 -1
- package/package.json +32 -27
- package/webpack.config.js +23 -28
package/dist/commands/build.js
CHANGED
|
@@ -93,15 +93,16 @@ ${cliName} Error: Environment variables option is not a valid JSON object.`, "er
|
|
|
93
93
|
} else {
|
|
94
94
|
webpackConfig = path.resolve(__dirname, "../../webpack.config.js");
|
|
95
95
|
}
|
|
96
|
-
const webpackMode = mode || "production";
|
|
97
96
|
const webpackOptions = [
|
|
98
97
|
"--color",
|
|
99
98
|
"--progress",
|
|
99
|
+
"--stats-error-details",
|
|
100
100
|
"--config",
|
|
101
|
-
webpackConfig
|
|
102
|
-
"--mode",
|
|
103
|
-
webpackMode
|
|
101
|
+
webpackConfig
|
|
104
102
|
];
|
|
103
|
+
if (mode) {
|
|
104
|
+
webpackOptions.push("--mode", mode);
|
|
105
|
+
}
|
|
105
106
|
if (outputChunkFilename) {
|
|
106
107
|
webpackOptions.push("--output-chunk-filename", outputChunkFilename);
|
|
107
108
|
}
|
package/dist/commands/compile.js
CHANGED
|
@@ -124,7 +124,7 @@ ${cliName} Error: ${error.message}`, "error", quiet);
|
|
|
124
124
|
"--outdir=lib",
|
|
125
125
|
"--platform=node",
|
|
126
126
|
"--sourcemap=inline",
|
|
127
|
-
"--target=esnext,
|
|
127
|
+
"--target=esnext,node14"
|
|
128
128
|
];
|
|
129
129
|
if (useTypescript) {
|
|
130
130
|
esbuildOptions.push("--loader:.ts=ts", "--loader:.tsx=tsx");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nlabs/lex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Lex",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -46,27 +46,28 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@hot-loader/react-dom": "17.0.1",
|
|
49
|
-
"@nlabs/gothamjs": "^0.
|
|
49
|
+
"@nlabs/gothamjs": "^0.8.2",
|
|
50
50
|
"@nlabs/webpack-plugin-static-site": "^0.1.1",
|
|
51
|
-
"acorn": "^8.
|
|
51
|
+
"acorn": "^8.5.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.30001258",
|
|
55
56
|
"chalk": "^4.1.2",
|
|
56
|
-
"commander": "^8.
|
|
57
|
+
"commander": "^8.2.0",
|
|
57
58
|
"compare-versions": "^3.6.0",
|
|
58
|
-
"compression-webpack-plugin": "^
|
|
59
|
+
"compression-webpack-plugin": "^9.0.0",
|
|
59
60
|
"config-webpack-plugin": "^1.1.0",
|
|
60
61
|
"copy-webpack-plugin": "^9.0.1",
|
|
61
|
-
"core-js": "^3.
|
|
62
|
+
"core-js": "^3.18.0",
|
|
62
63
|
"crypto-browserify": "^3.12.0",
|
|
63
|
-
"css-loader": "^6.
|
|
64
|
+
"css-loader": "^6.3.0",
|
|
64
65
|
"cssnano": "^5.0.8",
|
|
65
66
|
"dotenv-webpack": "^7.0.3",
|
|
66
67
|
"download-npm-package": "^3.1.12",
|
|
67
68
|
"esbuild-jest": "^0.5.0",
|
|
68
69
|
"esbuild-loader": "^2.15.1",
|
|
69
|
-
"execa": "
|
|
70
|
+
"execa": "5",
|
|
70
71
|
"exports-loader": "^3.0.0",
|
|
71
72
|
"favicons-webpack-plugin": "^5.0.2",
|
|
72
73
|
"file-loader": "^6.2.0",
|
|
@@ -76,21 +77,23 @@
|
|
|
76
77
|
"graphql-tag": "^2.12.5",
|
|
77
78
|
"html-loader": "^2.1.2",
|
|
78
79
|
"html-webpack-plugin": "^5.3.2",
|
|
80
|
+
"https-browserify": "^1.0.0",
|
|
79
81
|
"imports-loader": "^3.0.0",
|
|
80
|
-
"jest": "^27.1
|
|
81
|
-
"jest-cli": "^27.1
|
|
82
|
+
"jest": "^27.2.1",
|
|
83
|
+
"jest-cli": "^27.2.1",
|
|
82
84
|
"jest-transform-graphql": "^2.1.0",
|
|
83
85
|
"json-d-ts": "^1.0.1",
|
|
84
|
-
"latest-version": "5",
|
|
86
|
+
"latest-version": "5.1.0",
|
|
85
87
|
"lodash": "^4.17.21",
|
|
86
88
|
"luxon": "^2.0.2",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"ora": "5",
|
|
89
|
+
"net": "^1.0.2",
|
|
90
|
+
"npm-check-updates": "^11.8.5",
|
|
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
95
|
"postcss-cli": "^8.3.1",
|
|
93
|
-
"postcss-custom-properties": "^
|
|
96
|
+
"postcss-custom-properties": "^12.0.0",
|
|
94
97
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
95
98
|
"postcss-for": "^2.1.1",
|
|
96
99
|
"postcss-hash": "^3.0.0",
|
|
@@ -110,17 +113,19 @@
|
|
|
110
113
|
"rimraf": "^3.0.2",
|
|
111
114
|
"semver": "^7.3.5",
|
|
112
115
|
"source-map-loader": "^3.0.0",
|
|
113
|
-
"source-map-support": "^0.5.
|
|
116
|
+
"source-map-support": "^0.5.20",
|
|
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",
|
|
120
|
+
"stream-http": "^3.2.0",
|
|
117
121
|
"style-loader": "^3.2.1",
|
|
118
|
-
"svg-spritemap-webpack-plugin": "^4.3.
|
|
119
|
-
"svgo": "2.
|
|
120
|
-
"
|
|
122
|
+
"svg-spritemap-webpack-plugin": "^4.3.2",
|
|
123
|
+
"svgo": "2.6.1",
|
|
124
|
+
"tls": "^0.0.1",
|
|
125
|
+
"typescript": "^4.4.3",
|
|
121
126
|
"url-loader": "^4.1.1",
|
|
122
127
|
"util": "^0.12.4",
|
|
123
|
-
"webpack": "5.
|
|
128
|
+
"webpack": "5.53.0",
|
|
124
129
|
"webpack-bundle-analyzer": "^4.4.1",
|
|
125
130
|
"webpack-cli": "^4.8.0",
|
|
126
131
|
"webpack-merge": "^5.8.0",
|
|
@@ -128,16 +133,16 @@
|
|
|
128
133
|
"webpack-plugin-serve": "^1.5.0"
|
|
129
134
|
},
|
|
130
135
|
"devDependencies": {
|
|
131
|
-
"@nlabs/execa-mock": "^1.
|
|
136
|
+
"@nlabs/execa-mock": "^1.29.0",
|
|
132
137
|
"@types/jest": "^27.0.1",
|
|
133
|
-
"@types/luxon": "^2.0.
|
|
134
|
-
"@types/node": "^16.
|
|
138
|
+
"@types/luxon": "^2.0.4",
|
|
139
|
+
"@types/node": "^16.9.4",
|
|
135
140
|
"@types/ora": "^3.2.0",
|
|
136
|
-
"@types/react": "^17.0.
|
|
141
|
+
"@types/react": "^17.0.22",
|
|
137
142
|
"@types/webpack": "^5.28.0",
|
|
138
143
|
"eslint": "^7.32.0",
|
|
139
144
|
"eslint-config-styleguidejs": "^1.5.3",
|
|
140
145
|
"lerna": "^4.0.0"
|
|
141
146
|
},
|
|
142
|
-
"gitHead": "
|
|
147
|
+
"gitHead": "e023bf2c59248b153aff3ac14d6411ba1ad176f5"
|
|
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 {
|
|
@@ -49,27 +47,19 @@ 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 target = preset || targetEnvironment;
|
|
54
|
+
const isWeb = target === 'web';
|
|
55
|
+
|
|
56
|
+
if(isWeb) {
|
|
57
|
+
plugins.push(
|
|
58
|
+
new CompressionWebpackPlugin({algorithm: 'gzip'}),
|
|
59
|
+
new ProvidePlugin({process: 'process/browser'})
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
73
63
|
// Add svg files
|
|
74
64
|
const globOptions = {
|
|
75
65
|
cwd: sourceFullPath,
|
|
@@ -131,7 +121,7 @@ let outputFilename = outputFile;
|
|
|
131
121
|
|
|
132
122
|
if(outputFile) {
|
|
133
123
|
outputFilename = outputFile;
|
|
134
|
-
} else if(outputHash || isProduction) {
|
|
124
|
+
} else if(outputHash || (isWeb && isProduction)) {
|
|
135
125
|
outputFilename = '[name].[hash].js';
|
|
136
126
|
} else {
|
|
137
127
|
outputFilename = '[name].js';
|
|
@@ -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
|
{
|
|
@@ -288,7 +278,7 @@ 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,
|
|
@@ -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
|
|
340
335
|
};
|
|
341
336
|
|
|
342
337
|
// Add development plugins
|