@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/26.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let flagForceColor;
|
|
2
2
|
import __rslib_shim_module__, { createRequire, createRequire as __rspack_createRequire } from "node:module";
|
|
3
3
|
let require = __rslib_shim_module__.createRequire(import.meta.url);
|
|
4
|
-
import
|
|
4
|
+
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
5
5
|
import fs_0 from "fs";
|
|
6
6
|
import path_0, { dirname, isAbsolute, resolve as external_path_resolve } from "path";
|
|
7
7
|
import node_fs from "node:fs";
|
|
@@ -22,6 +22,7 @@ import { color } from "rslog";
|
|
|
22
22
|
import assert from "assert";
|
|
23
23
|
import { exec as external_node_child_process_exec } from "node:child_process";
|
|
24
24
|
import node_path, { join, dirname as __rspack_dirname } from "node:path";
|
|
25
|
+
import { randomUUID } from "node:crypto";
|
|
25
26
|
import { SourceMapConsumer } from "source-map";
|
|
26
27
|
import { diff, gt } from "semver";
|
|
27
28
|
import { builtinModules } from "module";
|
|
@@ -30,7 +31,6 @@ import node_process from "node:process";
|
|
|
30
31
|
import node_os from "node:os";
|
|
31
32
|
import node_tty from "node:tty";
|
|
32
33
|
import { loadConfig } from "browserslist-load-config";
|
|
33
|
-
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
34
34
|
import { addProbeLoader2Rules, parseBundle as parseBundle_parseBundle, interceptCompilationHooks, timeEnd as logger_timeEnd, logger_time, getSDK, extractLoaderName, logger as rsdoctorLogger, mapEachRules, getDocument, isESMLoader, parseQuery, filesize as filesize_filesize, color as external_rslog_color, getLoaderNameMatch, interceptCompilerHooks, loadLoaderModule, parser as parser_parser } from "./630.js";
|
|
35
35
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
36
36
|
var CheckVersionMap, __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
@@ -43,7 +43,7 @@ __webpack_require__.add({
|
|
|
43
43
|
BrowserslistError.prototype = Error.prototype, module.exports = BrowserslistError;
|
|
44
44
|
},
|
|
45
45
|
"../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/index.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
46
|
-
var bbm = __webpack_require__("../../node_modules/.pnpm/baseline-browser-mapping@2.10.29/node_modules/baseline-browser-mapping/dist/index.cjs"), jsReleases = __webpack_require__("../../node_modules/.pnpm/node-releases@2.0.38/node_modules/node-releases/data/processed/envs.json"), agents = __webpack_require__("caniuse-lite/dist/unpacker/agents").agents, e2c = __webpack_require__("../../node_modules/.pnpm/electron-to-chromium@1.5.353/node_modules/electron-to-chromium/versions.js"), jsEOL = __webpack_require__("../../node_modules/.pnpm/node-releases@2.0.38/node_modules/node-releases/data/release-schedule/release-schedule.json"), path = __webpack_require__("path?37f5"), BrowserslistError = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/error.js"), env = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/node.js"), parseWithoutCache = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/parse.js");
|
|
46
|
+
var bbm = __webpack_require__("../../node_modules/.pnpm/baseline-browser-mapping@2.10.29/node_modules/baseline-browser-mapping/dist/index.cjs"), jsReleases = __webpack_require__("../../node_modules/.pnpm/node-releases@2.0.38/node_modules/node-releases/data/processed/envs.json"), agents = __webpack_require__("caniuse-lite/dist/unpacker/agents").agents, e2c = __webpack_require__("../../node_modules/.pnpm/electron-to-chromium@1.5.353/node_modules/electron-to-chromium/versions.js"), jsEOL = __webpack_require__("../../node_modules/.pnpm/node-releases@2.0.38/node_modules/node-releases/data/release-schedule/release-schedule.json"), path = __webpack_require__("path?37f5"), BrowserslistError = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/error.js"), env = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/node.js"), parseWithoutCache = __webpack_require__("../../node_modules/.pnpm/browserslist@4.28.2/node_modules/browserslist/parse.js"), YEAR = 365.259641 * 86400000;
|
|
47
47
|
function isVersionsMatch(versionA, versionB) {
|
|
48
48
|
return 0 === (versionA + '.').indexOf(versionB + '.');
|
|
49
49
|
}
|
|
@@ -468,7 +468,7 @@ __webpack_require__.add({
|
|
|
468
468
|
],
|
|
469
469
|
regexp: /^last\s+((\d+\.)?\d+)\s+years?$/i,
|
|
470
470
|
select: function(context, node) {
|
|
471
|
-
return filterByYear(Date.now() -
|
|
471
|
+
return filterByYear(Date.now() - YEAR * node.years, context);
|
|
472
472
|
}
|
|
473
473
|
},
|
|
474
474
|
since_y: {
|
|
@@ -23562,28 +23562,6 @@ var duplicate_package_types_namespaceObject = {};
|
|
|
23562
23562
|
__webpack_require__.r(duplicate_package_types_namespaceObject), __webpack_require__.d(duplicate_package_types_namespaceObject, {
|
|
23563
23563
|
J: ()=>types_CheckVersionMap
|
|
23564
23564
|
});
|
|
23565
|
-
class FileSharding {
|
|
23566
|
-
constructor(content, limitBytes = 10485760, encoding = 'utf-8'){
|
|
23567
|
-
this.content = content, this.limitBytes = limitBytes, this.encoding = encoding;
|
|
23568
|
-
}
|
|
23569
|
-
createVirtualShardingFiles(ext = '', index = 0) {
|
|
23570
|
-
let bf = Buffer.from(this.content, this.encoding), res = [], threshold = this.limitBytes, tmpBytes = 0;
|
|
23571
|
-
for(; bf.byteLength > tmpBytes;)res.push(bf.subarray(tmpBytes, tmpBytes + threshold)), tmpBytes += threshold;
|
|
23572
|
-
return res.map((e, i)=>({
|
|
23573
|
-
filename: `${i + index}${ext}`,
|
|
23574
|
-
content: e
|
|
23575
|
-
}));
|
|
23576
|
-
}
|
|
23577
|
-
async writeStringToFolder(folder, ext = '', index) {
|
|
23578
|
-
let dist = path_0.resolve(folder);
|
|
23579
|
-
await fs_extra.ensureDir(dist);
|
|
23580
|
-
let res = this.createVirtualShardingFiles(ext, index);
|
|
23581
|
-
return await Promise.all(res.map((e)=>new Promise((resolve, reject)=>{
|
|
23582
|
-
let stream = fs_0.createWriteStream(path_0.join(dist, e.filename), this.encoding);
|
|
23583
|
-
stream.end(e.content), stream.once('close', ()=>resolve(void 0)), stream.once('error', (err)=>reject(err));
|
|
23584
|
-
}))), res;
|
|
23585
|
-
}
|
|
23586
|
-
}
|
|
23587
23565
|
let RESTRICTED_PORTS = [
|
|
23588
23566
|
3659,
|
|
23589
23567
|
4045,
|
|
@@ -23685,12 +23663,16 @@ class ProbeLoaderPlugin {
|
|
|
23685
23663
|
});
|
|
23686
23664
|
}
|
|
23687
23665
|
addProbeLoader(compiler) {
|
|
23666
|
+
if (this.instrumentedCompilers.has(compiler)) return;
|
|
23688
23667
|
let rules = compiler.options.module.rules;
|
|
23689
23668
|
if (Loader.isVue(compiler)) {
|
|
23690
|
-
compiler.options.module.rules = addProbeLoader2Rules(rules, compiler, (r)=>!!r.loader || 'string' == typeof r);
|
|
23669
|
+
compiler.options.module.rules = addProbeLoader2Rules(rules, compiler, (r)=>!!r.loader || 'string' == typeof r), this.instrumentedCompilers.add(compiler);
|
|
23691
23670
|
return;
|
|
23692
23671
|
}
|
|
23693
|
-
rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, 'builtin:swc-loader', !0)), rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, 'builtin:lightningcss-loader', !0)), compiler.options.module.rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, '.mjs', !1) || isESMLoader(r));
|
|
23672
|
+
rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, 'builtin:swc-loader', !0)), rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, 'builtin:lightningcss-loader', !0)), compiler.options.module.rules = addProbeLoader2Rules(rules, compiler, (r)=>getLoaderNameMatch(r, '.mjs', !1) || isESMLoader(r)), this.instrumentedCompilers.add(compiler);
|
|
23673
|
+
}
|
|
23674
|
+
constructor(){
|
|
23675
|
+
this.instrumentedCompilers = new WeakSet();
|
|
23694
23676
|
}
|
|
23695
23677
|
}
|
|
23696
23678
|
function truncateMessage(input, maxLen = 1000) {
|
|
@@ -24057,65 +24039,69 @@ function makeRulesSerializable(rules) {
|
|
|
24057
24039
|
function defaultBoolean(v, dft) {
|
|
24058
24040
|
return 'boolean' == typeof v ? v : dft;
|
|
24059
24041
|
}
|
|
24060
|
-
function
|
|
24061
|
-
return
|
|
24062
|
-
mode: void 0,
|
|
24063
|
-
reportCodeType: {
|
|
24064
|
-
noModuleSource: !1,
|
|
24065
|
-
noAssetsAndModuleSource: !1,
|
|
24066
|
-
noCode: !1
|
|
24067
|
-
},
|
|
24068
|
-
options: void 0,
|
|
24069
|
-
reportDir: '',
|
|
24070
|
-
compressData: void 0
|
|
24071
|
-
};
|
|
24042
|
+
function isCompilerWatching(compiler) {
|
|
24043
|
+
return !!(compiler.watchMode || compiler.parentCompilation?.compiler.watchMode);
|
|
24072
24044
|
}
|
|
24073
|
-
let
|
|
24074
|
-
let convertedReportCodeType = 'object' == typeof reportCodeType ? function(reportCodeType) {
|
|
24075
|
-
if (reportCodeType) {
|
|
24076
|
-
if (reportCodeType.noCode) return 'noCode';
|
|
24077
|
-
else if (reportCodeType.noAssetsAndModuleSource) return 'noAssetsAndModuleSource';
|
|
24078
|
-
else if (reportCodeType.noModuleSource) return 'noModuleSource';
|
|
24079
|
-
}
|
|
24080
|
-
}(reportCodeType) : reportCodeType;
|
|
24081
|
-
return 'noCode' === convertedReportCodeType || mode === SDK.IMode[SDK.IMode.brief] ? SDK.ToDataType.NoCode : mode === SDK.IMode[SDK.IMode.lite] || 'noAssetsAndModuleSource' === convertedReportCodeType ? SDK.ToDataType.NoSourceAndAssets : 'noModuleSource' === convertedReportCodeType ? SDK.ToDataType.NoSource : SDK.ToDataType.Normal;
|
|
24082
|
-
}, normalizeRspackUserOptions = function(config = {}) {
|
|
24045
|
+
let normalizeRspackUserOptions = function(config = {}) {
|
|
24083
24046
|
var mode, mode1, finalMode, value, value1;
|
|
24084
|
-
let
|
|
24047
|
+
let finalBrief, finalNormalOptions, gzipLevel, reportCodeType, mode2;
|
|
24048
|
+
for (let { name, value, replacement } of [
|
|
24049
|
+
{
|
|
24050
|
+
name: "top-level 'mode'",
|
|
24051
|
+
value: config.mode,
|
|
24052
|
+
replacement: 'lite' === config.mode ? 'output.reportCodeType' : 'output.mode'
|
|
24053
|
+
},
|
|
24054
|
+
{
|
|
24055
|
+
name: "top-level 'port'",
|
|
24056
|
+
value: config.port,
|
|
24057
|
+
replacement: 'server.port'
|
|
24058
|
+
},
|
|
24059
|
+
{
|
|
24060
|
+
name: "top-level 'brief'",
|
|
24061
|
+
value: config.brief,
|
|
24062
|
+
replacement: 'output.options.htmlOptions'
|
|
24063
|
+
},
|
|
24064
|
+
{
|
|
24065
|
+
name: "'output.compressData'",
|
|
24066
|
+
value: config.output?.compressData,
|
|
24067
|
+
replacement: "output.mode: 'brief' and output.options.type: ['json']"
|
|
24068
|
+
}
|
|
24069
|
+
])void 0 !== value && rsdoctorLogger.info(external_rslog_color.yellow(`The ${name} configuration was removed in Rsdoctor 2.x and is ignored. Please use '${replacement}' instead.`));
|
|
24070
|
+
config.supports?.generateTileGraph !== void 0 && rsdoctorLogger.info(external_rslog_color.yellow("The 'supports.generateTileGraph' configuration was removed in Rsdoctor 2.x and is ignored. Treemap is supported by default."));
|
|
24071
|
+
let userOutput = config.output, outputConfig = 'json' === process.env.RSDOCTOR_OUTPUT ? {
|
|
24085
24072
|
reportDir: userOutput?.reportDir,
|
|
24086
|
-
compressData: userOutput?.compressData,
|
|
24087
24073
|
mode: 'brief',
|
|
24088
24074
|
options: {
|
|
24089
24075
|
type: [
|
|
24090
24076
|
'json'
|
|
24091
24077
|
]
|
|
24092
24078
|
}
|
|
24093
|
-
} : userOutput ??
|
|
24079
|
+
} : userOutput ?? {
|
|
24080
|
+
mode: void 0,
|
|
24081
|
+
options: void 0,
|
|
24082
|
+
reportDir: ''
|
|
24083
|
+
}, { linter = {}, features = {}, loaderInterceptorOptions = {}, disableClientServer: userDisableClientServer = !1, sdkInstance, innerClientPath = '', output = outputConfig, supports: userSupports = {}, server: userServer = {}, printLog = {
|
|
24094
24084
|
serverUrls: !0
|
|
24095
|
-
},
|
|
24085
|
+
}, multiCompiler = !0 } = {
|
|
24096
24086
|
...config,
|
|
24097
24087
|
output: outputConfig
|
|
24098
24088
|
}, supports = {
|
|
24099
|
-
|
|
24100
|
-
|
|
24101
|
-
},
|
|
24102
|
-
...userSupports,
|
|
24089
|
+
banner: defaultBoolean(userSupports.banner, !0),
|
|
24090
|
+
parseBundle: defaultBoolean(userSupports.parseBundle, !0),
|
|
24103
24091
|
gzip: (assert(void 0 === (value = userSupports.gzip) || 'boolean' == typeof value || 'object' == typeof value && null !== value && !Array.isArray(value), '`supports.gzip` must be a boolean or an object.'), !1 !== value && {
|
|
24104
24092
|
gzipLevel: (assert('number' == typeof (gzipLevel = void 0 === (value1 = 'object' == typeof value && null !== value ? value.gzipLevel : void 0) ? 6 : value1) && Number.isInteger(gzipLevel) && gzipLevel >= 0 && gzipLevel <= 9, '`supports.gzip.gzipLevel` must be an integer between 0 and 9.'), gzipLevel)
|
|
24105
24093
|
})
|
|
24106
24094
|
}, disableClientServer = 'true' !== process.env.RSTEST && (!!process.env.CI || userDisableClientServer);
|
|
24107
|
-
assert('object' == typeof linter), assert('object' == typeof features || Array.isArray(features)), assert('object' == typeof loaderInterceptorOptions), assert('boolean' == typeof disableClientServer), assert(
|
|
24095
|
+
assert('object' == typeof linter), assert('object' == typeof features || Array.isArray(features)), assert('object' == typeof loaderInterceptorOptions), assert('boolean' == typeof disableClientServer), assert('object' == typeof userServer && null !== userServer);
|
|
24108
24096
|
let server = {
|
|
24109
24097
|
...userServer
|
|
24110
24098
|
};
|
|
24111
|
-
assert(void 0 === server.port || 'number' == typeof server.port), assert('boolean' == typeof multiCompiler || 'object' == typeof multiCompiler && null !== multiCompiler)
|
|
24099
|
+
assert(void 0 === server.port || 'number' == typeof server.port), assert('boolean' == typeof multiCompiler || 'object' == typeof multiCompiler && null !== multiCompiler);
|
|
24112
24100
|
let finalMode1 = ('mode' in output && 'string' == typeof (mode = output.mode) && [
|
|
24113
24101
|
'brief',
|
|
24114
24102
|
'normal',
|
|
24115
24103
|
'lite'
|
|
24116
|
-
].includes(mode) ? 'lite' === output.mode ? SDK.IMode[SDK.IMode.normal] : output.mode : void 0) ||
|
|
24117
|
-
mode2 && rsdoctorLogger.info(external_rslog_color.yellow("The 'mode' configuration will be deprecated in a future version. Please use 'output.mode' instead."));
|
|
24118
|
-
let _features = (mode1 = finalMode1, Array.isArray(features) ? {
|
|
24104
|
+
].includes(mode) ? 'lite' === output.mode ? SDK.IMode[SDK.IMode.normal] : output.mode : void 0) || SDK.IMode[SDK.IMode.normal], _features = (mode1 = finalMode1, Array.isArray(features) ? {
|
|
24119
24105
|
loader: features.includes('loader'),
|
|
24120
24106
|
plugins: features.includes('plugins'),
|
|
24121
24107
|
resolver: features.includes('resolver'),
|
|
@@ -24134,12 +24120,9 @@ let normalizeReportType = (reportCodeType, mode)=>{
|
|
|
24134
24120
|
extends: [],
|
|
24135
24121
|
level: 'Error',
|
|
24136
24122
|
...linter
|
|
24137
|
-
}
|
|
24138
|
-
(_features.lite || finalMode1 === SDK.IMode[SDK.IMode.lite]) && rsdoctorLogger.info(external_rslog_color.yellow("Lite features will be deprecated in a future version. Please use 'output: { reportCodeType: { noAssetsAndModuleSource: true }}' instead."));
|
|
24139
|
-
let { finalBrief: finalBrief1, finalNormalOptions: finalNormalOptions1 } = (finalBrief = {}, finalNormalOptions = {}, 'brief' === (finalMode = finalMode1) ? finalBrief = function(output, brief) {
|
|
24123
|
+
}, { finalBrief: finalBrief1, finalNormalOptions: finalNormalOptions1 } = (finalBrief = {}, finalNormalOptions = {}, 'brief' === (finalMode = finalMode1) ? finalBrief = function(output) {
|
|
24140
24124
|
let htmlOptions = {
|
|
24141
|
-
reportHtmlName: void 0
|
|
24142
|
-
writeDataJson: !1
|
|
24125
|
+
reportHtmlName: void 0
|
|
24143
24126
|
}, jsonOptions = {}, briefOptions = output?.options || {};
|
|
24144
24127
|
if ('type' in briefOptions && briefOptions.type?.includes('json') && (jsonOptions = briefOptions.jsonOptions || {
|
|
24145
24128
|
fileName: 'rsdoctor-data.json',
|
|
@@ -24151,8 +24134,7 @@ let normalizeReportType = (reportCodeType, mode)=>{
|
|
|
24151
24134
|
}), 'type' in briefOptions && briefOptions.type?.includes('html') || !briefOptions.type) {
|
|
24152
24135
|
let outputBriefOptions = briefOptions?.htmlOptions;
|
|
24153
24136
|
htmlOptions = {
|
|
24154
|
-
reportHtmlName: outputBriefOptions?.reportHtmlName ||
|
|
24155
|
-
writeDataJson: outputBriefOptions?.writeDataJson || brief?.writeDataJson || !1
|
|
24137
|
+
reportHtmlName: outputBriefOptions?.reportHtmlName || void 0
|
|
24156
24138
|
};
|
|
24157
24139
|
}
|
|
24158
24140
|
return {
|
|
@@ -24162,12 +24144,17 @@ let normalizeReportType = (reportCodeType, mode)=>{
|
|
|
24162
24144
|
htmlOptions,
|
|
24163
24145
|
jsonOptions
|
|
24164
24146
|
};
|
|
24165
|
-
}(output
|
|
24147
|
+
}(output) : 'normal' === finalMode && (finalNormalOptions = {}), {
|
|
24166
24148
|
finalBrief,
|
|
24167
24149
|
finalNormalOptions
|
|
24168
24150
|
});
|
|
24169
24151
|
_features.lite && finalMode1 !== SDK.IMode[SDK.IMode.brief] && (finalMode1 = SDK.IMode[SDK.IMode.lite]);
|
|
24170
|
-
let
|
|
24152
|
+
let reportCodeType1 = (reportCodeType = output.reportCodeType, mode2 = finalMode1, (assert(void 0 === reportCodeType || [
|
|
24153
|
+
'noModuleSource',
|
|
24154
|
+
'noAssetsAndModuleSource',
|
|
24155
|
+
'noCode'
|
|
24156
|
+
].includes(reportCodeType), '`output.reportCodeType` must be "noModuleSource", "noAssetsAndModuleSource", or "noCode".'), mode2 === SDK.IMode[SDK.IMode.brief] && void 0 !== reportCodeType && 'noCode' !== reportCodeType && rsdoctorLogger.warn('`output.reportCodeType` is ignored when `output.mode` is "brief"; brief mode always uses "noCode".'), 'noCode' === reportCodeType || mode2 === SDK.IMode[SDK.IMode.brief]) ? SDK.ToDataType.NoCode : mode2 === SDK.IMode[SDK.IMode.lite] || 'noAssetsAndModuleSource' === reportCodeType ? SDK.ToDataType.NoSourceAndAssets : 'noModuleSource' === reportCodeType ? SDK.ToDataType.NoSource : SDK.ToDataType.Normal);
|
|
24157
|
+
return {
|
|
24171
24158
|
linter: _linter,
|
|
24172
24159
|
features: _features,
|
|
24173
24160
|
loaderInterceptorOptions: {
|
|
@@ -24178,12 +24165,11 @@ let normalizeReportType = (reportCodeType, mode)=>{
|
|
|
24178
24165
|
output: {
|
|
24179
24166
|
mode: finalMode1,
|
|
24180
24167
|
options: 'brief' === finalMode1 ? finalBrief1 : finalNormalOptions1,
|
|
24181
|
-
reportCodeType,
|
|
24168
|
+
reportCodeType: reportCodeType1,
|
|
24182
24169
|
reportDir: output.reportDir || ''
|
|
24183
24170
|
},
|
|
24184
24171
|
innerClientPath,
|
|
24185
24172
|
supports,
|
|
24186
|
-
port,
|
|
24187
24173
|
server,
|
|
24188
24174
|
printLog,
|
|
24189
24175
|
multiCompiler: {
|
|
@@ -24191,7 +24177,6 @@ let normalizeReportType = (reportCodeType, mode)=>{
|
|
|
24191
24177
|
group: 'object' == typeof multiCompiler ? multiCompiler.group : void 0
|
|
24192
24178
|
}
|
|
24193
24179
|
};
|
|
24194
|
-
return void 0 !== output.compressData && rsdoctorLogger.info(external_rslog_color.yellow("The 'compressData' configuration will be deprecated in a future version.")), res;
|
|
24195
24180
|
}, execAsync = promisify(external_node_child_process_exec), supportedChromiumBrowsers = [
|
|
24196
24181
|
'Google Chrome Canary',
|
|
24197
24182
|
'Google Chrome Dev',
|
|
@@ -24379,6 +24364,7 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
24379
24364
|
}
|
|
24380
24365
|
}
|
|
24381
24366
|
getInterceptRules(compiler, rules) {
|
|
24367
|
+
let cacheMarkerPath = this.getCacheMarkerPath(compiler);
|
|
24382
24368
|
return function(rules, loaderPath, options, loaderResolver, cwd = process.cwd()) {
|
|
24383
24369
|
return mapEachRules(rules, (rule)=>{
|
|
24384
24370
|
if (rule.loader?.startsWith('builtin:') || rule.loader?.endsWith('.mjs') || isESMLoader(rule)) return rule;
|
|
@@ -24402,11 +24388,22 @@ class InternalLoaderPlugin extends InternalBasePlugin {
|
|
|
24402
24388
|
};
|
|
24403
24389
|
});
|
|
24404
24390
|
}(rules, this.internalLoaderPath, {
|
|
24391
|
+
cacheMarkerPath,
|
|
24405
24392
|
cwd: compiler.context || process.cwd(),
|
|
24406
24393
|
host: this.sdk.server.origin,
|
|
24407
24394
|
skipLoaders: this.options.loaderInterceptorOptions.skipLoaders
|
|
24408
24395
|
}, compiler.resolverFactory.get('loader', compiler.options.resolveLoader), this.sdk.root);
|
|
24409
24396
|
}
|
|
24397
|
+
getCacheMarkerPath(compiler) {
|
|
24398
|
+
if ('object' != typeof compiler.options.cache || 'persistent' !== compiler.options.cache.type) return;
|
|
24399
|
+
if (this.cacheMarkerPath) return this.cacheMarkerPath;
|
|
24400
|
+
let markerPath = node_path.join(this.sdk.outputDir, '.loader-cache');
|
|
24401
|
+
node_fs.mkdirSync(node_path.dirname(markerPath), {
|
|
24402
|
+
recursive: !0
|
|
24403
|
+
});
|
|
24404
|
+
let previous = node_fs.existsSync(markerPath) ? node_fs.readFileSync(markerPath, 'utf8') : '', prefix = previous.length < 4096 ? previous : '';
|
|
24405
|
+
return node_fs.writeFileSync(markerPath, `${prefix}${randomUUID()}\n`), this.cacheMarkerPath = markerPath, markerPath;
|
|
24406
|
+
}
|
|
24410
24407
|
constructor(...args){
|
|
24411
24408
|
super(...args), this.name = 'loader', this.internalLoaderPath = loader_require.resolve('@rsdoctor/core/proxy-loader'), this.afterPlugins = (compiler)=>{
|
|
24412
24409
|
logger_time('InternalLoaderPlugin.afterPlugins');
|
|
@@ -24592,7 +24589,7 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
24592
24589
|
try {
|
|
24593
24590
|
this.scheduler.ensureModulesChunksGraphApplied(compiler), this.changeDevtoolModuleFilename(compiler), compiler.hooks.compilation.tap(this.tapPostOptions, (compilation)=>{
|
|
24594
24591
|
compilation.compiler && compilation.compiler !== compiler || this.thisCompilation(compilation);
|
|
24595
|
-
}), compiler.isChild() ? compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.done.bind(this)) : compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
|
|
24592
|
+
}), compiler.isChild() ? compiler.hooks.afterCompile.tapPromise(this.tapPreOptions, this.done.bind(this, compiler)) : compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this, compiler));
|
|
24596
24593
|
} finally{
|
|
24597
24594
|
logger_timeEnd('InternalBundlePlugin.apply');
|
|
24598
24595
|
}
|
|
@@ -24621,10 +24618,11 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
24621
24618
|
} finally{
|
|
24622
24619
|
logger_timeEnd('InternalBundlePlugin.thisCompilation');
|
|
24623
24620
|
}
|
|
24624
|
-
}, this.done = async ()=>{
|
|
24621
|
+
}, this.done = async (compiler)=>{
|
|
24625
24622
|
logger_time('InternalBundlePlugin.done');
|
|
24626
24623
|
try {
|
|
24627
|
-
|
|
24624
|
+
var gzip;
|
|
24625
|
+
this.scheduler.chunkGraph && Chunks.assetsContents(this.map, this.scheduler.chunkGraph, (gzip = this.scheduler.options.supports.gzip, !isCompilerWatching(compiler) && gzip)), this.sdk.addClientRoutes([
|
|
24628
24626
|
Manifest.RsdoctorManifestClientRoutes.ModuleGraph,
|
|
24629
24627
|
Manifest.RsdoctorManifestClientRoutes.BundleSize
|
|
24630
24628
|
]);
|
|
@@ -24694,6 +24692,9 @@ async function collectSourceMaps(map, assetLinesCodeList, _compilation, _this, s
|
|
|
24694
24692
|
}
|
|
24695
24693
|
}
|
|
24696
24694
|
}
|
|
24695
|
+
function markAssetWithoutSourceMap(assetsWithoutSourceMap, assetName) {
|
|
24696
|
+
'string' == typeof assetName && /\.(?:js|bundle|css)$/.test(assetName) && assetsWithoutSourceMap.add(assetName);
|
|
24697
|
+
}
|
|
24697
24698
|
async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace) {
|
|
24698
24699
|
if ('rspack' in compilation.compiler) {
|
|
24699
24700
|
_this.sourceMapSets = new Map(), _this.assetsWithoutSourceMap ? _this.assetsWithoutSourceMap.clear() : _this.assetsWithoutSourceMap = new Set(), logger_time('ensureModulesChunkGraph.afterEmit.start');
|
|
@@ -24752,20 +24753,27 @@ async function handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex,
|
|
|
24752
24753
|
let baseNameWithoutHash = Graph.formatAssetName(sourceMapFileAssetName, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0);
|
|
24753
24754
|
sourceMapAsset = assets.find((asset)=>Graph.formatAssetName(asset.name, 'string' == typeof compilation.options.output.filename ? compilation.options.output.filename : void 0).includes(baseNameWithoutHash) && asset.name.endsWith('.map'));
|
|
24754
24755
|
}
|
|
24755
|
-
|
|
24756
|
-
|
|
24757
|
-
|
|
24758
|
-
|
|
24756
|
+
try {
|
|
24757
|
+
let sourceMapContent = sourceMapAsset?.source?.source();
|
|
24758
|
+
sourceMapContent && (map = JSON.parse(sourceMapContent.toString()));
|
|
24759
|
+
} catch (error) {
|
|
24760
|
+
rsdoctorLogger.debug(`Error parsing source map asset ${sourceMapFile}:`, error);
|
|
24759
24761
|
}
|
|
24762
|
+
if (!map) {
|
|
24763
|
+
markAssetWithoutSourceMap(_this.assetsWithoutSourceMap, assetName);
|
|
24764
|
+
continue;
|
|
24765
|
+
}
|
|
24766
|
+
let outputPath = compilation.options.output?.path;
|
|
24767
|
+
outputPath && 'string' == typeof outputPath && sourceMapAsset && (sourceMapPath = external_path_resolve(outputPath, sourceMapAsset.name));
|
|
24760
24768
|
} else {
|
|
24761
|
-
|
|
24769
|
+
markAssetWithoutSourceMap(_this.assetsWithoutSourceMap, assetName);
|
|
24762
24770
|
continue;
|
|
24763
24771
|
}
|
|
24764
24772
|
}
|
|
24765
24773
|
try {
|
|
24766
24774
|
await collectSourceMaps(map, assetLinesCodeList, compilation, _this, sourceMapFilenameRegex, namespace, skipSources, sourceMapPath);
|
|
24767
24775
|
} catch (e) {
|
|
24768
|
-
rsdoctorLogger.debug(e);
|
|
24776
|
+
rsdoctorLogger.debug(e), markAssetWithoutSourceMap(_this.assetsWithoutSourceMap, assetName);
|
|
24769
24777
|
}
|
|
24770
24778
|
_this.sourceMapSets.forEach((_value, key)=>{
|
|
24771
24779
|
skipSources.has(key) || skipSources.add(key);
|
|
@@ -24957,15 +24965,16 @@ let hasConsole = !1, ensureModulesChunksGraphFn = (compiler, _this)=>{
|
|
|
24957
24965
|
});
|
|
24958
24966
|
};
|
|
24959
24967
|
async function doneHandler(_this, compiler, nativeGraphState) {
|
|
24968
|
+
var gzip;
|
|
24960
24969
|
if (!nativeGraphState.chunkGraph || !_this.chunkGraph) throw Error('[RsdoctorRspackPlugin] The Rspack native plugin did not provide chunk graph data.');
|
|
24961
24970
|
if (!nativeGraphState.moduleGraph) throw Error('[RsdoctorRspackPlugin] The Rspack native plugin did not provide module graph data.');
|
|
24962
|
-
let shouldParseBundle = !1 !== _this.options.supports.parseBundle, gzip = _this.options.supports.gzip;
|
|
24963
|
-
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap, !1 ===
|
|
24971
|
+
let shouldParseBundle = !1 !== _this.options.supports.parseBundle, gzip1 = (gzip = _this.options.supports.gzip, !isCompilerWatching(compiler) && gzip);
|
|
24972
|
+
await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap, !1 === gzip1 ? {
|
|
24964
24973
|
enabled: !1
|
|
24965
24974
|
} : {
|
|
24966
24975
|
enabled: !0,
|
|
24967
|
-
level:
|
|
24968
|
-
}), rsdoctorLogger.debug('reportModuleGraph start'), await _this.sdk.reportModuleGraph(_this.modulesGraph), rsdoctorLogger.debug('reportModuleGraph done'), rsdoctorLogger.debug('reportChunkGraph start'), await _this.sdk.reportChunkGraph(_this.chunkGraph), rsdoctorLogger.debug('reportChunkGraph done'),
|
|
24976
|
+
level: gzip1.gzipLevel
|
|
24977
|
+
}), rsdoctorLogger.debug('reportModuleGraph start'), await _this.sdk.reportModuleGraph(_this.modulesGraph), rsdoctorLogger.debug('reportModuleGraph done'), rsdoctorLogger.debug('reportChunkGraph start'), await _this.sdk.reportChunkGraph(_this.chunkGraph), rsdoctorLogger.debug('reportChunkGraph done'), rsdoctorLogger.debug('doneHandler done');
|
|
24969
24978
|
}
|
|
24970
24979
|
let ensureDevtools = (compiler)=>{
|
|
24971
24980
|
let devtool = compiler.options.devtool;
|
|
@@ -25058,7 +25067,7 @@ class rule_Rule {
|
|
|
25058
25067
|
function defineRule(ruleCreator) {
|
|
25059
25068
|
return ruleCreator();
|
|
25060
25069
|
}
|
|
25061
|
-
var types_CheckVersionMap = ((CheckVersionMap = {})[CheckVersionMap.null = 0] = "null", CheckVersionMap[CheckVersionMap.prerelease =
|
|
25070
|
+
var types_CheckVersionMap = ((CheckVersionMap = {})[CheckVersionMap.null = 0] = "null", CheckVersionMap[CheckVersionMap.prerelease = 0x0000001] = "prerelease", CheckVersionMap[CheckVersionMap.prepatch = 0x0000011] = "prepatch", CheckVersionMap[CheckVersionMap.patch = 0x0000111] = "patch", CheckVersionMap[CheckVersionMap.preminor = 0x0001111] = "preminor", CheckVersionMap[CheckVersionMap.minor = 0x0011111] = "minor", CheckVersionMap[CheckVersionMap.premajor = 0x0111111] = "premajor", CheckVersionMap[CheckVersionMap.major = 0x1111111] = "major", CheckVersionMap);
|
|
25062
25071
|
let { J: duplicate_package_CheckVersionMap } = duplicate_package_types_namespaceObject, duplicate_package_rule = defineRule(()=>({
|
|
25063
25072
|
meta: {
|
|
25064
25073
|
code: 'E1001',
|
|
@@ -25127,7 +25136,7 @@ let { J: duplicate_package_CheckVersionMap } = duplicate_package_types_namespace
|
|
|
25127
25136
|
return node = dep.dependency.getProgram(), compare = [
|
|
25128
25137
|
exportsDefault,
|
|
25129
25138
|
moduleExportsDefault
|
|
25130
|
-
], !node.body.filter(parser_parser.asserts.isExpressionStatement).map((node)=>node.expression).filter(parser_parser.asserts.isAssignmentExpression).map((node)=>node.left).find((node)=>compare.some((item)=>parser_parser.utils.
|
|
25139
|
+
], !node.body.filter(parser_parser.asserts.isExpressionStatement).map((node)=>node.expression).filter(parser_parser.asserts.isAssignmentExpression).map((node)=>node.left).find((node)=>compare.some((item)=>parser_parser.utils.isSameSyntax(node, item)));
|
|
25131
25140
|
}).map((dependency)=>{
|
|
25132
25141
|
var node;
|
|
25133
25142
|
let { module, request } = dependency, node1 = module.getProgram() && (node = module.getProgram(), parser_parser.utils.getDefaultImports(node).find((decl)=>decl.source.value === request));
|
|
@@ -25255,7 +25264,7 @@ let loader_performance_optimization_rule = defineRule(()=>({
|
|
|
25255
25264
|
}
|
|
25256
25265
|
let sum = (arr)=>{
|
|
25257
25266
|
let v1 = arr.reduce((t, c)=>t + c.__costs__, 0), v2 = Math.max.apply(null, arr.map((e)=>e.endAt)) - Math.min.apply(arr.map((e)=>e.startAt));
|
|
25258
|
-
return v2 >= v1 ||
|
|
25267
|
+
return v2 >= v1 || -1 / 0 === v2 ? v1 : v2;
|
|
25259
25268
|
};
|
|
25260
25269
|
for (let [loaderName, v] of resultMap.entries()){
|
|
25261
25270
|
let nodeModulesFiles = v.filter((e)=>nodeModulesPathRegexp.test(e.__resource__.path)), nodeModulesFilesCosts = sum(nodeModulesFiles), outofCwdFiles = v.filter((e)=>!e.__resource__.path.startsWith(cwd)), outofCwdFilesCosts = sum(outofCwdFiles), msg = [
|
|
@@ -25371,7 +25380,7 @@ class ECMASyntaxError extends Error {
|
|
|
25371
25380
|
super(message), _define_property(this, "source", void 0), _define_property(this, "output", void 0), this.source = options.source, this.output = options.output;
|
|
25372
25381
|
}
|
|
25373
25382
|
}
|
|
25374
|
-
let
|
|
25383
|
+
let dist_isExcluded = (input, exclude)=>{
|
|
25375
25384
|
if (!exclude) return !1;
|
|
25376
25385
|
let excludes = Array.isArray(exclude) ? exclude : [
|
|
25377
25386
|
exclude
|
|
@@ -25398,7 +25407,7 @@ async function generateError({ err, code, filepath, rootPath, exclude, excludeEr
|
|
|
25398
25407
|
column: err.loc.column,
|
|
25399
25408
|
code: displayCodePointer(code, err.pos)
|
|
25400
25409
|
}
|
|
25401
|
-
})),
|
|
25410
|
+
})), dist_isExcluded(error.source.absolutePath, exclude) || dist_isExcluded(error.message, excludeErrorMessage)) ? null : error;
|
|
25402
25411
|
}
|
|
25403
25412
|
async function tryGenerateErrorFromSourceMap({ err, code, rootPath, outputFilepath, relativeOutputPath }) {
|
|
25404
25413
|
let sourceMapPath = `${outputFilepath}.map`;
|
|
@@ -25464,18 +25473,8 @@ async function tryGenerateErrorFromSourceMap({ err, code, rootPath, outputFilepa
|
|
|
25464
25473
|
}
|
|
25465
25474
|
async function generateHtmlScripts(filepath) {
|
|
25466
25475
|
var html;
|
|
25467
|
-
let
|
|
25468
|
-
return html = await node_fs.promises.readFile(filepath, 'utf-8'),
|
|
25469
|
-
onopentag (name, attrs) {
|
|
25470
|
-
"script" !== name || attrs.src || attrs.type && "application/javascript" !== attrs.type && "text/javascript" !== attrs.type || (currentScript = '');
|
|
25471
|
-
},
|
|
25472
|
-
ontext (text) {
|
|
25473
|
-
null !== currentScript && (currentScript += text);
|
|
25474
|
-
},
|
|
25475
|
-
onclosetag (tagname) {
|
|
25476
|
-
"script" === tagname && currentScript && inlineScripts.push(currentScript.trim()), currentScript = null;
|
|
25477
|
-
}
|
|
25478
|
-
})).write(html), parser.end(), inlineScripts;
|
|
25476
|
+
let parser;
|
|
25477
|
+
return html = await node_fs.promises.readFile(filepath, 'utf-8'), (parser = new Parser()).write(html), parser.end(), [];
|
|
25479
25478
|
}
|
|
25480
25479
|
function checkSyntax_define_property(obj, key, value) {
|
|
25481
25480
|
return key in obj ? Object.defineProperty(obj, key, {
|
|
@@ -25492,7 +25491,7 @@ class CheckSyntax {
|
|
|
25492
25491
|
if (HTML_REGEX.test(filepath)) {
|
|
25493
25492
|
let htmlScripts = await generateHtmlScripts(filepath);
|
|
25494
25493
|
await Promise.all(htmlScripts.map(async (script)=>{
|
|
25495
|
-
|
|
25494
|
+
dist_isExcluded(filepath, this.exclude) || await this.tryParse(filepath, script);
|
|
25496
25495
|
}));
|
|
25497
25496
|
}
|
|
25498
25497
|
if (JS_REGEX.test(filepath)) {
|
|
@@ -25717,35 +25716,54 @@ let ecma_version_check_rule = defineRule(()=>({
|
|
|
25717
25716
|
category: 'bundle',
|
|
25718
25717
|
severity: Linter.Severity.Warn,
|
|
25719
25718
|
defaultConfig: {
|
|
25720
|
-
ecmaVersion: void 0
|
|
25721
|
-
targets: []
|
|
25719
|
+
ecmaVersion: void 0
|
|
25722
25720
|
}
|
|
25723
25721
|
},
|
|
25724
25722
|
async check ({ chunkGraph, report, ruleConfig, root, configs }) {
|
|
25725
|
-
|
|
25726
|
-
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
|
|
25730
|
-
|
|
25731
|
-
|
|
25732
|
-
|
|
25733
|
-
|
|
25734
|
-
|
|
25735
|
-
|
|
25736
|
-
|
|
25737
|
-
|
|
25738
|
-
|
|
25739
|
-
|
|
25740
|
-
|
|
25741
|
-
|
|
25742
|
-
|
|
25743
|
-
|
|
25744
|
-
|
|
25745
|
-
|
|
25723
|
+
let assets = chunkGraph.getAssets().filter((asset)=>{
|
|
25724
|
+
let extension = path_0.extname(asset.path);
|
|
25725
|
+
return '.js' === extension || '.bundle' === extension;
|
|
25726
|
+
});
|
|
25727
|
+
if (!assets.length) return;
|
|
25728
|
+
let { exclude, excludeErrorMessage, excludeOutput, targets, ecmaVersion } = ruleConfig, hasEcmaVersion = void 0 !== ecmaVersion, buildConfig = configs[0]?.config, context = buildConfig?.context || root, finalTargets = targets ?? (hasEcmaVersion ? [] : loadConfig({
|
|
25729
|
+
path: context,
|
|
25730
|
+
env: 'production'
|
|
25731
|
+
})) ?? [];
|
|
25732
|
+
if (!finalTargets.length && !hasEcmaVersion) return;
|
|
25733
|
+
let outputDir = buildConfig?.output?.path || path_0.resolve(root, 'dist'), checkSyntax = new CheckSyntax({
|
|
25734
|
+
exclude,
|
|
25735
|
+
excludeErrorMessage,
|
|
25736
|
+
excludeOutput,
|
|
25737
|
+
ecmaVersion,
|
|
25738
|
+
rootPath: context,
|
|
25739
|
+
targets: finalTargets
|
|
25740
|
+
});
|
|
25741
|
+
for (let asset of assets){
|
|
25742
|
+
let assetPath = path_0.resolve(outputDir, asset.path);
|
|
25743
|
+
!function(filepath, exclude) {
|
|
25744
|
+
if (!exclude) return !1;
|
|
25745
|
+
let conditions = Array.isArray(exclude) ? exclude : [
|
|
25746
|
+
exclude
|
|
25747
|
+
], normalizedPath = filepath.replace(/\\/g, '/');
|
|
25748
|
+
return conditions.some((condition)=>{
|
|
25749
|
+
if ('function' == typeof condition) return condition(filepath);
|
|
25750
|
+
if ('string' == typeof condition) return normalizedPath.startsWith(condition.replace(/\\/g, '/'));
|
|
25751
|
+
let lastIndex = condition.lastIndex;
|
|
25752
|
+
condition.lastIndex = 0;
|
|
25753
|
+
let isExcluded = condition.test(normalizedPath);
|
|
25754
|
+
return condition.lastIndex = lastIndex, isExcluded;
|
|
25746
25755
|
});
|
|
25747
|
-
});
|
|
25756
|
+
}(assetPath, excludeOutput) && await checkSyntax.check(assetPath, asset.content);
|
|
25748
25757
|
}
|
|
25758
|
+
checkSyntax.errors.forEach((err)=>{
|
|
25759
|
+
report({
|
|
25760
|
+
message: `Found syntax that does not match "ecmaVersion <= ${checkSyntax.ecmaVersion}"`,
|
|
25761
|
+
detail: {
|
|
25762
|
+
error: err,
|
|
25763
|
+
type: 'link'
|
|
25764
|
+
}
|
|
25765
|
+
});
|
|
25766
|
+
});
|
|
25749
25767
|
}
|
|
25750
25768
|
})), cross_chunks_package_title = 'cross-chunks-package', cross_chunks_package_rule = defineRule(()=>({
|
|
25751
25769
|
meta: {
|
|
@@ -25921,7 +25939,7 @@ function normalizePathForCompare(filePath) {
|
|
|
25921
25939
|
let splitIndex = [
|
|
25922
25940
|
filePath.indexOf('?'),
|
|
25923
25941
|
filePath.indexOf('#')
|
|
25924
|
-
].filter((index)=>index >= 0).reduce((min, index)=>Math.min(min, index), 1 / 0), cleanPath =
|
|
25942
|
+
].filter((index)=>index >= 0).reduce((min, index)=>Math.min(min, index), 1 / 0), cleanPath = 1 / 0 === splitIndex ? filePath : filePath.slice(0, splitIndex);
|
|
25925
25943
|
return path_0.normalize(cleanPath);
|
|
25926
25944
|
}
|
|
25927
25945
|
function isRecord(value) {
|
|
@@ -26081,6 +26099,16 @@ class linter_Linter {
|
|
|
26081
26099
|
await Promise.all(this.rules.map((rule)=>rule.afterValidate(context)));
|
|
26082
26100
|
}
|
|
26083
26101
|
}
|
|
26102
|
+
let ECMA_VERSION_CHECK_CODE = 'E1004';
|
|
26103
|
+
function formatLocation(error) {
|
|
26104
|
+
let syntaxError = error.detail?.error, location = syntaxError?.output ?? syntaxError?.source;
|
|
26105
|
+
if (!location?.path) return;
|
|
26106
|
+
let position = [
|
|
26107
|
+
location.line,
|
|
26108
|
+
location.column
|
|
26109
|
+
].filter((value)=>'number' == typeof value).join(':');
|
|
26110
|
+
return position ? `${location.path}:${position}` : location.path;
|
|
26111
|
+
}
|
|
26084
26112
|
class InternalRulesPlugin extends InternalBasePlugin {
|
|
26085
26113
|
apply(compiler) {
|
|
26086
26114
|
logger_time('InternalRulesPlugin.apply');
|
|
@@ -26098,12 +26126,35 @@ class InternalRulesPlugin extends InternalBasePlugin {
|
|
|
26098
26126
|
controller: {
|
|
26099
26127
|
noColor: !0
|
|
26100
26128
|
}
|
|
26101
|
-
})), errors = validateErrors.filter((item)=>'Error' === item.level), warnings = validateErrors.filter((item)=>'Warn' === item.level)
|
|
26129
|
+
})), errors = validateErrors.filter((item)=>'Error' === item.level), warnings = validateErrors.filter((item)=>'Warn' === item.level), compilationWarnings = function(warnings) {
|
|
26130
|
+
let firstWarning, target, issueCount, locations, displayedLocations, remainingFileCount, message, ecmaVersionWarnings = warnings.filter(({ code })=>code === ECMA_VERSION_CHECK_CODE);
|
|
26131
|
+
if (!ecmaVersionWarnings.length) return warnings;
|
|
26132
|
+
let summary = (firstWarning = ecmaVersionWarnings[0], target = firstWarning.message.match(/"([^"]+)"/)?.[1], issueCount = ecmaVersionWarnings.length, displayedLocations = (locations = [
|
|
26133
|
+
...new Set(ecmaVersionWarnings.map(formatLocation).filter(Boolean))
|
|
26134
|
+
]).slice(0, 3), remainingFileCount = locations.length - displayedLocations.length, message = [
|
|
26135
|
+
`Found ${issueCount} incompatible syntax ${1 === issueCount ? 'issue' : 'issues'}${target ? ` for "${target}"` : ''}.`,
|
|
26136
|
+
displayedLocations.length ? `Affected outputs: ${displayedLocations.join(', ')}${remainingFileCount > 0 ? `, ... (+${remainingFileCount} more ${1 === remainingFileCount ? 'file' : 'files'})` : ''}` : void 0,
|
|
26137
|
+
'View the Rsdoctor report for source-level details.'
|
|
26138
|
+
].filter(Boolean).join('\n'), new DevToolError(firstWarning.title, message, {
|
|
26139
|
+
category: firstWarning.category,
|
|
26140
|
+
code: firstWarning.code,
|
|
26141
|
+
controller: {
|
|
26142
|
+
noColor: !0
|
|
26143
|
+
},
|
|
26144
|
+
detail: firstWarning.detail,
|
|
26145
|
+
level: firstWarning.level
|
|
26146
|
+
})), summaryAdded = !1;
|
|
26147
|
+
return warnings.flatMap((warning)=>warning.code !== ECMA_VERSION_CHECK_CODE ? [
|
|
26148
|
+
warning
|
|
26149
|
+
] : summaryAdded ? [] : (summaryAdded = !0, [
|
|
26150
|
+
summary
|
|
26151
|
+
]));
|
|
26152
|
+
}(warnings);
|
|
26102
26153
|
result.replace.forEach((item)=>{
|
|
26103
26154
|
Array.isArray(compilation.errors) && compilation.errors.includes(item) && pull(compilation.errors, item), Array.isArray(compilation.warnings) && compilation.warnings.includes(item) && pull(compilation.warnings, item);
|
|
26104
26155
|
}), Array.isArray(compilation.errors) && errors.forEach((err)=>{
|
|
26105
26156
|
compilation.errors.push(err.toError());
|
|
26106
|
-
}), Array.isArray(compilation.warnings) &&
|
|
26157
|
+
}), Array.isArray(compilation.warnings) && compilationWarnings.forEach((err)=>{
|
|
26107
26158
|
compilation.warnings.push(err.toError());
|
|
26108
26159
|
}), this.sdk.reportError(validateErrors), await linter.afterValidate({
|
|
26109
26160
|
data: this.sdk.getRuleContext({}),
|
|
@@ -26171,4 +26222,5 @@ class InternalResolverPlugin extends InternalBasePlugin {
|
|
|
26171
26222
|
};
|
|
26172
26223
|
}
|
|
26173
26224
|
}
|
|
26174
|
-
export {
|
|
26225
|
+
export { default as fs_extra } from "fs-extra";
|
|
26226
|
+
export { DevToolError, InternalBundlePlugin, InternalErrorReporterPlugin, InternalLoaderPlugin, InternalPluginsPlugin, InternalResolverPlugin, InternalRulesPlugin, InternalSummaryPlugin, Linter as LinterType, ProbeLoaderPlugin, createServer, defaultHost, defaultPort, defineRule, ensureModulesChunksGraphFn, getCPUInfo, getInternalLoaderOptions, getMemoryInfo, getNodeVersion, getNpmVersion, getOriginLoaderModule, getPnpmVersion, getPortSync, getRspackNativePlugin, getYarnVersion, handleBriefModeReport, isCompilerWatching, linter_Linter as Linter, normalizeRspackUserOptions, processCompilerConfig, reportLoader, rule_Rule as LinterRule, rules_rules as rules, shouldSkipLoader };
|