@rspack/cli 1.1.0-beta.0 → 1.1.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/bin/rspack.js +13 -0
- package/dist/629.js +9 -9
- package/dist/629.mjs +6 -6
- package/dist/index.js +13 -20
- package/dist/index.mjs +12 -19
- package/package.json +6 -5
package/bin/rspack.js
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
const nodeModule = require("node:module");
|
|
3
|
+
|
|
4
|
+
// enable on-disk code caching of all modules loaded by Node.js
|
|
5
|
+
// requires Nodejs >= 22.8.0
|
|
6
|
+
const { enableCompileCache } = nodeModule;
|
|
7
|
+
if (enableCompileCache) {
|
|
8
|
+
try {
|
|
9
|
+
enableCompileCache();
|
|
10
|
+
} catch {
|
|
11
|
+
// ignore errors
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
2
15
|
const { RspackCLI } = require("../dist/index");
|
|
3
16
|
|
|
4
17
|
async function runCLI() {
|
package/dist/629.js
CHANGED
|
@@ -9,15 +9,15 @@ exports.modules = {
|
|
|
9
9
|
return applyProfile;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
/*
|
|
13
|
-
/*
|
|
14
|
-
/*
|
|
15
|
-
/*
|
|
16
|
-
/*
|
|
17
|
-
/*
|
|
18
|
-
/*
|
|
19
|
-
/*
|
|
20
|
-
/*
|
|
12
|
+
/* ESM import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
13
|
+
/* ESM import */ var node_fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(node_fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
+
/* ESM import */ var node_inspector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:inspector");
|
|
15
|
+
/* ESM import */ var node_inspector__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(node_inspector__WEBPACK_IMPORTED_MODULE_1__);
|
|
16
|
+
/* ESM import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("node:path");
|
|
17
|
+
/* ESM import */ var node_path__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/ __webpack_require__.n(node_path__WEBPACK_IMPORTED_MODULE_2__);
|
|
18
|
+
/* ESM import */ var node_url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("node:url");
|
|
19
|
+
/* ESM import */ var _rspack_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@rspack/core");
|
|
20
|
+
/* ESM import */ var _crossImport__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./src/utils/crossImport.ts");
|
|
21
21
|
/*
|
|
22
22
|
The full syntax, remember update this when you change something in this file.
|
|
23
23
|
|
package/dist/629.mjs
CHANGED
|
@@ -8,12 +8,12 @@ export const modules = {
|
|
|
8
8
|
return applyProfile;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
/*
|
|
12
|
-
/*
|
|
13
|
-
/*
|
|
14
|
-
/*
|
|
15
|
-
/*
|
|
16
|
-
/*
|
|
11
|
+
/* ESM import */ var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
|
|
12
|
+
/* ESM import */ var node_inspector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:inspector");
|
|
13
|
+
/* ESM import */ var node_path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("node:path");
|
|
14
|
+
/* ESM import */ var node_url__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("node:url");
|
|
15
|
+
/* ESM import */ var _rspack_core__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("@rspack/core");
|
|
16
|
+
/* ESM import */ var _crossImport__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("./src/utils/crossImport.ts");
|
|
17
17
|
/*
|
|
18
18
|
The full syntax, remember update this when you change something in this file.
|
|
19
19
|
|
package/dist/index.js
CHANGED
|
@@ -9,13 +9,12 @@ var __webpack_modules__ = {
|
|
|
9
9
|
return dynamicImport;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
/*
|
|
13
|
-
/*
|
|
12
|
+
/* ESM import */ var node_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:url");
|
|
13
|
+
/* ESM import */ var _isEsmFile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/isEsmFile.ts");
|
|
14
14
|
/**
|
|
15
15
|
* Dynamically import files. It will make sure it's not being compiled away by TS/Rslib.
|
|
16
16
|
*/ const dynamicImport = new Function("path", "return import(path)");
|
|
17
|
-
const crossImport = async
|
|
18
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
17
|
+
const crossImport = async (path, cwd = process.cwd())=>{
|
|
19
18
|
if ((0, _isEsmFile__WEBPACK_IMPORTED_MODULE_1__ /* ["default"] */ .Z)(path, cwd)) {
|
|
20
19
|
const url = (0, node_url__WEBPACK_IMPORTED_MODULE_0__.pathToFileURL)(path).href;
|
|
21
20
|
const { default: config } = await dynamicImport(url);
|
|
@@ -26,7 +25,7 @@ var __webpack_modules__ = {
|
|
|
26
25
|
if (result && "object" == typeof result && "default" in result) result = result.default || {};
|
|
27
26
|
return result;
|
|
28
27
|
};
|
|
29
|
-
/*
|
|
28
|
+
/* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = crossImport;
|
|
30
29
|
},
|
|
31
30
|
"./src/utils/isEsmFile.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
32
31
|
// EXPORTS
|
|
@@ -39,8 +38,7 @@ var __webpack_modules__ = {
|
|
|
39
38
|
// EXTERNAL MODULE: external "node:fs"
|
|
40
39
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
41
40
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_);
|
|
42
|
-
const readPackageUp_readPackageUp =
|
|
43
|
-
let cwd = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : process.cwd();
|
|
41
|
+
const readPackageUp_readPackageUp = (cwd = process.cwd())=>{
|
|
44
42
|
let currentDir = external_node_path_default().resolve(cwd);
|
|
45
43
|
let packageJsonPath = external_node_path_default().join(currentDir, "package.json");
|
|
46
44
|
while(!external_node_fs_default().existsSync(packageJsonPath)){
|
|
@@ -55,16 +53,15 @@ var __webpack_modules__ = {
|
|
|
55
53
|
return null;
|
|
56
54
|
}
|
|
57
55
|
};
|
|
58
|
-
/*
|
|
59
|
-
const isEsmFile_isEsmFile =
|
|
60
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
56
|
+
/* ESM default export */ const readPackageUp = readPackageUp_readPackageUp;
|
|
57
|
+
const isEsmFile_isEsmFile = (filePath, cwd = process.cwd())=>{
|
|
61
58
|
const ext = external_node_path_default().extname(filePath);
|
|
62
59
|
if (/\.(mjs|mts)$/.test(ext)) return true;
|
|
63
60
|
if (/\.(cjs|cts)/.test(ext)) return false;
|
|
64
61
|
const packageJson = readPackageUp(cwd);
|
|
65
62
|
return (null == packageJson ? void 0 : packageJson.type) === "module";
|
|
66
63
|
};
|
|
67
|
-
/*
|
|
64
|
+
/* ESM default export */ const isEsmFile = isEsmFile_isEsmFile;
|
|
68
65
|
},
|
|
69
66
|
"@discoveryjs/json-ext": function(module) {
|
|
70
67
|
module.exports = require("@discoveryjs/json-ext");
|
|
@@ -111,7 +108,7 @@ function __webpack_require__(moduleId) {
|
|
|
111
108
|
__webpack_require__.m = __webpack_modules__;
|
|
112
109
|
/************************************************************************/ // webpack/runtime/compat_get_default_export
|
|
113
110
|
(()=>{
|
|
114
|
-
// getDefaultExport function for compatibility with non-
|
|
111
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
115
112
|
__webpack_require__.n = function(module) {
|
|
116
113
|
var getter = module && module.__esModule ? function() {
|
|
117
114
|
return module['default'];
|
|
@@ -666,24 +663,21 @@ const DEFAULT_EXTENSIONS = [
|
|
|
666
663
|
* Takes a basePath like `webpack.config`, return `webpack.config.{ext}` if
|
|
667
664
|
* exists. returns undefined if none of them exists
|
|
668
665
|
*/ const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_default().existsSync);
|
|
669
|
-
/*
|
|
666
|
+
/* ESM default export */ const utils_findConfig = findConfig;
|
|
670
667
|
// EXTERNAL MODULE: ./src/utils/isEsmFile.ts + 1 modules
|
|
671
668
|
var isEsmFile = __webpack_require__("./src/utils/isEsmFile.ts");
|
|
672
669
|
const isTsFile = (configPath)=>{
|
|
673
670
|
const ext = external_node_path_default().extname(configPath);
|
|
674
671
|
return /\.(c|m)?ts$/.test(ext);
|
|
675
672
|
};
|
|
676
|
-
/*
|
|
673
|
+
/* ESM default export */ const utils_isTsFile = isTsFile;
|
|
677
674
|
const loadConfig_DEFAULT_CONFIG_NAME = "rspack.config";
|
|
678
675
|
const registerLoader = (configPath)=>{
|
|
679
676
|
const ext = external_node_path_default().extname(configPath);
|
|
680
677
|
// TODO implement good `.mts` support after https://github.com/gulpjs/rechoir/issues/43
|
|
681
678
|
// For ESM and `.mts` you need to use: 'NODE_OPTIONS="--loader ts-node/esm" rspack build --config ./rspack.config.mts'
|
|
682
679
|
if ((0, isEsmFile /* default */ .Z)(configPath) && utils_isTsFile(configPath)) return;
|
|
683
|
-
const extensions = Object.fromEntries(Object.entries(external_interpret_default().extensions).filter((
|
|
684
|
-
let [key] = param;
|
|
685
|
-
return key === ext;
|
|
686
|
-
}));
|
|
680
|
+
const extensions = Object.fromEntries(Object.entries(external_interpret_default().extensions).filter(([key])=>key === ext));
|
|
687
681
|
if (0 === Object.keys(extensions).length) throw new Error(`config file "${configPath}" is not supported.`);
|
|
688
682
|
try {
|
|
689
683
|
external_rechoir_default().prepare(extensions, configPath);
|
|
@@ -696,8 +690,7 @@ const registerLoader = (configPath)=>{
|
|
|
696
690
|
throw error;
|
|
697
691
|
}
|
|
698
692
|
};
|
|
699
|
-
async function loadRspackConfig(options) {
|
|
700
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
693
|
+
async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
701
694
|
if (options.config) {
|
|
702
695
|
const configPath = external_node_path_default().resolve(cwd, options.config);
|
|
703
696
|
if (!external_node_fs_default().existsSync(configPath)) throw new Error(`config file "${configPath}" not found.`);
|
package/dist/index.mjs
CHANGED
|
@@ -20,13 +20,12 @@ var __webpack_modules__ = {
|
|
|
20
20
|
return dynamicImport;
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
-
/*
|
|
24
|
-
/*
|
|
23
|
+
/* ESM import */ var node_url__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:url");
|
|
24
|
+
/* ESM import */ var _isEsmFile__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/utils/isEsmFile.ts");
|
|
25
25
|
/**
|
|
26
26
|
* Dynamically import files. It will make sure it's not being compiled away by TS/Rslib.
|
|
27
27
|
*/ const dynamicImport = new Function("path", "return import(path)");
|
|
28
|
-
const crossImport = async
|
|
29
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
28
|
+
const crossImport = async (path, cwd = process.cwd())=>{
|
|
30
29
|
if ((0, _isEsmFile__WEBPACK_IMPORTED_MODULE_1__ /* ["default"] */ .Z)(path, cwd)) {
|
|
31
30
|
const url = (0, node_url__WEBPACK_IMPORTED_MODULE_0__.pathToFileURL)(path).href;
|
|
32
31
|
const { default: config } = await dynamicImport(url);
|
|
@@ -37,7 +36,7 @@ var __webpack_modules__ = {
|
|
|
37
36
|
if (result && "object" == typeof result && "default" in result) result = result.default || {};
|
|
38
37
|
return result;
|
|
39
38
|
};
|
|
40
|
-
/*
|
|
39
|
+
/* ESM default export */ const __WEBPACK_DEFAULT_EXPORT__ = crossImport;
|
|
41
40
|
},
|
|
42
41
|
"./src/utils/isEsmFile.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
43
42
|
// EXPORTS
|
|
@@ -48,8 +47,7 @@ var __webpack_modules__ = {
|
|
|
48
47
|
var external_node_path_ = __webpack_require__("node:path");
|
|
49
48
|
// EXTERNAL MODULE: external "node:fs"
|
|
50
49
|
var external_node_fs_ = __webpack_require__("node:fs");
|
|
51
|
-
const readPackageUp_readPackageUp =
|
|
52
|
-
let cwd = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : process.cwd();
|
|
50
|
+
const readPackageUp_readPackageUp = (cwd = process.cwd())=>{
|
|
53
51
|
let currentDir = external_node_path_["default"].resolve(cwd);
|
|
54
52
|
let packageJsonPath = external_node_path_["default"].join(currentDir, "package.json");
|
|
55
53
|
while(!external_node_fs_["default"].existsSync(packageJsonPath)){
|
|
@@ -64,16 +62,15 @@ var __webpack_modules__ = {
|
|
|
64
62
|
return null;
|
|
65
63
|
}
|
|
66
64
|
};
|
|
67
|
-
/*
|
|
68
|
-
const isEsmFile_isEsmFile =
|
|
69
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
65
|
+
/* ESM default export */ const readPackageUp = readPackageUp_readPackageUp;
|
|
66
|
+
const isEsmFile_isEsmFile = (filePath, cwd = process.cwd())=>{
|
|
70
67
|
const ext = external_node_path_["default"].extname(filePath);
|
|
71
68
|
if (/\.(mjs|mts)$/.test(ext)) return true;
|
|
72
69
|
if (/\.(cjs|cts)/.test(ext)) return false;
|
|
73
70
|
const packageJson = readPackageUp(cwd);
|
|
74
71
|
return (null == packageJson ? void 0 : packageJson.type) === "module";
|
|
75
72
|
};
|
|
76
|
-
/*
|
|
73
|
+
/* ESM default export */ const isEsmFile = isEsmFile_isEsmFile;
|
|
77
74
|
},
|
|
78
75
|
"@rspack/core": function(module) {
|
|
79
76
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rspack_core__;
|
|
@@ -603,24 +600,21 @@ const DEFAULT_EXTENSIONS = [
|
|
|
603
600
|
* Takes a basePath like `webpack.config`, return `webpack.config.{ext}` if
|
|
604
601
|
* exists. returns undefined if none of them exists
|
|
605
602
|
*/ const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
|
|
606
|
-
/*
|
|
603
|
+
/* ESM default export */ const utils_findConfig = findConfig;
|
|
607
604
|
// EXTERNAL MODULE: ./src/utils/isEsmFile.ts + 1 modules
|
|
608
605
|
var isEsmFile = __webpack_require__("./src/utils/isEsmFile.ts");
|
|
609
606
|
const isTsFile = (configPath)=>{
|
|
610
607
|
const ext = external_node_path_["default"].extname(configPath);
|
|
611
608
|
return /\.(c|m)?ts$/.test(ext);
|
|
612
609
|
};
|
|
613
|
-
/*
|
|
610
|
+
/* ESM default export */ const utils_isTsFile = isTsFile;
|
|
614
611
|
const loadConfig_DEFAULT_CONFIG_NAME = "rspack.config";
|
|
615
612
|
const registerLoader = (configPath)=>{
|
|
616
613
|
const ext = external_node_path_["default"].extname(configPath);
|
|
617
614
|
// TODO implement good `.mts` support after https://github.com/gulpjs/rechoir/issues/43
|
|
618
615
|
// For ESM and `.mts` you need to use: 'NODE_OPTIONS="--loader ts-node/esm" rspack build --config ./rspack.config.mts'
|
|
619
616
|
if ((0, isEsmFile /* default */ .Z)(configPath) && utils_isTsFile(configPath)) return;
|
|
620
|
-
const extensions = Object.fromEntries(Object.entries(__WEBPACK_EXTERNAL_MODULE_interpret__["default"].extensions).filter((
|
|
621
|
-
let [key] = param;
|
|
622
|
-
return key === ext;
|
|
623
|
-
}));
|
|
617
|
+
const extensions = Object.fromEntries(Object.entries(__WEBPACK_EXTERNAL_MODULE_interpret__["default"].extensions).filter(([key])=>key === ext));
|
|
624
618
|
if (0 === Object.keys(extensions).length) throw new Error(`config file "${configPath}" is not supported.`);
|
|
625
619
|
try {
|
|
626
620
|
__WEBPACK_EXTERNAL_MODULE_rechoir__["default"].prepare(extensions, configPath);
|
|
@@ -633,8 +627,7 @@ const registerLoader = (configPath)=>{
|
|
|
633
627
|
throw error;
|
|
634
628
|
}
|
|
635
629
|
};
|
|
636
|
-
async function loadRspackConfig(options) {
|
|
637
|
-
let cwd = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : process.cwd();
|
|
630
|
+
async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
638
631
|
if (options.config) {
|
|
639
632
|
const configPath = external_node_path_["default"].resolve(cwd, options.config);
|
|
640
633
|
if (!external_node_fs_["default"].existsSync(configPath)) throw new Error(`config file "${configPath}" not found.`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "1.1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.dev",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
15
16
|
"import": "./dist/index.mjs",
|
|
16
17
|
"require": "./dist/index.js"
|
|
17
18
|
},
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
],
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@discoveryjs/json-ext": "^0.5.7",
|
|
31
|
-
"@rspack/dev-server": "1.0.
|
|
32
|
+
"@rspack/dev-server": "1.0.9",
|
|
32
33
|
"colorette": "2.0.19",
|
|
33
34
|
"exit-hook": "^4.0.0",
|
|
34
35
|
"interpret": "^3.1.1",
|
|
@@ -38,19 +39,19 @@
|
|
|
38
39
|
"yargs": "17.6.2"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@rslib/core": "0.0.
|
|
42
|
+
"@rslib/core": "0.0.15",
|
|
42
43
|
"@types/interpret": "^1.1.3",
|
|
43
44
|
"@types/rechoir": "^0.6.1",
|
|
44
45
|
"@types/semver": "^7.5.6",
|
|
45
46
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
46
|
-
"@types/yargs": "17.0.
|
|
47
|
+
"@types/yargs": "17.0.33",
|
|
47
48
|
"concat-stream": "^2.0.0",
|
|
48
49
|
"cross-env": "^7.0.3",
|
|
49
50
|
"execa": "^5.0.0",
|
|
50
51
|
"internal-ip": "6.2.0",
|
|
51
52
|
"ts-node": "^10.9.2",
|
|
52
53
|
"typescript": "^5.6.3",
|
|
53
|
-
"@rspack/core": "1.1.0
|
|
54
|
+
"@rspack/core": "1.1.0"
|
|
54
55
|
},
|
|
55
56
|
"peerDependencies": {
|
|
56
57
|
"@rspack/core": "^1.0.0-alpha || ^1.x"
|