@rsbuild/webpack 1.1.3 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{15.cjs → 638.cjs} +67 -96
- package/dist/{238.js → 778.js} +1 -1
- package/dist/997.cjs +1 -0
- package/dist/index.cjs +19 -257
- package/dist/index.js +4 -8
- package/package.json +6 -6
package/dist/{15.cjs → 638.cjs}
RENAMED
|
@@ -1,86 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
let __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
2
3
|
exports.ids = [
|
|
3
|
-
'
|
|
4
|
+
'638'
|
|
4
5
|
], exports.modules = {
|
|
5
|
-
"./src/progress/ProgressPlugin.ts": function(
|
|
6
|
-
__webpack_require__.a(module, async function(__webpack_handle_async_dependencies__, __webpack_async_result__) {
|
|
7
|
-
try {
|
|
8
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
ProgressPlugin: function() {
|
|
10
|
-
return ProgressPlugin;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core"), picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors"), picocolors__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__), webpack__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("webpack"), _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/progress/helpers/index.ts"), _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./src/progress/helpers/nonTty.ts"), __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([
|
|
14
|
-
webpack__WEBPACK_IMPORTED_MODULE_2__
|
|
15
|
-
]);
|
|
16
|
-
function _define_property(obj, key, value) {
|
|
17
|
-
return key in obj ? Object.defineProperty(obj, key, {
|
|
18
|
-
value: value,
|
|
19
|
-
enumerable: !0,
|
|
20
|
-
configurable: !0,
|
|
21
|
-
writable: !0
|
|
22
|
-
}) : obj[key] = value, obj;
|
|
23
|
-
}
|
|
24
|
-
webpack__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
25
|
-
class ProgressPlugin extends webpack__WEBPACK_IMPORTED_MODULE_2__.default.ProgressPlugin {
|
|
26
|
-
apply(compiler) {
|
|
27
|
-
super.apply(compiler);
|
|
28
|
-
let startTime = null;
|
|
29
|
-
compiler.hooks.compile.tap(this.name, ()=>{
|
|
30
|
-
this.compileTime = null, startTime = process.hrtime();
|
|
31
|
-
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
32
|
-
if (startTime) {
|
|
33
|
-
this.hasCompileErrors = stat.hasErrors();
|
|
34
|
-
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
35
|
-
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
36
|
-
let suffix = this.id ? picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(` (${this.id})`) : '';
|
|
37
|
-
_rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.ready(`Built in ${this.compileTime} ${suffix}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
constructor(options){
|
|
43
|
-
let { id = 'Rsbuild' } = options, nonTTYLogger = (0, _helpers_nonTty_js__WEBPACK_IMPORTED_MODULE_4__.y)(), friendlyPercentage = (0, _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$b)();
|
|
44
|
-
super({
|
|
45
|
-
activeModules: !1,
|
|
46
|
-
entries: !0,
|
|
47
|
-
modules: !0,
|
|
48
|
-
modulesCount: 5000,
|
|
49
|
-
profile: !1,
|
|
50
|
-
dependencies: !0,
|
|
51
|
-
dependenciesCount: 10000,
|
|
52
|
-
percentBy: null,
|
|
53
|
-
handler: (originalPercentage, message)=>{
|
|
54
|
-
let percentage = friendlyPercentage(originalPercentage), done = 1 === percentage;
|
|
55
|
-
process.stdout.isTTY ? (_helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$x.update({
|
|
56
|
-
id,
|
|
57
|
-
current: 100 * percentage,
|
|
58
|
-
message,
|
|
59
|
-
done,
|
|
60
|
-
hasErrors: this.hasCompileErrors
|
|
61
|
-
}), _helpers_index_js__WEBPACK_IMPORTED_MODULE_3__.$x.render()) : nonTTYLogger.log({
|
|
62
|
-
id,
|
|
63
|
-
done,
|
|
64
|
-
current: 100 * percentage,
|
|
65
|
-
hasErrors: this.hasCompileErrors,
|
|
66
|
-
compileTime: this.compileTime
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}), _define_property(this, "name", 'ProgressPlugin'), _define_property(this, "id", void 0), _define_property(this, "hasCompileErrors", !1), _define_property(this, "compileTime", null), _define_property(this, "prettyTime", void 0), this.id = id, this.prettyTime = options.prettyTime;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
__webpack_async_result__();
|
|
73
|
-
} catch (e) {
|
|
74
|
-
__webpack_async_result__(e);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
},
|
|
78
|
-
"./src/progress/helpers/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6
|
+
"./src/progress/ProgressPlugin.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
79
7
|
__webpack_require__.d(__webpack_exports__, {
|
|
80
|
-
|
|
81
|
-
$b: ()=>createFriendlyPercentage
|
|
8
|
+
ProgressPlugin: ()=>ProgressPlugin
|
|
82
9
|
});
|
|
83
|
-
var external_node_console_ = __webpack_require__("node:console"), cli_truncate = __webpack_require__("../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"), cli_truncate_default = __webpack_require__.n(cli_truncate), build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"), build_default = __webpack_require__.n(build)
|
|
10
|
+
var core_ = __webpack_require__("@rsbuild/core"), external_picocolors_ = __webpack_require__("picocolors"), external_picocolors_default = __webpack_require__.n(external_picocolors_), external_webpack_ = __webpack_require__("webpack?d8b0"), external_webpack_default = __webpack_require__.n(external_webpack_), external_node_console_ = __webpack_require__("node:console"), cli_truncate = __webpack_require__("../../../node_modules/.pnpm/cli-truncate@2.1.0/node_modules/cli-truncate/index.js"), cli_truncate_default = __webpack_require__.n(cli_truncate), build = __webpack_require__("../../../node_modules/.pnpm/patch-console@1.0.0/node_modules/patch-console/build/index.js"), build_default = __webpack_require__.n(build);
|
|
84
11
|
let clamp = (x, min, max)=>Math.min(max, Math.max(min, x)), defaultOption = {
|
|
85
12
|
total: 100,
|
|
86
13
|
current: 0,
|
|
@@ -223,25 +150,69 @@ exports.ids = [
|
|
|
223
150
|
return prevPercentage = percentage, percentage;
|
|
224
151
|
};
|
|
225
152
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
153
|
+
function ProgressPlugin_define_property(obj, key, value) {
|
|
154
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
155
|
+
value: value,
|
|
156
|
+
enumerable: !0,
|
|
157
|
+
configurable: !0,
|
|
158
|
+
writable: !0
|
|
159
|
+
}) : obj[key] = value, obj;
|
|
160
|
+
}
|
|
161
|
+
class ProgressPlugin extends external_webpack_default().ProgressPlugin {
|
|
162
|
+
apply(compiler) {
|
|
163
|
+
super.apply(compiler);
|
|
164
|
+
let startTime = null;
|
|
165
|
+
compiler.hooks.compile.tap(this.name, ()=>{
|
|
166
|
+
this.compileTime = null, startTime = process.hrtime();
|
|
167
|
+
}), compiler.hooks.done.tap(this.name, (stat)=>{
|
|
168
|
+
if (startTime) {
|
|
169
|
+
this.hasCompileErrors = stat.hasErrors();
|
|
170
|
+
let hrtime = process.hrtime(startTime), seconds = hrtime[0] + hrtime[1] / 1e9;
|
|
171
|
+
if (this.compileTime = this.prettyTime(seconds), startTime = null, !this.hasCompileErrors) {
|
|
172
|
+
let suffix = this.id ? external_picocolors_default().gray(` (${this.id})`) : '';
|
|
173
|
+
core_.logger.ready(`Built in ${this.compileTime} ${suffix}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
constructor(options){
|
|
179
|
+
let prevPercentage, { id = 'Rsbuild' } = options;
|
|
180
|
+
let nonTTYLogger = (prevPercentage = 0, {
|
|
181
|
+
log: ({ id, done, current, hasErrors, compileTime })=>{
|
|
182
|
+
let suffix = external_picocolors_default().gray(`(${id})`);
|
|
183
|
+
if (done) {
|
|
184
|
+
if (100 === prevPercentage) return;
|
|
185
|
+
prevPercentage = 100, hasErrors ? core_.logger.error(`Built failed in ${compileTime} ${suffix}`) : core_.logger.ready(`Built in ${compileTime} ${suffix}`);
|
|
186
|
+
} else current - prevPercentage > 10 && (prevPercentage = current, core_.logger.info(`Build progress: ${current.toFixed(0)}% ${suffix}`));
|
|
187
|
+
}
|
|
188
|
+
}), friendlyPercentage = createFriendlyPercentage();
|
|
189
|
+
super({
|
|
190
|
+
activeModules: !1,
|
|
191
|
+
entries: !0,
|
|
192
|
+
modules: !0,
|
|
193
|
+
modulesCount: 5000,
|
|
194
|
+
profile: !1,
|
|
195
|
+
dependencies: !0,
|
|
196
|
+
dependenciesCount: 10000,
|
|
197
|
+
percentBy: null,
|
|
198
|
+
handler: (originalPercentage, message)=>{
|
|
199
|
+
let percentage = friendlyPercentage(originalPercentage), done = 1 === percentage;
|
|
200
|
+
process.stdout.isTTY ? (bus.update({
|
|
201
|
+
id,
|
|
202
|
+
current: 100 * percentage,
|
|
203
|
+
message,
|
|
204
|
+
done,
|
|
205
|
+
hasErrors: this.hasCompileErrors
|
|
206
|
+
}), bus.render()) : nonTTYLogger.log({
|
|
207
|
+
id,
|
|
208
|
+
done,
|
|
209
|
+
current: 100 * percentage,
|
|
210
|
+
hasErrors: this.hasCompileErrors,
|
|
211
|
+
compileTime: this.compileTime
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
}), ProgressPlugin_define_property(this, "name", 'ProgressPlugin'), ProgressPlugin_define_property(this, "id", void 0), ProgressPlugin_define_property(this, "hasCompileErrors", !1), ProgressPlugin_define_property(this, "compileTime", null), ProgressPlugin_define_property(this, "prettyTime", void 0), this.id = id, this.prettyTime = options.prettyTime;
|
|
231
215
|
}
|
|
232
|
-
});
|
|
233
|
-
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("@rsbuild/core"), picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("picocolors"), picocolors__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
|
|
234
|
-
function createNonTTYLogger() {
|
|
235
|
-
let prevPercentage = 0;
|
|
236
|
-
return {
|
|
237
|
-
log: ({ id, done, current, hasErrors, compileTime })=>{
|
|
238
|
-
let suffix = picocolors__WEBPACK_IMPORTED_MODULE_1___default().gray(`(${id})`);
|
|
239
|
-
if (done) {
|
|
240
|
-
if (100 === prevPercentage) return;
|
|
241
|
-
prevPercentage = 100, hasErrors ? _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.error(`Built failed in ${compileTime} ${suffix}`) : _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.ready(`Built in ${compileTime} ${suffix}`);
|
|
242
|
-
} else current - prevPercentage > 10 && (prevPercentage = current, _rsbuild_core__WEBPACK_IMPORTED_MODULE_0__.logger.info(`Build progress: ${current.toFixed(0)}% ${suffix}`));
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
216
|
}
|
|
246
217
|
}
|
|
247
218
|
};
|
package/dist/{238.js → 778.js}
RENAMED
package/dist/997.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
let __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
1
2
|
exports.ids = [
|
|
2
3
|
'997'
|
|
3
4
|
], exports.modules = {
|
package/dist/index.cjs
CHANGED
|
@@ -1,201 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
let __rslib_import_meta_url__ = 'undefined' == typeof document ? new (require('url'.replace('', ''))).URL('file:' + __filename).href : document.currentScript && document.currentScript.src || new URL('main.js', document.baseURI).href;
|
|
2
3
|
var __webpack_modules__ = {
|
|
3
|
-
"../../../node_modules/.pnpm/webpack@5.96.1/node_modules/webpack/lib/MultiStats.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
4
|
-
let identifierUtils = __webpack_require__("../../../node_modules/.pnpm/webpack@5.96.1/node_modules/webpack/lib/util/identifier.js"), indent = (str, prefix)=>{
|
|
5
|
-
let rem = str.replace(/\n([^\n])/g, `\n${prefix}$1`);
|
|
6
|
-
return prefix + rem;
|
|
7
|
-
};
|
|
8
|
-
module.exports = class MultiStats {
|
|
9
|
-
constructor(stats){
|
|
10
|
-
this.stats = stats;
|
|
11
|
-
}
|
|
12
|
-
get hash() {
|
|
13
|
-
return this.stats.map((stat)=>stat.hash).join("");
|
|
14
|
-
}
|
|
15
|
-
hasErrors() {
|
|
16
|
-
return this.stats.some((stat)=>stat.hasErrors());
|
|
17
|
-
}
|
|
18
|
-
hasWarnings() {
|
|
19
|
-
return this.stats.some((stat)=>stat.hasWarnings());
|
|
20
|
-
}
|
|
21
|
-
_createChildOptions(options, context) {
|
|
22
|
-
let getCreateStatsOptions = ()=>{
|
|
23
|
-
!options && (options = {});
|
|
24
|
-
let { children: childrenOptions, ...baseOptions } = "string" == typeof options ? {
|
|
25
|
-
preset: options
|
|
26
|
-
} : options;
|
|
27
|
-
return {
|
|
28
|
-
childrenOptions,
|
|
29
|
-
baseOptions
|
|
30
|
-
};
|
|
31
|
-
}, children = this.stats.map((stat, idx)=>{
|
|
32
|
-
if ("boolean" == typeof options) return stat.compilation.createStatsOptions(options, context);
|
|
33
|
-
let { childrenOptions, baseOptions } = getCreateStatsOptions(), childOptions = Array.isArray(childrenOptions) ? childrenOptions[idx] : childrenOptions;
|
|
34
|
-
return stat.compilation.createStatsOptions({
|
|
35
|
-
...baseOptions,
|
|
36
|
-
..."string" == typeof childOptions ? {
|
|
37
|
-
preset: childOptions
|
|
38
|
-
} : childOptions && "object" == typeof childOptions ? childOptions : void 0
|
|
39
|
-
}, context);
|
|
40
|
-
});
|
|
41
|
-
return {
|
|
42
|
-
version: children.every((o)=>o.version),
|
|
43
|
-
hash: children.every((o)=>o.hash),
|
|
44
|
-
errorsCount: children.every((o)=>o.errorsCount),
|
|
45
|
-
warningsCount: children.every((o)=>o.warningsCount),
|
|
46
|
-
errors: children.every((o)=>o.errors),
|
|
47
|
-
warnings: children.every((o)=>o.warnings),
|
|
48
|
-
children
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
toJson(options) {
|
|
52
|
-
let childOptions = this._createChildOptions(options, {
|
|
53
|
-
forToString: !1
|
|
54
|
-
}), obj = {};
|
|
55
|
-
obj.children = this.stats.map((stat, idx)=>{
|
|
56
|
-
let obj = stat.toJson(childOptions.children[idx]), compilationName = stat.compilation.name, name = compilationName && identifierUtils.makePathsRelative(stat.compilation.compiler.context, compilationName, stat.compilation.compiler.root);
|
|
57
|
-
return obj.name = name, obj;
|
|
58
|
-
}), childOptions.version && (obj.version = obj.children[0].version), childOptions.hash && (obj.hash = obj.children.map((j)=>j.hash).join(""));
|
|
59
|
-
let mapError = (j, obj)=>({
|
|
60
|
-
...obj,
|
|
61
|
-
compilerPath: obj.compilerPath ? `${j.name}.${obj.compilerPath}` : j.name
|
|
62
|
-
});
|
|
63
|
-
if (childOptions.errors) for (let j of (obj.errors = [], obj.children))for (let i of j.errors)obj.errors.push(mapError(j, i));
|
|
64
|
-
if (childOptions.warnings) for (let j of (obj.warnings = [], obj.children))for (let i of j.warnings)obj.warnings.push(mapError(j, i));
|
|
65
|
-
if (childOptions.errorsCount) for (let j of (obj.errorsCount = 0, obj.children))obj.errorsCount += j.errorsCount;
|
|
66
|
-
if (childOptions.warningsCount) for (let j of (obj.warningsCount = 0, obj.children))obj.warningsCount += j.warningsCount;
|
|
67
|
-
return obj;
|
|
68
|
-
}
|
|
69
|
-
toString(options) {
|
|
70
|
-
let childOptions = this._createChildOptions(options, {
|
|
71
|
-
forToString: !0
|
|
72
|
-
});
|
|
73
|
-
return this.stats.map((stat, idx)=>{
|
|
74
|
-
let str = stat.toString(childOptions.children[idx]), compilationName = stat.compilation.name, name = compilationName && identifierUtils.makePathsRelative(stat.compilation.compiler.context, compilationName, stat.compilation.compiler.root).replace(/\|/g, " ");
|
|
75
|
-
return str ? name ? `${name}:\n${indent(str, " ")}` : str : str;
|
|
76
|
-
}).filter(Boolean).join("\n\n");
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
},
|
|
80
|
-
"../../../node_modules/.pnpm/webpack@5.96.1/node_modules/webpack/lib/util/identifier.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
81
|
-
let path = __webpack_require__("path"), WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/, SEGMENTS_SPLIT_REGEXP = /([|!])/, WINDOWS_PATH_SEPARATOR_REGEXP = /\\/g, relativePathToRequest = (relativePath)=>"" === relativePath ? "./." : ".." === relativePath ? "../." : relativePath.startsWith("../") ? relativePath : `./${relativePath}`, absoluteToRequest = (context, maybeAbsolutePath)=>{
|
|
82
|
-
if ("/" === maybeAbsolutePath[0]) {
|
|
83
|
-
if (maybeAbsolutePath.length > 1 && "/" === maybeAbsolutePath[maybeAbsolutePath.length - 1]) return maybeAbsolutePath;
|
|
84
|
-
let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
85
|
-
return resource = relativePathToRequest(path.posix.relative(context, resource)), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
86
|
-
}
|
|
87
|
-
if (WINDOWS_ABS_PATH_REGEXP.test(maybeAbsolutePath)) {
|
|
88
|
-
let querySplitPos = maybeAbsolutePath.indexOf("?"), resource = -1 === querySplitPos ? maybeAbsolutePath : maybeAbsolutePath.slice(0, querySplitPos);
|
|
89
|
-
return resource = path.win32.relative(context, resource), !WINDOWS_ABS_PATH_REGEXP.test(resource) && (resource = relativePathToRequest(resource.replace(WINDOWS_PATH_SEPARATOR_REGEXP, "/"))), -1 === querySplitPos ? resource : resource + maybeAbsolutePath.slice(querySplitPos);
|
|
90
|
-
}
|
|
91
|
-
return maybeAbsolutePath;
|
|
92
|
-
}, requestToAbsolute = (context, relativePath)=>relativePath.startsWith("./") || relativePath.startsWith("../") ? path.join(context, relativePath) : relativePath, makeCacheable = (realFn)=>{
|
|
93
|
-
let cache = new WeakMap(), getCache = (associatedObjectForCache)=>{
|
|
94
|
-
let entry = cache.get(associatedObjectForCache);
|
|
95
|
-
if (void 0 !== entry) return entry;
|
|
96
|
-
let map = new Map();
|
|
97
|
-
return cache.set(associatedObjectForCache, map), map;
|
|
98
|
-
}, fn = (str, associatedObjectForCache)=>{
|
|
99
|
-
if (!associatedObjectForCache) return realFn(str);
|
|
100
|
-
let cache = getCache(associatedObjectForCache), entry = cache.get(str);
|
|
101
|
-
if (void 0 !== entry) return entry;
|
|
102
|
-
let result = realFn(str);
|
|
103
|
-
return cache.set(str, result), result;
|
|
104
|
-
};
|
|
105
|
-
return fn.bindCache = (associatedObjectForCache)=>{
|
|
106
|
-
let cache = getCache(associatedObjectForCache);
|
|
107
|
-
return (str)=>{
|
|
108
|
-
let entry = cache.get(str);
|
|
109
|
-
if (void 0 !== entry) return entry;
|
|
110
|
-
let result = realFn(str);
|
|
111
|
-
return cache.set(str, result), result;
|
|
112
|
-
};
|
|
113
|
-
}, fn;
|
|
114
|
-
}, makeCacheableWithContext = (fn)=>{
|
|
115
|
-
let cache = new WeakMap(), cachedFn = (context, identifier, associatedObjectForCache)=>{
|
|
116
|
-
let cachedResult;
|
|
117
|
-
if (!associatedObjectForCache) return fn(context, identifier);
|
|
118
|
-
let innerCache = cache.get(associatedObjectForCache);
|
|
119
|
-
void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache));
|
|
120
|
-
let innerSubCache = innerCache.get(context);
|
|
121
|
-
if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
|
|
122
|
-
let result = fn(context, identifier);
|
|
123
|
-
return innerSubCache.set(identifier, result), result;
|
|
124
|
-
};
|
|
125
|
-
return cachedFn.bindCache = (associatedObjectForCache)=>{
|
|
126
|
-
let innerCache;
|
|
127
|
-
return associatedObjectForCache ? void 0 === (innerCache = cache.get(associatedObjectForCache)) && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)) : innerCache = new Map(), (context, identifier)=>{
|
|
128
|
-
let cachedResult;
|
|
129
|
-
let innerSubCache = innerCache.get(context);
|
|
130
|
-
if (void 0 === innerSubCache ? innerCache.set(context, innerSubCache = new Map()) : cachedResult = innerSubCache.get(identifier), void 0 !== cachedResult) return cachedResult;
|
|
131
|
-
let result = fn(context, identifier);
|
|
132
|
-
return innerSubCache.set(identifier, result), result;
|
|
133
|
-
};
|
|
134
|
-
}, cachedFn.bindContextCache = (context, associatedObjectForCache)=>{
|
|
135
|
-
let innerSubCache;
|
|
136
|
-
if (associatedObjectForCache) {
|
|
137
|
-
let innerCache = cache.get(associatedObjectForCache);
|
|
138
|
-
void 0 === innerCache && (innerCache = new Map(), cache.set(associatedObjectForCache, innerCache)), void 0 === (innerSubCache = innerCache.get(context)) && innerCache.set(context, innerSubCache = new Map());
|
|
139
|
-
} else innerSubCache = new Map();
|
|
140
|
-
return (identifier)=>{
|
|
141
|
-
let cachedResult = innerSubCache.get(identifier);
|
|
142
|
-
if (void 0 !== cachedResult) return cachedResult;
|
|
143
|
-
let result = fn(context, identifier);
|
|
144
|
-
return innerSubCache.set(identifier, result), result;
|
|
145
|
-
};
|
|
146
|
-
}, cachedFn;
|
|
147
|
-
};
|
|
148
|
-
module.exports.makePathsRelative = makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>absoluteToRequest(context, str)).join(""));
|
|
149
|
-
module.exports.makePathsAbsolute = makeCacheableWithContext((context, identifier)=>identifier.split(SEGMENTS_SPLIT_REGEXP).map((str)=>requestToAbsolute(context, str)).join(""));
|
|
150
|
-
let contextify = makeCacheableWithContext((context, request)=>request.split("!").map((r)=>absoluteToRequest(context, r)).join("!"));
|
|
151
|
-
module.exports.contextify = contextify;
|
|
152
|
-
let absolutify = makeCacheableWithContext((context, request)=>request.split("!").map((r)=>requestToAbsolute(context, r)).join("!"));
|
|
153
|
-
module.exports.absolutify = absolutify;
|
|
154
|
-
let PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/, PATH_QUERY_REGEXP = /^((?:\0.|[^?\0])*)(\?.*)?$/;
|
|
155
|
-
module.exports.parseResource = makeCacheable((str)=>{
|
|
156
|
-
let match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
|
|
157
|
-
return {
|
|
158
|
-
resource: str,
|
|
159
|
-
path: match[1].replace(/\0(.)/g, "$1"),
|
|
160
|
-
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "",
|
|
161
|
-
fragment: match[3] || ""
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
|
-
module.exports.parseResourceWithoutFragment = makeCacheable((str)=>{
|
|
165
|
-
let match = PATH_QUERY_REGEXP.exec(str);
|
|
166
|
-
return {
|
|
167
|
-
resource: str,
|
|
168
|
-
path: match[1].replace(/\0(.)/g, "$1"),
|
|
169
|
-
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : ""
|
|
170
|
-
};
|
|
171
|
-
}), module.exports.getUndoPath = (filename, outputPath, enforceRelative)=>{
|
|
172
|
-
let depth = -1, append = "";
|
|
173
|
-
for (let part of (outputPath = outputPath.replace(/[\\/]$/, ""), filename.split(/[/\\]+/)))if (".." === part) {
|
|
174
|
-
if (depth > -1) depth--;
|
|
175
|
-
else {
|
|
176
|
-
let i = outputPath.lastIndexOf("/"), j = outputPath.lastIndexOf("\\"), pos = i < 0 ? j : j < 0 ? i : Math.max(i, j);
|
|
177
|
-
if (pos < 0) return `${outputPath}/`;
|
|
178
|
-
append = `${outputPath.slice(pos + 1)}/${append}`, outputPath = outputPath.slice(0, pos);
|
|
179
|
-
}
|
|
180
|
-
} else "." !== part && depth++;
|
|
181
|
-
return depth > 0 ? `${"../".repeat(depth)}${append}` : enforceRelative ? `./${append}` : append;
|
|
182
|
-
};
|
|
183
|
-
},
|
|
184
4
|
"@rsbuild/core": function(module) {
|
|
185
5
|
module.exports = require("@rsbuild/core");
|
|
186
6
|
},
|
|
187
7
|
"node:console": function(module) {
|
|
188
8
|
module.exports = require("node:console");
|
|
189
9
|
},
|
|
190
|
-
path: function(module) {
|
|
191
|
-
module.exports = require("path");
|
|
192
|
-
},
|
|
193
10
|
picocolors: function(module) {
|
|
194
11
|
module.exports = require("picocolors");
|
|
195
12
|
},
|
|
196
13
|
stream: function(module) {
|
|
197
14
|
module.exports = require("stream");
|
|
198
15
|
},
|
|
16
|
+
"webpack?d8b0": function(module) {
|
|
17
|
+
module.exports = require("webpack");
|
|
18
|
+
},
|
|
199
19
|
"copy-webpack-plugin": function(module) {
|
|
200
20
|
module.exports = import("copy-webpack-plugin");
|
|
201
21
|
},
|
|
@@ -205,7 +25,7 @@ var __webpack_modules__ = {
|
|
|
205
25
|
"tsconfig-paths-webpack-plugin": function(module) {
|
|
206
26
|
module.exports = import("tsconfig-paths-webpack-plugin");
|
|
207
27
|
},
|
|
208
|
-
webpack: function(module) {
|
|
28
|
+
"webpack?7ba0": function(module) {
|
|
209
29
|
module.exports = import("webpack");
|
|
210
30
|
}
|
|
211
31
|
}, __webpack_module_cache__ = {};
|
|
@@ -219,63 +39,7 @@ function __webpack_require__(moduleId) {
|
|
|
219
39
|
};
|
|
220
40
|
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.loaded = !0, module.exports;
|
|
221
41
|
}
|
|
222
|
-
__webpack_require__.m = __webpack_modules__, (
|
|
223
|
-
var webpackQueues = "function" == typeof Symbol ? Symbol("webpack queues") : "__webpack_queues__", webpackExports = "function" == typeof Symbol ? Symbol("webpack exports") : "__webpack_exports__", webpackError = "function" == typeof Symbol ? Symbol("webpack error") : "__webpack_error__", resolveQueue = function(queue) {
|
|
224
|
-
queue && queue.d < 1 && (queue.d = 1, queue.forEach(function(fn) {
|
|
225
|
-
fn.r--;
|
|
226
|
-
}), queue.forEach(function(fn) {
|
|
227
|
-
fn.r-- ? fn.r++ : fn();
|
|
228
|
-
}));
|
|
229
|
-
};
|
|
230
|
-
__webpack_require__.a = function(module, body, hasAwait) {
|
|
231
|
-
hasAwait && ((queue = []).d = -1);
|
|
232
|
-
var queue, currentDeps, outerResolve, reject, depQueues = new Set(), exports1 = module.exports, promise = new Promise(function(resolve, rej) {
|
|
233
|
-
reject = rej, outerResolve = resolve;
|
|
234
|
-
});
|
|
235
|
-
promise[webpackExports] = exports1, promise[webpackQueues] = function(fn) {
|
|
236
|
-
queue && fn(queue), depQueues.forEach(fn), promise.catch(function() {});
|
|
237
|
-
}, module.exports = promise, body(function(deps) {
|
|
238
|
-
currentDeps = deps.map(function(dep) {
|
|
239
|
-
if (null !== dep && "object" == typeof dep) {
|
|
240
|
-
if (dep[webpackQueues]) return dep;
|
|
241
|
-
if (dep.then) {
|
|
242
|
-
var queue = [];
|
|
243
|
-
queue.d = 0, dep.then(function(r) {
|
|
244
|
-
obj[webpackExports] = r, resolveQueue(queue);
|
|
245
|
-
}, function(e) {
|
|
246
|
-
obj[webpackError] = e, resolveQueue(queue);
|
|
247
|
-
});
|
|
248
|
-
var obj = {};
|
|
249
|
-
return obj[webpackQueues] = function(fn) {
|
|
250
|
-
fn(queue);
|
|
251
|
-
}, obj;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
var ret = {};
|
|
255
|
-
return ret[webpackQueues] = function() {}, ret[webpackExports] = dep, ret;
|
|
256
|
-
});
|
|
257
|
-
var fn, getResult = function() {
|
|
258
|
-
return currentDeps.map(function(d) {
|
|
259
|
-
if (d[webpackError]) throw d[webpackError];
|
|
260
|
-
return d[webpackExports];
|
|
261
|
-
});
|
|
262
|
-
}, promise = new Promise(function(resolve) {
|
|
263
|
-
(fn = function() {
|
|
264
|
-
resolve(getResult);
|
|
265
|
-
}).r = 0;
|
|
266
|
-
var fnQueue = function(q) {
|
|
267
|
-
q === queue || depQueues.has(q) || (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn)));
|
|
268
|
-
};
|
|
269
|
-
currentDeps.map(function(dep) {
|
|
270
|
-
dep[webpackQueues](fnQueue);
|
|
271
|
-
});
|
|
272
|
-
});
|
|
273
|
-
return fn.r ? promise : getResult();
|
|
274
|
-
}, function(err) {
|
|
275
|
-
err ? reject(promise[webpackError] = err) : outerResolve(exports1), resolveQueue(queue);
|
|
276
|
-
}), queue && queue.d < 0 && (queue.d = 0);
|
|
277
|
-
};
|
|
278
|
-
})(), __webpack_require__.n = function(module) {
|
|
42
|
+
__webpack_require__.m = __webpack_modules__, __webpack_require__.n = function(module) {
|
|
279
43
|
var getter = module && module.__esModule ? function() {
|
|
280
44
|
return module.default;
|
|
281
45
|
} : function() {
|
|
@@ -322,7 +86,9 @@ var __webpack_exports__ = {};
|
|
|
322
86
|
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, {
|
|
323
87
|
webpackProvider: ()=>webpackProvider
|
|
324
88
|
});
|
|
325
|
-
var core_ = __webpack_require__("@rsbuild/core")
|
|
89
|
+
var core_ = __webpack_require__("@rsbuild/core");
|
|
90
|
+
let MultiStats_js_namespaceObject = require("webpack/lib/MultiStats.js");
|
|
91
|
+
var MultiStats_js_default = __webpack_require__.n(MultiStats_js_namespaceObject);
|
|
326
92
|
let external_node_path_namespaceObject = require("node:path"), getInspectOutputPath = (context, inspectOptions)=>{
|
|
327
93
|
if (inspectOptions.outputPath) return (0, external_node_path_namespaceObject.isAbsolute)(inspectOptions.outputPath) ? inspectOptions.outputPath : (0, external_node_path_namespaceObject.join)(context.distPath, inspectOptions.outputPath);
|
|
328
94
|
return (0, external_node_path_namespaceObject.join)(context.distPath, '.rsbuild');
|
|
@@ -395,7 +161,7 @@ async function modifyWebpackConfig(context, webpackConfig, utils) {
|
|
|
395
161
|
})), core_.logger.debug('modify webpack config done'), modifiedConfig;
|
|
396
162
|
}
|
|
397
163
|
async function getChainUtils(target, environment, helpers) {
|
|
398
|
-
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack"));
|
|
164
|
+
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?7ba0"));
|
|
399
165
|
return {
|
|
400
166
|
...helpers.getChainUtils(target, environment),
|
|
401
167
|
name: ({
|
|
@@ -408,7 +174,7 @@ async function getChainUtils(target, environment, helpers) {
|
|
|
408
174
|
};
|
|
409
175
|
}
|
|
410
176
|
async function generateWebpackConfig({ target, context, environment, helpers }) {
|
|
411
|
-
let chainUtils = await getChainUtils(target, context.environments[environment], helpers), { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack")), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, HotModuleReplacementPlugin } = webpack, bundlerChain = await helpers.modifyBundlerChain(context, {
|
|
177
|
+
let chainUtils = await getChainUtils(target, context.environments[environment], helpers), { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?7ba0")), { BannerPlugin, DefinePlugin, IgnorePlugin, ProvidePlugin, HotModuleReplacementPlugin } = webpack, bundlerChain = await helpers.modifyBundlerChain(context, {
|
|
412
178
|
...chainUtils,
|
|
413
179
|
bundler: {
|
|
414
180
|
BannerPlugin,
|
|
@@ -460,7 +226,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
460
226
|
bundlerConfigs: webpackConfigs,
|
|
461
227
|
environments: context.environments
|
|
462
228
|
});
|
|
463
|
-
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack")), compiler = webpack(1 === webpackConfigs.length ? webpackConfigs[0] : webpackConfigs), done = (stats)=>{
|
|
229
|
+
let { default: webpack } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "webpack?7ba0")), compiler = webpack(1 === webpackConfigs.length ? webpackConfigs[0] : webpackConfigs), done = (stats)=>{
|
|
464
230
|
let statsOptions = helpers.getStatsOptions(compiler), statsJson = stats.toJson({
|
|
465
231
|
moduleTrace: !0,
|
|
466
232
|
children: !0,
|
|
@@ -475,7 +241,7 @@ async function createCompiler_createCompiler(options) {
|
|
|
475
241
|
compiler,
|
|
476
242
|
context,
|
|
477
243
|
bundlerConfigs: webpackConfigs,
|
|
478
|
-
MultiStatsCtor:
|
|
244
|
+
MultiStatsCtor: MultiStats_js_default()
|
|
479
245
|
}), await context.hooks.onAfterCreateCompiler.call({
|
|
480
246
|
compiler,
|
|
481
247
|
environments: context.environments
|
|
@@ -497,7 +263,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
497
263
|
bundlerConfigs: bundlerConfigs,
|
|
498
264
|
compiler,
|
|
499
265
|
isWatch: !!watch,
|
|
500
|
-
MultiStatsCtor:
|
|
266
|
+
MultiStatsCtor: MultiStats_js_default()
|
|
501
267
|
}), watch) return compiler.watch({}, (err)=>{
|
|
502
268
|
err && core_.logger.error(err);
|
|
503
269
|
}), {
|
|
@@ -518,11 +284,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
518
284
|
});
|
|
519
285
|
return {
|
|
520
286
|
stats,
|
|
521
|
-
close:
|
|
522
|
-
compiler.close(()=>{
|
|
523
|
-
resolve();
|
|
524
|
-
});
|
|
525
|
-
})
|
|
287
|
+
close: async ()=>{}
|
|
526
288
|
};
|
|
527
289
|
}, external_node_fs_namespaceObject = require("node:fs");
|
|
528
290
|
var external_node_fs_default = __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -553,8 +315,8 @@ let getMainFields = (chain, target)=>{
|
|
|
553
315
|
name: 'rsbuild-webpack:adaptor',
|
|
554
316
|
setup (api) {
|
|
555
317
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
556
|
-
let { config, tsconfigPath } = environment;
|
|
557
|
-
tsconfigPath && 'prefer-tsconfig' ===
|
|
318
|
+
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
319
|
+
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
558
320
|
chain,
|
|
559
321
|
CHAIN_ID,
|
|
560
322
|
configFile: tsconfigPath,
|
|
@@ -565,7 +327,7 @@ let getMainFields = (chain, target)=>{
|
|
|
565
327
|
if (progress) {
|
|
566
328
|
let { ProgressPlugin } = await Promise.all([
|
|
567
329
|
__webpack_require__.e("997"),
|
|
568
|
-
__webpack_require__.e("
|
|
330
|
+
__webpack_require__.e("638")
|
|
569
331
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
570
332
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
571
333
|
{
|
|
@@ -651,7 +413,7 @@ let getMainFields = (chain, target)=>{
|
|
|
651
413
|
};
|
|
652
414
|
};
|
|
653
415
|
var __webpack_export_target__ = exports;
|
|
654
|
-
for(var
|
|
416
|
+
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
655
417
|
__webpack_exports__.__esModule && Object.defineProperty(__webpack_export_target__, '__esModule', {
|
|
656
418
|
value: !0
|
|
657
419
|
});
|
package/dist/index.js
CHANGED
|
@@ -279,11 +279,7 @@ let build = async (initOptions, { watch, compiler: customCompiler } = {})=>{
|
|
|
279
279
|
});
|
|
280
280
|
return {
|
|
281
281
|
stats,
|
|
282
|
-
close:
|
|
283
|
-
compiler.close(()=>{
|
|
284
|
-
resolve();
|
|
285
|
-
});
|
|
286
|
-
})
|
|
282
|
+
close: async ()=>{}
|
|
287
283
|
};
|
|
288
284
|
};
|
|
289
285
|
async function applyTsConfigPathsPlugin({ chain, CHAIN_ID, mainFields, extensions, configFile }) {
|
|
@@ -312,8 +308,8 @@ let getMainFields = (chain, target)=>{
|
|
|
312
308
|
name: 'rsbuild-webpack:adaptor',
|
|
313
309
|
setup (api) {
|
|
314
310
|
api.modifyBundlerChain(async (chain, { CHAIN_ID, environment, target })=>{
|
|
315
|
-
let { config, tsconfigPath } = environment;
|
|
316
|
-
tsconfigPath && 'prefer-tsconfig' ===
|
|
311
|
+
let { config, tsconfigPath } = environment, aliasStrategy = config.source.aliasStrategy ?? config.resolve.aliasStrategy;
|
|
312
|
+
tsconfigPath && 'prefer-tsconfig' === aliasStrategy && await applyTsConfigPathsPlugin({
|
|
317
313
|
chain,
|
|
318
314
|
CHAIN_ID,
|
|
319
315
|
configFile: tsconfigPath,
|
|
@@ -324,7 +320,7 @@ let getMainFields = (chain, target)=>{
|
|
|
324
320
|
if (progress) {
|
|
325
321
|
let { ProgressPlugin } = await Promise.all([
|
|
326
322
|
__webpack_require__.e("997"),
|
|
327
|
-
__webpack_require__.e("
|
|
323
|
+
__webpack_require__.e("778")
|
|
328
324
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/progress/ProgressPlugin.ts"));
|
|
329
325
|
chain.plugin(CHAIN_ID.PLUGIN.PROGRESS).use(ProgressPlugin, [
|
|
330
326
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/webpack",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"homepage": "https://rsbuild.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,18 +26,18 @@
|
|
|
26
26
|
"copy-webpack-plugin": "11.0.0",
|
|
27
27
|
"mini-css-extract-plugin": "2.9.2",
|
|
28
28
|
"picocolors": "^1.1.1",
|
|
29
|
-
"reduce-configs": "^1.
|
|
29
|
+
"reduce-configs": "^1.1.0",
|
|
30
30
|
"tsconfig-paths-webpack-plugin": "4.2.0",
|
|
31
31
|
"webpack": "^5.96.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@rslib/core": "0.0
|
|
35
|
-
"@types/node": "^22.
|
|
34
|
+
"@rslib/core": "0.1.0",
|
|
35
|
+
"@types/node": "^22.10.0",
|
|
36
36
|
"ansi-escapes": "4.3.2",
|
|
37
37
|
"cli-truncate": "2.1.0",
|
|
38
38
|
"patch-console": "1.0.0",
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"@rsbuild/core": "1.1.
|
|
39
|
+
"typescript": "^5.7.2",
|
|
40
|
+
"@rsbuild/core": "1.1.7",
|
|
41
41
|
"@scripts/test-helper": "1.0.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|