@rsdoctor/core 2.0.0-alpha.1 → 2.0.0-beta.0
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 +26174 -0
- package/dist/630.js +1280 -0
- package/dist/630.js.LICENSE.txt +7 -0
- package/dist/build-utils/build/chunks/assetsModules.d.ts +7 -1
- package/dist/build-utils/build/loader/probeLoader.d.ts +7 -2
- package/dist/build-utils/build/server.d.ts +1 -2
- package/dist/build-utils/build/utils/parseBundle.d.ts +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +1908 -7
- package/dist/inner-plugins/constants.d.ts +1 -1
- package/dist/inner-plugins/plugins/base.d.ts +2 -2
- package/dist/inner-plugins/plugins/errors.d.ts +1 -0
- package/dist/inner-plugins/plugins/plugins.d.ts +1 -1
- package/dist/inner-plugins/plugins/summary.d.ts +3 -2
- package/dist/inner-plugins/utils/sdk.d.ts +2 -1
- package/dist/logger.d.ts +2 -2
- package/dist/probe-loader.js +2 -0
- package/dist/proxy-loader.d.ts +1 -0
- package/dist/proxy-loader.js +48 -0
- package/dist/rslib-runtime.js +28 -0
- package/dist/rspack-plugin/constants.d.ts +1 -1
- package/dist/rspack-plugin/multiple.d.ts +5 -3
- package/dist/rspack-plugin/plugin.d.ts +43 -17
- package/dist/rspack-plugin/session.d.ts +20 -0
- package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +3 -0
- package/dist/rules/rules/ecma-version-check/types.d.ts +13 -2
- package/dist/sdk/multiple/controller.d.ts +13 -2
- package/dist/sdk/multiple/primary.d.ts +12 -4
- package/dist/sdk/server/apis/base.d.ts +1 -1
- package/dist/sdk/server/socket/api.d.ts +1 -1
- package/dist/sdk/utils/date.d.ts +1 -0
- package/dist/types/loader.d.ts +1 -1
- package/package.json +23 -117
- package/dist/build-utils/build/chunks/assetsModules.js +0 -9
- package/dist/build-utils/build/chunks/index.js +0 -3
- package/dist/build-utils/build/chunks/rspack/transform.js +0 -44
- package/dist/build-utils/build/envinfo.js +0 -60
- package/dist/build-utils/build/file/cache.js +0 -24
- package/dist/build-utils/build/file/index.js +0 -5
- package/dist/build-utils/build/file/sharding.js +0 -38
- package/dist/build-utils/build/index.js +0 -12
- package/dist/build-utils/build/json.js +0 -67
- package/dist/build-utils/build/loader/index.js +0 -3
- package/dist/build-utils/build/loader/probeLoader.js +0 -44
- package/dist/build-utils/build/loader/probeLoaderPlugin.js +0 -32
- package/dist/build-utils/build/module-graph/index.js +0 -2
- package/dist/build-utils/build/module-graph/parser.js +0 -13
- package/dist/build-utils/build/module-graph/rspack/transform.js +0 -111
- package/dist/build-utils/build/module-graph/utils.js +0 -60
- package/dist/build-utils/build/process.js +0 -18
- package/dist/build-utils/build/server.js +0 -107
- package/dist/build-utils/build/utils/index.js +0 -4
- package/dist/build-utils/build/utils/loader.js +0 -267
- package/dist/build-utils/build/utils/parseBundle.js +0 -238
- package/dist/build-utils/build/utils/plugin.js +0 -21
- package/dist/build-utils/index.js +0 -13
- package/dist/collection.d.ts +0 -1
- package/dist/collection.js +0 -2
- package/dist/common/file.js +0 -8
- package/dist/common/global-config.js +0 -33
- package/dist/common/index.d.ts +0 -4
- package/dist/common/index.js +0 -6
- package/dist/common-browser.d.ts +0 -1
- package/dist/common-browser.js +0 -2
- package/dist/error/error.js +0 -143
- package/dist/error/index.js +0 -3
- package/dist/error/transform.js +0 -138
- package/dist/error/utils.js +0 -23
- package/dist/graph/index.d.ts +0 -1
- package/dist/graph/index.js +0 -2
- package/dist/inner-plugins/constants.js +0 -19
- package/dist/inner-plugins/index.js +0 -3
- package/dist/inner-plugins/loaders/proxy.js +0 -65
- package/dist/inner-plugins/plugins/base.js +0 -20
- package/dist/inner-plugins/plugins/bundle.js +0 -63
- package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +0 -74
- package/dist/inner-plugins/plugins/errors.js +0 -65
- package/dist/inner-plugins/plugins/index.js +0 -11
- package/dist/inner-plugins/plugins/loader.js +0 -108
- package/dist/inner-plugins/plugins/plugins.js +0 -40
- package/dist/inner-plugins/plugins/progress.js +0 -35
- package/dist/inner-plugins/plugins/resolver.js +0 -57
- package/dist/inner-plugins/plugins/rspack.js +0 -99
- package/dist/inner-plugins/plugins/rules.js +0 -64
- package/dist/inner-plugins/plugins/sourcemapTool.js +0 -230
- package/dist/inner-plugins/plugins/summary.js +0 -92
- package/dist/inner-plugins/utils/circleDetect.js +0 -16
- package/dist/inner-plugins/utils/config.js +0 -141
- package/dist/inner-plugins/utils/index.js +0 -8
- package/dist/inner-plugins/utils/loader.js +0 -134
- package/dist/inner-plugins/utils/normalize-config.js +0 -77
- package/dist/inner-plugins/utils/openBrowser.js +0 -55
- package/dist/inner-plugins/utils/plugin-common.js +0 -94
- package/dist/inner-plugins/utils/plugin.js +0 -70
- package/dist/inner-plugins/utils/sdk.js +0 -19
- package/dist/logger.js +0 -51
- package/dist/rspack-plugin/constants.js +0 -23
- package/dist/rspack-plugin/index.js +0 -3
- package/dist/rspack-plugin/multiple.js +0 -39
- package/dist/rspack-plugin/plugin.js +0 -133
- package/dist/rule-utils/document/document.js +0 -46
- package/dist/rule-utils/document/index.js +0 -4
- package/dist/rule-utils/document/server.js +0 -13
- package/dist/rule-utils/document/types.js +0 -1
- package/dist/rule-utils/index.js +0 -3
- package/dist/rule-utils/parser/asserts.js +0 -105
- package/dist/rule-utils/parser/index.js +0 -5
- package/dist/rule-utils/parser/parser.js +0 -24
- package/dist/rule-utils/parser/types.js +0 -8
- package/dist/rule-utils/parser/utils.js +0 -106
- package/dist/rules/index.js +0 -4
- package/dist/rules/linter.js +0 -36
- package/dist/rules/rule.js +0 -101
- package/dist/rules/rules/cjs-require/index.js +0 -50
- package/dist/rules/rules/cjs-require/types.js +0 -1
- package/dist/rules/rules/cross-chunks-package/index.js +0 -41
- package/dist/rules/rules/cross-chunks-package/types.js +0 -1
- package/dist/rules/rules/cross-chunks-package/utils.js +0 -7
- package/dist/rules/rules/default-import-check/index.js +0 -83
- package/dist/rules/rules/default-import-check/types.js +0 -1
- package/dist/rules/rules/default-import-check/utils.js +0 -52
- package/dist/rules/rules/duplicate-package/index.js +0 -39
- package/dist/rules/rules/duplicate-package/types.js +0 -24
- package/dist/rules/rules/duplicate-package/utils.js +0 -38
- package/dist/rules/rules/ecma-version-check/index.js +0 -53
- package/dist/rules/rules/ecma-version-check/types.js +0 -1
- package/dist/rules/rules/ecma-version-check/utils.js +0 -6
- package/dist/rules/rules/esm-resolved-to-cjs/index.js +0 -193
- package/dist/rules/rules/esm-resolved-to-cjs/types.js +0 -1
- package/dist/rules/rules/index.js +0 -22
- package/dist/rules/rules/loader-performance-optimization/index.js +0 -86
- package/dist/rules/rules/loader-performance-optimization/types.js +0 -1
- package/dist/rules/rules/loader-performance-optimization/utils.js +0 -10
- package/dist/rules/rules/module-mixed-chunks/index.js +0 -52
- package/dist/rules/rules/module-mixed-chunks/types.js +0 -1
- package/dist/rules/rules/side-effects-only-imports/index.js +0 -81
- package/dist/rules/rules/side-effects-only-imports/types.js +0 -1
- package/dist/rules/utils.js +0 -10
- package/dist/sdk/index.js +0 -3
- package/dist/sdk/multiple/controller.js +0 -42
- package/dist/sdk/multiple/index.js +0 -3
- package/dist/sdk/multiple/primary.js +0 -64
- package/dist/sdk/multiple/server.js +0 -14
- package/dist/sdk/sdk/core.js +0 -163
- package/dist/sdk/sdk/index.js +0 -435
- package/dist/sdk/sdk/types.js +0 -1
- package/dist/sdk/server/apis/alerts.js +0 -30
- package/dist/sdk/server/apis/base.js +0 -22
- package/dist/sdk/server/apis/bundle-diff.js +0 -51
- package/dist/sdk/server/apis/data.js +0 -44
- package/dist/sdk/server/apis/fs.js +0 -28
- package/dist/sdk/server/apis/graph.js +0 -116
- package/dist/sdk/server/apis/index.js +0 -11
- package/dist/sdk/server/apis/loader.js +0 -120
- package/dist/sdk/server/apis/plugin.js +0 -39
- package/dist/sdk/server/apis/project.js +0 -59
- package/dist/sdk/server/apis/renderer.js +0 -33
- package/dist/sdk/server/apis/resolver.js +0 -38
- package/dist/sdk/server/client.js +0 -8
- package/dist/sdk/server/fakeServer.js +0 -12
- package/dist/sdk/server/index.js +0 -292
- package/dist/sdk/server/json-body.js +0 -150
- package/dist/sdk/server/router.js +0 -83
- package/dist/sdk/server/security.js +0 -47
- package/dist/sdk/server/socket/api.js +0 -22
- package/dist/sdk/server/socket/index.js +0 -166
- package/dist/sdk/server/utils.js +0 -19
- package/dist/sdk/utils/base.js +0 -22
- package/dist/sdk/utils/constant.js +0 -4
- package/dist/sdk/utils/index.js +0 -4
- package/dist/sdk/utils/openBrowser.js +0 -53
- package/dist/sdk/utils/upload.js +0 -6
- package/dist/sdk.js +0 -2
- package/dist/types/index.js +0 -4
- package/dist/types/loader.js +0 -1
- package/dist/types/plugin.js +0 -1
- package/dist/types/rules.js +0 -1
|
@@ -7,6 +7,6 @@ export declare abstract class InternalBasePlugin<T extends Plugin.BaseCompiler>
|
|
|
7
7
|
abstract apply(compiler: T): void;
|
|
8
8
|
get options(): Plugin.RsdoctorPluginOptionsNormalized<Linter.ExtendRuleData<any, string>[]>;
|
|
9
9
|
get sdk(): SDK.RsdoctorBuilderSDKInstance;
|
|
10
|
-
get tapPostOptions(): import("tapable").Tap;
|
|
11
|
-
get tapPreOptions(): import("tapable").Tap;
|
|
10
|
+
get tapPostOptions(): import("@rspack/lite-tapable").Tap;
|
|
11
|
+
get tapPreOptions(): import("@rspack/lite-tapable").Tap;
|
|
12
12
|
}
|
|
@@ -5,6 +5,7 @@ export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler>
|
|
|
5
5
|
readonly name = "error-reporter";
|
|
6
6
|
apply(compiler: T): void;
|
|
7
7
|
done: (stats: Plugin.BaseStats) => Promise<void>;
|
|
8
|
+
afterCompile: (compilation: Plugin.BaseCompilation) => Promise<void>;
|
|
8
9
|
handleBundlerError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
|
|
9
10
|
reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
|
|
10
11
|
reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
|
|
@@ -4,5 +4,5 @@ export declare class InternalPluginsPlugin<T extends Plugin.BaseCompiler> extend
|
|
|
4
4
|
readonly name = "plugins";
|
|
5
5
|
apply(compiler: Plugin.BaseCompiler): void;
|
|
6
6
|
afterPlugins: (compiler: Plugin.BaseCompiler) => void;
|
|
7
|
-
compilation: (compilation: Plugin.BaseCompilation) => void;
|
|
7
|
+
compilation: (compiler: Plugin.BaseCompiler, compilation: Plugin.BaseCompilation) => void;
|
|
8
8
|
}
|
|
@@ -5,10 +5,11 @@ export declare class InternalSummaryPlugin<T extends Plugin.BaseCompiler> extend
|
|
|
5
5
|
private times;
|
|
6
6
|
private preTimes;
|
|
7
7
|
private postTimes;
|
|
8
|
+
private readonly createdAt;
|
|
8
9
|
apply(compiler: T): void;
|
|
9
10
|
private mark;
|
|
10
|
-
beforeCompile: () => Promise<void>;
|
|
11
|
-
afterCompile: (compilation: Plugin.BaseCompilation) => Promise<void>;
|
|
11
|
+
beforeCompile: (compiler: T) => Promise<void>;
|
|
12
|
+
afterCompile: (compiler: T, compilation: Plugin.BaseCompilation) => Promise<void>;
|
|
12
13
|
done: (compiler: T) => Promise<void>;
|
|
13
14
|
private report;
|
|
14
15
|
}
|
|
@@ -4,4 +4,5 @@ declare global {
|
|
|
4
4
|
var __rsdoctor_sdk__: SDK.RsdoctorBuilderSDKInstance | undefined;
|
|
5
5
|
}
|
|
6
6
|
export declare function setSDK(t: SDK.RsdoctorBuilderSDKInstance): void;
|
|
7
|
-
export declare function
|
|
7
|
+
export declare function registerSDK(t: SDK.RsdoctorBuilderSDKInstance, asDefault?: boolean): void;
|
|
8
|
+
export declare function getSDK(compilerId?: string): SDK.RsdoctorBuilderSDKInstance | undefined;
|
package/dist/logger.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { color } from 'rslog';
|
|
2
2
|
/**
|
|
3
3
|
* log debug message
|
|
4
4
|
*/
|
|
@@ -6,4 +6,4 @@ export declare function debug(getMsg: () => string, prefix?: string): void;
|
|
|
6
6
|
declare const rsdoctorLogger: import("rslog").Logger;
|
|
7
7
|
declare function time(label: string): void;
|
|
8
8
|
declare function timeEnd(label: string): void;
|
|
9
|
-
export { time, timeEnd,
|
|
9
|
+
export { time, timeEnd, color as chalk, rsdoctorLogger as logger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, pitch, raw } from './inner-plugins/loaders/proxy.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
import { shouldSkipLoader, reportLoader, getOriginLoaderModule } from "./26.js";
|
|
3
|
+
import { createLoaderContextTrap } from "./630.js";
|
|
4
|
+
let loaderModule = function(...args) {
|
|
5
|
+
if (shouldSkipLoader(this)) return void this.callback(null, ...args);
|
|
6
|
+
this.cacheable(!1);
|
|
7
|
+
let mod = getOriginLoaderModule(this);
|
|
8
|
+
if (mod.default) {
|
|
9
|
+
!1 === mod.raw && Buffer.isBuffer(args[0]) && (args[0] = args[0].toString());
|
|
10
|
+
let start = 0, startHRTime = [
|
|
11
|
+
0,
|
|
12
|
+
0
|
|
13
|
+
], trap = createLoaderContextTrap.call(this, (err, res, sourceMap)=>{
|
|
14
|
+
reportLoader(this, start, startHRTime, !1, !1, args[0].toString(), err, res, sourceMap);
|
|
15
|
+
});
|
|
16
|
+
start = Date.now(), startHRTime = process.hrtime();
|
|
17
|
+
try {
|
|
18
|
+
let result = mod.default.apply(trap, args);
|
|
19
|
+
return !result || result instanceof Promise || reportLoader(this, start, startHRTime, !1, !0, args[0].toString(), null, result), result || '';
|
|
20
|
+
} catch (error) {
|
|
21
|
+
throw reportLoader(this, start, startHRTime, !1, !0, args[0].toString(), error, null), error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
this.callback(null, ...args);
|
|
25
|
+
}, pitch = function() {
|
|
26
|
+
if (shouldSkipLoader(this)) return;
|
|
27
|
+
this.cacheable(!1);
|
|
28
|
+
let mod = getOriginLoaderModule(this);
|
|
29
|
+
if (mod.pitch && 'function' == typeof mod.pitch) {
|
|
30
|
+
let start = 0, startHRTime = [
|
|
31
|
+
0,
|
|
32
|
+
0
|
|
33
|
+
], trap = createLoaderContextTrap.call(this, (err, res)=>{
|
|
34
|
+
reportLoader(this, start, startHRTime, !0, !1, err ? 'Loader Pitch Async Error' : '', err, res);
|
|
35
|
+
});
|
|
36
|
+
start = Date.now(), startHRTime = process.hrtime();
|
|
37
|
+
try {
|
|
38
|
+
let res = mod.pitch.apply(trap, arguments);
|
|
39
|
+
return !res || res instanceof Promise || reportLoader(this, start, startHRTime, !0, !0, '', null, res), res;
|
|
40
|
+
} catch (error) {
|
|
41
|
+
throw reportLoader(this, start, startHRTime, !0, !0, 'Loader Pitch Sync Error', error, null), error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
loaderModule.raw = !0, loaderModule.pitch = pitch;
|
|
46
|
+
let raw = !0;
|
|
47
|
+
export default loaderModule;
|
|
48
|
+
export { pitch, raw };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
var __webpack_modules__ = {}, __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
return __webpack_modules__[moduleId](module, module.exports, __webpack_require__), module.exports;
|
|
10
|
+
}
|
|
11
|
+
__webpack_require__.m = __webpack_modules__, __webpack_require__.d = (exports, getters, values)=>{
|
|
12
|
+
var define = (defs, kind)=>{
|
|
13
|
+
for(var key in defs)__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key) && Object.defineProperty(exports, key, {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
[kind]: defs[key]
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
define(getters, "get"), define(values, "value");
|
|
19
|
+
}, __webpack_require__.add = function(modules) {
|
|
20
|
+
Object.assign(__webpack_require__.m, modules);
|
|
21
|
+
}, __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop), __webpack_require__.r = (exports)=>{
|
|
22
|
+
"u" > typeof Symbol && Symbol.toStringTag && Object.defineProperty(exports, Symbol.toStringTag, {
|
|
23
|
+
value: 'Module'
|
|
24
|
+
}), Object.defineProperty(exports, '__esModule', {
|
|
25
|
+
value: !0
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export { __webpack_require__ };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type { Linter } from '@rsdoctor/shared/types';
|
|
1
2
|
import type { RsdoctorMultiplePluginOptions } from '../types/index.js';
|
|
2
|
-
import { type Linter, type Plugin } from '@rsdoctor/shared/types';
|
|
3
3
|
import { RsdoctorRspackPlugin } from './plugin.js';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use {@link RsdoctorRspackPlugin}. Multi-compiler builds are now
|
|
6
|
+
* detected and isolated automatically.
|
|
7
|
+
*/
|
|
4
8
|
export declare class RsdoctorRspackMultiplePlugin<Rules extends Linter.ExtendRuleData[]> extends RsdoctorRspackPlugin<Rules> {
|
|
5
|
-
private controller;
|
|
6
9
|
constructor(options?: RsdoctorMultiplePluginOptions<Rules>);
|
|
7
|
-
apply(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
8
10
|
}
|
|
@@ -1,25 +1,51 @@
|
|
|
1
|
-
import type { RsdoctorRspackPluginInstance, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../types/index.js';
|
|
2
1
|
import { RsdoctorPrimarySDK } from '../sdk/index.js';
|
|
2
|
+
import type { RsdoctorRspackPluginInstance, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../types/index.js';
|
|
3
3
|
import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
|
|
4
|
+
declare class RsdoctorCompilerContext implements RsdoctorRspackPluginInstance<Linter.ExtendRuleData[]> {
|
|
5
|
+
readonly sdk: SDK.RsdoctorBuilderSDKInstance;
|
|
6
|
+
readonly options: RsdoctorRspackPluginOptionsNormalized<Linter.ExtendRuleData[]>;
|
|
7
|
+
readonly name = "RsdoctorRspackPlugin";
|
|
8
|
+
readonly isRsdoctorPlugin = true;
|
|
9
|
+
readonly modulesGraph: SDK.ModuleGraphInstance;
|
|
10
|
+
bootstrapTask?: Promise<unknown>;
|
|
11
|
+
applied: boolean;
|
|
12
|
+
constructor(sdk: SDK.RsdoctorBuilderSDKInstance, options: RsdoctorRspackPluginOptionsNormalized<Linter.ExtendRuleData[]>);
|
|
13
|
+
apply(): void;
|
|
14
|
+
ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
15
|
+
}
|
|
4
16
|
export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorRspackPluginInstance<Rules> {
|
|
5
17
|
readonly name = "RsdoctorRspackPlugin";
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
18
|
+
readonly isRsdoctorPlugin = true;
|
|
19
|
+
readonly options: RsdoctorRspackPluginOptionsNormalized<Rules>;
|
|
20
|
+
readonly outsideInstance: boolean;
|
|
21
|
+
private readonly childOptions;
|
|
22
|
+
private readonly defaultName;
|
|
23
|
+
private readonly defaultStage?;
|
|
24
|
+
private readonly controller?;
|
|
25
|
+
private readonly sessionLease?;
|
|
26
|
+
private readonly primaryContext;
|
|
27
|
+
private readonly compilerContexts;
|
|
28
|
+
private readonly childPlugins;
|
|
29
|
+
private appliedCompilerCount;
|
|
13
30
|
constructor(options?: RsdoctorRspackPluginOptions<Rules>);
|
|
31
|
+
get sdk(): SDK.RsdoctorBuilderSDKInstance;
|
|
32
|
+
get modulesGraph(): SDK.ModuleGraphInstance;
|
|
33
|
+
get _bootstrapTask(): Promise<unknown>;
|
|
34
|
+
getCompilerSDK(name: string): SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK | undefined;
|
|
14
35
|
apply(compiler: unknown): unknown;
|
|
15
|
-
/**
|
|
16
|
-
* @description Generate ModuleGraph and ChunkGraph from the Rspack native plugin.
|
|
17
|
-
* @param {Compiler} compiler
|
|
18
|
-
* @return {*}
|
|
19
|
-
* @memberof RsdoctorRspackPlugin
|
|
20
|
-
*/
|
|
21
36
|
ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
|
|
22
|
-
afterPlugins: (compiler: Plugin.BaseCompilerType<'rspack'
|
|
23
|
-
done: (compiler: Plugin.BaseCompilerType<'rspack'
|
|
24
|
-
getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'
|
|
37
|
+
afterPlugins: (compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext) => void;
|
|
38
|
+
done: (compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext) => Promise<void>;
|
|
39
|
+
getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext): void;
|
|
40
|
+
private createCompilerContext;
|
|
41
|
+
private getCompilerContext;
|
|
42
|
+
private getOutputDir;
|
|
43
|
+
private getBriefReportFileName;
|
|
44
|
+
private applyChildCompilerSupport;
|
|
45
|
+
private registerChildCompiler;
|
|
46
|
+
private removeInheritedRsdoctorTaps;
|
|
47
|
+
private childDone;
|
|
48
|
+
private shouldDisposeSDK;
|
|
49
|
+
private releasePendingSessionOnRun;
|
|
25
50
|
}
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RsdoctorSDKController } from '../sdk/index.js';
|
|
2
|
+
export interface RsdoctorBuildSessionOptions {
|
|
3
|
+
multiCompiler: {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
group?: string;
|
|
6
|
+
};
|
|
7
|
+
output: {
|
|
8
|
+
mode: string;
|
|
9
|
+
reportDir: string;
|
|
10
|
+
};
|
|
11
|
+
server: {
|
|
12
|
+
port?: number;
|
|
13
|
+
};
|
|
14
|
+
port?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface RsdoctorBuildSessionLease {
|
|
17
|
+
controller: RsdoctorSDKController;
|
|
18
|
+
release(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function acquireBuildSession(options: RsdoctorBuildSessionOptions): RsdoctorBuildSessionLease;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ecmaVersion as EcmaVersion } from 'acorn';
|
|
2
|
+
type Condition = string | RegExp | ((filepath: string) => boolean);
|
|
3
|
+
type CheckSyntaxExclude = Condition | Condition[];
|
|
4
|
+
type SyntaxErrorKey = 'source' | 'output' | 'reason' | 'code';
|
|
5
|
+
export type Config = {
|
|
6
|
+
targets?: string[];
|
|
7
|
+
exclude?: CheckSyntaxExclude;
|
|
8
|
+
excludeOutput?: CheckSyntaxExclude;
|
|
9
|
+
excludeErrorMessage?: RegExp | RegExp[];
|
|
10
|
+
excludeErrorLogs?: SyntaxErrorKey[];
|
|
11
|
+
ecmaVersion?: EcmaVersion;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -2,11 +2,22 @@ import { Manifest } from '@rsdoctor/shared/types';
|
|
|
2
2
|
import { RsdoctorPrimarySDK } from './primary.js';
|
|
3
3
|
export declare class RsdoctorSDKController {
|
|
4
4
|
readonly slaves: RsdoctorPrimarySDK[];
|
|
5
|
+
private readonly activeSlaves;
|
|
6
|
+
private outputDir;
|
|
7
|
+
private outputOwner?;
|
|
8
|
+
private refreshManifestTask;
|
|
5
9
|
root: string;
|
|
6
10
|
constructor(root?: string);
|
|
7
11
|
get master(): RsdoctorPrimarySDK;
|
|
12
|
+
get isMultiple(): boolean;
|
|
8
13
|
getLastSdk(): RsdoctorPrimarySDK;
|
|
9
|
-
hasName(name: string): boolean;
|
|
14
|
+
hasName(name: string, exclude?: RsdoctorPrimarySDK): boolean;
|
|
15
|
+
registerSlave(slave: RsdoctorPrimarySDK): void;
|
|
16
|
+
setOutputDir(slave: RsdoctorPrimarySDK, outputDir: string): void;
|
|
17
|
+
getCompilerOutputDir(slave: RsdoctorPrimarySDK): string;
|
|
10
18
|
getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
|
|
11
|
-
|
|
19
|
+
getBriefSeriesData(current: RsdoctorPrimarySDK): Manifest.RsdoctorManifestSeriesData[];
|
|
20
|
+
createSlave({ name, displayName, compilerPath, parentCompilerPath, isChild, stage, extraConfig, type, }: Omit<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'controller'>): RsdoctorPrimarySDK;
|
|
21
|
+
refreshManifestSeries(): Promise<void>;
|
|
22
|
+
private getActiveSlaves;
|
|
12
23
|
}
|
|
@@ -3,6 +3,10 @@ import { RsdoctorSDK } from '../sdk/index.js';
|
|
|
3
3
|
import type { RsdoctorSDKController } from './controller.js';
|
|
4
4
|
interface RsdoctorSlaveSDKOptions {
|
|
5
5
|
name: string;
|
|
6
|
+
displayName?: string;
|
|
7
|
+
compilerPath?: string;
|
|
8
|
+
parentCompilerPath?: string;
|
|
9
|
+
isChild?: boolean;
|
|
6
10
|
/**
|
|
7
11
|
* use to sort for display in the client page.
|
|
8
12
|
* the smaller the front.
|
|
@@ -17,16 +21,20 @@ export declare class RsdoctorPrimarySDK extends RsdoctorSDK implements SDK.Rsdoc
|
|
|
17
21
|
id: number;
|
|
18
22
|
parent: RsdoctorSDKController;
|
|
19
23
|
readonly stage: number;
|
|
24
|
+
displayName: string;
|
|
25
|
+
readonly compilerPath: string;
|
|
26
|
+
readonly parentCompilerPath?: string;
|
|
27
|
+
readonly isChild: boolean;
|
|
20
28
|
dependencies: Array<string> | undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
constructor({ name, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
|
|
24
|
-
private clearSwitch;
|
|
29
|
+
reportFileName: string;
|
|
30
|
+
constructor({ name, displayName, compilerPath, parentCompilerPath, isChild, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
|
|
25
31
|
get isMaster(): boolean;
|
|
26
32
|
protected writePieces(): Promise<void>;
|
|
27
33
|
protected writeManifest(): Promise<string>;
|
|
34
|
+
refreshManifestSeries(): Promise<void>;
|
|
28
35
|
getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
|
|
29
36
|
setName(name: string): void;
|
|
30
37
|
getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
|
|
38
|
+
addRsdoctorDataToHTML(storeData: SDK.BuilderStoreData, htmlContent: string): string;
|
|
31
39
|
}
|
|
32
40
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatLocalDate: (date: Date) => string;
|
package/dist/types/loader.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/core",
|
|
3
|
-
"version": "2.0.0-
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
7
7
|
"directory": "packages/core"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=22.18.0"
|
|
12
|
+
},
|
|
10
13
|
"main": "dist/index.js",
|
|
11
14
|
"types": "dist/index.d.ts",
|
|
12
15
|
"files": [
|
|
13
16
|
"dist",
|
|
14
|
-
"compiled",
|
|
15
17
|
"static"
|
|
16
18
|
],
|
|
17
19
|
"type": "module",
|
|
@@ -20,57 +22,9 @@
|
|
|
20
22
|
"types": "./dist/index.d.ts",
|
|
21
23
|
"default": "./dist/index.js"
|
|
22
24
|
},
|
|
23
|
-
"./
|
|
24
|
-
"types": "./dist/
|
|
25
|
-
"default": "./dist/
|
|
26
|
-
},
|
|
27
|
-
"./collection": {
|
|
28
|
-
"types": "./dist/collection.d.ts",
|
|
29
|
-
"default": "./dist/collection.js"
|
|
30
|
-
},
|
|
31
|
-
"./common": {
|
|
32
|
-
"types": "./dist/common/index.d.ts",
|
|
33
|
-
"default": "./dist/common/index.js"
|
|
34
|
-
},
|
|
35
|
-
"./common-browser": {
|
|
36
|
-
"types": "./dist/common-browser.d.ts",
|
|
37
|
-
"default": "./dist/common-browser.js"
|
|
38
|
-
},
|
|
39
|
-
"./graph": {
|
|
40
|
-
"types": "./dist/graph/index.d.ts",
|
|
41
|
-
"default": "./dist/graph/index.js"
|
|
42
|
-
},
|
|
43
|
-
"./error": {
|
|
44
|
-
"types": "./dist/error/index.d.ts",
|
|
45
|
-
"default": "./dist/error/index.js"
|
|
46
|
-
},
|
|
47
|
-
"./logger": {
|
|
48
|
-
"types": "./dist/logger.d.ts",
|
|
49
|
-
"default": "./dist/logger.js"
|
|
50
|
-
},
|
|
51
|
-
"./sdk": {
|
|
52
|
-
"types": "./dist/sdk.d.ts",
|
|
53
|
-
"default": "./dist/sdk.js"
|
|
54
|
-
},
|
|
55
|
-
"./plugins": {
|
|
56
|
-
"types": "./dist/inner-plugins/index.d.ts",
|
|
57
|
-
"default": "./dist/inner-plugins/index.js"
|
|
58
|
-
},
|
|
59
|
-
"./rspack-plugin": {
|
|
60
|
-
"types": "./dist/rspack-plugin/index.d.ts",
|
|
61
|
-
"default": "./dist/rspack-plugin/index.js"
|
|
62
|
-
},
|
|
63
|
-
"./rules": {
|
|
64
|
-
"types": "./dist/rules/index.d.ts",
|
|
65
|
-
"default": "./dist/rules/index.js"
|
|
66
|
-
},
|
|
67
|
-
"./rule-utils": {
|
|
68
|
-
"types": "./dist/rule-utils/index.d.ts",
|
|
69
|
-
"default": "./dist/rule-utils/index.js"
|
|
70
|
-
},
|
|
71
|
-
"./types": {
|
|
72
|
-
"types": "./dist/types/index.d.ts",
|
|
73
|
-
"default": "./dist/types/index.js"
|
|
25
|
+
"./proxy-loader": {
|
|
26
|
+
"types": "./dist/proxy-loader.d.ts",
|
|
27
|
+
"default": "./dist/proxy-loader.js"
|
|
74
28
|
}
|
|
75
29
|
},
|
|
76
30
|
"typesVersions": {
|
|
@@ -78,95 +32,48 @@
|
|
|
78
32
|
".": [
|
|
79
33
|
"./dist/index.d.ts"
|
|
80
34
|
],
|
|
81
|
-
"
|
|
82
|
-
"./dist/
|
|
83
|
-
],
|
|
84
|
-
"collection": [
|
|
85
|
-
"./dist/collection.d.ts"
|
|
86
|
-
],
|
|
87
|
-
"common": [
|
|
88
|
-
"./dist/common/index.d.ts"
|
|
89
|
-
],
|
|
90
|
-
"common-browser": [
|
|
91
|
-
"./dist/common-browser.d.ts"
|
|
92
|
-
],
|
|
93
|
-
"graph": [
|
|
94
|
-
"./dist/graph/index.d.ts"
|
|
95
|
-
],
|
|
96
|
-
"error": [
|
|
97
|
-
"./dist/error/index.d.ts"
|
|
98
|
-
],
|
|
99
|
-
"logger": [
|
|
100
|
-
"./dist/logger.d.ts"
|
|
101
|
-
],
|
|
102
|
-
"sdk": [
|
|
103
|
-
"./dist/sdk.d.ts"
|
|
104
|
-
],
|
|
105
|
-
"plugins": [
|
|
106
|
-
"./dist/inner-plugins/index.d.ts"
|
|
107
|
-
],
|
|
108
|
-
"rspack-plugin": [
|
|
109
|
-
"./dist/rspack-plugin/index.d.ts"
|
|
110
|
-
],
|
|
111
|
-
"rules": [
|
|
112
|
-
"./dist/rules/index.d.ts"
|
|
113
|
-
],
|
|
114
|
-
"rule-utils": [
|
|
115
|
-
"./dist/rule-utils/index.d.ts"
|
|
116
|
-
],
|
|
117
|
-
"types": [
|
|
118
|
-
"./dist/types/index.d.ts"
|
|
35
|
+
"proxy-loader": [
|
|
36
|
+
"./dist/proxy-loader.d.ts"
|
|
119
37
|
]
|
|
120
38
|
}
|
|
121
39
|
},
|
|
122
40
|
"dependencies": {
|
|
123
41
|
"@babel/code-frame": "7.26.2",
|
|
124
|
-
"@
|
|
42
|
+
"@rspack/lite-tapable": "^1.1.5",
|
|
125
43
|
"@types/estree": "1.0.5",
|
|
126
44
|
"acorn": "^8.10.0",
|
|
127
45
|
"acorn-import-attributes": "^1.9.5",
|
|
128
46
|
"acorn-walk": "8.3.5",
|
|
129
47
|
"browserslist-load-config": "^1.0.3",
|
|
130
|
-
"
|
|
131
|
-
"
|
|
48
|
+
"caniuse-lite": "^1.0.30001809",
|
|
49
|
+
"connect-next": "4.0.3",
|
|
132
50
|
"envinfo": "7.21.0",
|
|
133
|
-
"filesize": "^11.0.22",
|
|
134
51
|
"fs-extra": "^11.1.1",
|
|
135
52
|
"get-port": "5.1.1",
|
|
136
|
-
"json-stream-stringify": "3.0.1",
|
|
137
53
|
"lines-and-columns": "2.0.4",
|
|
138
54
|
"open": "^11.0.0",
|
|
139
|
-
"path-browserify": "1.0.1",
|
|
140
|
-
"picocolors": "^1.1.1",
|
|
141
55
|
"raw-body": "3.0.2",
|
|
142
56
|
"rslog": "^2.1.3",
|
|
143
57
|
"semver": "^7.8.5",
|
|
144
58
|
"source-map": "^0.7.6",
|
|
145
|
-
"strip-ansi": "^7.2.0",
|
|
146
59
|
"cors": "2.8.6",
|
|
147
|
-
"dayjs": "1.11.21",
|
|
148
60
|
"launch-editor": "^2.14.1",
|
|
149
|
-
"safer-buffer": "2.1.2",
|
|
150
61
|
"sirv": "3.0.2",
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"@rsdoctor/client": "2.0.0-
|
|
154
|
-
"@rsdoctor/shared": "2.0.0-alpha.0"
|
|
62
|
+
"ws": "8.21.3",
|
|
63
|
+
"@rsdoctor/shared": "2.0.0-beta.0",
|
|
64
|
+
"@rsdoctor/client": "2.0.0-beta.0"
|
|
155
65
|
},
|
|
156
66
|
"devDependencies": {
|
|
157
|
-
"@
|
|
67
|
+
"@rsbuild/plugin-check-syntax": "^1.6.1",
|
|
68
|
+
"@rspack/core": "^2.1.8",
|
|
158
69
|
"@types/babel__code-frame": "7.27.0",
|
|
159
|
-
"@types/connect": "3.4.38",
|
|
160
|
-
"@types/deep-eql": "4.0.2",
|
|
161
70
|
"@types/envinfo": "7.8.4",
|
|
162
71
|
"@types/fs-extra": "^11.0.4",
|
|
163
72
|
"@types/node": "^24.12.3",
|
|
164
|
-
"@types/
|
|
165
|
-
"@types/path-browserify": "1.0.3",
|
|
166
|
-
"@types/semver": "^7.7.1",
|
|
167
|
-
"@types/tapable": "2.3.0",
|
|
73
|
+
"@types/semver": "^7.8.0",
|
|
168
74
|
"babel-loader": "10.1.1",
|
|
169
|
-
"
|
|
75
|
+
"filesize": "^11.0.22",
|
|
76
|
+
"json-stream-stringify": "3.0.1",
|
|
170
77
|
"string-loader": "0.0.1",
|
|
171
78
|
"ts-loader": "^9.6.2",
|
|
172
79
|
"tslib": "2.8.1",
|
|
@@ -176,7 +83,7 @@
|
|
|
176
83
|
"@scripts/test-helper": "0.1.1"
|
|
177
84
|
},
|
|
178
85
|
"peerDependencies": {
|
|
179
|
-
"@rspack/core": "
|
|
86
|
+
"@rspack/core": "^2.0.0"
|
|
180
87
|
},
|
|
181
88
|
"peerDependenciesMeta": {
|
|
182
89
|
"@rspack/core": {
|
|
@@ -189,9 +96,8 @@
|
|
|
189
96
|
},
|
|
190
97
|
"scripts": {
|
|
191
98
|
"dev": "npm run start",
|
|
192
|
-
"build": "
|
|
99
|
+
"build": "rslib build",
|
|
193
100
|
"start": "rslib build -w",
|
|
194
|
-
"test": "rstest run"
|
|
195
|
-
"prebundle": "prebundle"
|
|
101
|
+
"test": "rstest run"
|
|
196
102
|
}
|
|
197
103
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Chunks } from "../../../graph/index.js";
|
|
3
|
-
import { parseBundle } from "../utils/index.js";
|
|
4
|
-
async function getAssetsModulesData(moduleGraph, chunkGraph, bundleDir, sourceMapSets, hasParseBundle = true, assetsWithoutSourceMap) {
|
|
5
|
-
return Chunks.getAssetsModulesData(moduleGraph, chunkGraph, bundleDir, hasParseBundle ? {
|
|
6
|
-
parseBundle: parseBundle
|
|
7
|
-
} : {}, sourceMapSets, assetsWithoutSourceMap);
|
|
8
|
-
}
|
|
9
|
-
export { getAssetsModulesData };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
import { Asset, Chunk, EntryPoint } from "../../../../graph/index.js";
|
|
3
|
-
function patchNativeChunkGraph(cg, rawChunkGraph) {
|
|
4
|
-
const { chunks: rawChunks, entrypoints: rawEntrypoints } = rawChunkGraph;
|
|
5
|
-
const chunks = rawChunks.map((chunk)=>new Chunk(chunk.ukey.toString(), chunk.name, 0, chunk.initial, chunk.entry));
|
|
6
|
-
cg.setChunks(chunks);
|
|
7
|
-
const entrypoints = rawEntrypoints.map((entrypoint)=>{
|
|
8
|
-
const res = new EntryPoint(entrypoint.name);
|
|
9
|
-
res.setId(entrypoint.ukey);
|
|
10
|
-
return res;
|
|
11
|
-
});
|
|
12
|
-
cg.setEntrypoints(entrypoints);
|
|
13
|
-
for (const rawChunk of rawChunks){
|
|
14
|
-
const chunk = cg.getChunkById(rawChunk.ukey.toString());
|
|
15
|
-
chunk.setDependencies(rawChunk.dependencies.map((ukey)=>cg.getChunkById(ukey.toString())));
|
|
16
|
-
chunk.setImported(rawChunk.imported.map((ukey)=>cg.getChunkById(ukey.toString())));
|
|
17
|
-
}
|
|
18
|
-
for (const rawEntrypoint of rawEntrypoints){
|
|
19
|
-
const entrypoint = cg.getEntryPointById(rawEntrypoint.ukey);
|
|
20
|
-
entrypoint.setChunks(rawEntrypoint.chunks.map((ukey)=>cg.getChunkById(ukey.toString())));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function patchNativeAssets(cg, rawAssetPatch) {
|
|
24
|
-
const { assets: rawAssets, chunkAssets: rawChunkAssets, entrypointAssets: rawEntrypointAssets } = rawAssetPatch;
|
|
25
|
-
const assets = rawAssets.map((asset)=>{
|
|
26
|
-
const res = new Asset(asset.path, asset.size, [], '');
|
|
27
|
-
res.setId(asset.ukey);
|
|
28
|
-
return res;
|
|
29
|
-
});
|
|
30
|
-
cg.setAssets(assets);
|
|
31
|
-
for (const rawAsset of rawAssets){
|
|
32
|
-
const asset = cg.getAssetById(rawAsset.ukey);
|
|
33
|
-
asset.setChunks(rawAsset.chunks.map((ukey)=>cg.getChunkById(ukey.toString())));
|
|
34
|
-
}
|
|
35
|
-
for (const rawChunkAsset of rawChunkAssets){
|
|
36
|
-
const chunk = cg.getChunkById(rawChunkAsset.chunk.toString());
|
|
37
|
-
chunk.setAssets(rawChunkAsset.assets.map((ukey)=>cg.getAssetById(ukey)));
|
|
38
|
-
}
|
|
39
|
-
for (const rawEntrypointAsset of rawEntrypointAssets){
|
|
40
|
-
const entrypoint = cg.getEntryPointById(rawEntrypointAsset.entrypoint);
|
|
41
|
-
entrypoint.setAssets(rawEntrypointAsset.assets.map((ukey)=>cg.getAssetById(ukey)));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export { patchNativeAssets, patchNativeChunkGraph };
|