@rsbuild/core 1.3.16 → 1.3.18
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 +21 -21
- package/compiled/html-rspack-plugin/index.js +54 -43
- package/compiled/html-rspack-plugin/loader.js +4 -3
- package/compiled/html-rspack-plugin/package.json +1 -1
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +52 -48
- package/dist/index.js +48 -45
- package/dist-types/config.d.ts +11 -1
- package/dist-types/index.d.ts +1 -0
- package/dist-types/rspack/RsbuildHtmlPlugin.d.ts +7 -7
- package/dist-types/types/context.d.ts +8 -0
- package/dist-types/types/rsbuild.d.ts +8 -1
- package/package.json +3 -3
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
4278: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const loader = __nccwpck_require__(
|
|
5
|
+
const loader = __nccwpck_require__(2284);
|
|
6
6
|
module.exports = loader.default;
|
|
7
7
|
module.exports.defaultGetLocalIdent =
|
|
8
|
-
__nccwpck_require__(
|
|
8
|
+
__nccwpck_require__(8453).defaultGetLocalIdent;
|
|
9
9
|
},
|
|
10
|
-
|
|
10
|
+
2284: (__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__(1539);
|
|
16
|
+
var _utils = __nccwpck_require__(8453);
|
|
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
|
+
1539: (__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,20 +258,20 @@
|
|
|
258
258
|
},
|
|
259
259
|
});
|
|
260
260
|
var _postcssImportParser = _interopRequireDefault(
|
|
261
|
-
__nccwpck_require__(
|
|
261
|
+
__nccwpck_require__(2984),
|
|
262
262
|
);
|
|
263
|
-
var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(
|
|
264
|
-
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(
|
|
263
|
+
var _postcssIcssParser = _interopRequireDefault(__nccwpck_require__(893));
|
|
264
|
+
var _postcssUrlParser = _interopRequireDefault(__nccwpck_require__(1500));
|
|
265
265
|
function _interopRequireDefault(obj) {
|
|
266
266
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
267
267
|
}
|
|
268
268
|
},
|
|
269
|
-
|
|
269
|
+
893: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
270
270
|
"use strict";
|
|
271
271
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
272
272
|
exports["default"] = void 0;
|
|
273
273
|
var _icssUtils = __nccwpck_require__(4531);
|
|
274
|
-
var _utils = __nccwpck_require__(
|
|
274
|
+
var _utils = __nccwpck_require__(8453);
|
|
275
275
|
const plugin = (options = {}) => ({
|
|
276
276
|
postcssPlugin: "postcss-icss-parser",
|
|
277
277
|
async OnceExit(root) {
|
|
@@ -370,14 +370,14 @@
|
|
|
370
370
|
plugin.postcss = true;
|
|
371
371
|
var _default = (exports["default"] = plugin);
|
|
372
372
|
},
|
|
373
|
-
|
|
373
|
+
2984: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
374
374
|
"use strict";
|
|
375
375
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
376
376
|
exports["default"] = void 0;
|
|
377
377
|
var _postcssValueParser = _interopRequireDefault(
|
|
378
378
|
__nccwpck_require__(2948),
|
|
379
379
|
);
|
|
380
|
-
var _utils = __nccwpck_require__(
|
|
380
|
+
var _utils = __nccwpck_require__(8453);
|
|
381
381
|
function _interopRequireDefault(obj) {
|
|
382
382
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
383
383
|
}
|
|
@@ -682,14 +682,14 @@
|
|
|
682
682
|
plugin.postcss = true;
|
|
683
683
|
var _default = (exports["default"] = plugin);
|
|
684
684
|
},
|
|
685
|
-
|
|
685
|
+
1500: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
686
686
|
"use strict";
|
|
687
687
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
688
688
|
exports["default"] = void 0;
|
|
689
689
|
var _postcssValueParser = _interopRequireDefault(
|
|
690
690
|
__nccwpck_require__(2948),
|
|
691
691
|
);
|
|
692
|
-
var _utils = __nccwpck_require__(
|
|
692
|
+
var _utils = __nccwpck_require__(8453);
|
|
693
693
|
function _interopRequireDefault(obj) {
|
|
694
694
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
695
695
|
}
|
|
@@ -1032,7 +1032,7 @@
|
|
|
1032
1032
|
plugin.postcss = true;
|
|
1033
1033
|
var _default = (exports["default"] = plugin);
|
|
1034
1034
|
},
|
|
1035
|
-
|
|
1035
|
+
8453: (__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
1036
1036
|
"use strict";
|
|
1037
1037
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1038
1038
|
exports.WEBPACK_IGNORE_COMMENT_REGEXP = void 0;
|
|
@@ -3731,7 +3731,7 @@
|
|
|
3731
3731
|
var _selector = _interopRequireDefault(__nccwpck_require__(5297));
|
|
3732
3732
|
var _className = _interopRequireDefault(__nccwpck_require__(173));
|
|
3733
3733
|
var _comment = _interopRequireDefault(__nccwpck_require__(8983));
|
|
3734
|
-
var _id = _interopRequireDefault(__nccwpck_require__(
|
|
3734
|
+
var _id = _interopRequireDefault(__nccwpck_require__(834));
|
|
3735
3735
|
var _tag = _interopRequireDefault(__nccwpck_require__(5526));
|
|
3736
3736
|
var _string = _interopRequireDefault(__nccwpck_require__(4349));
|
|
3737
3737
|
var _pseudo = _interopRequireDefault(__nccwpck_require__(7250));
|
|
@@ -5707,7 +5707,7 @@
|
|
|
5707
5707
|
var _className = _interopRequireDefault(__nccwpck_require__(173));
|
|
5708
5708
|
var _combinator = _interopRequireDefault(__nccwpck_require__(3998));
|
|
5709
5709
|
var _comment = _interopRequireDefault(__nccwpck_require__(8983));
|
|
5710
|
-
var _id = _interopRequireDefault(__nccwpck_require__(
|
|
5710
|
+
var _id = _interopRequireDefault(__nccwpck_require__(834));
|
|
5711
5711
|
var _nesting = _interopRequireDefault(__nccwpck_require__(8568));
|
|
5712
5712
|
var _pseudo = _interopRequireDefault(__nccwpck_require__(7250));
|
|
5713
5713
|
var _root = _interopRequireDefault(__nccwpck_require__(9608));
|
|
@@ -6289,7 +6289,7 @@
|
|
|
6289
6289
|
return isAttribute(node) || isTag(node);
|
|
6290
6290
|
}
|
|
6291
6291
|
},
|
|
6292
|
-
|
|
6292
|
+
834: (module, exports, __nccwpck_require__) => {
|
|
6293
6293
|
"use strict";
|
|
6294
6294
|
exports.__esModule = true;
|
|
6295
6295
|
exports["default"] = void 0;
|
|
@@ -8096,6 +8096,6 @@
|
|
|
8096
8096
|
}
|
|
8097
8097
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
8098
8098
|
__nccwpck_require__.ab = __dirname + "/";
|
|
8099
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
8099
|
+
var __webpack_exports__ = __nccwpck_require__(4278);
|
|
8100
8100
|
module.exports = __webpack_exports__;
|
|
8101
8101
|
})();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
var __webpack_modules__ = {
|
|
3
|
-
|
|
3
|
+
722: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
4
4
|
"use strict";
|
|
5
|
-
const { HtmlWebpackChildCompiler } = __nccwpck_require__(
|
|
5
|
+
const { HtmlWebpackChildCompiler } = __nccwpck_require__(907);
|
|
6
6
|
const compilerMap = new WeakMap();
|
|
7
7
|
class CachedChildCompilation {
|
|
8
8
|
constructor(compiler) {
|
|
@@ -52,35 +52,43 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
class PersistentChildCompilerSingletonPlugin {
|
|
55
|
-
static createSnapshot(fileDependencies, mainCompilation
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
static createSnapshot(fileDependencies, mainCompilation) {
|
|
56
|
+
const timestamps = {};
|
|
57
|
+
const fs = mainCompilation.inputFileSystem;
|
|
58
|
+
return Promise.all(
|
|
59
|
+
fileDependencies.map(
|
|
60
|
+
(file) =>
|
|
61
|
+
new Promise((resolve) => {
|
|
62
|
+
fs.stat(file, (err, stat) => {
|
|
63
|
+
if (!err && stat) {
|
|
64
|
+
timestamps[file] = stat.mtime.getTime();
|
|
65
|
+
} else {
|
|
66
|
+
timestamps[file] = null;
|
|
67
|
+
}
|
|
68
|
+
resolve();
|
|
69
|
+
});
|
|
70
|
+
}),
|
|
71
|
+
),
|
|
72
|
+
).then(() => timestamps);
|
|
71
73
|
}
|
|
72
74
|
static isSnapshotValid(snapshot, mainCompilation) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
const fs = mainCompilation.inputFileSystem;
|
|
76
|
+
return Promise.all(
|
|
77
|
+
Object.keys(snapshot).map(
|
|
78
|
+
(file) =>
|
|
79
|
+
new Promise((resolve) => {
|
|
80
|
+
fs.stat(file, (err, stat) => {
|
|
81
|
+
if (!err && stat && snapshot[file] !== null) {
|
|
82
|
+
resolve(stat.mtime.getTime() === snapshot[file]);
|
|
83
|
+
} else if (err && snapshot[file] === null) {
|
|
84
|
+
resolve(true);
|
|
85
|
+
} else {
|
|
86
|
+
resolve(false);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}),
|
|
90
|
+
),
|
|
91
|
+
).then((results) => !results.includes(false));
|
|
84
92
|
}
|
|
85
93
|
static watchFiles(mainCompilation, fileDependencies) {
|
|
86
94
|
Object.keys(fileDependencies).forEach((depencyTypes) => {
|
|
@@ -154,9 +162,8 @@
|
|
|
154
162
|
compiledEntriesPromise
|
|
155
163
|
.then((childCompilationResult) =>
|
|
156
164
|
PersistentChildCompilerSingletonPlugin.createSnapshot(
|
|
157
|
-
childCompilationResult.dependencies,
|
|
165
|
+
childCompilationResult.dependencies.fileDependencies,
|
|
158
166
|
mainCompilation,
|
|
159
|
-
compilationStartTime,
|
|
160
167
|
),
|
|
161
168
|
)
|
|
162
169
|
.then((snapshot) => {
|
|
@@ -304,7 +311,7 @@
|
|
|
304
311
|
}
|
|
305
312
|
module.exports = { CachedChildCompilation };
|
|
306
313
|
},
|
|
307
|
-
|
|
314
|
+
907: (module) => {
|
|
308
315
|
"use strict";
|
|
309
316
|
class HtmlWebpackChildCompiler {
|
|
310
317
|
constructor(templates) {
|
|
@@ -473,7 +480,7 @@
|
|
|
473
480
|
}
|
|
474
481
|
module.exports = { HtmlWebpackChildCompiler };
|
|
475
482
|
},
|
|
476
|
-
|
|
483
|
+
297: (module) => {
|
|
477
484
|
"use strict";
|
|
478
485
|
module.exports = {};
|
|
479
486
|
module.exports.none = (chunks) => chunks;
|
|
@@ -492,7 +499,7 @@
|
|
|
492
499
|
};
|
|
493
500
|
module.exports.auto = module.exports.none;
|
|
494
501
|
},
|
|
495
|
-
|
|
502
|
+
184: (module) => {
|
|
496
503
|
"use strict";
|
|
497
504
|
module.exports = function (err) {
|
|
498
505
|
return {
|
|
@@ -513,7 +520,7 @@
|
|
|
513
520
|
};
|
|
514
521
|
};
|
|
515
522
|
},
|
|
516
|
-
|
|
523
|
+
55: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
517
524
|
"use strict";
|
|
518
525
|
const { AsyncSeriesWaterfallHook } = __nccwpck_require__(408);
|
|
519
526
|
const htmlWebpackPluginHooksMap = new WeakMap();
|
|
@@ -539,7 +546,7 @@
|
|
|
539
546
|
}
|
|
540
547
|
module.exports = { getHtmlRspackPluginHooks };
|
|
541
548
|
},
|
|
542
|
-
|
|
549
|
+
502: (module) => {
|
|
543
550
|
const voidTags = [
|
|
544
551
|
"area",
|
|
545
552
|
"base",
|
|
@@ -607,19 +614,20 @@
|
|
|
607
614
|
htmlTagObjectToString,
|
|
608
615
|
};
|
|
609
616
|
},
|
|
610
|
-
|
|
617
|
+
759: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
611
618
|
"use strict";
|
|
612
619
|
const promisify = __nccwpck_require__(23).promisify;
|
|
613
620
|
const vm = __nccwpck_require__(154);
|
|
614
621
|
const fs = __nccwpck_require__(896);
|
|
615
622
|
const path = __nccwpck_require__(928);
|
|
616
|
-
const { CachedChildCompilation } = __nccwpck_require__(
|
|
623
|
+
const { CachedChildCompilation } = __nccwpck_require__(722);
|
|
617
624
|
const { createHtmlTagObject, htmlTagObjectToString, HtmlTagArray } =
|
|
618
|
-
__nccwpck_require__(
|
|
619
|
-
const prettyError = __nccwpck_require__(
|
|
620
|
-
const chunkSorter = __nccwpck_require__(
|
|
625
|
+
__nccwpck_require__(502);
|
|
626
|
+
const prettyError = __nccwpck_require__(184);
|
|
627
|
+
const chunkSorter = __nccwpck_require__(297);
|
|
621
628
|
const getHtmlRspackPluginHooks =
|
|
622
|
-
__nccwpck_require__(
|
|
629
|
+
__nccwpck_require__(55).getHtmlRspackPluginHooks;
|
|
630
|
+
const WITH_PLACEHOLDER = "function __with_placeholder__";
|
|
623
631
|
class HtmlRspackPlugin {
|
|
624
632
|
constructor(userOptions = {}) {
|
|
625
633
|
this.version = HtmlRspackPlugin.version;
|
|
@@ -887,6 +895,9 @@
|
|
|
887
895
|
new Error("The child compilation didn't provide a result"),
|
|
888
896
|
);
|
|
889
897
|
}
|
|
898
|
+
if (source.indexOf(WITH_PLACEHOLDER) >= 0) {
|
|
899
|
+
source = source.replace(WITH_PLACEHOLDER, "with");
|
|
900
|
+
}
|
|
890
901
|
if (source.indexOf("HTML_WEBPACK_PLUGIN_RESULT") >= 0) {
|
|
891
902
|
source += ";\nHTML_WEBPACK_PLUGIN_RESULT";
|
|
892
903
|
}
|
|
@@ -1586,6 +1597,6 @@
|
|
|
1586
1597
|
}
|
|
1587
1598
|
if (typeof __nccwpck_require__ !== "undefined")
|
|
1588
1599
|
__nccwpck_require__.ab = __dirname + "/";
|
|
1589
|
-
var __webpack_exports__ = __nccwpck_require__(
|
|
1600
|
+
var __webpack_exports__ = __nccwpck_require__(759);
|
|
1590
1601
|
module.exports = __webpack_exports__;
|
|
1591
1602
|
})();
|
|
@@ -30,6 +30,7 @@ const stringEscapes = {
|
|
|
30
30
|
'\u2029': 'u2029',
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
const WITH_PLACEHOLDER = 'function __with_placeholder__';
|
|
33
34
|
const escapeStringChar = (chr) => '\\' + stringEscapes[chr];
|
|
34
35
|
|
|
35
36
|
function template(string) {
|
|
@@ -150,11 +151,11 @@ function lodashEscape(string) {
|
|
|
150
151
|
};`;
|
|
151
152
|
|
|
152
153
|
// The following part renders the template with lodash as a minimalistic loader
|
|
154
|
+
// The WITH_PLACEHOLDER will be replaced with `with` in the next step
|
|
155
|
+
// to make the code compatible with SWC strict mode
|
|
153
156
|
const { compiled, isEscaping } = template(source);
|
|
154
|
-
// Use `eval("require")("lodash")` to enforce using the native nodejs require
|
|
155
|
-
// during template execution
|
|
156
157
|
return `
|
|
157
|
-
module.exports = function (templateParams) {
|
|
158
|
+
module.exports = function (templateParams) { ${WITH_PLACEHOLDER}(templateParams) {
|
|
158
159
|
${isEscaping ? escapeCode : ''}
|
|
159
160
|
// Execute the lodash template
|
|
160
161
|
return (${compiled})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.
|
|
1
|
+
{"name":"html-rspack-plugin","author":"Jan Nicklas <j.nicklas@me.com> (https://github.com/jantimon)","version":"6.1.2","funding":{"type":"opencollective","url":"https://opencollective.com/html-webpack-plugin"},"license":"MIT","types":"index.d.ts","type":"commonjs"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
(() => {
|
|
2
2
|
"use strict";
|
|
3
3
|
var __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
module.exports = __nccwpck_require__(
|
|
4
|
+
866: (module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
5
|
+
module.exports = __nccwpck_require__(184)["default"];
|
|
6
6
|
},
|
|
7
|
-
|
|
7
|
+
184: (__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__(201);
|
|
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
|
+
201: (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__(866);
|
|
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
|
+
14: (__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
|
+
207: (__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__(14);
|
|
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__(207);
|
|
316
316
|
Object.defineProperty(exports, "getCompilerHooks", {
|
|
317
317
|
enumerable: true,
|
|
318
318
|
get: function () {
|
package/dist/index.cjs
CHANGED
|
@@ -1032,6 +1032,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1032
1032
|
"use strict";
|
|
1033
1033
|
let swcHelpersPath, pluginHelper_htmlPlugin, cssExtractPlugin;
|
|
1034
1034
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
1035
|
+
loadEnv: ()=>loadEnv,
|
|
1035
1036
|
logger: ()=>rslog_index_js_namespaceObject.logger,
|
|
1036
1037
|
createRsbuild: ()=>createRsbuild,
|
|
1037
1038
|
rspack: ()=>core_namespaceObject.rspack,
|
|
@@ -1041,9 +1042,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
1041
1042
|
version: ()=>src_version,
|
|
1042
1043
|
PLUGIN_SWC_NAME: ()=>PLUGIN_SWC_NAME,
|
|
1043
1044
|
PLUGIN_CSS_NAME: ()=>PLUGIN_CSS_NAME,
|
|
1044
|
-
loadConfig: ()=>config_loadConfig,
|
|
1045
1045
|
ensureAssetPrefix: ()=>ensureAssetPrefix,
|
|
1046
|
-
|
|
1046
|
+
loadConfig: ()=>config_loadConfig,
|
|
1047
|
+
defaultAllowedOrigins: ()=>defaultAllowedOrigins
|
|
1047
1048
|
});
|
|
1048
1049
|
var provider_helpers_namespaceObject = {};
|
|
1049
1050
|
__webpack_require__.r(provider_helpers_namespaceObject), __webpack_require__.d(provider_helpers_namespaceObject, {
|
|
@@ -1593,7 +1594,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1593
1594
|
overlay: !0,
|
|
1594
1595
|
reconnect: 100
|
|
1595
1596
|
}
|
|
1596
|
-
}),
|
|
1597
|
+
}), defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, getDefaultServerConfig = ()=>({
|
|
1597
1598
|
port: 3000,
|
|
1598
1599
|
host: DEFAULT_DEV_HOST,
|
|
1599
1600
|
open: !1,
|
|
@@ -1603,7 +1604,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
1603
1604
|
printUrls: !0,
|
|
1604
1605
|
strictPort: !1,
|
|
1605
1606
|
cors: {
|
|
1606
|
-
origin:
|
|
1607
|
+
origin: defaultAllowedOrigins
|
|
1607
1608
|
},
|
|
1608
1609
|
middlewareMode: !1
|
|
1609
1610
|
}), getDefaultSourceConfig = ()=>({
|
|
@@ -2256,13 +2257,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
2256
2257
|
}
|
|
2257
2258
|
}
|
|
2258
2259
|
async function createContext(options, userConfig) {
|
|
2259
|
-
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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;
|
|
2260
|
+
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(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';
|
|
2260
2261
|
return {
|
|
2261
|
-
version: "1.3.
|
|
2262
|
+
version: "1.3.18",
|
|
2262
2263
|
rootPath,
|
|
2263
2264
|
distPath: '',
|
|
2264
2265
|
cachePath,
|
|
2265
|
-
|
|
2266
|
+
callerName: options.callerName,
|
|
2267
|
+
bundlerType,
|
|
2266
2268
|
environments: {},
|
|
2267
2269
|
hooks: {
|
|
2268
2270
|
onExit: createAsyncHook(),
|
|
@@ -2571,7 +2573,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
2571
2573
|
javascript: {
|
|
2572
2574
|
exportsPresence: 'error'
|
|
2573
2575
|
}
|
|
2574
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys',
|
|
2576
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', 'rspack' === api.context.bundlerType && chain.experiments({
|
|
2575
2577
|
...chain.get('experiments'),
|
|
2576
2578
|
incremental: !0
|
|
2577
2579
|
});
|
|
@@ -3301,15 +3303,18 @@ for(var __webpack_i__ in (()=>{
|
|
|
3301
3303
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3302
3304
|
let hooks = getHTMLPlugin().getCompilationHooks(compilation);
|
|
3303
3305
|
hooks.alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3306
|
+
let extraData = this.getExtraData(data.plugin);
|
|
3307
|
+
if (!extraData) return data;
|
|
3308
|
+
let { headTags, bodyTags } = data, { favicon, context, tagConfig, entryName, environment, templateContent } = extraData;
|
|
3309
|
+
if (!hasTitle(templateContent)) {
|
|
3310
|
+
var _data_plugin_options;
|
|
3311
|
+
addTitleTag(headTags, null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.title);
|
|
3312
|
+
}
|
|
3313
|
+
favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
|
|
3309
3314
|
let tags = {
|
|
3310
3315
|
headTags: headTags.map(formatBasicTag),
|
|
3311
3316
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
3312
|
-
},
|
|
3317
|
+
}, [modified] = await context.hooks.modifyHTMLTags.callChain({
|
|
3313
3318
|
environment: environment.name,
|
|
3314
3319
|
args: [
|
|
3315
3320
|
tags,
|
|
@@ -3327,7 +3332,9 @@ for(var __webpack_i__ in (()=>{
|
|
|
3327
3332
|
bodyTags: modified.bodyTags.map(fromBasicTag)
|
|
3328
3333
|
}), tagConfig && applyTagConfig(data, tagConfig, compilation.hash ?? '', entryName), data;
|
|
3329
3334
|
}), hooks.beforeEmit.tapPromise(this.name, async (data)=>{
|
|
3330
|
-
let
|
|
3335
|
+
let extraData = this.getExtraData(data.plugin);
|
|
3336
|
+
if (!extraData) return data;
|
|
3337
|
+
let { context, environment } = extraData, [modified] = await context.hooks.modifyHTML.callChain({
|
|
3331
3338
|
environment: environment.name,
|
|
3332
3339
|
args: [
|
|
3333
3340
|
data.html,
|
|
@@ -3346,8 +3353,8 @@ for(var __webpack_i__ in (()=>{
|
|
|
3346
3353
|
});
|
|
3347
3354
|
});
|
|
3348
3355
|
}
|
|
3349
|
-
constructor(
|
|
3350
|
-
RsbuildHtmlPlugin_define_property(this, "name", void 0), RsbuildHtmlPlugin_define_property(this, "
|
|
3356
|
+
constructor(getExtraData){
|
|
3357
|
+
RsbuildHtmlPlugin_define_property(this, "name", void 0), RsbuildHtmlPlugin_define_property(this, "getExtraData", void 0), this.name = 'RsbuildHtmlPlugin', this.getExtraData = getExtraData;
|
|
3351
3358
|
}
|
|
3352
3359
|
}
|
|
3353
3360
|
let getDefaultTemplateContent = (mountId)=>`<!doctype html><html><head></head><body><div id="${mountId}"></div></body></html>`, existTemplatePath = new Set();
|
|
@@ -3388,7 +3395,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3388
3395
|
api.modifyBundlerChain(async (chain, { HtmlPlugin, CHAIN_ID, environment })=>{
|
|
3389
3396
|
let { config, htmlPaths } = environment;
|
|
3390
3397
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
3391
|
-
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]),
|
|
3398
|
+
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]), extraDataList = [], finalOptions = await Promise.all(entryNames.map(async (entryName)=>{
|
|
3392
3399
|
var entryName1, entryName2, config1, assetPrefix1, entryName3, entryName4;
|
|
3393
3400
|
let entryValue = entries[entryName].values(), chunks = function(entryName, entryValue) {
|
|
3394
3401
|
let chunks = [
|
|
@@ -3447,10 +3454,14 @@ for(var __webpack_i__ in (()=>{
|
|
|
3447
3454
|
scriptLoading: config.html.scriptLoading
|
|
3448
3455
|
};
|
|
3449
3456
|
templatePath && (pluginOptions.template = templatePath), chunks.length > 1 && (pluginOptions.chunksSortMode = 'manual');
|
|
3450
|
-
let
|
|
3451
|
-
|
|
3457
|
+
let extraData = {
|
|
3458
|
+
entryName,
|
|
3459
|
+
context,
|
|
3460
|
+
environment
|
|
3461
|
+
};
|
|
3462
|
+
extraDataList.push(extraData), templateContent && (extraData.templateContent = templateContent);
|
|
3452
3463
|
let tagConfig = getTagConfig(environment.config);
|
|
3453
|
-
tagConfig && (
|
|
3464
|
+
tagConfig && (extraData.tagConfig = tagConfig), entryName3 = entryName, pluginOptions.title = reduceConfigsMergeContext({
|
|
3454
3465
|
initial: '',
|
|
3455
3466
|
config: config.html.title,
|
|
3456
3467
|
ctx: {
|
|
@@ -3464,7 +3475,7 @@ for(var __webpack_i__ in (()=>{
|
|
|
3464
3475
|
entryName: entryName4
|
|
3465
3476
|
}
|
|
3466
3477
|
}));
|
|
3467
|
-
favicon && (
|
|
3478
|
+
favicon && (extraData.favicon = favicon);
|
|
3468
3479
|
let finalOptions = reduceConfigsWithContext({
|
|
3469
3480
|
initial: pluginOptions,
|
|
3470
3481
|
config: 'boolean' == typeof config.tools.htmlPlugin ? {} : config.tools.htmlPlugin,
|
|
@@ -3474,15 +3485,12 @@ for(var __webpack_i__ in (()=>{
|
|
|
3474
3485
|
}
|
|
3475
3486
|
});
|
|
3476
3487
|
return finalOptions.template || finalOptions.templateContent || (pluginOptions.template = '', pluginOptions.templateContent = templateContent), finalOptions;
|
|
3477
|
-
}));
|
|
3488
|
+
})), extraDataMap = new WeakMap();
|
|
3478
3489
|
if (entryNames.forEach((entryName, index)=>{
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
]);
|
|
3490
|
+
let pluginInstance = new HtmlPlugin(finalOptions[index]), extraData = extraDataList.find((item)=>item.entryName === entryName);
|
|
3491
|
+
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).use(pluginInstance), extraData && extraDataMap.set(pluginInstance, extraData);
|
|
3482
3492
|
}), chain.plugin('rsbuild-html-plugin').use(RsbuildHtmlPlugin, [
|
|
3483
|
-
|
|
3484
|
-
()=>environment,
|
|
3485
|
-
()=>context
|
|
3493
|
+
(pluginInstance)=>extraDataMap.get(pluginInstance)
|
|
3486
3494
|
]), config.html) {
|
|
3487
3495
|
let { crossorigin } = config.html;
|
|
3488
3496
|
crossorigin && chain.output.crossOriginLoading(!0 === crossorigin ? 'anonymous' : crossorigin);
|
|
@@ -4392,33 +4400,25 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
4392
4400
|
}
|
|
4393
4401
|
});
|
|
4394
4402
|
}
|
|
4395
|
-
}),
|
|
4396
|
-
var external_node_inspector_default = __webpack_require__.n(external_node_inspector_namespaceObject);
|
|
4397
|
-
let stopProfiler = (output, profileSession)=>{
|
|
4398
|
-
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
4399
|
-
if (error) return void rslog_index_js_namespaceObject.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4400
|
-
external_node_fs_default().writeFileSync(output, JSON.stringify(param.profile));
|
|
4401
|
-
});
|
|
4402
|
-
}, pluginRspackProfile = ()=>({
|
|
4403
|
+
}), pluginRspackProfile = ()=>({
|
|
4403
4404
|
name: 'rsbuild:rspack-profile',
|
|
4404
4405
|
async setup (api) {
|
|
4405
4406
|
var _process_env_RSPACK_PROFILE;
|
|
4406
|
-
let profileSession;
|
|
4407
4407
|
if ('webpack' === api.context.bundlerType) return;
|
|
4408
4408
|
let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
|
|
4409
4409
|
if (!RSPACK_PROFILE) return;
|
|
4410
|
-
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'),
|
|
4410
|
+
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), onStart = async ()=>{
|
|
4411
4411
|
let profileDir = external_node_path_default().join(api.context.distPath, profileDirName), traceFilePath = external_node_path_default().join(profileDir, 'trace.json');
|
|
4412
4412
|
await isFileExists(profileDir) || await external_node_fs_default().promises.mkdir(profileDir, {
|
|
4413
4413
|
recursive: !0
|
|
4414
|
-
}), enableProfileTrace && core_default().experiments.globalTrace.register('trace', 'chrome', traceFilePath)
|
|
4414
|
+
}), enableProfileTrace && core_default().experiments.globalTrace.register('trace', 'chrome', traceFilePath);
|
|
4415
4415
|
};
|
|
4416
4416
|
api.onBeforeBuild(({ isFirstCompile })=>{
|
|
4417
4417
|
isFirstCompile && onStart();
|
|
4418
4418
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
4419
4419
|
enableProfileTrace && core_default().experiments.globalTrace.cleanup();
|
|
4420
4420
|
let profileDir = external_node_path_default().join(api.context.distPath, profileDirName);
|
|
4421
|
-
|
|
4421
|
+
rslog_index_js_namespaceObject.logger.info(`profile file saved to ${index_js_default().cyan(profileDir)}`);
|
|
4422
4422
|
});
|
|
4423
4423
|
}
|
|
4424
4424
|
}), pluginServer = ()=>({
|
|
@@ -6816,9 +6816,10 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6816
6816
|
setup (api) {
|
|
6817
6817
|
'webpack' !== api.context.bundlerType && (api.modifyRsbuildConfig((config)=>{
|
|
6818
6818
|
let { moduleFederation } = config;
|
|
6819
|
-
if (
|
|
6820
|
-
var _config_server, _config_dev_client,
|
|
6821
|
-
|
|
6819
|
+
if ((null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
6820
|
+
var _userConfig_server, _config_server, _config_dev_client, _userConfig_dev, _config_server1;
|
|
6821
|
+
let userConfig = api.getRsbuildConfig('original');
|
|
6822
|
+
config.dev ||= {}, config.server ||= {}, (null == (_userConfig_server = userConfig.server) ? void 0 : _userConfig_server.cors) === void 0 && (config.server.cors = !0), (null == (_config_server = config.server) ? void 0 : _config_server.port) && !(null == (_config_dev_client = config.dev.client) ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null == (_userConfig_dev = userConfig.dev) ? void 0 : _userConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null == (_config_server1 = config.server) ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
|
|
6822
6823
|
}
|
|
6823
6824
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
6824
6825
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
@@ -6870,6 +6871,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6870
6871
|
}
|
|
6871
6872
|
let resolvedOptions = {
|
|
6872
6873
|
cwd: process.cwd(),
|
|
6874
|
+
callerName: 'rsbuild',
|
|
6873
6875
|
...options,
|
|
6874
6876
|
rsbuildConfig: config
|
|
6875
6877
|
}, pluginManager = (plugins = [], {
|
|
@@ -6932,6 +6934,7 @@ throw new Error('Failed to load Node.js addon: "${name}"\\n' + error);
|
|
|
6932
6934
|
'distPath',
|
|
6933
6935
|
'devServer',
|
|
6934
6936
|
'cachePath',
|
|
6937
|
+
'callerName',
|
|
6935
6938
|
'bundlerType'
|
|
6936
6939
|
];
|
|
6937
6940
|
return new Proxy(context, {
|
|
@@ -7527,11 +7530,11 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7527
7530
|
}
|
|
7528
7531
|
process.title = 'rsbuild-node';
|
|
7529
7532
|
let { npm_execpath } = process.env;
|
|
7530
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.
|
|
7533
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), rslog_index_js_namespaceObject.logger.greet(` Rsbuild v1.3.18\n`);
|
|
7531
7534
|
try {
|
|
7532
7535
|
!function() {
|
|
7533
7536
|
let cli = cac_dist('rsbuild');
|
|
7534
|
-
cli.help(), cli.version("1.3.
|
|
7537
|
+
cli.help(), cli.version("1.3.18"), applyCommonOptions(cli);
|
|
7535
7538
|
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7536
7539
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7537
7540
|
try {
|
|
@@ -7582,11 +7585,12 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
7582
7585
|
rslog_index_js_namespaceObject.logger.error('Failed to start Rsbuild CLI.'), rslog_index_js_namespaceObject.logger.error(err);
|
|
7583
7586
|
}
|
|
7584
7587
|
}
|
|
7585
|
-
let src_version = "1.3.
|
|
7586
|
-
})(), exports.PLUGIN_CSS_NAME = __webpack_exports__.PLUGIN_CSS_NAME, exports.PLUGIN_SWC_NAME = __webpack_exports__.PLUGIN_SWC_NAME, exports.createRsbuild = __webpack_exports__.createRsbuild, 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 === [
|
|
7588
|
+
let src_version = "1.3.18";
|
|
7589
|
+
})(), 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 === [
|
|
7587
7590
|
"PLUGIN_CSS_NAME",
|
|
7588
7591
|
"PLUGIN_SWC_NAME",
|
|
7589
7592
|
"createRsbuild",
|
|
7593
|
+
"defaultAllowedOrigins",
|
|
7590
7594
|
"defineConfig",
|
|
7591
7595
|
"ensureAssetPrefix",
|
|
7592
7596
|
"loadConfig",
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_crypto_9ba42079__ from "node:crypto";
|
|
|
21
21
|
import * as __WEBPACK_EXTERNAL_MODULE_node_zlib_a5bb16fc__ from "node:zlib";
|
|
22
22
|
import * as __WEBPACK_EXTERNAL_MODULE_node_child_process_27f17141__ from "node:child_process";
|
|
23
23
|
import * as __WEBPACK_EXTERNAL_MODULE_node_net_0373943e__ from "node:net";
|
|
24
|
-
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
25
24
|
import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
|
|
26
25
|
import * as __WEBPACK_EXTERNAL_MODULE_node_readline_91c31510__ from "node:readline";
|
|
27
26
|
import * as __WEBPACK_EXTERNAL_MODULE_node_dns_78d346ee__ from "node:dns";
|
|
@@ -1456,7 +1455,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1456
1455
|
overlay: !0,
|
|
1457
1456
|
reconnect: 100
|
|
1458
1457
|
}
|
|
1459
|
-
}),
|
|
1458
|
+
}), defaultAllowedOrigins = /^https?:\/\/(?:(?:[^:]+\.)?localhost|127\.0\.0\.1|\[::1\])(?::\d+)?$/, getDefaultServerConfig = ()=>({
|
|
1460
1459
|
port: 3000,
|
|
1461
1460
|
host: DEFAULT_DEV_HOST,
|
|
1462
1461
|
open: !1,
|
|
@@ -1466,7 +1465,7 @@ let configCache = {}, OVERRIDE_PATHS = [
|
|
|
1466
1465
|
printUrls: !0,
|
|
1467
1466
|
strictPort: !1,
|
|
1468
1467
|
cors: {
|
|
1469
|
-
origin:
|
|
1468
|
+
origin: defaultAllowedOrigins
|
|
1470
1469
|
},
|
|
1471
1470
|
middlewareMode: !1
|
|
1472
1471
|
}), getDefaultSourceConfig = ()=>({
|
|
@@ -2115,13 +2114,14 @@ async function updateEnvironmentContext(context, configs) {
|
|
|
2115
2114
|
}
|
|
2116
2115
|
}
|
|
2117
2116
|
async function createContext(options, userConfig) {
|
|
2118
|
-
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0;
|
|
2117
|
+
let { cwd } = options, rootPath = userConfig.root ? getAbsolutePath(cwd, userConfig.root) : cwd, rsbuildConfig = await withDefaultConfig(rootPath, userConfig), cachePath = (0, __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.join)(rootPath, 'node_modules', '.cache'), specifiedEnvironments = options.environment && options.environment.length > 0 ? options.environment : void 0, bundlerType = userConfig.provider ? 'webpack' : 'rspack';
|
|
2119
2118
|
return {
|
|
2120
|
-
version: "1.3.
|
|
2119
|
+
version: "1.3.18",
|
|
2121
2120
|
rootPath,
|
|
2122
2121
|
distPath: '',
|
|
2123
2122
|
cachePath,
|
|
2124
|
-
|
|
2123
|
+
callerName: options.callerName,
|
|
2124
|
+
bundlerType,
|
|
2125
2125
|
environments: {},
|
|
2126
2126
|
hooks: {
|
|
2127
2127
|
onExit: createAsyncHook(),
|
|
@@ -2430,7 +2430,7 @@ let configChain_CHAIN_ID = {
|
|
|
2430
2430
|
javascript: {
|
|
2431
2431
|
exportsPresence: 'error'
|
|
2432
2432
|
}
|
|
2433
|
-
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys',
|
|
2433
|
+
}), isDev && config.dev.hmr && 'web' === target && chain.plugin(CHAIN_ID.PLUGIN.HMR).use(bundler.HotModuleReplacementPlugin), 'development' === env && chain.output.devtoolModuleFilenameTemplate((info)=>toPosixPath(info.absoluteResourcePath)), process.env.RSPACK_CONFIG_VALIDATE ||= 'loose-unrecognized-keys', 'rspack' === api.context.bundlerType && chain.experiments({
|
|
2434
2434
|
...chain.get('experiments'),
|
|
2435
2435
|
incremental: !0
|
|
2436
2436
|
});
|
|
@@ -3157,15 +3157,18 @@ class RsbuildHtmlPlugin {
|
|
|
3157
3157
|
compiler.hooks.compilation.tap(this.name, (compilation)=>{
|
|
3158
3158
|
let hooks = getHTMLPlugin().getCompilationHooks(compilation);
|
|
3159
3159
|
hooks.alterAssetTagGroups.tapPromise(this.name, async (data)=>{
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3160
|
+
let extraData = this.getExtraData(data.plugin);
|
|
3161
|
+
if (!extraData) return data;
|
|
3162
|
+
let { headTags, bodyTags } = data, { favicon, context, tagConfig, entryName, environment, templateContent } = extraData;
|
|
3163
|
+
if (!hasTitle(templateContent)) {
|
|
3164
|
+
var _data_plugin_options;
|
|
3165
|
+
addTitleTag(headTags, null == (_data_plugin_options = data.plugin.options) ? void 0 : _data_plugin_options.title);
|
|
3166
|
+
}
|
|
3167
|
+
favicon && await addFavicon(headTags, favicon, compilation, data.publicPath);
|
|
3165
3168
|
let tags = {
|
|
3166
3169
|
headTags: headTags.map(formatBasicTag),
|
|
3167
3170
|
bodyTags: bodyTags.map(formatBasicTag)
|
|
3168
|
-
},
|
|
3171
|
+
}, [modified] = await context.hooks.modifyHTMLTags.callChain({
|
|
3169
3172
|
environment: environment.name,
|
|
3170
3173
|
args: [
|
|
3171
3174
|
tags,
|
|
@@ -3183,7 +3186,9 @@ class RsbuildHtmlPlugin {
|
|
|
3183
3186
|
bodyTags: modified.bodyTags.map(fromBasicTag)
|
|
3184
3187
|
}), tagConfig && applyTagConfig(data, tagConfig, compilation.hash ?? '', entryName), data;
|
|
3185
3188
|
}), hooks.beforeEmit.tapPromise(this.name, async (data)=>{
|
|
3186
|
-
let
|
|
3189
|
+
let extraData = this.getExtraData(data.plugin);
|
|
3190
|
+
if (!extraData) return data;
|
|
3191
|
+
let { context, environment } = extraData, [modified] = await context.hooks.modifyHTML.callChain({
|
|
3187
3192
|
environment: environment.name,
|
|
3188
3193
|
args: [
|
|
3189
3194
|
data.html,
|
|
@@ -3202,8 +3207,8 @@ class RsbuildHtmlPlugin {
|
|
|
3202
3207
|
});
|
|
3203
3208
|
});
|
|
3204
3209
|
}
|
|
3205
|
-
constructor(
|
|
3206
|
-
RsbuildHtmlPlugin_define_property(this, "name", void 0), RsbuildHtmlPlugin_define_property(this, "
|
|
3210
|
+
constructor(getExtraData){
|
|
3211
|
+
RsbuildHtmlPlugin_define_property(this, "name", void 0), RsbuildHtmlPlugin_define_property(this, "getExtraData", void 0), this.name = 'RsbuildHtmlPlugin', this.getExtraData = getExtraData;
|
|
3207
3212
|
}
|
|
3208
3213
|
}
|
|
3209
3214
|
let getDefaultTemplateContent = (mountId)=>`<!doctype html><html><head></head><body><div id="${mountId}"></div></body></html>`, existTemplatePath = new Set();
|
|
@@ -3244,7 +3249,7 @@ let getTagConfig = (config)=>{
|
|
|
3244
3249
|
api.modifyBundlerChain(async (chain, { HtmlPlugin, CHAIN_ID, environment })=>{
|
|
3245
3250
|
let { config, htmlPaths } = environment;
|
|
3246
3251
|
if (0 === Object.keys(htmlPaths).length) return;
|
|
3247
|
-
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]),
|
|
3252
|
+
let assetPrefix = getPublicPathFromChain(chain, !1), entries = chain.entryPoints.entries() || {}, entryNames = Object.keys(entries).filter((entryName)=>!!htmlPaths[entryName]), extraDataList = [], finalOptions = await Promise.all(entryNames.map(async (entryName)=>{
|
|
3248
3253
|
let entryValue = entries[entryName].values(), chunks = function(entryName, entryValue) {
|
|
3249
3254
|
let chunks = [
|
|
3250
3255
|
entryName
|
|
@@ -3302,10 +3307,14 @@ let getTagConfig = (config)=>{
|
|
|
3302
3307
|
scriptLoading: config.html.scriptLoading
|
|
3303
3308
|
};
|
|
3304
3309
|
templatePath && (pluginOptions.template = templatePath), chunks.length > 1 && (pluginOptions.chunksSortMode = 'manual');
|
|
3305
|
-
let
|
|
3306
|
-
|
|
3310
|
+
let extraData = {
|
|
3311
|
+
entryName,
|
|
3312
|
+
context,
|
|
3313
|
+
environment
|
|
3314
|
+
};
|
|
3315
|
+
extraDataList.push(extraData), templateContent && (extraData.templateContent = templateContent);
|
|
3307
3316
|
let tagConfig = getTagConfig(environment.config);
|
|
3308
|
-
tagConfig && (
|
|
3317
|
+
tagConfig && (extraData.tagConfig = tagConfig), pluginOptions.title = reduceConfigsMergeContext({
|
|
3309
3318
|
initial: '',
|
|
3310
3319
|
config: config.html.title,
|
|
3311
3320
|
ctx: {
|
|
@@ -3319,7 +3328,7 @@ let getTagConfig = (config)=>{
|
|
|
3319
3328
|
entryName: entryName
|
|
3320
3329
|
}
|
|
3321
3330
|
});
|
|
3322
|
-
favicon && (
|
|
3331
|
+
favicon && (extraData.favicon = favicon);
|
|
3323
3332
|
let finalOptions = reduceConfigsWithContext({
|
|
3324
3333
|
initial: pluginOptions,
|
|
3325
3334
|
config: 'boolean' == typeof config.tools.htmlPlugin ? {} : config.tools.htmlPlugin,
|
|
@@ -3329,15 +3338,12 @@ let getTagConfig = (config)=>{
|
|
|
3329
3338
|
}
|
|
3330
3339
|
});
|
|
3331
3340
|
return finalOptions.template || finalOptions.templateContent || (pluginOptions.template = '', pluginOptions.templateContent = templateContent), finalOptions;
|
|
3332
|
-
}));
|
|
3341
|
+
})), extraDataMap = new WeakMap();
|
|
3333
3342
|
if (entryNames.forEach((entryName, index)=>{
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
]);
|
|
3343
|
+
let pluginInstance = new HtmlPlugin(finalOptions[index]), extraData = extraDataList.find((item)=>item.entryName === entryName);
|
|
3344
|
+
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).use(pluginInstance), extraData && extraDataMap.set(pluginInstance, extraData);
|
|
3337
3345
|
}), chain.plugin('rsbuild-html-plugin').use(RsbuildHtmlPlugin, [
|
|
3338
|
-
|
|
3339
|
-
()=>environment,
|
|
3340
|
-
()=>context
|
|
3346
|
+
(pluginInstance)=>extraDataMap.get(pluginInstance)
|
|
3341
3347
|
]), config.html) {
|
|
3342
3348
|
let { crossorigin } = config.html;
|
|
3343
3349
|
crossorigin && chain.output.crossOriginLoading(!0 === crossorigin ? 'anonymous' : crossorigin);
|
|
@@ -4244,31 +4250,25 @@ let resourceHints_generateLinks = (options, rel)=>options.map((option)=>({
|
|
|
4244
4250
|
}
|
|
4245
4251
|
});
|
|
4246
4252
|
}
|
|
4247
|
-
}),
|
|
4248
|
-
profileSession && profileSession.post('Profiler.stop', (error, param)=>{
|
|
4249
|
-
if (error) return void __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to generate JavaScript CPU profile:', error);
|
|
4250
|
-
__WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.writeFileSync(output, JSON.stringify(param.profile));
|
|
4251
|
-
});
|
|
4252
|
-
}, pluginRspackProfile = ()=>({
|
|
4253
|
+
}), pluginRspackProfile = ()=>({
|
|
4253
4254
|
name: 'rsbuild:rspack-profile',
|
|
4254
4255
|
async setup (api) {
|
|
4255
4256
|
var _process_env_RSPACK_PROFILE;
|
|
4256
|
-
let profileSession;
|
|
4257
4257
|
if ('webpack' === api.context.bundlerType) return;
|
|
4258
4258
|
let RSPACK_PROFILE = null == (_process_env_RSPACK_PROFILE = process.env.RSPACK_PROFILE) ? void 0 : _process_env_RSPACK_PROFILE.toUpperCase();
|
|
4259
4259
|
if (!RSPACK_PROFILE) return;
|
|
4260
|
-
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'),
|
|
4260
|
+
let timestamp = Date.now(), profileDirName = `rspack-profile-${timestamp}`, enableProfileTrace = 'ALL' === RSPACK_PROFILE || RSPACK_PROFILE.includes('TRACE'), onStart = async ()=>{
|
|
4261
4261
|
let profileDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.distPath, profileDirName), traceFilePath = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(profileDir, 'trace.json');
|
|
4262
4262
|
await isFileExists(profileDir) || await __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__.default.promises.mkdir(profileDir, {
|
|
4263
4263
|
recursive: !0
|
|
4264
|
-
}), enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.register('trace', 'chrome', traceFilePath)
|
|
4264
|
+
}), enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.register('trace', 'chrome', traceFilePath);
|
|
4265
4265
|
};
|
|
4266
4266
|
api.onBeforeBuild(({ isFirstCompile })=>{
|
|
4267
4267
|
isFirstCompile && onStart();
|
|
4268
4268
|
}), api.onBeforeStartDevServer(onStart), api.onExit(()=>{
|
|
4269
4269
|
enableProfileTrace && __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.default.experiments.globalTrace.cleanup();
|
|
4270
4270
|
let profileDir = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__.default.join(api.context.distPath, profileDirName);
|
|
4271
|
-
|
|
4271
|
+
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.info(`profile file saved to ${__WEBPACK_EXTERNAL_MODULE__compiled_picocolors_index_js_ea7a20e9__.default.cyan(profileDir)}`);
|
|
4272
4272
|
});
|
|
4273
4273
|
}
|
|
4274
4274
|
}), pluginServer = ()=>({
|
|
@@ -6653,9 +6653,10 @@ async function applyDefaultPlugins(pluginManager, context) {
|
|
|
6653
6653
|
setup (api) {
|
|
6654
6654
|
'webpack' !== api.context.bundlerType && (api.modifyRsbuildConfig((config)=>{
|
|
6655
6655
|
let { moduleFederation } = config;
|
|
6656
|
-
if (
|
|
6657
|
-
var _config_server, _config_dev_client,
|
|
6658
|
-
|
|
6656
|
+
if ((null == moduleFederation ? void 0 : moduleFederation.options) && moduleFederation.options.exposes) {
|
|
6657
|
+
var _userConfig_server, _config_server, _config_dev_client, _userConfig_dev, _config_server1;
|
|
6658
|
+
let userConfig = api.getRsbuildConfig('original');
|
|
6659
|
+
config.dev ||= {}, config.server ||= {}, (null == (_userConfig_server = userConfig.server) ? void 0 : _userConfig_server.cors) === void 0 && (config.server.cors = !0), (null == (_config_server = config.server) ? void 0 : _config_server.port) && !(null == (_config_dev_client = config.dev.client) ? void 0 : _config_dev_client.port) && (config.dev.client ||= {}, config.dev.client.port = config.server.port), (null == (_userConfig_dev = userConfig.dev) ? void 0 : _userConfig_dev.assetPrefix) === void 0 && config.dev.assetPrefix === (null == (_config_server1 = config.server) ? void 0 : _config_server1.base) && (config.dev.assetPrefix = !0);
|
|
6659
6660
|
}
|
|
6660
6661
|
}), api.modifyEnvironmentConfig((config)=>{
|
|
6661
6662
|
var _config_moduleFederation, _config_performance_chunkSplit, _config_performance;
|
|
@@ -6707,6 +6708,7 @@ async function createRsbuild(options = {}) {
|
|
|
6707
6708
|
}
|
|
6708
6709
|
let resolvedOptions = {
|
|
6709
6710
|
cwd: process.cwd(),
|
|
6711
|
+
callerName: 'rsbuild',
|
|
6710
6712
|
...options,
|
|
6711
6713
|
rsbuildConfig: config
|
|
6712
6714
|
}, pluginManager = (plugins = [], {
|
|
@@ -6768,6 +6770,7 @@ async function createRsbuild(options = {}) {
|
|
|
6768
6770
|
'distPath',
|
|
6769
6771
|
'devServer',
|
|
6770
6772
|
'cachePath',
|
|
6773
|
+
'callerName',
|
|
6771
6774
|
'bundlerType'
|
|
6772
6775
|
];
|
|
6773
6776
|
return new Proxy(context, {
|
|
@@ -7362,11 +7365,11 @@ async function runCLI() {
|
|
|
7362
7365
|
}
|
|
7363
7366
|
process.title = 'rsbuild-node';
|
|
7364
7367
|
let { npm_execpath } = process.env;
|
|
7365
|
-
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.
|
|
7368
|
+
(!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) && console.log(), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.greet(` Rsbuild v1.3.18\n`);
|
|
7366
7369
|
try {
|
|
7367
7370
|
!function() {
|
|
7368
7371
|
let cli = cac_dist('rsbuild');
|
|
7369
|
-
cli.help(), cli.version("1.3.
|
|
7372
|
+
cli.help(), cli.version("1.3.18"), applyCommonOptions(cli);
|
|
7370
7373
|
let devCommand = cli.command('', 'starting the dev server').alias('dev'), buildCommand = cli.command('build', 'build the app for production'), previewCommand = cli.command('preview', 'preview the production build locally'), inspectCommand = cli.command('inspect', 'inspect the Rspack and Rsbuild configs');
|
|
7371
7374
|
applyServerOptions(devCommand), applyServerOptions(previewCommand), devCommand.action(async (options)=>{
|
|
7372
7375
|
try {
|
|
@@ -7417,6 +7420,6 @@ async function runCLI() {
|
|
|
7417
7420
|
__WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error('Failed to start Rsbuild CLI.'), __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger.error(err);
|
|
7418
7421
|
}
|
|
7419
7422
|
}
|
|
7420
|
-
let src_version = "1.3.
|
|
7423
|
+
let src_version = "1.3.18";
|
|
7421
7424
|
var __webpack_exports__logger = __WEBPACK_EXTERNAL_MODULE__compiled_rslog_index_js_c302f6e3__.logger, __webpack_exports__rspack = __WEBPACK_EXTERNAL_MODULE__rspack_core_e0096ff7__.rspack;
|
|
7422
|
-
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
|
7425
|
+
export { PLUGIN_CSS_NAME, PLUGIN_SWC_NAME, createRsbuild, defaultAllowedOrigins, defineConfig, ensureAssetPrefix, config_loadConfig as loadConfig, loadEnv, mergeRsbuildConfig, runCLI, src_version as version, __webpack_exports__logger as logger, __webpack_exports__rspack as rspack };
|
package/dist-types/config.d.ts
CHANGED
|
@@ -4,8 +4,18 @@ import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, Plugi
|
|
|
4
4
|
* - localhost
|
|
5
5
|
* - 127.0.0.1
|
|
6
6
|
* - [::1]
|
|
7
|
+
*
|
|
8
|
+
* Can be used in `server.cors.origin` config.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* server: {
|
|
12
|
+
* cors: {
|
|
13
|
+
* origin: [defaultAllowedOrigins, 'https://example.com'],
|
|
14
|
+
* },
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
7
17
|
*/
|
|
8
|
-
export declare const
|
|
18
|
+
export declare const defaultAllowedOrigins: RegExp;
|
|
9
19
|
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
10
20
|
export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
11
21
|
/**
|
package/dist-types/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export type { Rspack };
|
|
|
14
14
|
export { logger } from './logger';
|
|
15
15
|
export { mergeRsbuildConfig } from './mergeConfig';
|
|
16
16
|
export { ensureAssetPrefix } from './helpers';
|
|
17
|
+
export { defaultAllowedOrigins } from './config';
|
|
17
18
|
export { PLUGIN_SWC_NAME, PLUGIN_CSS_NAME } from './constants';
|
|
18
19
|
export type { AppIcon, AppIconItem, AliasStrategy, Build, BuildOptions, BundlerPluginInstance, Charset, ClientConfig, CliShortcut, CleanDistPath, CleanDistPathObject, ConfigChain, ConfigChainWithContext, ConsoleType, CreateCompiler, CreateRsbuildOptions, CrossOrigin, CSSLoaderOptions, CSSModules, CSSModulesLocalsConvention, DataUriLimit, Decorators, DevConfig, DistPathConfig, EnvironmentContext, EnvironmentConfig, FilenameConfig, HistoryApiFallbackContext, HistoryApiFallbackOptions, HtmlConfig, HtmlRspackPlugin, HtmlBasicTag, HtmlFallback, HtmlTagHandler, HtmlTagDescriptor, HtmlTagContext, InspectConfigOptions, InspectConfigResult, InlineChunkConfig, InlineChunkTest, InlineChunkTestFunction, InternalContext, LegalComments, ManifestData, ManifestConfig, ManifestObjectConfig, MetaAttrs, MetaOptions, Minify, ModifyBundlerChainFn, ModifyBundlerChainUtils, ModifyChainUtils, ModifyEnvironmentConfigFn, ModifyEnvironmentConfigUtils, ModifyHTMLContext, ModifyHTMLFn, ModifyHTMLTagsContext, ModifyHTMLTagsFn, ModifyRsbuildConfigUtils, ModifyRspackConfigFn, ModifyRspackConfigUtils, ModifyRsbuildConfigFn, ModifyWebpackChainFn, ModifyWebpackChainUtils, ModifyWebpackConfigFn, ModifyWebpackConfigUtils, ModuleFederationConfig, MergedEnvironmentConfig, NormalizedConfig, NormalizedDevConfig, NormalizedEnvironmentConfig, NormalizedHtmlConfig, NormalizedModuleFederationConfig, NormalizedOutputConfig, NormalizedPerformanceConfig, NormalizedSecurityConfig, NormalizedServerConfig, NormalizedSourceConfig, NormalizedToolsConfig, OnAfterEnvironmentCompileFn, OnBeforeEnvironmentCompileFn, OnCloseBuildFn, OnAfterBuildFn, OnAfterCreateCompilerFn, OnAfterStartDevServerFn, OnAfterStartProdServerFn, OnBeforeBuildFn, OnBeforeCreateCompilerFn, OnBeforeStartDevServerFn, OnBeforeStartProdServerFn, OnCloseDevServerFn, OnDevCompileDoneFn, OnExitFn, OutputConfig, OutputStructure, PerformanceConfig, PluginManager, Polyfill, PostCSSLoaderOptions, PostCSSOptions, PostCSSPlugin, PreviewOptions, PreconnectOption, ProcessAssetsDescriptor, ProcessAssetsHook, ProcessAssetsHandler, ProxyBypass, ProxyConfig, ProxyFilter, ProxyOptions, PrintUrls, PublicDir, PublicDirOptions, ProgressBarConfig, RequestHandler, ResolveHook, ResolveHandler, ResolvedCreateRsbuildOptions, RsbuildConfig, RsbuildContext, RsbuildEntry, RsbuildEntryDescription, RsbuildInstance, RsbuildMode, RsbuildPlugin, RsbuildPluginAPI, RsbuildPlugins, RsbuildProvider, RsbuildProviderHelpers, RsbuildTarget, RspackChain, RspackRule, ResourceHintsIncludeType, StartDevServerOptions, SriOptions, SriAlgorithm, ScriptInject, ScriptLoading, SecurityConfig, SourceMap, SetupMiddlewaresFn, SetupMiddlewaresServer, ServerConfig, SourceConfig, SplitChunks, StyleLoaderOptions, TransformContext, TransformDescriptor, ToolsConfig, TransformHook, TransformHandler, TransformImport, WatchFiles, } from './types';
|
|
19
20
|
export type { ChainIdentifier } from './configChain';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Compiler } from '@rspack/core';
|
|
1
|
+
import type { Compiler, RspackPluginInstance } from '@rspack/core';
|
|
2
2
|
import type { HtmlRspackPlugin, InternalContext } from '../types';
|
|
3
3
|
import type { EnvironmentContext, HtmlTag, HtmlTagDescriptor } from '../types';
|
|
4
4
|
type HtmlTagObject = HtmlRspackPlugin.HtmlTagObject;
|
|
@@ -12,12 +12,14 @@ export declare const FILE_ATTRS: {
|
|
|
12
12
|
link: string;
|
|
13
13
|
script: string;
|
|
14
14
|
};
|
|
15
|
-
export type
|
|
15
|
+
export type HtmlExtraData = {
|
|
16
|
+
entryName: string;
|
|
17
|
+
context: InternalContext;
|
|
18
|
+
environment: EnvironmentContext;
|
|
16
19
|
favicon?: string;
|
|
17
20
|
tagConfig?: TagConfig;
|
|
18
21
|
templateContent?: string;
|
|
19
22
|
};
|
|
20
|
-
export type RsbuildHtmlPluginOptions = Record<string, HtmlInfo>;
|
|
21
23
|
export type AlterAssetTagGroupsData = {
|
|
22
24
|
headTags: HtmlTagObject[];
|
|
23
25
|
bodyTags: HtmlTagObject[];
|
|
@@ -28,10 +30,8 @@ export type AlterAssetTagGroupsData = {
|
|
|
28
30
|
export declare const hasTitle: (html?: string) => boolean;
|
|
29
31
|
export declare class RsbuildHtmlPlugin {
|
|
30
32
|
readonly name: string;
|
|
31
|
-
readonly
|
|
32
|
-
|
|
33
|
-
readonly getContext: () => InternalContext;
|
|
34
|
-
constructor(options: RsbuildHtmlPluginOptions, getEnvironment: () => EnvironmentContext, getContext: () => InternalContext);
|
|
33
|
+
readonly getExtraData: (pluginInstance: RspackPluginInstance) => HtmlExtraData | undefined;
|
|
34
|
+
constructor(getExtraData: (pluginInstance: RspackPluginInstance) => HtmlExtraData | undefined);
|
|
35
35
|
apply(compiler: Compiler): void;
|
|
36
36
|
}
|
|
37
37
|
export {};
|
|
@@ -30,6 +30,14 @@ export type RsbuildContext = {
|
|
|
30
30
|
* The bundler type, can be `rspack` or `webpack`.
|
|
31
31
|
*/
|
|
32
32
|
bundlerType: BundlerType;
|
|
33
|
+
/**
|
|
34
|
+
* The name of the framework or tool that is currently invoking Rsbuild,
|
|
35
|
+
* same as the `callerName` option in the `createRsbuild` method.
|
|
36
|
+
* @example
|
|
37
|
+
* - `rslib` is set when Rslib calls Rsbuild.
|
|
38
|
+
* - `rspress` is set when Rspress calls Rsbuild.
|
|
39
|
+
*/
|
|
40
|
+
callerName: string;
|
|
33
41
|
};
|
|
34
42
|
/** The inner context. */
|
|
35
43
|
export type InternalContext = RsbuildContext & {
|
|
@@ -104,6 +104,13 @@ export type CreateRsbuildOptions = {
|
|
|
104
104
|
* @default process.cwd()
|
|
105
105
|
*/
|
|
106
106
|
cwd?: string;
|
|
107
|
+
/**
|
|
108
|
+
* The name of the framework or tool that is currently invoking Rsbuild.
|
|
109
|
+
* This allows plugins to tailor their behavior based on the calling context.
|
|
110
|
+
* Rsbuild plugins can access this value via `api.context.callerName`.
|
|
111
|
+
* @default 'rsbuild'
|
|
112
|
+
*/
|
|
113
|
+
callerName?: string;
|
|
107
114
|
/**
|
|
108
115
|
* Only build specified environments.
|
|
109
116
|
* For example, passing `['web']` will only build the `web` environment.
|
|
@@ -122,7 +129,7 @@ export type CreateRsbuildOptions = {
|
|
|
122
129
|
*/
|
|
123
130
|
loadEnv?: boolean | LoadEnvOptions;
|
|
124
131
|
};
|
|
125
|
-
export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment'> & {
|
|
132
|
+
export type ResolvedCreateRsbuildOptions = Required<Pick<CreateRsbuildOptions, 'cwd' | 'callerName'>> & Pick<CreateRsbuildOptions, 'loadEnv' | 'environment'> & {
|
|
126
133
|
rsbuildConfig: RsbuildConfig;
|
|
127
134
|
};
|
|
128
135
|
export type CreateDevServer = (options?: CreateDevServerOptions) => Promise<RsbuildDevServer>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.18",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.
|
|
49
|
+
"@rspack/core": "1.3.9",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.42.0",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"deepmerge": "^4.3.1",
|
|
71
71
|
"dotenv": "16.5.0",
|
|
72
72
|
"dotenv-expand": "12.0.2",
|
|
73
|
-
"html-rspack-plugin": "6.
|
|
73
|
+
"html-rspack-plugin": "6.1.2",
|
|
74
74
|
"http-proxy-middleware": "^2.0.9",
|
|
75
75
|
"launch-editor-middleware": "^2.10.0",
|
|
76
76
|
"mrmime": "^2.0.1",
|