@rsdoctor/core 2.0.0-beta.2 → 2.0.0-beta.3
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 +3 -0
- package/dist/compat.d.ts +34 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +55 -3
- package/package.json +3 -4
- package/dist/build-utils/build/module-graph/parser.d.ts +0 -2
- package/dist/build-utils/build/module-graph/utils.d.ts +0 -3
- package/dist/common/file.d.ts +0 -2
- package/dist/rules/rules/ecma-version-check/utils.d.ts +0 -2
package/dist/26.js
CHANGED
|
@@ -24630,6 +24630,8 @@ class InternalBundlePlugin extends InternalBasePlugin {
|
|
|
24630
24630
|
this.scheduler.chunkGraph && Chunks.assetsContents(this.map, this.scheduler.chunkGraph, (compression = this.scheduler.options.supports.gzip, !isCompilerWatching(compiler) && compression), (compression1 = this.scheduler.options.supports.brotli, !isCompilerWatching(compiler) && compression1)), this.sdk.addClientRoutes([
|
|
24631
24631
|
Manifest.RsdoctorManifestClientRoutes.ModuleGraph,
|
|
24632
24632
|
Manifest.RsdoctorManifestClientRoutes.BundleSize
|
|
24633
|
+
]), this.options.features.treeShaking && 'brief' !== this.options.output.mode && this.sdk.addClientRoutes([
|
|
24634
|
+
Manifest.RsdoctorManifestClientRoutes.TreeShaking
|
|
24633
24635
|
]);
|
|
24634
24636
|
} finally{
|
|
24635
24637
|
logger_timeEnd('InternalBundlePlugin.done');
|
|
@@ -25726,6 +25728,7 @@ let ecma_version_check_rule = defineRule(()=>({
|
|
|
25726
25728
|
},
|
|
25727
25729
|
async check ({ chunkGraph, report, ruleConfig, root, configs }) {
|
|
25728
25730
|
let assets = chunkGraph.getAssets().filter((asset)=>{
|
|
25731
|
+
if (asset.path.endsWith('.lynx.bundle')) return !1;
|
|
25729
25732
|
let extension = path_0.extname(asset.path);
|
|
25730
25733
|
return '.js' === extension || '.bundle' === extension;
|
|
25731
25734
|
});
|
package/dist/compat.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Config, Linter, Plugin } from '@rsdoctor/shared/types';
|
|
2
|
+
type LegacyBriefConfig = Config.BriefConfig & {
|
|
3
|
+
writeDataJson?: boolean;
|
|
4
|
+
};
|
|
5
|
+
/** Options accepted by framework integrations migrating from Rsdoctor 1.x. */
|
|
6
|
+
export type CompatibleRsdoctorOptions<Rules extends Linter.ExtendRuleData[] = []> = Omit<Plugin.RsdoctorRspackPluginOptions<Rules>, 'output' | 'supports'> & {
|
|
7
|
+
mode?: 'normal' | 'brief' | 'lite';
|
|
8
|
+
port?: number;
|
|
9
|
+
brief?: LegacyBriefConfig;
|
|
10
|
+
experiments?: {
|
|
11
|
+
enableNativePlugin?: boolean | {
|
|
12
|
+
moduleGraph?: boolean;
|
|
13
|
+
chunkGraph?: boolean;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
supports?: Plugin.RsdoctorRspackPluginOptions<Rules>['supports'] & {
|
|
17
|
+
generateTileGraph?: boolean;
|
|
18
|
+
};
|
|
19
|
+
output?: {
|
|
20
|
+
mode?: 'normal' | 'brief';
|
|
21
|
+
reportDir?: string;
|
|
22
|
+
reportCodeType?: Config.NewReportCodeType | Partial<Record<Config.NewReportCodeType, boolean>>;
|
|
23
|
+
compressData?: boolean;
|
|
24
|
+
options?: Omit<Config.BriefModeOptions, 'htmlOptions'> & {
|
|
25
|
+
htmlOptions?: LegacyBriefConfig;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Translate legacy options before constructing the plugin. Explicit current
|
|
31
|
+
* options take precedence. The input is never mutated; only legacy fields log.
|
|
32
|
+
*/
|
|
33
|
+
export declare function migrateRsdoctorOptions<Rules extends Linter.ExtendRuleData[] = []>(config?: CompatibleRsdoctorOptions<Rules>): Plugin.RsdoctorRspackPluginOptions<Rules>;
|
|
34
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { logger } from './logger.js';
|
|
2
|
+
export { migrateRsdoctorOptions } from './compat.js';
|
|
3
|
+
export type { CompatibleRsdoctorOptions } from './compat.js';
|
|
2
4
|
export { RsdoctorRspackPlugin } from './rspack-plugin/index.js';
|
|
3
5
|
export { Linter, LinterType, Rule as LinterRule, defineRule, rules, } from './rules/index.js';
|
|
4
6
|
export { RsdoctorSDK, resolveClientDiffHtmlPath } from './sdk/index.js';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import "node:module";
|
|
2
2
|
import { __webpack_require__ } from "./rslib-runtime.js";
|
|
3
|
+
import { Algorithm, Bundle, Data, Loader, Lodash, decycle } from "@rsdoctor/shared/common-browser";
|
|
4
|
+
import node_assert from "node:assert";
|
|
3
5
|
import node_fs from "node:fs";
|
|
4
6
|
import fs_extra from "fs-extra";
|
|
5
7
|
import path_0 from "path";
|
|
@@ -8,7 +10,6 @@ import { Client, Constants, Manifest, SDK } from "@rsdoctor/shared/types";
|
|
|
8
10
|
import { SourceMapConsumer } from "source-map";
|
|
9
11
|
import { ChunkGraph, ModuleGraph, PackageGraph } from "@rsdoctor/shared/graph";
|
|
10
12
|
import sirv from "sirv";
|
|
11
|
-
import { Algorithm, Bundle, Data, Loader, Lodash, decycle } from "@rsdoctor/shared/common-browser";
|
|
12
13
|
import fs from "fs";
|
|
13
14
|
import os_0 from "os";
|
|
14
15
|
import assert from "assert";
|
|
@@ -31,6 +32,57 @@ import { setSDK, logger as rsdoctorLogger, logger_time, timeEnd, color, stringif
|
|
|
31
32
|
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";
|
|
32
33
|
import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
33
34
|
var date, __rspack_import_meta_dirname__ = __rspack_dirname(__rspack_fileURLToPath(import.meta.url)), apis_namespaceObject = {};
|
|
35
|
+
function migrateRsdoctorOptions(config = {}) {
|
|
36
|
+
let { mode, port, brief, output, supports, experiments, ...rest } = config, migrations = [], migrate = (value, from, to)=>{
|
|
37
|
+
void 0 !== value && migrations.push(`${from} → ${to}`);
|
|
38
|
+
}, result = {
|
|
39
|
+
...rest
|
|
40
|
+
};
|
|
41
|
+
if (migrate(experiments?.enableNativePlugin, 'experiments.enableNativePlugin', 'remove (the native plugin is always enabled)'), migrate(port, 'port', 'server.port'), void 0 !== port && (result.server = {
|
|
42
|
+
...config.server,
|
|
43
|
+
port: config.server?.port ?? port
|
|
44
|
+
}), supports) {
|
|
45
|
+
let { generateTileGraph, ...currentSupports } = supports;
|
|
46
|
+
migrate(generateTileGraph, 'supports.generateTileGraph', 'remove (treemap is always supported)'), result.supports = currentSupports;
|
|
47
|
+
}
|
|
48
|
+
if (migrate(mode, 'mode', 'lite' === mode ? 'output.reportCodeType' : 'output.mode'), migrate(brief, 'brief', 'output.options.htmlOptions'), migrate(output?.compressData, 'output.compressData', "output.mode: 'brief', output.options.type: ['json']"), migrate(brief?.writeDataJson, 'brief.writeDataJson', "output.options.type: ['html', 'json']"), migrate(output?.options?.htmlOptions?.writeDataJson, 'output.options.htmlOptions.writeDataJson', "output.options.type: ['html', 'json']"), output || void 0 !== mode) {
|
|
49
|
+
let codeType, { compressData, reportCodeType, options, ...currentOutput } = output ?? {};
|
|
50
|
+
null != reportCodeType && 'object' == typeof reportCodeType ? (node_assert(Lodash.isPlainObject(reportCodeType), '`output.reportCodeType` must be a string or a plain object of legacy flags.'), codeType = [
|
|
51
|
+
'noCode',
|
|
52
|
+
'noAssetsAndModuleSource',
|
|
53
|
+
'noModuleSource'
|
|
54
|
+
].find((key)=>reportCodeType[key]), migrate(reportCodeType, 'output.reportCodeType (object)', 'output.reportCodeType (string)')) : codeType = reportCodeType ?? void 0;
|
|
55
|
+
let outputMode = output?.mode ?? (!0 === compressData ? 'brief' : 'lite' === mode ? 'normal' : mode);
|
|
56
|
+
if ('lite' === mode && output?.mode === void 0 && (codeType ??= 'noAssetsAndModuleSource'), 'brief' === outputMode) {
|
|
57
|
+
let { writeDataJson, ...htmlOptions } = options?.htmlOptions ?? {}, reportHtmlName = htmlOptions.reportHtmlName ?? brief?.reportHtmlName;
|
|
58
|
+
result.output = {
|
|
59
|
+
...currentOutput,
|
|
60
|
+
mode: 'brief',
|
|
61
|
+
reportCodeType: void 0 === codeType ? void 0 : 'noCode',
|
|
62
|
+
options: {
|
|
63
|
+
...options,
|
|
64
|
+
type: options?.type ?? (writeDataJson ?? brief?.writeDataJson ? [
|
|
65
|
+
'html',
|
|
66
|
+
'json'
|
|
67
|
+
] : !0 === compressData ? [
|
|
68
|
+
'json'
|
|
69
|
+
] : [
|
|
70
|
+
'html'
|
|
71
|
+
]),
|
|
72
|
+
htmlOptions: {
|
|
73
|
+
...htmlOptions,
|
|
74
|
+
reportHtmlName
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
} else result.output = {
|
|
79
|
+
...currentOutput,
|
|
80
|
+
mode: outputMode,
|
|
81
|
+
reportCodeType: codeType
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return migrations.length && rsdoctorLogger.warn(`Legacy Rsdoctor options detected. The compatibility layer applied the available migrations; explicit current options take precedence. Please migrate your configuration: ${migrations.join('; ')}.`), result;
|
|
85
|
+
}
|
|
34
86
|
__webpack_require__.r(apis_namespaceObject), __webpack_require__.d(apis_namespaceObject, {
|
|
35
87
|
AlertsAPI: ()=>AlertsAPI,
|
|
36
88
|
BundleDiffAPI: ()=>BundleDiffAPI,
|
|
@@ -1697,7 +1749,7 @@ class RsdoctorSDKController {
|
|
|
1697
1749
|
return this.slaves.filter((item)=>this.activeSlaves.has(item));
|
|
1698
1750
|
}
|
|
1699
1751
|
}
|
|
1700
|
-
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/core","version":"2.0.0-beta.
|
|
1752
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/core","version":"2.0.0-beta.3","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","typescript":"catalog:"},"peerDependencies":{"@rspack/core":"^2.0.0"},"peerDependenciesMeta":{"@rspack/core":{"optional":true}},"engines":{"node":"^20.19.0 || >=22.12.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
1701
1753
|
let pluginTapName = 'RsdoctorRspackPlugin', pluginTapPostOptions = {
|
|
1702
1754
|
name: pluginTapName,
|
|
1703
1755
|
stage: 999
|
|
@@ -1963,4 +2015,4 @@ class RsdoctorRspackPlugin {
|
|
|
1963
2015
|
}
|
|
1964
2016
|
export { Linter, LinterRule, LinterType, defineRule, rules } from "./26.js";
|
|
1965
2017
|
export { logger } from "./630.js";
|
|
1966
|
-
export { RsdoctorRspackPlugin, RsdoctorSDK, resolveClientDiffHtmlPath };
|
|
2018
|
+
export { RsdoctorRspackPlugin, RsdoctorSDK, migrateRsdoctorOptions, resolveClientDiffHtmlPath };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"sirv": "3.0.2",
|
|
58
58
|
"source-map": "^0.7.6",
|
|
59
59
|
"ws": "8.21.3",
|
|
60
|
-
"@rsdoctor/client": "2.0.0-beta.
|
|
61
|
-
"@rsdoctor/shared": "2.0.0-beta.
|
|
60
|
+
"@rsdoctor/client": "2.0.0-beta.3",
|
|
61
|
+
"@rsdoctor/shared": "2.0.0-beta.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@rsbuild/plugin-check-syntax": "^1.6.1",
|
|
@@ -75,7 +75,6 @@
|
|
|
75
75
|
"json-stream-stringify": "3.0.1",
|
|
76
76
|
"string-loader": "0.0.1",
|
|
77
77
|
"ts-loader": "^9.6.2",
|
|
78
|
-
"tslib": "2.8.1",
|
|
79
78
|
"typescript": "^7.0.2",
|
|
80
79
|
"@scripts/test-helper": "0.1.1"
|
|
81
80
|
},
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { SDK } from '@rsdoctor/shared/types';
|
|
2
|
-
export declare function getExportIdentifierStatement(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
|
|
3
|
-
export declare function getDeclarationIdentifier(name: string, module: SDK.ModuleInstance): SDK.StatementInstance | undefined;
|
package/dist/common/file.d.ts
DELETED