@rsbuild/core 1.4.5 → 1.4.7
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/compiled/css-loader/index.js +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +64 -39
- package/dist/index.js +66 -41
- package/dist-types/index.d.ts +1 -1
- package/dist-types/types/config.d.ts +64 -7
- package/package.json +5 -5
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
6079: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(6161);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(3212).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
6161: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
11
11
|
"use strict";
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports["default"] = loader;
|
|
14
14
|
var _postcss = _interopRequireDefault(__nccwpck_require__(9409));
|
|
15
|
-
var _plugins = __nccwpck_require__(
|
|
16
|
-
var _utils = __nccwpck_require__(
|
|
15
|
+
var _plugins = __nccwpck_require__(4222);
|
|
16
|
+
var _utils = __nccwpck_require__(3212);
|
|
17
17
|
function _interopRequireDefault(obj) {
|
|
18
18
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
19
19
|
}
|
|
@@ -236,7 +236,7 @@
|
|
|
236
236
|
callback(null, `${importCode}${moduleCode}${exportCode}`);
|
|
237
237
|
}
|
|
238
238
|
},
|
|
239
|
-
|
|
239
|
+
4222: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
240
240
|
"use strict";
|
|
241
241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
242
242
|
Object.defineProperty(exports, "icssParser", {
|
|
@@ -258,22 +258,22 @@
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
var _postcssImportParser = _interopRequireDefault(
|
|
261
|
-
__nccwpck_require__(
|
|
261
|
+
__nccwpck_require__(7173),
|
|
262
262
|
);
|
|
263
263
|
var _postcssIcssParser = _interopRequireDefault(
|
|
264
|
-
__nccwpck_require__(
|
|
264
|
+
__nccwpck_require__(2420),
|
|
265
265
|
);
|
|
266
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
266
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(835));
|
|
267
267
|
function _interopRequireDefault(obj) {
|
|
268
268
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
269
269
|
}
|
|
270
270
|
},
|
|
271
|
-
|
|
271
|
+
2420: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
272
272
|
"use strict";
|
|
273
273
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
274
274
|
exports["default"] = void 0;
|
|
275
275
|
var _icssUtils = __nccwpck_require__(9028);
|
|
276
|
-
var _utils = __nccwpck_require__(
|
|
276
|
+
var _utils = __nccwpck_require__(3212);
|
|
277
277
|
const plugin = (options = {}) => ({
|
|
278
278
|
postcssPlugin: "postcss-icss-parser",
|
|
279
279
|
async OnceExit(root) {
|
|
@@ -372,14 +372,14 @@
|
|
|
372
372
|
plugin.postcss = true;
|
|
373
373
|
var _default = (exports["default"] = plugin);
|
|
374
374
|
},
|
|
375
|
-
|
|
375
|
+
7173: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
376
376
|
"use strict";
|
|
377
377
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
378
378
|
exports["default"] = void 0;
|
|
379
379
|
var _postcssValueParser = _interopRequireDefault(
|
|
380
380
|
__nccwpck_require__(2948),
|
|
381
381
|
);
|
|
382
|
-
var _utils = __nccwpck_require__(
|
|
382
|
+
var _utils = __nccwpck_require__(3212);
|
|
383
383
|
function _interopRequireDefault(obj) {
|
|
384
384
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
385
385
|
}
|
|
@@ -684,14 +684,14 @@
|
|
|
684
684
|
plugin.postcss = true;
|
|
685
685
|
var _default = (exports["default"] = plugin);
|
|
686
686
|
},
|
|
687
|
-
|
|
687
|
+
835: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
688
688
|
"use strict";
|
|
689
689
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
690
690
|
exports["default"] = void 0;
|
|
691
691
|
var _postcssValueParser = _interopRequireDefault(
|
|
692
692
|
__nccwpck_require__(2948),
|
|
693
693
|
);
|
|
694
|
-
var _utils = __nccwpck_require__(
|
|
694
|
+
var _utils = __nccwpck_require__(3212);
|
|
695
695
|
function _interopRequireDefault(obj) {
|
|
696
696
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
697
697
|
}
|
|
@@ -1034,7 +1034,7 @@
|
|
|
1034
1034
|
plugin.postcss = true;
|
|
1035
1035
|
var _default = (exports["default"] = plugin);
|
|
1036
1036
|
},
|
|
1037
|
-
|
|
1037
|
+
3212: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1038
1038
|
"use strict";
|
|
1039
1039
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1040
1040
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -8098,6 +8098,6 @@
|
|
|
8098
8098
|
}
|
|
8099
8099
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
8100
8100
|
__nccwpck_require__.ab = __dirname + "/";
|
|
8101
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
8101
|
+
var __webpack_exports__ = __nccwpck_require__(6079);
|
|
8102
8102
|
module.exports = __webpack_exports__;
|
|
8103
8103
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
776: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(397);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
}
|
|
312
312
|
module.exports = { CachedChildCompilation };
|
|
313
313
|
},
|
|
314
|
-
|
|
314
|
+
397: (module) => {
|
|
315
315
|
"use strict";
|
|
316
316
|
class HtmlWebpackChildCompiler {
|
|
317
317
|
constructor(templates) {
|
|
@@ -480,7 +480,7 @@
|
|
|
480
480
|
}
|
|
481
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
482
482
|
},
|
|
483
|
-
|
|
483
|
+
875: (module) => {
|
|
484
484
|
"use strict";
|
|
485
485
|
module.exports = {};
|
|
486
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
module.exports.auto = module.exports.none;
|
|
501
501
|
},
|
|
502
|
-
|
|
502
|
+
926: (module) => {
|
|
503
503
|
"use strict";
|
|
504
504
|
module.exports = function (err) {
|
|
505
505
|
return {
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
};
|
|
521
521
|
};
|
|
522
522
|
},
|
|
523
|
-
|
|
523
|
+
829: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
524
524
|
"use strict";
|
|
525
525
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
526
526
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -546,7 +546,7 @@
|
|
|
546
546
|
}
|
|
547
547
|
module.exports = { getHtmlRspackPluginHooks };
|
|
548
548
|
},
|
|
549
|
-
|
|
549
|
+
236: (module) => {
|
|
550
550
|
const voidTags = [
|
|
551
551
|
"area",
|
|
552
552
|
"base",
|
|
@@ -614,19 +614,19 @@
|
|
|
614
614
|
htmlTagObjectToString,
|
|
615
615
|
};
|
|
616
616
|
},
|
|
617
|
-
|
|
617
|
+
297: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
618
618
|
"use strict";
|
|
619
619
|
const promisify = __nccwpck_require__(23).promisify;
|
|
620
620
|
const vm = __nccwpck_require__(154);
|
|
621
621
|
const fs = __nccwpck_require__(896);
|
|
622
622
|
const path = __nccwpck_require__(928);
|
|
623
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
623
|
+
const { CachedChildCompilation } = __nccwpck_require__(776);
|
|
624
624
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
625
|
-
__nccwpck_require__(
|
|
626
|
-
const prettyError = __nccwpck_require__(
|
|
627
|
-
const chunkSorter = __nccwpck_require__(
|
|
625
|
+
__nccwpck_require__(236);
|
|
626
|
+
const prettyError = __nccwpck_require__(926);
|
|
627
|
+
const chunkSorter = __nccwpck_require__(875);
|
|
628
628
|
const getHtmlRspackPluginHooks =
|
|
629
|
-
__nccwpck_require__(
|
|
629
|
+
__nccwpck_require__(829).getHtmlRspackPluginHooks;
|
|
630
630
|
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
631
631
|
class HtmlRspackPlugin {
|
|
632
632
|
constructor(userOptions = {}) {
|
|
@@ -1597,6 +1597,6 @@
|
|
|
1597
1597
|
}
|
|
1598
1598
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1599
1599
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1600
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1600
|
+
var __webpack_exports__ = __nccwpck_require__(297);
|
|
1601
1601
|
module.exports = __webpack_exports__;
|
|
1602
1602
|
})();
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
124: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(642)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
642: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
8
8
|
var __webpack_unused_export__;
|
|
9
9
|
__webpack_unused_export__ = { value: true };
|
|
10
10
|
exports["default"] = loader;
|
|
11
11
|
var _path = _interopRequireDefault(__nccwpck_require__(928));
|
|
12
|
-
var _utils = __nccwpck_require__(
|
|
12
|
+
var _utils = __nccwpck_require__(307);
|
|
13
13
|
function _interopRequireDefault(obj) {
|
|
14
14
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
15
15
|
}
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
callback(null, result.css, map, { ast });
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
|
-
|
|
182
|
+
307: (module, exports, __nccwpck_require__) => {
|
|
183
183
|
module = __nccwpck_require__.nmd(module);
|
|
184
184
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
185
185
|
exports.exec = exec;
|
|
@@ -716,6 +716,6 @@
|
|
|
716
716
|
})();
|
|
717
717
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
718
718
|
__nccwpck_require__.ab = __dirname + "/";
|
|
719
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
719
|
+
var __webpack_exports__ = __nccwpck_require__(124);
|
|
720
720
|
module.exports = __webpack_exports__;
|
|
721
721
|
})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
664: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.transformFiles =
|
|
7
7
|
exports.reduceChunk =
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
.map(standardizeFilePaths);
|
|
121
121
|
exports.transformFiles = transformFiles;
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
161: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
124
124
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
125
125
|
exports.normalModuleLoaderHook =
|
|
126
126
|
exports.getCompilerHooks =
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
const fs_1 = __nccwpck_require__(896);
|
|
131
131
|
const path_1 = __nccwpck_require__(928);
|
|
132
132
|
const lite_tapable_1 = __nccwpck_require__(408);
|
|
133
|
-
const helpers_1 = __nccwpck_require__(
|
|
133
|
+
const helpers_1 = __nccwpck_require__(664);
|
|
134
134
|
const compilerHookMap = new WeakMap();
|
|
135
135
|
const getCompilerHooks = (compiler) => {
|
|
136
136
|
let hooks = compilerHookMap.get(compiler);
|
|
@@ -312,7 +312,7 @@
|
|
|
312
312
|
exports.getCompilerHooks =
|
|
313
313
|
void 0;
|
|
314
314
|
const path_1 = __nccwpck_require__(928);
|
|
315
|
-
const hooks_1 = __nccwpck_require__(
|
|
315
|
+
const hooks_1 = __nccwpck_require__(161);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
package/dist/index.cjs
CHANGED
|
@@ -2250,7 +2250,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2250
2250
|
async function createContext(options, userConfig) {
|
|
2251
2251
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, external_node_path_namespaceObject.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2252
2252
|
return {
|
|
2253
|
-
version: "1.4.
|
|
2253
|
+
version: "1.4.7",
|
|
2254
2254
|
rootPath,
|
|
2255
2255
|
distPath: '',
|
|
2256
2256
|
cachePath,
|
|
@@ -2733,7 +2733,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2733
2733
|
}, await updateEnvironmentContext(context, environments);
|
|
2734
2734
|
var context1 = context;
|
|
2735
2735
|
let distPaths = Object.values(context1.environments).map((item)=>item.distPath);
|
|
2736
|
-
context1.distPath = function(paths) {
|
|
2736
|
+
return context1.distPath = function(paths) {
|
|
2737
2737
|
let uniquePaths = [
|
|
2738
2738
|
...new Set(paths)
|
|
2739
2739
|
];
|
|
@@ -2745,14 +2745,20 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2745
2745
|
else break;
|
|
2746
2746
|
}
|
|
2747
2747
|
return common.join(external_node_path_namespaceObject.sep);
|
|
2748
|
-
}(distPaths)
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2748
|
+
}(distPaths), ((config)=>{
|
|
2749
|
+
if (config.server.base && !config.server.base.startsWith('/')) throw Error(`${picocolors_index_js_default().dim('[rsbuild:config]')} The ${picocolors_index_js_default().yellow('"server.base"')} option should start with a slash, for example: "/base"`);
|
|
2750
|
+
if (!config.environments) return;
|
|
2751
|
+
let environmentNames = Object.keys(config.environments), environmentNameRegexp = /^[\w$-]+$/, validTargets = [
|
|
2752
|
+
'web',
|
|
2753
|
+
'node',
|
|
2754
|
+
'web-worker'
|
|
2755
|
+
];
|
|
2756
|
+
for (let name of environmentNames){
|
|
2757
|
+
environmentNameRegexp.test(name) || index_js_namespaceObject.logger.warn(`${picocolors_index_js_default().dim('[rsbuild:config]')} Environment name "${picocolors_index_js_default().yellow(name)}" contains invalid characters. Only letters, numbers, "-", "_", and "$" are allowed.`);
|
|
2758
|
+
let outputConfig = config.environments[name].output;
|
|
2759
|
+
if (outputConfig.target && !validTargets.includes(outputConfig.target)) throw Error(`${picocolors_index_js_default().dim('[rsbuild:config]')} Invalid value of ${picocolors_index_js_default().yellow('output.target')}: ${picocolors_index_js_default().yellow(`"${outputConfig.target}"`)}, valid values are: ${picocolors_index_js_default().yellow(validTargets.join(', '))}`);
|
|
2760
|
+
}
|
|
2761
|
+
})(context.normalizedConfig), context.normalizedConfig;
|
|
2756
2762
|
}
|
|
2757
2763
|
async function initConfigs({ context, pluginManager, rsbuildOptions }) {
|
|
2758
2764
|
let normalizedConfig = await initRsbuildConfig({
|
|
@@ -3227,9 +3233,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3227
3233
|
}, formatBasicTag = (tag)=>({
|
|
3228
3234
|
tag: tag.tagName,
|
|
3229
3235
|
attrs: tag.attributes,
|
|
3230
|
-
children: tag.innerHTML
|
|
3236
|
+
children: tag.innerHTML,
|
|
3237
|
+
metadata: tag.meta
|
|
3231
3238
|
}), fromBasicTag = (tag)=>({
|
|
3232
|
-
meta: {},
|
|
3239
|
+
meta: tag.metadata ?? {},
|
|
3233
3240
|
tagName: tag.tag,
|
|
3234
3241
|
attributes: tag.attrs ?? {},
|
|
3235
3242
|
voidTag: VOID_TAGS.includes(tag.tag),
|
|
@@ -3458,7 +3465,24 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3458
3465
|
} catch {
|
|
3459
3466
|
return !1;
|
|
3460
3467
|
}
|
|
3461
|
-
}, is_wsl = external_node_process_namespaceObject.env.__IS_WSL_TEST__ ? isWsl : isWsl()
|
|
3468
|
+
}, is_wsl = external_node_process_namespaceObject.env.__IS_WSL_TEST__ ? isWsl : isWsl(), wslDrivesMountPoint = (()=>{
|
|
3469
|
+
let mountPoint, defaultMountPoint = '/mnt/';
|
|
3470
|
+
return async function() {
|
|
3471
|
+
if (mountPoint) return mountPoint;
|
|
3472
|
+
let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
|
|
3473
|
+
try {
|
|
3474
|
+
await promises_namespaceObject.access(configFilePath, promises_namespaceObject.constants.F_OK), isConfigFileExists = !0;
|
|
3475
|
+
} catch {}
|
|
3476
|
+
if (!isConfigFileExists) return defaultMountPoint;
|
|
3477
|
+
let configContent = await promises_namespaceObject.readFile(configFilePath, {
|
|
3478
|
+
encoding: 'utf8'
|
|
3479
|
+
}), configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
3480
|
+
return configMountPoint ? mountPoint = (mountPoint = configMountPoint.groups.mountPoint.trim()).endsWith('/') ? mountPoint : `${mountPoint}/` : defaultMountPoint;
|
|
3481
|
+
};
|
|
3482
|
+
})(), powerShellPathFromWsl = async ()=>{
|
|
3483
|
+
let mountPoint = await wslDrivesMountPoint();
|
|
3484
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
3485
|
+
}, powerShellPath = async ()=>is_wsl ? powerShellPathFromWsl() : `${external_node_process_namespaceObject.env.SYSTEMROOT || external_node_process_namespaceObject.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
3462
3486
|
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
3463
3487
|
let define = (value)=>Object.defineProperty(object, propertyName, {
|
|
3464
3488
|
value,
|
|
@@ -3577,26 +3601,9 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3577
3601
|
if ('win32' === external_node_process_namespaceObject.platform) return defaultBrowser();
|
|
3578
3602
|
throw Error('Only macOS, Linux, and Windows are supported');
|
|
3579
3603
|
}
|
|
3580
|
-
let execFile = external_node_util_namespaceObject.promisify(external_node_child_process_namespaceObject.execFile), open_dirname = external_node_path_namespaceObject.dirname((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__)), localXdgOpenPath = external_node_path_namespaceObject.join(open_dirname, 'xdg-open'), { platform, arch } = external_node_process_namespaceObject
|
|
3581
|
-
let mountPoint, defaultMountPoint = '/mnt/';
|
|
3582
|
-
return async function() {
|
|
3583
|
-
if (mountPoint) return mountPoint;
|
|
3584
|
-
let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
|
|
3585
|
-
try {
|
|
3586
|
-
await promises_namespaceObject.access(configFilePath, promises_namespaceObject.constants.F_OK), isConfigFileExists = !0;
|
|
3587
|
-
} catch {}
|
|
3588
|
-
if (!isConfigFileExists) return defaultMountPoint;
|
|
3589
|
-
let configContent = await promises_namespaceObject.readFile(configFilePath, {
|
|
3590
|
-
encoding: 'utf8'
|
|
3591
|
-
}), configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
3592
|
-
return configMountPoint ? mountPoint = (mountPoint = configMountPoint.groups.mountPoint.trim()).endsWith('/') ? mountPoint : `${mountPoint}/` : defaultMountPoint;
|
|
3593
|
-
};
|
|
3594
|
-
})(), getPowershellPathFromWsl = async ()=>{
|
|
3595
|
-
let mountPoint = await getWslDrivesMountPoint();
|
|
3596
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
3597
|
-
};
|
|
3604
|
+
let execFile = (0, external_node_util_namespaceObject.promisify)(external_node_child_process_namespaceObject.execFile), open_dirname = external_node_path_namespaceObject.dirname((0, external_node_url_namespaceObject.fileURLToPath)(__rslib_import_meta_url__)), localXdgOpenPath = external_node_path_namespaceObject.join(open_dirname, 'xdg-open'), { platform, arch } = external_node_process_namespaceObject;
|
|
3598
3605
|
async function getWindowsDefaultBrowserFromWsl() {
|
|
3599
|
-
let powershellPath = await
|
|
3606
|
+
let powershellPath = await powerShellPath(), rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, encodedCommand = external_node_buffer_namespaceObject.Buffer.from(rawCommand, 'utf16le').toString('base64'), { stdout } = await execFile(powershellPath, [
|
|
3600
3607
|
'-NoProfile',
|
|
3601
3608
|
'-NonInteractive',
|
|
3602
3609
|
'-ExecutionPolicy',
|
|
@@ -3607,6 +3614,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3607
3614
|
encoding: 'utf8'
|
|
3608
3615
|
}), progId = stdout.trim(), browserMap = {
|
|
3609
3616
|
ChromeHTML: 'com.google.chrome',
|
|
3617
|
+
BraveHTML: 'com.brave.Browser',
|
|
3610
3618
|
MSEdgeHTM: 'com.microsoft.edge',
|
|
3611
3619
|
FirefoxURL: 'org.mozilla.firefox'
|
|
3612
3620
|
};
|
|
@@ -3648,6 +3656,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3648
3656
|
let ids = {
|
|
3649
3657
|
'com.google.chrome': 'chrome',
|
|
3650
3658
|
'google-chrome.desktop': 'chrome',
|
|
3659
|
+
'com.brave.Browser': 'brave',
|
|
3651
3660
|
'org.mozilla.firefox': 'firefox',
|
|
3652
3661
|
'firefox.desktop': 'firefox',
|
|
3653
3662
|
'com.microsoft.msedge': 'edge',
|
|
@@ -3659,6 +3668,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3659
3668
|
let browserName = ids[browser.id];
|
|
3660
3669
|
return 'browserPrivate' === app && appArguments.push({
|
|
3661
3670
|
chrome: '--incognito',
|
|
3671
|
+
brave: '--incognito',
|
|
3662
3672
|
firefox: '--private-window',
|
|
3663
3673
|
edge: '--inPrivate'
|
|
3664
3674
|
}[browserName]), baseOpen({
|
|
@@ -3678,13 +3688,13 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3678
3688
|
else {
|
|
3679
3689
|
let isBundled = !open_dirname || '/' === open_dirname, exeLocalXdgOpen = !1;
|
|
3680
3690
|
try {
|
|
3681
|
-
await promises_namespaceObject.access(localXdgOpenPath,
|
|
3691
|
+
await promises_namespaceObject.access(localXdgOpenPath, external_node_fs_namespaceObject.constants.X_OK), exeLocalXdgOpen = !0;
|
|
3682
3692
|
} catch {}
|
|
3683
3693
|
command = external_node_process_namespaceObject.versions.electron ?? ('android' === platform || isBundled || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
|
|
3684
3694
|
}
|
|
3685
3695
|
appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
|
|
3686
3696
|
} else {
|
|
3687
|
-
command =
|
|
3697
|
+
command = await powerShellPath(), cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand'), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0);
|
|
3688
3698
|
let encodedArguments = [
|
|
3689
3699
|
'Start'
|
|
3690
3700
|
];
|
|
@@ -3727,9 +3737,24 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
3727
3737
|
'/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
|
|
3728
3738
|
]
|
|
3729
3739
|
}
|
|
3740
|
+
})), defineLazyProperty(apps, 'brave', ()=>detectPlatformBinary({
|
|
3741
|
+
darwin: 'brave browser',
|
|
3742
|
+
win32: 'brave',
|
|
3743
|
+
linux: [
|
|
3744
|
+
'brave-browser',
|
|
3745
|
+
'brave'
|
|
3746
|
+
]
|
|
3747
|
+
}, {
|
|
3748
|
+
wsl: {
|
|
3749
|
+
ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
3750
|
+
x64: [
|
|
3751
|
+
'/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
3752
|
+
'/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
|
|
3753
|
+
]
|
|
3754
|
+
}
|
|
3730
3755
|
})), defineLazyProperty(apps, 'firefox', ()=>detectPlatformBinary({
|
|
3731
3756
|
darwin: 'firefox',
|
|
3732
|
-
win32:
|
|
3757
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
3733
3758
|
linux: 'firefox'
|
|
3734
3759
|
}, {
|
|
3735
3760
|
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
|
|
@@ -5902,7 +5927,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
5902
5927
|
buildDependencies
|
|
5903
5928
|
});
|
|
5904
5929
|
}), api.onAfterCreateCompiler(()=>{
|
|
5905
|
-
cacheEnabled && 'rspack' === api.context.bundlerType && index_js_namespaceObject.logger.
|
|
5930
|
+
cacheEnabled && 'rspack' === api.context.bundlerType && index_js_namespaceObject.logger.debug('Rspack persistent cache enabled');
|
|
5906
5931
|
});
|
|
5907
5932
|
}
|
|
5908
5933
|
},
|
|
@@ -7864,11 +7889,11 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7864
7889
|
].includes(level) && (index_js_namespaceObject.logger.level = level);
|
|
7865
7890
|
}
|
|
7866
7891
|
let { npm_execpath } = process.env;
|
|
7867
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.
|
|
7892
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && index_js_namespaceObject.logger.log(), index_js_namespaceObject.logger.greet(` Rsbuild v1.4.7\n`);
|
|
7868
7893
|
try {
|
|
7869
7894
|
!function() {
|
|
7870
7895
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7871
|
-
cli.help(), cli.version("1.4.
|
|
7896
|
+
cli.help(), cli.version("1.4.7"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
7872
7897
|
default: 'jiti'
|
|
7873
7898
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
7874
7899
|
type: [
|
|
@@ -7926,7 +7951,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
7926
7951
|
index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), index_js_namespaceObject.logger.error(err);
|
|
7927
7952
|
}
|
|
7928
7953
|
}
|
|
7929
|
-
let src_version = "1.4.
|
|
7954
|
+
let src_version = "1.4.7";
|
|
7930
7955
|
})(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, exports.defaultAllowedOrigins = __webpack_exports__.defaultAllowedOrigins, exports.defineConfig = __webpack_exports__.defineConfig, exports.ensureAssetPrefix = __webpack_exports__.ensureAssetPrefix, exports.loadConfig = __webpack_exports__.loadConfig, exports.loadEnv = __webpack_exports__.loadEnv, exports.logger = __webpack_exports__.logger, exports.mergeRsbuildConfig = __webpack_exports__.mergeRsbuildConfig, exports.rspack = __webpack_exports__.rspack, exports.runCLI = __webpack_exports__.runCLI, exports.version = __webpack_exports__.version, __webpack_exports__)-1 === [
|
|
7931
7956
|
"PLUGIN_CSS_NAME",
|
|
7932
7957
|
"PLUGIN_SWC_NAME",
|
package/dist/index.js
CHANGED
|
@@ -5,14 +5,14 @@ import { logger } from "../compiled/rslog/index.js";
|
|
|
5
5
|
import node_path, { dirname, isAbsolute as external_node_path_isAbsolute, join, posix, relative, sep } from "node:path";
|
|
6
6
|
import { URL as external_node_url_URL, fileURLToPath, pathToFileURL } from "node:url";
|
|
7
7
|
import picocolors from "../compiled/picocolors/index.js";
|
|
8
|
-
import node_fs, { existsSync } from "node:fs";
|
|
8
|
+
import node_fs, { constants as external_node_fs_constants, existsSync } from "node:fs";
|
|
9
9
|
import { EventEmitter } from "events";
|
|
10
10
|
import { createRequire } from "node:module";
|
|
11
11
|
import node_os, { constants as external_node_os_constants } from "node:os";
|
|
12
12
|
import node_process from "node:process";
|
|
13
13
|
import rspack_chain from "../compiled/rspack-chain/index.js";
|
|
14
14
|
import { isPromise, isRegExp } from "node:util/types";
|
|
15
|
-
import
|
|
15
|
+
import { promisify as external_node_util_promisify } from "node:util";
|
|
16
16
|
import { lookup } from "../compiled/mrmime/index.js";
|
|
17
17
|
import node_zlib from "node:zlib";
|
|
18
18
|
import { Buffer as external_node_buffer_Buffer } from "node:buffer";
|
|
@@ -2065,7 +2065,7 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2065
2065
|
async function createContext(options, userConfig) {
|
|
2066
2066
|
let { cwd } = options, rootPath = userConfig.root ? ensureAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = join(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2067
2067
|
return {
|
|
2068
|
-
version: "1.4.
|
|
2068
|
+
version: "1.4.7",
|
|
2069
2069
|
rootPath,
|
|
2070
2070
|
distPath: '',
|
|
2071
2071
|
cachePath,
|
|
@@ -2540,7 +2540,7 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
2540
2540
|
environments
|
|
2541
2541
|
}, await updateEnvironmentContext(context, environments);
|
|
2542
2542
|
let distPaths = Object.values(context.environments).map((item)=>item.distPath);
|
|
2543
|
-
context.distPath = function(paths) {
|
|
2543
|
+
return context.distPath = function(paths) {
|
|
2544
2544
|
let uniquePaths = [
|
|
2545
2545
|
...new Set(paths)
|
|
2546
2546
|
];
|
|
@@ -2552,14 +2552,20 @@ async function initRsbuildConfig({ context, pluginManager }) {
|
|
|
2552
2552
|
else break;
|
|
2553
2553
|
}
|
|
2554
2554
|
return common.join(sep);
|
|
2555
|
-
}(distPaths)
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2555
|
+
}(distPaths), ((config)=>{
|
|
2556
|
+
if (config.server.base && !config.server.base.startsWith('/')) throw Error(`${picocolors.dim('[rsbuild:config]')} The ${picocolors.yellow('"server.base"')} option should start with a slash, for example: "/base"`);
|
|
2557
|
+
if (!config.environments) return;
|
|
2558
|
+
let environmentNames = Object.keys(config.environments), environmentNameRegexp = /^[\w$-]+$/, validTargets = [
|
|
2559
|
+
'web',
|
|
2560
|
+
'node',
|
|
2561
|
+
'web-worker'
|
|
2562
|
+
];
|
|
2563
|
+
for (let name of environmentNames){
|
|
2564
|
+
environmentNameRegexp.test(name) || logger.warn(`${picocolors.dim('[rsbuild:config]')} Environment name "${picocolors.yellow(name)}" contains invalid characters. Only letters, numbers, "-", "_", and "$" are allowed.`);
|
|
2565
|
+
let outputConfig = config.environments[name].output;
|
|
2566
|
+
if (outputConfig.target && !validTargets.includes(outputConfig.target)) throw Error(`${picocolors.dim('[rsbuild:config]')} Invalid value of ${picocolors.yellow('output.target')}: ${picocolors.yellow(`"${outputConfig.target}"`)}, valid values are: ${picocolors.yellow(validTargets.join(', '))}`);
|
|
2567
|
+
}
|
|
2568
|
+
})(context.normalizedConfig), context.normalizedConfig;
|
|
2563
2569
|
}
|
|
2564
2570
|
async function initConfigs({ context, pluginManager, rsbuildOptions }) {
|
|
2565
2571
|
let normalizedConfig = await initRsbuildConfig({
|
|
@@ -3032,9 +3038,10 @@ let entryNameSymbol = Symbol('entryName'), VOID_TAGS = [
|
|
|
3032
3038
|
}, formatBasicTag = (tag)=>({
|
|
3033
3039
|
tag: tag.tagName,
|
|
3034
3040
|
attrs: tag.attributes,
|
|
3035
|
-
children: tag.innerHTML
|
|
3041
|
+
children: tag.innerHTML,
|
|
3042
|
+
metadata: tag.meta
|
|
3036
3043
|
}), fromBasicTag = (tag)=>({
|
|
3037
|
-
meta: {},
|
|
3044
|
+
meta: tag.metadata ?? {},
|
|
3038
3045
|
tagName: tag.tag,
|
|
3039
3046
|
attributes: tag.attrs ?? {},
|
|
3040
3047
|
voidTag: VOID_TAGS.includes(tag.tag),
|
|
@@ -3263,7 +3270,24 @@ let isWsl = ()=>{
|
|
|
3263
3270
|
} catch {
|
|
3264
3271
|
return !1;
|
|
3265
3272
|
}
|
|
3266
|
-
}, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl()
|
|
3273
|
+
}, is_wsl = node_process.env.__IS_WSL_TEST__ ? isWsl : isWsl(), wslDrivesMountPoint = (()=>{
|
|
3274
|
+
let mountPoint, defaultMountPoint = '/mnt/';
|
|
3275
|
+
return async function() {
|
|
3276
|
+
if (mountPoint) return mountPoint;
|
|
3277
|
+
let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
|
|
3278
|
+
try {
|
|
3279
|
+
await promises.access(configFilePath, promises_constants.F_OK), isConfigFileExists = !0;
|
|
3280
|
+
} catch {}
|
|
3281
|
+
if (!isConfigFileExists) return defaultMountPoint;
|
|
3282
|
+
let configContent = await promises.readFile(configFilePath, {
|
|
3283
|
+
encoding: 'utf8'
|
|
3284
|
+
}), configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
3285
|
+
return configMountPoint ? mountPoint = (mountPoint = configMountPoint.groups.mountPoint.trim()).endsWith('/') ? mountPoint : `${mountPoint}/` : defaultMountPoint;
|
|
3286
|
+
};
|
|
3287
|
+
})(), powerShellPathFromWsl = async ()=>{
|
|
3288
|
+
let mountPoint = await wslDrivesMountPoint();
|
|
3289
|
+
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
3290
|
+
}, powerShellPath = async ()=>is_wsl ? powerShellPathFromWsl() : `${node_process.env.SYSTEMROOT || node_process.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
|
|
3267
3291
|
function defineLazyProperty(object, propertyName, valueGetter) {
|
|
3268
3292
|
let define = (value)=>Object.defineProperty(object, propertyName, {
|
|
3269
3293
|
value,
|
|
@@ -3382,26 +3406,9 @@ async function default_browser_defaultBrowser() {
|
|
|
3382
3406
|
if ('win32' === node_process.platform) return defaultBrowser();
|
|
3383
3407
|
throw Error('Only macOS, Linux, and Windows are supported');
|
|
3384
3408
|
}
|
|
3385
|
-
let open_execFile =
|
|
3386
|
-
let mountPoint, defaultMountPoint = '/mnt/';
|
|
3387
|
-
return async function() {
|
|
3388
|
-
if (mountPoint) return mountPoint;
|
|
3389
|
-
let configFilePath = '/etc/wsl.conf', isConfigFileExists = !1;
|
|
3390
|
-
try {
|
|
3391
|
-
await promises.access(configFilePath, promises_constants.F_OK), isConfigFileExists = !0;
|
|
3392
|
-
} catch {}
|
|
3393
|
-
if (!isConfigFileExists) return defaultMountPoint;
|
|
3394
|
-
let configContent = await promises.readFile(configFilePath, {
|
|
3395
|
-
encoding: 'utf8'
|
|
3396
|
-
}), configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
|
|
3397
|
-
return configMountPoint ? mountPoint = (mountPoint = configMountPoint.groups.mountPoint.trim()).endsWith('/') ? mountPoint : `${mountPoint}/` : defaultMountPoint;
|
|
3398
|
-
};
|
|
3399
|
-
})(), getPowershellPathFromWsl = async ()=>{
|
|
3400
|
-
let mountPoint = await getWslDrivesMountPoint();
|
|
3401
|
-
return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
|
|
3402
|
-
};
|
|
3409
|
+
let open_execFile = external_node_util_promisify(node_child_process.execFile), open_dirname = node_path.dirname(fileURLToPath(import.meta.url)), localXdgOpenPath = node_path.join(open_dirname, 'xdg-open'), { platform, arch } = node_process;
|
|
3403
3410
|
async function getWindowsDefaultBrowserFromWsl() {
|
|
3404
|
-
let powershellPath = await
|
|
3411
|
+
let powershellPath = await powerShellPath(), rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`, encodedCommand = external_node_buffer_Buffer.from(rawCommand, 'utf16le').toString('base64'), { stdout } = await open_execFile(powershellPath, [
|
|
3405
3412
|
'-NoProfile',
|
|
3406
3413
|
'-NonInteractive',
|
|
3407
3414
|
'-ExecutionPolicy',
|
|
@@ -3412,6 +3419,7 @@ async function getWindowsDefaultBrowserFromWsl() {
|
|
|
3412
3419
|
encoding: 'utf8'
|
|
3413
3420
|
}), progId = stdout.trim(), browserMap = {
|
|
3414
3421
|
ChromeHTML: 'com.google.chrome',
|
|
3422
|
+
BraveHTML: 'com.brave.Browser',
|
|
3415
3423
|
MSEdgeHTM: 'com.microsoft.edge',
|
|
3416
3424
|
FirefoxURL: 'org.mozilla.firefox'
|
|
3417
3425
|
};
|
|
@@ -3453,6 +3461,7 @@ let pTryEach = async (array, mapper)=>{
|
|
|
3453
3461
|
let ids = {
|
|
3454
3462
|
'com.google.chrome': 'chrome',
|
|
3455
3463
|
'google-chrome.desktop': 'chrome',
|
|
3464
|
+
'com.brave.Browser': 'brave',
|
|
3456
3465
|
'org.mozilla.firefox': 'firefox',
|
|
3457
3466
|
'firefox.desktop': 'firefox',
|
|
3458
3467
|
'com.microsoft.msedge': 'edge',
|
|
@@ -3464,6 +3473,7 @@ let pTryEach = async (array, mapper)=>{
|
|
|
3464
3473
|
let browserName = ids[browser.id];
|
|
3465
3474
|
return 'browserPrivate' === app && appArguments.push({
|
|
3466
3475
|
chrome: '--incognito',
|
|
3476
|
+
brave: '--incognito',
|
|
3467
3477
|
firefox: '--private-window',
|
|
3468
3478
|
edge: '--inPrivate'
|
|
3469
3479
|
}[browserName]), baseOpen({
|
|
@@ -3483,13 +3493,13 @@ let pTryEach = async (array, mapper)=>{
|
|
|
3483
3493
|
else {
|
|
3484
3494
|
let exeLocalXdgOpen = !1;
|
|
3485
3495
|
try {
|
|
3486
|
-
await promises.access(localXdgOpenPath,
|
|
3496
|
+
await promises.access(localXdgOpenPath, external_node_fs_constants.X_OK), exeLocalXdgOpen = !0;
|
|
3487
3497
|
} catch {}
|
|
3488
3498
|
command = node_process.versions.electron ?? ('android' === platform || !open_dirname || '/' === open_dirname || !exeLocalXdgOpen) ? 'xdg-open' : localXdgOpenPath;
|
|
3489
3499
|
}
|
|
3490
3500
|
appArguments.length > 0 && cliArguments.push(...appArguments), options.wait || (childProcessOptions.stdio = 'ignore', childProcessOptions.detached = !0);
|
|
3491
3501
|
} else {
|
|
3492
|
-
command =
|
|
3502
|
+
command = await powerShellPath(), cliArguments.push('-NoProfile', '-NonInteractive', '-ExecutionPolicy', 'Bypass', '-EncodedCommand'), is_wsl || (childProcessOptions.windowsVerbatimArguments = !0);
|
|
3493
3503
|
let encodedArguments = [
|
|
3494
3504
|
'Start'
|
|
3495
3505
|
];
|
|
@@ -3532,9 +3542,24 @@ defineLazyProperty(apps, 'chrome', ()=>detectPlatformBinary({
|
|
|
3532
3542
|
'/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
|
|
3533
3543
|
]
|
|
3534
3544
|
}
|
|
3545
|
+
})), defineLazyProperty(apps, 'brave', ()=>detectPlatformBinary({
|
|
3546
|
+
darwin: 'brave browser',
|
|
3547
|
+
win32: 'brave',
|
|
3548
|
+
linux: [
|
|
3549
|
+
'brave-browser',
|
|
3550
|
+
'brave'
|
|
3551
|
+
]
|
|
3552
|
+
}, {
|
|
3553
|
+
wsl: {
|
|
3554
|
+
ia32: '/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
3555
|
+
x64: [
|
|
3556
|
+
'/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe',
|
|
3557
|
+
'/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe'
|
|
3558
|
+
]
|
|
3559
|
+
}
|
|
3535
3560
|
})), defineLazyProperty(apps, 'firefox', ()=>detectPlatformBinary({
|
|
3536
3561
|
darwin: 'firefox',
|
|
3537
|
-
win32:
|
|
3562
|
+
win32: String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,
|
|
3538
3563
|
linux: 'firefox'
|
|
3539
3564
|
}, {
|
|
3540
3565
|
wsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe'
|
|
@@ -5691,7 +5716,7 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
5691
5716
|
buildDependencies
|
|
5692
5717
|
});
|
|
5693
5718
|
}), api.onAfterCreateCompiler(()=>{
|
|
5694
|
-
cacheEnabled && 'rspack' === api.context.bundlerType && logger.
|
|
5719
|
+
cacheEnabled && 'rspack' === api.context.bundlerType && logger.debug('Rspack persistent cache enabled');
|
|
5695
5720
|
});
|
|
5696
5721
|
}
|
|
5697
5722
|
},
|
|
@@ -7647,11 +7672,11 @@ async function runCLI() {
|
|
|
7647
7672
|
].includes(level) && (logger.level = level);
|
|
7648
7673
|
}
|
|
7649
7674
|
let { npm_execpath } = process.env;
|
|
7650
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.
|
|
7675
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && logger.log(), logger.greet(` Rsbuild v1.4.7\n`);
|
|
7651
7676
|
try {
|
|
7652
7677
|
!function() {
|
|
7653
7678
|
let cli = ((name = "")=>new CAC(name))('rsbuild');
|
|
7654
|
-
cli.help(), cli.version("1.4.
|
|
7679
|
+
cli.help(), cli.version("1.4.7"), cli.option('--base <base>', 'specify the base path of the server').option('-c, --config <config>', 'specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'specify the loader to load the config file, can be `jiti` or `native`', {
|
|
7655
7680
|
default: 'jiti'
|
|
7656
7681
|
}).option('-r, --root <root>', 'specify the project root directory, can be an absolute path or a path relative to cwd').option('-m, --mode <mode>', 'specify the build mode, can be `development`, `production` or `none`').option('--log-level <level>', 'specify the log level, can be `info`, `warn`, `error` or `silent`').option('--env-mode <mode>', 'specify the env mode to load the `.env.[mode]` file').option('--environment <name>', 'specify the name of environment to build', {
|
|
7657
7682
|
type: [
|
|
@@ -7709,5 +7734,5 @@ async function runCLI() {
|
|
|
7709
7734
|
logger.error('Failed to start Rsbuild CLI.'), logger.error(err);
|
|
7710
7735
|
}
|
|
7711
7736
|
}
|
|
7712
|
-
let src_version = "1.4.
|
|
7737
|
+
let src_version = "1.4.7";
|
|
7713
7738
|
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, loadConfig_loadConfig as loadConfig, loadEnv, logger, mergeRsbuildConfig, rspack, runCLI, src_version as version };
|
package/dist-types/index.d.ts
CHANGED
|
@@ -19,4 +19,4 @@ export { type Logger, logger } from './logger';
|
|
|
19
19
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
20
20
|
export type { RsbuildDevServer } from './server/devServer';
|
|
21
21
|
export type { StartServerResult } from './server/helper';
|
|
22
|
-
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
22
|
+
export type { AliasStrategy, AppIcon, AppIconItem, Build, BuildOptions, BundlerPluginInstance, Charset, CleanDistPath, CleanDistPathObject, ClientConfig, CliShortcut, CompressOptions, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentConfig, EnvironmentContext, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlBasicTag, HtmlConfig, HtmlFallback, HtmlRspackPlugin, HtmlTag, HtmlTagContext, HtmlTagDescriptor, HtmlTagHandler, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InspectConfigOptions, InspectConfigResult, InternalContext, LegalComments, LogLevel, ManifestConfig, ManifestData, ManifestObjectConfig, MergedEnvironmentConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterEnvironmentCompileFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeEnvironmentCompileFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseBuildFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreconnectOption, PreviewOptions, PrintUrls, ProcessAssetsDescriptor, ProcessAssetsHandler, ProcessAssetsHook, ProgressBarConfig, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PublicDir, PublicDirOptions, RequestHandler, ResolvedCreateRsbuildOptions, ResolveHandler, ResolveHook, ResourceHintsIncludeType, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ScriptInject, ScriptLoading, SecurityConfig, ServerConfig, SetupMiddlewaresContext, SetupMiddlewaresFn, SourceConfig, SourceMap, SplitChunks, SriAlgorithm, SriOptions, StartDevServerOptions, StyleLoaderOptions, ToolsConfig, TransformContext, TransformDescriptor, TransformHandler, TransformHook, TransformImport, WatchFiles, } from './types';
|
|
@@ -1110,25 +1110,82 @@ export type MetaOptions = {
|
|
|
1110
1110
|
[name: string]: string | false | MetaAttrs;
|
|
1111
1111
|
};
|
|
1112
1112
|
export type HtmlBasicTag = {
|
|
1113
|
+
/**
|
|
1114
|
+
* The HTML tag name to be generated. Should be a valid HTML element name.
|
|
1115
|
+
* @example
|
|
1116
|
+
* - `'script'` for JavaScript files
|
|
1117
|
+
* - `'link'` for stylesheets or external resources
|
|
1118
|
+
* - `'meta'` for metadata
|
|
1119
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element
|
|
1120
|
+
*/
|
|
1113
1121
|
tag: string;
|
|
1122
|
+
/**
|
|
1123
|
+
* HTML attributes to be applied to the tag.
|
|
1124
|
+
* - `string` values will be rendered as `attribute="value"`
|
|
1125
|
+
* - `true` renders as boolean attribute (e.g., `<input disabled>`)
|
|
1126
|
+
* - `false` or `null` or `undefined` values will omit the attribute
|
|
1127
|
+
*
|
|
1128
|
+
* @example
|
|
1129
|
+
* // String attributes
|
|
1130
|
+
* attrs: {
|
|
1131
|
+
* src: 'https://example.com/script.js',
|
|
1132
|
+
* type: 'text/javascript',
|
|
1133
|
+
* }
|
|
1134
|
+
* // Result: <script src="https://example.com/script.js" type="text/javascript">
|
|
1135
|
+
|
|
1136
|
+
* // Boolean attributes
|
|
1137
|
+
* attrs: {
|
|
1138
|
+
* async: true, // <script async>
|
|
1139
|
+
* defer: false, // attribute omitted
|
|
1140
|
+
* }
|
|
1141
|
+
* // Result: <script async>
|
|
1142
|
+
*/
|
|
1114
1143
|
attrs?: Record<string, string | boolean | null | undefined>;
|
|
1144
|
+
/**
|
|
1145
|
+
* The innerHTML content of the tag. The content is inserted as-is without
|
|
1146
|
+
* HTML escaping, so ensure it's safe to prevent XSS vulnerabilities.
|
|
1147
|
+
*/
|
|
1115
1148
|
children?: string;
|
|
1149
|
+
/**
|
|
1150
|
+
* The metadata object for tags, used to store additional information about tags.
|
|
1151
|
+
* `metadata` does not affect the generated HTML content.
|
|
1152
|
+
* @default undefined
|
|
1153
|
+
*/
|
|
1154
|
+
metadata?: Record<string, any>;
|
|
1116
1155
|
};
|
|
1117
1156
|
export type HtmlTag = HtmlBasicTag & {
|
|
1118
|
-
/**
|
|
1157
|
+
/**
|
|
1158
|
+
* Controls whether to add a hash query parameter to asset URLs for cache invalidation.
|
|
1159
|
+
* Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
|
|
1160
|
+
* - `false`: No hash query
|
|
1161
|
+
* - `true`: Generate hash based on HTML content
|
|
1162
|
+
* - `string`: Uses a custom hash string
|
|
1163
|
+
* - `function`: Custom hash generation via a function
|
|
1164
|
+
* @default false
|
|
1165
|
+
*/
|
|
1119
1166
|
hash?: boolean | string | ((url: string, hash: string) => string);
|
|
1120
|
-
/**
|
|
1167
|
+
/**
|
|
1168
|
+
* Controls whether to prepend the asset prefix to resource URLs.
|
|
1169
|
+
* Only affects the `src` attribute of the `script` tag and the `href` attribute of the `link` tag.
|
|
1170
|
+
* - `true`: Prepends asset prefix to the URL
|
|
1171
|
+
* - `false`: Uses the URL as-is
|
|
1172
|
+
* - `string`: Uses a custom prefix
|
|
1173
|
+
* - `function`: Custom path transformation via a function
|
|
1174
|
+
* @default true
|
|
1175
|
+
*/
|
|
1121
1176
|
publicPath?: boolean | string | ((url: string, publicPath: string) => string);
|
|
1122
1177
|
/**
|
|
1123
|
-
* Defines the injection position
|
|
1124
|
-
* -
|
|
1125
|
-
* -
|
|
1178
|
+
* Defines the injection position relative to existing tags.
|
|
1179
|
+
* - `true`: Insert after existing tags
|
|
1180
|
+
* - `false`: Insert before existing tags
|
|
1126
1181
|
* @default true
|
|
1127
1182
|
*/
|
|
1128
1183
|
append?: boolean;
|
|
1129
1184
|
/**
|
|
1130
|
-
* Specifies whether to
|
|
1131
|
-
*
|
|
1185
|
+
* Specifies whether to inject the tag into the HTML `<head>` element.
|
|
1186
|
+
* - `true`: Inject into `<head>`
|
|
1187
|
+
* - `false`: Inject into `<body>`
|
|
1188
|
+
* @default Auto-detect: `true` for head-allowed elements, `false` otherwise
|
|
1132
1189
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/head#see_also
|
|
1133
1190
|
*/
|
|
1134
1191
|
head?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.7",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.4.
|
|
49
|
+
"@rspack/core": "1.4.8",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.44.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.10.
|
|
56
|
+
"@rslib/core": "0.10.5",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
58
|
"@types/cors": "^2.8.19",
|
|
59
|
-
"@types/node": "^22.16.
|
|
59
|
+
"@types/node": "^22.16.4",
|
|
60
60
|
"@types/on-finished": "2.3.5",
|
|
61
61
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
62
62
|
"@types/ws": "^8.18.1",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"launch-editor-middleware": "^2.10.0",
|
|
75
75
|
"mrmime": "^2.0.1",
|
|
76
76
|
"on-finished": "2.4.1",
|
|
77
|
-
"open": "^10.
|
|
77
|
+
"open": "^10.2.0",
|
|
78
78
|
"picocolors": "^1.1.1",
|
|
79
79
|
"postcss": "^8.5.6",
|
|
80
80
|
"postcss-load-config": "6.0.1",
|