@rspack/cli 1.0.0-alpha.5 → 1.0.0-beta.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/cli.js +1 -3
- package/dist/commands/preview.js +1 -3
- package/dist/utils/crossImport.js +5 -7
- package/dist/utils/isEsmFile.js +3 -5
- package/dist/utils/loadConfig.js +6 -12
- package/package.json +6 -5
package/dist/cli.js
CHANGED
|
@@ -195,9 +195,7 @@ class RspackCLI {
|
|
|
195
195
|
if (Array.isArray(item)) {
|
|
196
196
|
return Promise.all(item.map(internalBuildConfig));
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
return internalBuildConfig(item);
|
|
200
|
-
}
|
|
198
|
+
return internalBuildConfig(item);
|
|
201
199
|
}
|
|
202
200
|
async loadConfig(options) {
|
|
203
201
|
let loadedConfig = (await (0, loadConfig_1.loadRspackConfig)(options));
|
package/dist/commands/preview.js
CHANGED
|
@@ -16,13 +16,11 @@ const crossImport = async (path, cwd = process.cwd()) => {
|
|
|
16
16
|
const { default: config } = await (0, exports.dynamicImport)(url);
|
|
17
17
|
return config;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
result = result.default || {};
|
|
24
|
-
}
|
|
25
|
-
return result;
|
|
19
|
+
let result = require(path);
|
|
20
|
+
// compatible with export default config in common ts config
|
|
21
|
+
if (result && typeof result === "object" && "default" in result) {
|
|
22
|
+
result = result.default || {};
|
|
26
23
|
}
|
|
24
|
+
return result;
|
|
27
25
|
};
|
|
28
26
|
exports.default = crossImport;
|
package/dist/utils/isEsmFile.js
CHANGED
|
@@ -10,12 +10,10 @@ const isEsmFile = (filePath, cwd = process.cwd()) => {
|
|
|
10
10
|
if (/\.(mjs|mts)$/.test(ext)) {
|
|
11
11
|
return true;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
if (/\.(cjs|cts)/.test(ext)) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return packageJson?.type === "module";
|
|
19
|
-
}
|
|
16
|
+
const packageJson = (0, readPackageUp_1.default)(cwd);
|
|
17
|
+
return packageJson?.type === "module";
|
|
20
18
|
};
|
|
21
19
|
exports.default = isEsmFile;
|
package/dist/utils/loadConfig.js
CHANGED
|
@@ -33,9 +33,7 @@ const registerLoader = (configPath) => {
|
|
|
33
33
|
const messages = failures.map(failure => failure.error.message);
|
|
34
34
|
throw new Error(`${messages.join("\n")}`);
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
throw error;
|
|
38
|
-
}
|
|
36
|
+
throw error;
|
|
39
37
|
}
|
|
40
38
|
};
|
|
41
39
|
async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
@@ -47,15 +45,11 @@ async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
|
47
45
|
(0, isTsFile_1.default)(configPath) && registerLoader(configPath);
|
|
48
46
|
return (0, crossImport_1.default)(configPath, cwd);
|
|
49
47
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return (0, crossImport_1.default)(defaultConfig, cwd);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
48
|
+
const defaultConfig = (0, findConfig_1.default)(node_path_1.default.resolve(cwd, DEFAULT_CONFIG_NAME));
|
|
49
|
+
if (defaultConfig) {
|
|
50
|
+
(0, isTsFile_1.default)(defaultConfig) && registerLoader(defaultConfig);
|
|
51
|
+
return (0, crossImport_1.default)(defaultConfig, cwd);
|
|
59
52
|
}
|
|
53
|
+
return {};
|
|
60
54
|
}
|
|
61
55
|
exports.loadRspackConfig = loadRspackConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "CLI for rspack",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,12 +32,13 @@
|
|
|
32
32
|
"@types/semver": "^7.5.6",
|
|
33
33
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
34
34
|
"@types/yargs": "17.0.32",
|
|
35
|
+
"typescript": "5.0.2",
|
|
35
36
|
"ts-node": "^10.9.2",
|
|
36
37
|
"concat-stream": "^2.0.0",
|
|
37
38
|
"cross-env": "^7.0.3",
|
|
38
39
|
"execa": "^5.0.0",
|
|
39
40
|
"internal-ip": "6.2.0",
|
|
40
|
-
"@rspack/core": "1.0.0-
|
|
41
|
+
"@rspack/core": "1.0.0-beta.0"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
44
|
"@discoveryjs/json-ext": "^0.5.7",
|
|
@@ -45,14 +46,14 @@
|
|
|
45
46
|
"exit-hook": "^3.2.0",
|
|
46
47
|
"interpret": "^3.1.1",
|
|
47
48
|
"rechoir": "^0.8.0",
|
|
48
|
-
"semver": "6.
|
|
49
|
+
"semver": "^7.6.2",
|
|
49
50
|
"webpack-bundle-analyzer": "4.6.1",
|
|
50
51
|
"yargs": "17.6.2",
|
|
51
|
-
"@rspack/dev-server": "1.0.0-
|
|
52
|
+
"@rspack/dev-server": "1.0.0-beta.0"
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "tsc -b ./tsconfig.build.json",
|
|
55
56
|
"dev": "tsc -b -w",
|
|
56
|
-
"test": "cross-env jest --
|
|
57
|
+
"test": "cross-env jest --colors"
|
|
57
58
|
}
|
|
58
59
|
}
|