@rspack/cli 2.2.7 → 2.2.8
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/bin/rspack.js +4 -3
- package/dist/index.js +13 -4
- package/package.json +5 -5
package/bin/rspack.js
CHANGED
|
@@ -4,7 +4,9 @@ import nodeModule from 'node:module';
|
|
|
4
4
|
// enable on-disk code caching of all modules loaded by Node.js
|
|
5
5
|
// requires Nodejs >= 22.8.0
|
|
6
6
|
const { enableCompileCache } = nodeModule;
|
|
7
|
-
|
|
7
|
+
const isCI = Boolean(process.env.CI) && process.env.CI !== 'false';
|
|
8
|
+
// Skip CI, where builds typically run once and cannot reuse the cache.
|
|
9
|
+
if (enableCompileCache && !isCI) {
|
|
8
10
|
try {
|
|
9
11
|
enableCompileCache();
|
|
10
12
|
} catch {
|
|
@@ -12,9 +14,8 @@ if (enableCompileCache) {
|
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
import { RspackCLI } from '../dist/index.js';
|
|
16
|
-
|
|
17
17
|
async function runCLI() {
|
|
18
|
+
const { RspackCLI } = await import('../dist/index.js');
|
|
18
19
|
const cli = new RspackCLI();
|
|
19
20
|
await cli.run(process.argv);
|
|
20
21
|
}
|
package/dist/index.js
CHANGED
|
@@ -862,10 +862,18 @@ const getConfigExport = (configModule, exportName, configPath)=>{
|
|
|
862
862
|
if (canReadExport(configModule) && Object.hasOwn(configModule, exportName)) return configModule[exportName];
|
|
863
863
|
throw new Error(`Cannot find export ${exportName} in config file: ${configPath}`);
|
|
864
864
|
};
|
|
865
|
+
const cachedImport = (importer)=>{
|
|
866
|
+
let promise;
|
|
867
|
+
return ()=>promise ??= importer().catch((error)=>{
|
|
868
|
+
promise = void 0;
|
|
869
|
+
throw error;
|
|
870
|
+
});
|
|
871
|
+
};
|
|
872
|
+
const getJiti = cachedImport(()=>import("../compiled/jiti/index.js"));
|
|
865
873
|
const loadWithJiti = async (configPath, exportName, fresh)=>{
|
|
866
874
|
let createJiti;
|
|
867
875
|
try {
|
|
868
|
-
({ createJiti } = await
|
|
876
|
+
({ createJiti } = await getJiti());
|
|
869
877
|
} catch (error) {
|
|
870
878
|
throw new Error('The "jiti" package is required to load this config. Install it with your package manager.', {
|
|
871
879
|
cause: error
|
|
@@ -894,6 +902,7 @@ const CONFIG_META = Symbol.for('@rstackjs/load-config/meta');
|
|
|
894
902
|
function getConfigMeta(config) {
|
|
895
903
|
if (null !== config && 'object' == typeof config && Object.hasOwn(config, CONFIG_META)) return config[CONFIG_META];
|
|
896
904
|
}
|
|
905
|
+
const getFreshImport = cachedImport(()=>import("./freshImport.js"));
|
|
897
906
|
const JS_CONFIG_REGEXP = /\.(?:js|mjs|cjs)$/;
|
|
898
907
|
const loadWithNative = async (configPath, fresh)=>{
|
|
899
908
|
const configFileURL = pathToFileURL(configPath).href;
|
|
@@ -904,7 +913,7 @@ const loadWithNative = async (configPath, fresh)=>{
|
|
|
904
913
|
dependencies: []
|
|
905
914
|
};
|
|
906
915
|
}
|
|
907
|
-
const { freshImport } = await
|
|
916
|
+
const { freshImport } = await getFreshImport();
|
|
908
917
|
const freshImportResult = await freshImport(configFileURL);
|
|
909
918
|
if (freshImportResult) return {
|
|
910
919
|
configModule: freshImportResult.result,
|
|
@@ -1107,7 +1116,7 @@ function isEnvColorSupported() {
|
|
|
1107
1116
|
const p = process;
|
|
1108
1117
|
const argv = p.argv ?? [];
|
|
1109
1118
|
const env = p.env ?? {};
|
|
1110
|
-
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === p.platform || p.stdout?.isTTY && 'dumb' !== env.TERM ||
|
|
1119
|
+
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === p.platform || p.stdout?.isTTY && 'dumb' !== env.TERM || Boolean(env.CI) && 'false' !== env.CI);
|
|
1111
1120
|
}
|
|
1112
1121
|
function createAnsiFormatter(open, close, replace = open) {
|
|
1113
1122
|
const closeLength = close.length;
|
|
@@ -1134,7 +1143,7 @@ class RspackCLI {
|
|
|
1134
1143
|
this.colors = this.createColors();
|
|
1135
1144
|
this.program = program;
|
|
1136
1145
|
program.help();
|
|
1137
|
-
program.version("2.2.
|
|
1146
|
+
program.version("2.2.8");
|
|
1138
1147
|
}
|
|
1139
1148
|
wrapAction(fn) {
|
|
1140
1149
|
return (...args)=>{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.8",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
],
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@discoveryjs/json-ext": "^1.1.0",
|
|
32
|
-
"@microsoft/api-extractor": "^7.59.
|
|
33
|
-
"@rstackjs/load-config": "^1.0.
|
|
34
|
-
"@rspack/core": "2.2.
|
|
32
|
+
"@microsoft/api-extractor": "^7.59.2",
|
|
33
|
+
"@rstackjs/load-config": "^1.0.1",
|
|
34
|
+
"@rspack/core": "2.2.8",
|
|
35
35
|
"@rspack/dev-server": "^2.2.1",
|
|
36
36
|
"cac": "^7.0.0",
|
|
37
37
|
"concat-stream": "^2.0.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"jiti": "^2.7.0",
|
|
41
41
|
"prebundle": "^1.6.5",
|
|
42
42
|
"rspack-merge": "1.0.1",
|
|
43
|
-
"rstack": "^0.
|
|
43
|
+
"rstack": "^0.8.0",
|
|
44
44
|
"typescript": "^6.0.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|