@rsdoctor/core 2.0.0-beta.0 → 2.0.0-beta.1
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/26.js +186 -134
- package/dist/630.js +12 -12
- package/dist/630.js.LICENSE.txt +1 -1
- package/dist/build-utils/build/json.d.ts +1 -1
- package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +153 -95
- package/dist/inner-plugins/plugins/bundle.d.ts +1 -1
- package/dist/inner-plugins/plugins/loader.d.ts +2 -0
- package/dist/inner-plugins/utils/config.d.ts +3 -1
- package/dist/inner-plugins/utils/normalize-config.d.ts +3 -8
- package/dist/inner-plugins/utils/ruleWarnings.d.ts +2 -0
- package/dist/proxy-loader.js +7 -3
- package/dist/rspack-plugin/index.d.ts +0 -1
- package/dist/rspack-plugin/plugin.d.ts +7 -3
- package/dist/rspack-plugin/session.d.ts +0 -1
- package/dist/rspack-plugin/writeStore.d.ts +2 -0
- package/dist/rule-utils/parser/utils.d.ts +3 -6
- package/dist/rules/rules/ecma-version-check/index.d.ts +1 -1
- package/dist/sdk/multiple/primary.d.ts +2 -2
- package/dist/sdk/sdk/core.d.ts +3 -2
- package/dist/sdk/sdk/types.d.ts +1 -1
- package/dist/sdk/utils/index.d.ts +1 -0
- package/dist/sdk/utils/manifestSharding.d.ts +16 -0
- package/dist/types/loader.d.ts +5 -0
- package/dist/types/plugin.d.ts +0 -8
- package/package.json +24 -24
- package/dist/rspack-plugin/multiple.d.ts +0 -10
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
2
3
|
import node_fs from "node:fs";
|
|
3
4
|
import fs_extra from "fs-extra";
|
|
4
5
|
import path_0 from "path";
|
|
@@ -21,21 +22,15 @@ import node_path, { join, dirname as __rspack_dirname } from "node:path";
|
|
|
21
22
|
import { promisify } from "node:util";
|
|
22
23
|
import { randomBytes } from "crypto";
|
|
23
24
|
import raw_body from "raw-body";
|
|
24
|
-
import { createBrotliDecompress, createGunzip, createInflate } from "node:zlib";
|
|
25
|
+
import { createBrotliDecompress, createDeflate, createGunzip, createInflate } from "node:zlib";
|
|
25
26
|
import node_process from "node:process";
|
|
26
27
|
import { AsyncSeriesHook } from "@rspack/lite-tapable";
|
|
27
|
-
import
|
|
28
|
+
import node_fs_promises from "node:fs/promises";
|
|
29
|
+
import { Readable } from "node:stream";
|
|
28
30
|
import { setSDK, logger as rsdoctorLogger, logger_time, timeEnd, color, stringify, registerSDK } from "./630.js";
|
|
29
|
-
import { InternalResolverPlugin, getYarnVersion, InternalPluginsPlugin, getRspackNativePlugin, InternalSummaryPlugin, ensureModulesChunksGraphFn, getNpmVersion, InternalBundlePlugin, getNodeVersion, fs_extra as external_fs_extra_fs_extra, handleBriefModeReport, processCompilerConfig, InternalLoaderPlugin,
|
|
31
|
+
import { InternalResolverPlugin, getYarnVersion, InternalPluginsPlugin, getRspackNativePlugin, InternalSummaryPlugin, ensureModulesChunksGraphFn, getNpmVersion, InternalBundlePlugin, isCompilerWatching, getNodeVersion, fs_extra as external_fs_extra_fs_extra, handleBriefModeReport, processCompilerConfig, InternalLoaderPlugin, normalizeRspackUserOptions, defaultPort, getCPUInfo, getPnpmVersion, createServer, getMemoryInfo, InternalErrorReporterPlugin, defaultHost, ProbeLoaderPlugin, getPortSync, InternalRulesPlugin, DevToolError } from "./26.js";
|
|
30
32
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
31
|
-
var date, __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
32
|
-
let __rspack_createRequire_require = __rspack_createRequire(import.meta.url);
|
|
33
|
-
__webpack_require__.add({
|
|
34
|
-
"launch-editor" (module) {
|
|
35
|
-
module.exports = __rspack_createRequire_require("launch-editor");
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
var apis_namespaceObject = {};
|
|
33
|
+
var date, __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url)), apis_namespaceObject = {};
|
|
39
34
|
__webpack_require__.r(apis_namespaceObject), __webpack_require__.d(apis_namespaceObject, {
|
|
40
35
|
AlertsAPI: ()=>AlertsAPI,
|
|
41
36
|
BundleDiffAPI: ()=>BundleDiffAPI,
|
|
@@ -284,8 +279,8 @@ class BaseAPI {
|
|
|
284
279
|
return key.includes('.') && (res = key.split('.').reduce((t, k)=>t[k], data)), res;
|
|
285
280
|
}
|
|
286
281
|
}
|
|
287
|
-
function _ts_metadata(
|
|
288
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
282
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
283
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
289
284
|
}
|
|
290
285
|
class AlertsAPI extends BaseAPI {
|
|
291
286
|
async getPackageRelationAlertDetails() {
|
|
@@ -302,8 +297,8 @@ function bundle_diff_ts_decorate(decorators, target, key, desc) {
|
|
|
302
297
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
303
298
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
304
299
|
}
|
|
305
|
-
function bundle_diff_ts_metadata(
|
|
306
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
300
|
+
function bundle_diff_ts_metadata(metadataKey, metadataValue) {
|
|
301
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
307
302
|
}
|
|
308
303
|
!function(decorators, target, key, desc) {
|
|
309
304
|
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -342,8 +337,8 @@ function data_ts_decorate(decorators, target, key, desc) {
|
|
|
342
337
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
343
338
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
344
339
|
}
|
|
345
|
-
function data_ts_metadata(
|
|
346
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
340
|
+
function data_ts_metadata(metadataKey, metadataValue) {
|
|
341
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
347
342
|
}
|
|
348
343
|
bundle_diff_ts_decorate([
|
|
349
344
|
Router.get(SDK.ServerAPI.API.GetBundleDiffSummary),
|
|
@@ -367,8 +362,8 @@ class DataAPI extends BaseAPI {
|
|
|
367
362
|
await server.sendAPIDataToClient(api, data);
|
|
368
363
|
}
|
|
369
364
|
}
|
|
370
|
-
function fs_ts_metadata(
|
|
371
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
365
|
+
function fs_ts_metadata(metadataKey, metadataValue) {
|
|
366
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
372
367
|
}
|
|
373
368
|
data_ts_decorate([
|
|
374
369
|
Router.post(SDK.ServerAPI.API.LoadDataByKey),
|
|
@@ -393,8 +388,8 @@ function loader_ts_decorate(decorators, target, key, desc) {
|
|
|
393
388
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
394
389
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
395
390
|
}
|
|
396
|
-
function loader_ts_metadata(
|
|
397
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
391
|
+
function loader_ts_metadata(metadataKey, metadataValue) {
|
|
392
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
398
393
|
}
|
|
399
394
|
!function(decorators, target, key, desc) {
|
|
400
395
|
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -444,11 +439,12 @@ class LoaderAPI extends BaseAPI {
|
|
|
444
439
|
});
|
|
445
440
|
}
|
|
446
441
|
async getLoaderFileInputAndOutput() {
|
|
447
|
-
let { req } = this.ctx, { file, loader, loaderIndex } = req.body;
|
|
442
|
+
let { req } = this.ctx, { file, loader, loaderIndex, isPitch } = req.body;
|
|
448
443
|
return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetLoaderFileInputAndOutput, {
|
|
449
444
|
file,
|
|
450
445
|
loader,
|
|
451
|
-
loaderIndex
|
|
446
|
+
loaderIndex,
|
|
447
|
+
isPitch
|
|
452
448
|
});
|
|
453
449
|
}
|
|
454
450
|
}
|
|
@@ -458,8 +454,8 @@ function graph_ts_decorate(decorators, target, key, desc) {
|
|
|
458
454
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
459
455
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
460
456
|
}
|
|
461
|
-
function graph_ts_metadata(
|
|
462
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
457
|
+
function graph_ts_metadata(metadataKey, metadataValue) {
|
|
458
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
463
459
|
}
|
|
464
460
|
loader_ts_decorate([
|
|
465
461
|
Router.post(SDK.ServerAPI.API.ReportLoader),
|
|
@@ -560,8 +556,8 @@ function plugin_ts_decorate(decorators, target, key, desc) {
|
|
|
560
556
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
561
557
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
562
558
|
}
|
|
563
|
-
function plugin_ts_metadata(
|
|
564
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
559
|
+
function plugin_ts_metadata(metadataKey, metadataValue) {
|
|
560
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
565
561
|
}
|
|
566
562
|
graph_ts_decorate([
|
|
567
563
|
Router.post(SDK.ServerAPI.API.GetAssetsSummary),
|
|
@@ -622,8 +618,8 @@ function project_ts_decorate(decorators, target, key, desc) {
|
|
|
622
618
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
623
619
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
624
620
|
}
|
|
625
|
-
function project_ts_metadata(
|
|
626
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
621
|
+
function project_ts_metadata(metadataKey, metadataValue) {
|
|
622
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
627
623
|
}
|
|
628
624
|
plugin_ts_decorate([
|
|
629
625
|
Router.post(SDK.ServerAPI.API.GetPluginSummary),
|
|
@@ -658,8 +654,8 @@ class ProjectAPI extends BaseAPI {
|
|
|
658
654
|
return this.dataLoader.loadAPI(SDK.ServerAPI.API.GetClientRoutes);
|
|
659
655
|
}
|
|
660
656
|
}
|
|
661
|
-
function renderer_ts_metadata(
|
|
662
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
657
|
+
function renderer_ts_metadata(metadataKey, metadataValue) {
|
|
658
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
663
659
|
}
|
|
664
660
|
project_ts_decorate([
|
|
665
661
|
Router.get(SDK.ServerAPI.API.Env),
|
|
@@ -695,8 +691,8 @@ function resolver_ts_decorate(decorators, target, key, desc) {
|
|
|
695
691
|
else for(var i = decorators.length - 1; i >= 0; i--)(d = decorators[i]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
|
|
696
692
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
697
693
|
}
|
|
698
|
-
function resolver_ts_metadata(
|
|
699
|
-
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(
|
|
694
|
+
function resolver_ts_metadata(metadataKey, metadataValue) {
|
|
695
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(metadataKey, metadataValue);
|
|
700
696
|
}
|
|
701
697
|
!function(decorators, target, key, desc) {
|
|
702
698
|
var d, c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
|
|
@@ -1008,7 +1004,7 @@ class RsdoctorServer {
|
|
|
1008
1004
|
return;
|
|
1009
1005
|
}
|
|
1010
1006
|
try {
|
|
1011
|
-
let launch =
|
|
1007
|
+
let launch = server_require('launch-editor'), responded = !1, safeEnd = (code, body)=>{
|
|
1012
1008
|
responded || (responded = !0, res.statusCode = code, res.end(body));
|
|
1013
1009
|
};
|
|
1014
1010
|
launch(file, editor, (_fileName, errorMessage)=>{
|
|
@@ -1065,7 +1061,7 @@ class RsdoctorServer {
|
|
|
1065
1061
|
}
|
|
1066
1062
|
async openClientPage(...args) {
|
|
1067
1063
|
let relativeUrl = this.getClientUrl(...args), needEncodeURI = args[0] === Client.RsdoctorClientRoutes.BundleDiff, url = `http://${this.host}:${this.port}${relativeUrl}`, localhostUrl = `http://localhost:${this.port}${relativeUrl}`;
|
|
1068
|
-
await openBrowser(localhostUrl, !needEncodeURI), this._printServerUrl && rsdoctorLogger.info(
|
|
1064
|
+
await openBrowser(localhostUrl, !needEncodeURI), this._printServerUrl && rsdoctorLogger.info(`Analyzer running on: ${color.cyan(url)}`);
|
|
1069
1065
|
}
|
|
1070
1066
|
sendAPIDataToClient(api, msg) {
|
|
1071
1067
|
this._socket?.sendAPIData(api, msg);
|
|
@@ -1091,6 +1087,41 @@ function findRoot(startDir = process.cwd()) {
|
|
|
1091
1087
|
}
|
|
1092
1088
|
return firstPkgDir || null;
|
|
1093
1089
|
}
|
|
1090
|
+
async function writeManifestShards(jsonFragments, folder, options = {}) {
|
|
1091
|
+
if (0 === jsonFragments.length) throw Error('Cannot write empty JSON fragments.');
|
|
1092
|
+
let { index = 0, shardSize = 10485760, compressionLevel } = options;
|
|
1093
|
+
if (!Number.isSafeInteger(shardSize) || shardSize <= 0) throw Error('Manifest shard size must be a positive integer.');
|
|
1094
|
+
if (void 0 !== compressionLevel && (!Number.isInteger(compressionLevel) || compressionLevel < 0 || compressionLevel > 9)) throw RangeError('`compressionLevel` must be an integer between 0 and 9.');
|
|
1095
|
+
await node_fs_promises.mkdir(folder, {
|
|
1096
|
+
recursive: !0
|
|
1097
|
+
});
|
|
1098
|
+
let files = [], shardParts = [], shardLength = 0, flushShard = async ()=>{
|
|
1099
|
+
if (0 === shardLength) return;
|
|
1100
|
+
let basename = String(index + files.length), filePath = node_path.resolve(folder, basename);
|
|
1101
|
+
await node_fs_promises.writeFile(filePath, shardParts.join(''), 'utf8'), files.push({
|
|
1102
|
+
path: filePath,
|
|
1103
|
+
basename
|
|
1104
|
+
}), shardParts = [], shardLength = 0;
|
|
1105
|
+
}, appendEncodedText = async (encodedText)=>{
|
|
1106
|
+
let offset = 0;
|
|
1107
|
+
for(; offset < encodedText.length;){
|
|
1108
|
+
let length = Math.min(shardSize - shardLength, encodedText.length - offset);
|
|
1109
|
+
shardParts.push(encodedText.slice(offset, offset + length)), shardLength += length, offset += length, shardLength === shardSize && await flushShard();
|
|
1110
|
+
}
|
|
1111
|
+
}, compressor = Readable.from(jsonFragments, {
|
|
1112
|
+
objectMode: !1
|
|
1113
|
+
}).pipe(createDeflate(void 0 === compressionLevel ? void 0 : {
|
|
1114
|
+
level: compressionLevel
|
|
1115
|
+
})), base64Remainder = Buffer.alloc(0);
|
|
1116
|
+
for await (let chunk of compressor){
|
|
1117
|
+
let compressedChunk = Buffer.from(chunk), bytes = base64Remainder.length ? Buffer.concat([
|
|
1118
|
+
base64Remainder,
|
|
1119
|
+
compressedChunk
|
|
1120
|
+
]) : compressedChunk, encodableLength = bytes.length - bytes.length % 3;
|
|
1121
|
+
encodableLength > 0 && await appendEncodedText(bytes.subarray(0, encodableLength).toString('base64')), base64Remainder = Buffer.from(bytes.subarray(encodableLength));
|
|
1122
|
+
}
|
|
1123
|
+
return base64Remainder.length > 0 && await appendEncodedText(base64Remainder.toString('base64')), await flushShard(), files;
|
|
1124
|
+
}
|
|
1094
1125
|
String((date = new Date()).getMonth() + 1).padStart(2, '0'), String(date.getDate()).padStart(2, '0'), date.getFullYear();
|
|
1095
1126
|
class SDKCore {
|
|
1096
1127
|
constructor({ name, root }){
|
|
@@ -1157,10 +1188,10 @@ class SDKCore {
|
|
|
1157
1188
|
this._clientRoutes.add(route);
|
|
1158
1189
|
}), this.onDataReport();
|
|
1159
1190
|
}
|
|
1160
|
-
async writePieces(storeData,
|
|
1191
|
+
async writePieces(storeData, options) {
|
|
1161
1192
|
let { outputDir } = this, manifest = node_path.resolve(outputDir, Constants.RsdoctorOutputManifest);
|
|
1162
1193
|
this.diskManifestPath = manifest, await external_fs_extra_fs_extra.ensureDir(outputDir);
|
|
1163
|
-
let urlsPromiseList = [];
|
|
1194
|
+
let urlsPromiseList = [], compressionLevel = options?.compressionLevel;
|
|
1164
1195
|
for (let key of Object.keys(storeData)){
|
|
1165
1196
|
let data = storeData[key];
|
|
1166
1197
|
if ('object' != typeof data) {
|
|
@@ -1178,20 +1209,21 @@ class SDKCore {
|
|
|
1178
1209
|
return stringify(data);
|
|
1179
1210
|
}
|
|
1180
1211
|
})();
|
|
1181
|
-
|
|
1182
|
-
let fileOffset = 0;
|
|
1183
|
-
for (let str of jsonStr){
|
|
1184
|
-
let result = await this.writeToFolder(str, outputDir, key, fileOffset);
|
|
1185
|
-
fileOffset += result.files.length, urlsPromiseList.push(result);
|
|
1186
|
-
}
|
|
1187
|
-
} else urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key));
|
|
1212
|
+
Array.isArray(jsonStr) ? urlsPromiseList.push(this.writeJsonFragmentsToFolder(jsonStr, outputDir, key, void 0, compressionLevel)) : urlsPromiseList.push(this.writeToFolder(jsonStr, outputDir, key, void 0, compressionLevel));
|
|
1188
1213
|
}
|
|
1189
1214
|
let dataUrls = await Promise.all(urlsPromiseList);
|
|
1190
1215
|
rsdoctorLogger.debug(`SDKCore.writePieces extraConfig: ${JSON.stringify(this.extraConfig)}`, '[SDKCore.writePieces]'), this.cloudData = {
|
|
1191
1216
|
client: {
|
|
1192
1217
|
enableRoutes: this.getClientRoutes()
|
|
1193
1218
|
},
|
|
1194
|
-
data: dataUrls.reduce((t, item)=>
|
|
1219
|
+
data: dataUrls.reduce((t, item)=>{
|
|
1220
|
+
if (!Array.isArray(item.files)) return t[item.name] = item.files, t;
|
|
1221
|
+
let previous = t[item.name];
|
|
1222
|
+
return t[item.name] = [
|
|
1223
|
+
...Array.isArray(previous) ? previous : [],
|
|
1224
|
+
...item.files.map((e)=>e.path)
|
|
1225
|
+
], t;
|
|
1226
|
+
}, {})
|
|
1195
1227
|
};
|
|
1196
1228
|
}
|
|
1197
1229
|
async writeManifest() {
|
|
@@ -1208,16 +1240,21 @@ class SDKCore {
|
|
|
1208
1240
|
manifestDiskPath
|
|
1209
1241
|
}), manifestDiskPath;
|
|
1210
1242
|
}
|
|
1211
|
-
writeToFolder(jsonStr, dir, key, index) {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1243
|
+
writeToFolder(jsonStr, dir, key, index, compressionLevel) {
|
|
1244
|
+
return this.writeJsonFragmentsToFolder([
|
|
1245
|
+
jsonStr
|
|
1246
|
+
], dir, key, index, compressionLevel);
|
|
1247
|
+
}
|
|
1248
|
+
async writeJsonFragmentsToFolder(jsonFragments, dir, key, index, compressionLevel) {
|
|
1249
|
+
if (0 === jsonFragments.length) throw Error(`Cannot write empty JSON fragments for "${key}".`);
|
|
1250
|
+
let folder = node_path.resolve(dir, key);
|
|
1251
|
+
return {
|
|
1252
|
+
name: key,
|
|
1253
|
+
files: await writeManifestShards(jsonFragments, folder, {
|
|
1254
|
+
index,
|
|
1255
|
+
compressionLevel
|
|
1256
|
+
})
|
|
1257
|
+
};
|
|
1221
1258
|
}
|
|
1222
1259
|
}
|
|
1223
1260
|
let client_require = createRequire(import.meta.url), resolveClientDiffHtmlPath = (innerClientPath)=>{
|
|
@@ -1296,10 +1333,13 @@ class RsdoctorSDK extends SDKCore {
|
|
|
1296
1333
|
let _builtinLoader = data.loaders[0];
|
|
1297
1334
|
if (_builtinLoader.startAt) this._loaderStart.push(data);
|
|
1298
1335
|
else if (_builtinLoader.endAt) {
|
|
1299
|
-
let
|
|
1300
|
-
|
|
1301
|
-
matchLoaderStart
|
|
1302
|
-
|
|
1336
|
+
let matchLoaderStartIndex = this._loaderStart.findIndex((e)=>e.resource.path === data.resource.path && e.resource.queryRaw === data.resource.queryRaw && e.loaders[0].loader === _builtinLoader.loader && e.loaders[0].loaderIndex === _builtinLoader.loaderIndex && e.loaders[0].isPitch === _builtinLoader.isPitch && e.loaders[0].pid === _builtinLoader.pid);
|
|
1337
|
+
if (-1 !== matchLoaderStartIndex) {
|
|
1338
|
+
let [matchLoaderStart] = this._loaderStart.splice(matchLoaderStartIndex, 1);
|
|
1339
|
+
matchLoaderStart.loaders[0].result = _builtinLoader.result, matchLoaderStart.loaders[0].endAt = _builtinLoader.endAt, this.reportLoader([
|
|
1340
|
+
matchLoaderStart
|
|
1341
|
+
]);
|
|
1342
|
+
}
|
|
1303
1343
|
}
|
|
1304
1344
|
}
|
|
1305
1345
|
reportResolver(data) {
|
|
@@ -1383,8 +1423,7 @@ class RsdoctorSDK extends SDKCore {
|
|
|
1383
1423
|
return ctx.pid;
|
|
1384
1424
|
},
|
|
1385
1425
|
get errors () {
|
|
1386
|
-
|
|
1387
|
-
return ctx._errors.map((err)=>err.toData());
|
|
1426
|
+
return isJsonType && sections && !sections.rules ? [] : ctx._errors.map((err)=>err.toData());
|
|
1388
1427
|
},
|
|
1389
1428
|
get configs () {
|
|
1390
1429
|
return ctx._configs.slice();
|
|
@@ -1401,7 +1440,7 @@ class RsdoctorSDK extends SDKCore {
|
|
|
1401
1440
|
return ctx._loader.slice();
|
|
1402
1441
|
},
|
|
1403
1442
|
get moduleGraph () {
|
|
1404
|
-
|
|
1443
|
+
return isJsonType && sections && !sections.moduleGraph ? {
|
|
1405
1444
|
dependencies: [],
|
|
1406
1445
|
modules: [],
|
|
1407
1446
|
moduleGraphModules: [],
|
|
@@ -1409,23 +1448,20 @@ class RsdoctorSDK extends SDKCore {
|
|
|
1409
1448
|
sideEffects: [],
|
|
1410
1449
|
variables: [],
|
|
1411
1450
|
layers: []
|
|
1412
|
-
}
|
|
1413
|
-
return ctx._moduleGraph.toData({
|
|
1451
|
+
} : ctx._moduleGraph.toData({
|
|
1414
1452
|
contextPath: ctx._configs?.[0]?.config?.context || '',
|
|
1415
1453
|
briefOptions
|
|
1416
1454
|
});
|
|
1417
1455
|
},
|
|
1418
1456
|
get chunkGraph () {
|
|
1419
|
-
|
|
1457
|
+
return isJsonType && sections && !sections.chunkGraph ? {
|
|
1420
1458
|
assets: [],
|
|
1421
1459
|
chunks: [],
|
|
1422
1460
|
entrypoints: []
|
|
1423
|
-
};
|
|
1424
|
-
return ctx._chunkGraph.toData(ctx.type);
|
|
1461
|
+
} : ctx._chunkGraph.toData(ctx.type);
|
|
1425
1462
|
},
|
|
1426
1463
|
get moduleCodeMap () {
|
|
1427
|
-
|
|
1428
|
-
return ctx._moduleGraph.toCodeData(ctx.type);
|
|
1464
|
+
return ctx.extraConfig?.mode === SDK.IMode[SDK.IMode.brief] ? {} : ctx._moduleGraph.toCodeData(ctx.type);
|
|
1429
1465
|
},
|
|
1430
1466
|
get plugin () {
|
|
1431
1467
|
return {
|
|
@@ -1439,8 +1475,7 @@ class RsdoctorSDK extends SDKCore {
|
|
|
1439
1475
|
};
|
|
1440
1476
|
},
|
|
1441
1477
|
get treeShaking () {
|
|
1442
|
-
if (ctx.extraConfig?.mode
|
|
1443
|
-
return ctx._moduleGraph.toTreeShakingData();
|
|
1478
|
+
if (ctx.extraConfig?.mode !== SDK.IMode[SDK.IMode.brief] && ctx.extraConfig?.features?.treeShaking) return ctx._moduleGraph.toTreeShakingData();
|
|
1444
1479
|
},
|
|
1445
1480
|
get otherReports () {
|
|
1446
1481
|
return {
|
|
@@ -1552,8 +1587,8 @@ class RsdoctorPrimarySDK extends RsdoctorSDK {
|
|
|
1552
1587
|
get isMaster() {
|
|
1553
1588
|
return this.parent.master === this;
|
|
1554
1589
|
}
|
|
1555
|
-
async writePieces() {
|
|
1556
|
-
this.setOutputDir(this.parent.getCompilerOutputDir(this)), await super.writePieces(this.getStoreData());
|
|
1590
|
+
async writePieces(_storeData, options) {
|
|
1591
|
+
this.setOutputDir(this.parent.getCompilerOutputDir(this)), await super.writePieces(this.getStoreData(), options);
|
|
1557
1592
|
}
|
|
1558
1593
|
async writeManifest() {
|
|
1559
1594
|
let { parent, cloudData } = this;
|
|
@@ -1662,14 +1697,20 @@ class RsdoctorSDKController {
|
|
|
1662
1697
|
return this.slaves.filter((item)=>this.activeSlaves.has(item));
|
|
1663
1698
|
}
|
|
1664
1699
|
}
|
|
1665
|
-
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/core","version":"2.0.0-beta.
|
|
1700
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/core","version":"2.0.0-beta.1","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/core"},"license":"MIT","type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./proxy-loader":{"types":"./dist/proxy-loader.d.ts","default":"./dist/proxy-loader.js"}},"main":"dist/index.js","types":"dist/index.d.ts","typesVersions":{"*":{".":["./dist/index.d.ts"],"proxy-loader":["./dist/proxy-loader.d.ts"]}},"files":["dist","static"],"scripts":{"build":"rs lib","dev":"npm run start","start":"rs lib -w","test":"rs test"},"dependencies":{"@babel/code-frame":"7.26.2","@rsdoctor/client":"workspace:*","@rsdoctor/shared":"workspace:*","@rspack/lite-tapable":"catalog:","@types/estree":"catalog:","acorn":"^8.10.0","acorn-import-attributes":"^1.9.5","acorn-walk":"8.3.5","browserslist-load-config":"^1.0.3","caniuse-lite":"^1.0.30001810","connect-next":"catalog:","cors":"2.8.6","envinfo":"7.21.0","fs-extra":"catalog:","get-port":"5.1.1","launch-editor":"^2.14.1","lines-and-columns":"2.0.4","open":"^11.0.2","raw-body":"3.0.2","rslog":"^2.1.3","semver":"^7.8.5","sirv":"catalog:","source-map":"catalog:","ws":"8.21.3"},"devDependencies":{"@rsbuild/plugin-check-syntax":"catalog:","@rspack/core":"catalog:","@scripts/test-helper":"workspace:*","@types/babel__code-frame":"7.27.0","@types/cors":"2.8.19","@types/envinfo":"7.8.4","@types/fs-extra":"catalog:","@types/node":"catalog:","@types/semver":"^7.8.0","@types/ws":"^8.18.1","babel-loader":"10.1.1","filesize":"catalog:","json-stream-stringify":"3.0.1","string-loader":"0.0.1","ts-loader":"^9.6.2","tslib":"catalog:","typescript":"catalog:"},"peerDependencies":{"@rspack/core":"^2.0.0"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"engines":{"node":">=22.18.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
1666
1701
|
let pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
1667
1702
|
name: pluginTapName,
|
|
1668
1703
|
stage: 999
|
|
1669
|
-
}, pendingSessions = new Map(),
|
|
1704
|
+
}, pendingSessions = new Map(), watchWriteStoreOptions = {
|
|
1705
|
+
compressionLevel: 1
|
|
1706
|
+
};
|
|
1707
|
+
function getWriteStoreOptions(compiler) {
|
|
1708
|
+
return isCompilerWatching(compiler) ? watchWriteStoreOptions : void 0;
|
|
1709
|
+
}
|
|
1710
|
+
let hasGreeted = !1;
|
|
1670
1711
|
class RsdoctorCompilerContext {
|
|
1671
1712
|
constructor(sdk, options){
|
|
1672
|
-
this.sdk = sdk, this.options = options, this.name = pluginTapName, this.isRsdoctorPlugin = !0, this.modulesGraph = new ModuleGraph(), this.applied = !1;
|
|
1713
|
+
this.sdk = sdk, this.options = options, this.name = pluginTapName, this.isRsdoctorPlugin = !0, this.modulesGraph = new ModuleGraph(), this.applied = !1, this.hasOpenedClientAutomatically = !1;
|
|
1673
1714
|
}
|
|
1674
1715
|
apply() {}
|
|
1675
1716
|
ensureModulesChunksGraphApplied(compiler) {
|
|
@@ -1678,7 +1719,7 @@ class RsdoctorCompilerContext {
|
|
|
1678
1719
|
}
|
|
1679
1720
|
class RsdoctorRspackPlugin {
|
|
1680
1721
|
constructor(options){
|
|
1681
|
-
if (this.name = pluginTapName, this.isRsdoctorPlugin = !0, this.compilerContexts = new WeakMap(), this.childPlugins = new Map(), this.appliedCompilerCount = 0, this.afterPlugins = (compiler, context = this.getCompilerContext(compiler))=>{
|
|
1722
|
+
if (this.name = pluginTapName, this.isRsdoctorPlugin = !0, this.defaultName = pluginTapName, this.compilerContexts = new WeakMap(), this.childPlugins = new Map(), this.appliedCompilerCount = 0, this.afterPlugins = (compiler, context = this.getCompilerContext(compiler))=>{
|
|
1682
1723
|
logger_time('RsdoctorRspackPlugin.afterPlugins');
|
|
1683
1724
|
try {
|
|
1684
1725
|
this.getRspackConfig(compiler, context);
|
|
@@ -1688,24 +1729,27 @@ class RsdoctorRspackPlugin {
|
|
|
1688
1729
|
}, this.done = async (compiler, context = this.getCompilerContext(compiler))=>{
|
|
1689
1730
|
logger_time('RsdoctorRspackPlugin.done');
|
|
1690
1731
|
try {
|
|
1691
|
-
rsdoctorLogger.debug('[RsdoctorRspackPlugin] bootstrap(start) in done()')
|
|
1732
|
+
rsdoctorLogger.debug('[RsdoctorRspackPlugin] bootstrap(start) in done()');
|
|
1733
|
+
let bootstrapTask = this.ensureBootstrap(context);
|
|
1734
|
+
await this.awaitBootstrap(context, bootstrapTask), rsdoctorLogger.debug('[RsdoctorRspackPlugin] bootstrap(end) in done()'), context.sdk.addClientRoutes([
|
|
1692
1735
|
Manifest.RsdoctorManifestClientRoutes.Overall
|
|
1693
|
-
]), context.sdk instanceof RsdoctorPrimarySDK ? context.sdk.setOutputDir(context.sdk.parent.getCompilerOutputDir(context.sdk)) : context.sdk.setOutputDir(this.getOutputDir(compiler)), await context.sdk.writeStore();
|
|
1736
|
+
]), context.sdk instanceof RsdoctorPrimarySDK ? context.sdk.setOutputDir(context.sdk.parent.getCompilerOutputDir(context.sdk)) : context.sdk.setOutputDir(this.getOutputDir(compiler)), await context.sdk.writeStore(getWriteStoreOptions(compiler));
|
|
1694
1737
|
let isPrimaryCompiler = !(context.sdk instanceof RsdoctorPrimarySDK) || context.sdk.isMaster;
|
|
1695
|
-
|
|
1738
|
+
this.options.disableClientServer || !isPrimaryCompiler || context.hasOpenedClientAutomatically || (context.hasOpenedClientAutomatically = !0, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? await handleBriefModeReport(context.sdk, this.options, this.options.disableClientServer) : await context.sdk.server.openClientPage('homepage')), this.shouldDisposeSDK() && await this.disposeSDK(context, bootstrapTask);
|
|
1696
1739
|
} finally{
|
|
1697
1740
|
timeEnd('RsdoctorRspackPlugin.done');
|
|
1698
1741
|
}
|
|
1699
1742
|
}, this.childDone = async (compiler, context)=>{
|
|
1700
|
-
|
|
1743
|
+
let bootstrapTask = this.ensureBootstrap(context);
|
|
1744
|
+
await this.awaitBootstrap(context, bootstrapTask), context.sdk.addClientRoutes([
|
|
1701
1745
|
Manifest.RsdoctorManifestClientRoutes.Overall
|
|
1702
|
-
]), context.sdk instanceof RsdoctorPrimarySDK ? context.sdk.setOutputDir(context.sdk.parent.getCompilerOutputDir(context.sdk)) : context.sdk.setOutputDir(this.getOutputDir(compiler)), await context.sdk.writeStore(), this.shouldDisposeSDK() && await
|
|
1746
|
+
]), context.sdk instanceof RsdoctorPrimarySDK ? context.sdk.setOutputDir(context.sdk.parent.getCompilerOutputDir(context.sdk)) : context.sdk.setOutputDir(this.getOutputDir(compiler)), await context.sdk.writeStore(getWriteStoreOptions(compiler)), this.shouldDisposeSDK() && await this.disposeSDK(context, bootstrapTask);
|
|
1703
1747
|
}, this.childOptions = {
|
|
1704
1748
|
...options,
|
|
1705
1749
|
supports: {
|
|
1706
1750
|
...options?.supports
|
|
1707
1751
|
}
|
|
1708
|
-
}, this.options = normalizeRspackUserOptions(this.childOptions), this.outsideInstance = !!this.options.sdkInstance, this.
|
|
1752
|
+
}, this.options = normalizeRspackUserOptions(this.childOptions), this.outsideInstance = !!this.options.sdkInstance, this.options.sdkInstance) {
|
|
1709
1753
|
this.options.sdkInstance instanceof RsdoctorPrimarySDK && (this.controller = this.options.sdkInstance.parent), this.primaryContext = new RsdoctorCompilerContext(this.options.sdkInstance, this.options);
|
|
1710
1754
|
return;
|
|
1711
1755
|
}
|
|
@@ -1725,7 +1769,7 @@ class RsdoctorRspackPlugin {
|
|
|
1725
1769
|
root,
|
|
1726
1770
|
options.output.mode,
|
|
1727
1771
|
options.output.reportDir,
|
|
1728
|
-
options.server.port ??
|
|
1772
|
+
options.server.port ?? ''
|
|
1729
1773
|
].join('\0');
|
|
1730
1774
|
}(options), session = pendingSessions.get(key);
|
|
1731
1775
|
if (!session) {
|
|
@@ -1745,7 +1789,7 @@ class RsdoctorRspackPlugin {
|
|
|
1745
1789
|
current?.controller === controller && (clearTimeout(current.timer), pendingSessions.delete(key));
|
|
1746
1790
|
}
|
|
1747
1791
|
};
|
|
1748
|
-
}(this.options), this.controller = this.sessionLease.controller, this.primaryContext = this.createCompilerContext(
|
|
1792
|
+
}(this.options), this.controller = this.sessionLease.controller, this.primaryContext = this.createCompilerContext();
|
|
1749
1793
|
}
|
|
1750
1794
|
get sdk() {
|
|
1751
1795
|
return this.primaryContext.sdk;
|
|
@@ -1765,7 +1809,7 @@ class RsdoctorRspackPlugin {
|
|
|
1765
1809
|
context.applied = !0, logger_time('RsdoctorRspackPlugin.apply');
|
|
1766
1810
|
try {
|
|
1767
1811
|
hasGreeted || compiler.isChild() || (hasGreeted = !0, rsdoctorLogger.greet(`
|
|
1768
|
-
\nRsdoctor v${package_namespaceObject.version}\n`)), this.releasePendingSessionOnRun(compiler),
|
|
1812
|
+
\nRsdoctor v${package_namespaceObject.version}\n`)), this.releasePendingSessionOnRun(compiler), this.ensureBootstrap(context);
|
|
1769
1813
|
let compilerName = compiler.name || compiler.options.name || (1 === this.appliedCompilerCount ? this.defaultName : `${this.defaultName}-${this.appliedCompilerCount}`);
|
|
1770
1814
|
compiler.isChild() || context.sdk.setName(compilerName), context.sdk instanceof RsdoctorPrimarySDK && (compiler.isChild() || (context.sdk.displayName = compiler.name || compiler.options.name || (1 === this.appliedCompilerCount ? 'Main compiler' : compilerName)), 'dependencies' in compiler.options && (context.sdk.dependencies = compiler.options.dependencies), context.sdk.parent.registerSlave(context.sdk), context.sdk.parent.setOutputDir(context.sdk, this.getOutputDir(compiler)), this.options.output.mode === SDK.IMode[SDK.IMode.brief] && (context.sdk.reportFileName = this.getBriefReportFileName())), compiler.isChild() ? registerSDK(context.sdk) : setSDK(context.sdk), this.applyChildCompilerSupport(compiler, context), compiler.isChild() ? (this.getRspackConfig(compiler, context), compiler.hooks.afterCompile.tapPromise({
|
|
1771
1815
|
...pluginTapPostOptions,
|
|
@@ -1809,11 +1853,10 @@ class RsdoctorRspackPlugin {
|
|
|
1809
1853
|
timeEnd('RsdoctorRspackPlugin.getRspackConfig');
|
|
1810
1854
|
}
|
|
1811
1855
|
}
|
|
1812
|
-
createCompilerContext(
|
|
1856
|
+
createCompilerContext() {
|
|
1813
1857
|
let controller = this.controller, { output, innerClientPath, printLog, server, features } = this.options;
|
|
1814
1858
|
return new RsdoctorCompilerContext(controller.createSlave({
|
|
1815
1859
|
name: this.defaultName,
|
|
1816
|
-
stage,
|
|
1817
1860
|
extraConfig: {
|
|
1818
1861
|
innerClientPath,
|
|
1819
1862
|
printLog,
|
|
@@ -1838,6 +1881,26 @@ class RsdoctorRspackPlugin {
|
|
|
1838
1881
|
}
|
|
1839
1882
|
return this.appliedCompilerCount += 1, this.compilerContexts.set(compiler, context), context;
|
|
1840
1883
|
}
|
|
1884
|
+
ensureBootstrap(context) {
|
|
1885
|
+
if (!context.bootstrapTask) {
|
|
1886
|
+
let task = context.sdk.bootstrap();
|
|
1887
|
+
context.bootstrapTask = task, task.catch(()=>{});
|
|
1888
|
+
}
|
|
1889
|
+
return context.bootstrapTask;
|
|
1890
|
+
}
|
|
1891
|
+
async awaitBootstrap(context, bootstrapTask) {
|
|
1892
|
+
try {
|
|
1893
|
+
await bootstrapTask;
|
|
1894
|
+
} catch (error) {
|
|
1895
|
+
throw this.clearBootstrapTask(context, bootstrapTask), error;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
clearBootstrapTask(context, bootstrapTask) {
|
|
1899
|
+
context.bootstrapTask === bootstrapTask && (context.bootstrapTask = void 0);
|
|
1900
|
+
}
|
|
1901
|
+
async disposeSDK(context, bootstrapTask) {
|
|
1902
|
+
await context.sdk.dispose(), this.clearBootstrapTask(context, bootstrapTask);
|
|
1903
|
+
}
|
|
1841
1904
|
getOutputDir(compiler) {
|
|
1842
1905
|
return node_path.resolve(this.options.output.reportDir || compiler.options.output?.path || compiler.outputPath, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? '' : `./${Constants.RsdoctorOutputFolder}`);
|
|
1843
1906
|
}
|
|
@@ -1898,11 +1961,6 @@ class RsdoctorRspackPlugin {
|
|
|
1898
1961
|
compiler.hooks.beforeRun.tap(pluginTapName, release), compiler.hooks.watchRun.tap(pluginTapName, release);
|
|
1899
1962
|
}
|
|
1900
1963
|
}
|
|
1901
|
-
class RsdoctorRspackMultiplePlugin extends RsdoctorRspackPlugin {
|
|
1902
|
-
constructor(options = {}){
|
|
1903
|
-
super(options);
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
1964
|
export { Linter, LinterRule, LinterType, defineRule, rules } from "./26.js";
|
|
1907
1965
|
export { logger } from "./630.js";
|
|
1908
|
-
export {
|
|
1966
|
+
export { RsdoctorRspackPlugin, RsdoctorSDK, resolveClientDiffHtmlPath };
|
|
@@ -2,9 +2,11 @@ import { Plugin } from '@rsdoctor/shared/types';
|
|
|
2
2
|
import { InternalBasePlugin } from './base.js';
|
|
3
3
|
export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
|
|
4
4
|
readonly name = "loader";
|
|
5
|
+
private cacheMarkerPath?;
|
|
5
6
|
readonly internalLoaderPath: string;
|
|
6
7
|
apply(compiler: T): void;
|
|
7
8
|
afterPlugins: (compiler: T) => void;
|
|
8
9
|
compilation(compiler: T, compilation: Plugin.BaseCompilation): void;
|
|
9
10
|
getInterceptRules(compiler: T, rules: Plugin.BuildRuleSetRules): Plugin.BuildRuleSetRule[];
|
|
11
|
+
private getCacheMarkerPath;
|
|
10
12
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
2
|
+
export declare function isCompilerWatching(compiler: Pick<Plugin.BaseCompiler, 'watchMode' | 'parentCompilation'>): boolean;
|
|
3
|
+
export declare function getEffectiveGzipConfig(compiler: Pick<Plugin.BaseCompiler, 'watchMode' | 'parentCompilation'>, gzip: Plugin.NormalizedGzipConfig): Plugin.NormalizedGzipConfig;
|
|
2
4
|
export declare function normalizeUserConfig<Rules extends Linter.ExtendRuleData[]>(config?: Plugin.RsdoctorRspackPluginOptions<Rules>): Plugin.RsdoctorPluginOptionsNormalized<Rules>;
|
|
3
|
-
export declare const normalizeReportType: (reportCodeType: Plugin.
|
|
5
|
+
export declare const normalizeReportType: (reportCodeType: Plugin.NewReportCodeType | undefined, mode: keyof typeof SDK.IMode) => SDK.ToDataType;
|
|
4
6
|
export declare const normalizeRspackUserOptions: typeof normalizeUserConfig;
|
|
@@ -3,19 +3,14 @@ import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackR
|
|
|
3
3
|
/**
|
|
4
4
|
* Process mode-specific configurations with priority logic
|
|
5
5
|
*/
|
|
6
|
-
export declare function processModeConfigurations(finalMode: keyof typeof SDK.IMode, output: Config.IOutput<'brief' | 'normal'
|
|
6
|
+
export declare function processModeConfigurations(finalMode: keyof typeof SDK.IMode, output: Config.IOutput<'brief' | 'normal'>): {
|
|
7
7
|
finalBrief: {};
|
|
8
8
|
finalNormalOptions: Config.NormalModeOptions;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
|
-
* Process brief mode configuration
|
|
12
|
-
* Priority: output.options.briefOptions > output.brief > default
|
|
11
|
+
* Process brief mode configuration.
|
|
13
12
|
*/
|
|
14
|
-
export declare function processBriefHtmlModeConfig(output: Config.BriefModeConfig
|
|
15
|
-
/**
|
|
16
|
-
* Convert reportCodeType object to NewReportCodeType enum value
|
|
17
|
-
*/
|
|
18
|
-
export declare function convertReportCodeTypeObject(reportCodeType: any): Config.NewReportCodeType | undefined;
|
|
13
|
+
export declare function processBriefHtmlModeConfig(output: Config.BriefModeConfig): Config.BriefModeOptions;
|
|
19
14
|
/**
|
|
20
15
|
* This function recursively processes rule set conditions to ensure they can be
|
|
21
16
|
* properly serialized to JSON.
|
package/dist/proxy-loader.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import { shouldSkipLoader, reportLoader, getOriginLoaderModule } from "./26.js";
|
|
2
|
+
import { shouldSkipLoader, reportLoader, getInternalLoaderOptions, getOriginLoaderModule } from "./26.js";
|
|
3
3
|
import { createLoaderContextTrap } from "./630.js";
|
|
4
|
+
function addCacheMarkerDependency(context) {
|
|
5
|
+
let { cacheMarkerPath } = getInternalLoaderOptions(context);
|
|
6
|
+
cacheMarkerPath && context.addBuildDependency(cacheMarkerPath);
|
|
7
|
+
}
|
|
4
8
|
let loaderModule = function(...args) {
|
|
5
9
|
if (shouldSkipLoader(this)) return void this.callback(null, ...args);
|
|
6
|
-
this
|
|
10
|
+
addCacheMarkerDependency(this);
|
|
7
11
|
let mod = getOriginLoaderModule(this);
|
|
8
12
|
if (mod.default) {
|
|
9
13
|
!1 === mod.raw && Buffer.isBuffer(args[0]) && (args[0] = args[0].toString());
|
|
@@ -24,7 +28,7 @@ let loaderModule = function(...args) {
|
|
|
24
28
|
this.callback(null, ...args);
|
|
25
29
|
}, pitch = function() {
|
|
26
30
|
if (shouldSkipLoader(this)) return;
|
|
27
|
-
this
|
|
31
|
+
addCacheMarkerDependency(this);
|
|
28
32
|
let mod = getOriginLoaderModule(this);
|
|
29
33
|
if (mod.pitch && 'function' == typeof mod.pitch) {
|
|
30
34
|
let start = 0, startHRTime = [
|