@rsdoctor/core 2.0.0-beta.4 → 2.0.0-rc.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.
Files changed (153) hide show
  1. package/dist/e.js +6422 -0
  2. package/dist/{630.js.LICENSE.txt → e.js.LICENSE.txt} +1 -1
  3. package/dist/index.d.ts +458 -7
  4. package/dist/index.js +2532 -1698
  5. package/dist/index.js.LICENSE.txt +8 -2
  6. package/dist/probe-loader.d.ts +13 -0
  7. package/dist/probe-loader.js +1 -1
  8. package/dist/proxy-loader.d.ts +36 -1
  9. package/dist/proxy-loader.js +2 -2
  10. package/dist/{26.js → r.js} +9244 -272
  11. package/dist/r.js.LICENSE.txt +57 -0
  12. package/dist/rslib-runtime.js +15 -13
  13. package/package.json +26 -26
  14. package/dist/630.js +0 -1280
  15. package/dist/build-utils/build/chunks/assetsModules.d.ts +0 -23
  16. package/dist/build-utils/build/chunks/index.d.ts +0 -2
  17. package/dist/build-utils/build/chunks/rspack/transform.d.ts +0 -13
  18. package/dist/build-utils/build/envinfo.d.ts +0 -13
  19. package/dist/build-utils/build/file/cache.d.ts +0 -5
  20. package/dist/build-utils/build/file/index.d.ts +0 -3
  21. package/dist/build-utils/build/file/sharding.d.ts +0 -21
  22. package/dist/build-utils/build/index.d.ts +0 -10
  23. package/dist/build-utils/build/json.d.ts +0 -3
  24. package/dist/build-utils/build/loader/index.d.ts +0 -2
  25. package/dist/build-utils/build/loader/probeLoader.d.ts +0 -9
  26. package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +0 -6
  27. package/dist/build-utils/build/module-graph/index.d.ts +0 -1
  28. package/dist/build-utils/build/module-graph/rspack/transform.d.ts +0 -26
  29. package/dist/build-utils/build/process.d.ts +0 -2
  30. package/dist/build-utils/build/server.d.ts +0 -14
  31. package/dist/build-utils/build/utils/index.d.ts +0 -3
  32. package/dist/build-utils/build/utils/loader.d.ts +0 -20
  33. package/dist/build-utils/build/utils/parseBundle.d.ts +0 -12
  34. package/dist/build-utils/build/utils/plugin.d.ts +0 -5
  35. package/dist/build-utils/index.d.ts +0 -11
  36. package/dist/common/global-config.d.ts +0 -21
  37. package/dist/compat.d.ts +0 -34
  38. package/dist/error/error.d.ts +0 -35
  39. package/dist/error/index.d.ts +0 -2
  40. package/dist/error/transform.d.ts +0 -3
  41. package/dist/error/utils.d.ts +0 -4
  42. package/dist/inner-plugins/constants.d.ts +0 -6
  43. package/dist/inner-plugins/index.d.ts +0 -2
  44. package/dist/inner-plugins/loaders/proxy.d.ts +0 -7
  45. package/dist/inner-plugins/plugins/base.d.ts +0 -12
  46. package/dist/inner-plugins/plugins/bundle.d.ts +0 -15
  47. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +0 -34
  48. package/dist/inner-plugins/plugins/errors.d.ts +0 -12
  49. package/dist/inner-plugins/plugins/index.d.ts +0 -10
  50. package/dist/inner-plugins/plugins/loader.d.ts +0 -12
  51. package/dist/inner-plugins/plugins/plugins.d.ts +0 -8
  52. package/dist/inner-plugins/plugins/progress.d.ts +0 -8
  53. package/dist/inner-plugins/plugins/resolver.d.ts +0 -12
  54. package/dist/inner-plugins/plugins/rspack.d.ts +0 -9
  55. package/dist/inner-plugins/plugins/rules.d.ts +0 -8
  56. package/dist/inner-plugins/plugins/sourcemapTool.d.ts +0 -52
  57. package/dist/inner-plugins/plugins/summary.d.ts +0 -15
  58. package/dist/inner-plugins/utils/circleDetect.d.ts +0 -4
  59. package/dist/inner-plugins/utils/config.d.ts +0 -6
  60. package/dist/inner-plugins/utils/index.d.ts +0 -9
  61. package/dist/inner-plugins/utils/loader.d.ts +0 -10
  62. package/dist/inner-plugins/utils/normalize-config.d.ts +0 -32
  63. package/dist/inner-plugins/utils/openBrowser.d.ts +0 -1
  64. package/dist/inner-plugins/utils/plugin-common.d.ts +0 -11
  65. package/dist/inner-plugins/utils/plugin.d.ts +0 -4
  66. package/dist/inner-plugins/utils/ruleWarnings.d.ts +0 -2
  67. package/dist/inner-plugins/utils/sdk.d.ts +0 -8
  68. package/dist/logger.d.ts +0 -9
  69. package/dist/rspack-plugin/constants.d.ts +0 -9
  70. package/dist/rspack-plugin/index.d.ts +0 -1
  71. package/dist/rspack-plugin/plugin.d.ts +0 -55
  72. package/dist/rspack-plugin/session.d.ts +0 -19
  73. package/dist/rspack-plugin/writeStore.d.ts +0 -2
  74. package/dist/rule-utils/document/document.d.ts +0 -16
  75. package/dist/rule-utils/document/index.d.ts +0 -3
  76. package/dist/rule-utils/document/server.d.ts +0 -4
  77. package/dist/rule-utils/document/types.d.ts +0 -31
  78. package/dist/rule-utils/index.d.ts +0 -2
  79. package/dist/rule-utils/parser/asserts.d.ts +0 -81
  80. package/dist/rule-utils/parser/index.d.ts +0 -4
  81. package/dist/rule-utils/parser/parser.d.ts +0 -118
  82. package/dist/rule-utils/parser/types.d.ts +0 -30
  83. package/dist/rule-utils/parser/utils.d.ts +0 -27
  84. package/dist/rules/index.d.ts +0 -3
  85. package/dist/rules/linter.d.ts +0 -9
  86. package/dist/rules/rule.d.ts +0 -27
  87. package/dist/rules/rules/cjs-require/index.d.ts +0 -4
  88. package/dist/rules/rules/cjs-require/types.d.ts +0 -7
  89. package/dist/rules/rules/cross-chunks-package/index.d.ts +0 -4
  90. package/dist/rules/rules/cross-chunks-package/types.d.ts +0 -3
  91. package/dist/rules/rules/cross-chunks-package/utils.d.ts +0 -1
  92. package/dist/rules/rules/default-import-check/index.d.ts +0 -4
  93. package/dist/rules/rules/default-import-check/types.d.ts +0 -4
  94. package/dist/rules/rules/default-import-check/utils.d.ts +0 -10
  95. package/dist/rules/rules/duplicate-package/index.d.ts +0 -4
  96. package/dist/rules/rules/duplicate-package/types.d.ts +0 -24
  97. package/dist/rules/rules/duplicate-package/utils.d.ts +0 -3
  98. package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +0 -3
  99. package/dist/rules/rules/ecma-version-check/index.d.ts +0 -5
  100. package/dist/rules/rules/ecma-version-check/types.d.ts +0 -13
  101. package/dist/rules/rules/esm-resolved-to-cjs/index.d.ts +0 -4
  102. package/dist/rules/rules/esm-resolved-to-cjs/types.d.ts +0 -8
  103. package/dist/rules/rules/index.d.ts +0 -2
  104. package/dist/rules/rules/loader-performance-optimization/index.d.ts +0 -4
  105. package/dist/rules/rules/loader-performance-optimization/types.d.ts +0 -22
  106. package/dist/rules/rules/loader-performance-optimization/utils.d.ts +0 -1
  107. package/dist/rules/rules/module-mixed-chunks/index.d.ts +0 -4
  108. package/dist/rules/rules/module-mixed-chunks/types.d.ts +0 -3
  109. package/dist/rules/rules/side-effects-only-imports/index.d.ts +0 -4
  110. package/dist/rules/rules/side-effects-only-imports/types.d.ts +0 -9
  111. package/dist/rules/utils.d.ts +0 -3
  112. package/dist/sdk/index.d.ts +0 -2
  113. package/dist/sdk/multiple/controller.d.ts +0 -26
  114. package/dist/sdk/multiple/index.d.ts +0 -2
  115. package/dist/sdk/multiple/primary.d.ts +0 -41
  116. package/dist/sdk/multiple/server.d.ts +0 -7
  117. package/dist/sdk/sdk/core.d.ts +0 -34
  118. package/dist/sdk/sdk/index.d.ts +0 -54
  119. package/dist/sdk/sdk/types.d.ts +0 -26
  120. package/dist/sdk/server/apis/alerts.d.ts +0 -5
  121. package/dist/sdk/server/apis/base.d.ts +0 -11
  122. package/dist/sdk/server/apis/bundle-diff.d.ts +0 -6
  123. package/dist/sdk/server/apis/data.d.ts +0 -6
  124. package/dist/sdk/server/apis/fs.d.ts +0 -5
  125. package/dist/sdk/server/apis/graph.d.ts +0 -12
  126. package/dist/sdk/server/apis/index.d.ts +0 -10
  127. package/dist/sdk/server/apis/loader.d.ts +0 -15
  128. package/dist/sdk/server/apis/plugin.d.ts +0 -6
  129. package/dist/sdk/server/apis/project.d.ts +0 -8
  130. package/dist/sdk/server/apis/renderer.d.ts +0 -6
  131. package/dist/sdk/server/apis/resolver.d.ts +0 -6
  132. package/dist/sdk/server/client.d.ts +0 -3
  133. package/dist/sdk/server/fakeServer.d.ts +0 -9
  134. package/dist/sdk/server/index.d.ts +0 -44
  135. package/dist/sdk/server/json-body.d.ts +0 -6
  136. package/dist/sdk/server/router.d.ts +0 -24
  137. package/dist/sdk/server/security.d.ts +0 -5
  138. package/dist/sdk/server/socket/api.d.ts +0 -15
  139. package/dist/sdk/server/socket/index.d.ts +0 -48
  140. package/dist/sdk/server/utils.d.ts +0 -6
  141. package/dist/sdk/utils/base.d.ts +0 -1
  142. package/dist/sdk/utils/constant.d.ts +0 -1
  143. package/dist/sdk/utils/date.d.ts +0 -1
  144. package/dist/sdk/utils/index.d.ts +0 -4
  145. package/dist/sdk/utils/manifestSharding.d.ts +0 -16
  146. package/dist/sdk/utils/openBrowser.d.ts +0 -4
  147. package/dist/sdk/utils/upload.d.ts +0 -2
  148. package/dist/sdk/utils/writeJson.d.ts +0 -1
  149. package/dist/sdk.d.ts +0 -1
  150. package/dist/types/index.d.ts +0 -3
  151. package/dist/types/loader.d.ts +0 -24
  152. package/dist/types/plugin.d.ts +0 -22
  153. package/dist/types/rules.d.ts +0 -7
@@ -1,24 +0,0 @@
1
- export declare enum CheckVersion {
2
- null = 0,
3
- prerelease = 1,
4
- prepatch = 16,
5
- patch = 256,
6
- preminor = 4096,
7
- minor = 65536,
8
- premajor = 1048576,
9
- major = 16777216
10
- }
11
- export declare enum CheckVersionMap {
12
- null = 0,
13
- prerelease = 1,
14
- prepatch = 17,
15
- patch = 273,
16
- preminor = 4369,
17
- minor = 69905,
18
- premajor = 1118481,
19
- major = 17895697
20
- }
21
- export interface Config {
22
- checkVersion: keyof typeof CheckVersion;
23
- ignore: string[];
24
- }
@@ -1,3 +0,0 @@
1
- import type { SDK, Rule } from '@rsdoctor/shared/types';
2
- export declare function getErrorMsg(packages: SDK.PackageInstance[], root: string): string;
3
- export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
@@ -1,3 +0,0 @@
1
- export declare class Parser {
2
- constructor();
3
- }
@@ -1,5 +0,0 @@
1
- import type { Config } from './types.js';
2
- import { Linter } from '@rsdoctor/shared/types';
3
- export type { Config } from './types.js';
4
- declare const title = "ecma-version-check";
5
- export declare const rule: Linter.RuleData<Config, typeof title>;
@@ -1,13 +0,0 @@
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 {};
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import type { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "esm-resolved-to-cjs">;
@@ -1,8 +0,0 @@
1
- export interface Config {
2
- /**
3
- * Package name patterns to ignore (substring match against the import request).
4
- * @example ['my-legacy-pkg', '@internal/']
5
- * @default []
6
- */
7
- ignore: string[];
8
- }
@@ -1,2 +0,0 @@
1
- import type { Linter } from '@rsdoctor/shared/types';
2
- export declare const rules: Linter.RuleData[];
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "loader-performance-optimization">;
@@ -1,22 +0,0 @@
1
- import type { SDK } from '@rsdoctor/shared/types';
2
- export interface Config {
3
- /**
4
- * loaders which should be ignore.
5
- */
6
- ignore?: (string | RegExp)[];
7
- /**
8
- * threshold which the loader total costs.
9
- * @unit millisecond
10
- * @default 5000
11
- */
12
- threshold?: number;
13
- /**
14
- * the file extensions which will be match in rule check.
15
- * @default ["js", "css", "jpg", "jpeg", "png", "gif", "webp", "svg"]
16
- */
17
- extensions?: (string | RegExp)[];
18
- }
19
- export interface LoaderMapValue extends SDK.LoaderTransformData {
20
- __resource__: SDK.ResourceData;
21
- __costs__: number;
22
- }
@@ -1 +0,0 @@
1
- export declare function match(str: string, patterns: (string | RegExp)[]): boolean;
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "module-mixed-chunks">;
@@ -1,3 +0,0 @@
1
- export interface Config {
2
- ignore: string[];
3
- }
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import type { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "tree-shaking-side-effects-only">;
@@ -1,9 +0,0 @@
1
- export interface Config {
2
- /** Module path patterns to ignore */
3
- ignore: string[];
4
- /**
5
- * Module path patterns to include when the module is under node_modules.
6
- * Example: ['react', '@babel/runtime']
7
- */
8
- include: string[];
9
- }
@@ -1,3 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- export declare function toSeverity(input: Linter.SeverityInput, defaultLevel: Linter.Severity): Linter.Severity;
3
- export declare function noop(): void;
@@ -1,2 +0,0 @@
1
- export * from './sdk/index.js';
2
- export * from './multiple/index.js';
@@ -1,26 +0,0 @@
1
- import { Manifest } from '@rsdoctor/shared/types';
2
- import { RsdoctorPrimarySDK } from './primary.js';
3
- export declare class RsdoctorSDKController {
4
- readonly slaves: RsdoctorPrimarySDK[];
5
- private readonly activeSlaves;
6
- private outputDir;
7
- private outputOwner?;
8
- private refreshManifestTask;
9
- private readonly compilerDirectories;
10
- private readonly briefReports;
11
- root: string;
12
- constructor(root?: string);
13
- get master(): RsdoctorPrimarySDK;
14
- get isMultiple(): boolean;
15
- getLastSdk(): RsdoctorPrimarySDK;
16
- hasName(name: string, exclude?: RsdoctorPrimarySDK): boolean;
17
- registerSlave(slave: RsdoctorPrimarySDK): void;
18
- setOutputDir(slave: RsdoctorPrimarySDK, outputDir: string): void;
19
- getCompilerOutputDir(slave: RsdoctorPrimarySDK): string;
20
- writeBriefJson(current: RsdoctorPrimarySDK, data: Manifest.RsdoctorBriefData): void;
21
- getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
22
- getBriefSeriesData(current: RsdoctorPrimarySDK): Manifest.RsdoctorManifestSeriesData[];
23
- createSlave({ name, displayName, compilerPath, parentCompilerPath, isChild, stage, extraConfig, type, }: Omit<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'controller'>): RsdoctorPrimarySDK;
24
- refreshManifestSeries(): Promise<void>;
25
- private getActiveSlaves;
26
- }
@@ -1,2 +0,0 @@
1
- export * from './controller.js';
2
- export * from './primary.js';
@@ -1,41 +0,0 @@
1
- import { Common, Manifest, SDK } from '@rsdoctor/shared/types';
2
- import { RsdoctorSDK } from '../sdk/index.js';
3
- import type { RsdoctorSDKController } from './controller.js';
4
- interface RsdoctorSlaveSDKOptions {
5
- name: string;
6
- displayName?: string;
7
- compilerPath?: string;
8
- parentCompilerPath?: string;
9
- isChild?: boolean;
10
- /**
11
- * use to sort for display in the client page.
12
- * the smaller the front.
13
- * @default 1
14
- */
15
- stage?: number;
16
- extraConfig?: SDK.SDKOptionsType;
17
- controller: RsdoctorSDKController;
18
- type: SDK.ToDataType;
19
- }
20
- export declare class RsdoctorPrimarySDK extends RsdoctorSDK implements SDK.RsdoctorBuilderSDKInstance {
21
- id: number;
22
- parent: RsdoctorSDKController;
23
- readonly stage: number;
24
- displayName: string;
25
- readonly compilerPath: string;
26
- readonly parentCompilerPath?: string;
27
- readonly isChild: boolean;
28
- dependencies: Array<string> | undefined;
29
- reportFileName: string;
30
- constructor({ name, displayName, compilerPath, parentCompilerPath, isChild, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
31
- get isMaster(): boolean;
32
- protected writeBriefJson(data: Manifest.RsdoctorBriefData): void;
33
- protected writePieces(_storeData: Common.PlainObject, options?: SDK.WriteStoreOptionsType): Promise<void>;
34
- protected writeManifest(): Promise<string>;
35
- refreshManifestSeries(): Promise<void>;
36
- getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
37
- setName(name: string): void;
38
- getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
39
- addRsdoctorDataToHTML(storeData: SDK.BuilderStoreData, htmlContent: string): string;
40
- }
41
- export {};
@@ -1,7 +0,0 @@
1
- import { RsdoctorServer, type RsdoctorServerOptions } from '../server/index.js';
2
- import type { RsdoctorPrimarySDK } from './primary.js';
3
- export declare class RsdoctorSlaveServer extends RsdoctorServer {
4
- protected sdk: RsdoctorPrimarySDK;
5
- constructor(sdk: RsdoctorPrimarySDK, port?: number, config?: RsdoctorServerOptions);
6
- openClientPage(...args: unknown[]): Promise<void>;
7
- }
@@ -1,34 +0,0 @@
1
- import { Common, Manifest, SDK } from '@rsdoctor/shared/types';
2
- import { RsdoctorSDKOptions, DataWithUrl } from './types.js';
3
- export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements SDK.RsdoctorSDKInstance {
4
- protected _name: string;
5
- protected hash: string;
6
- extraConfig: SDK.SDKOptionsType | undefined;
7
- readonly root: string;
8
- readonly pid: number;
9
- readonly hooks: SDK.Hooks;
10
- protected _envinfo: SDK.EnvInfo;
11
- private _clientRoutes;
12
- private _outputDir;
13
- diskManifestPath: string;
14
- cloudData?: Manifest.RsdoctorManifestWithShardingFiles;
15
- constructor({ name, root }: T);
16
- get outputDir(): string;
17
- get name(): string;
18
- bootstrap(): Promise<void>;
19
- dispose(): Promise<void>;
20
- setOutputDir(outputDir: string): void;
21
- setName(name: string): void;
22
- setHash(hash: string): void;
23
- getHash(): string;
24
- getClientRoutes(): Manifest.RsdoctorManifestClientRoutes[];
25
- addClientRoutes(routes: Manifest.RsdoctorManifestClientRoutes[]): void;
26
- /** Upload analysis data pieces */
27
- protected writePieces(storeData: Common.PlainObject, options?: SDK.WriteStoreOptionsType): Promise<void>;
28
- /** Upload manifest file */
29
- protected writeManifest(): Promise<string>;
30
- saveManifest(data: Common.PlainObject, options: SDK.WriteStoreOptionsType): Promise<string>;
31
- protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number, compressionLevel?: number): Promise<DataWithUrl>;
32
- protected writeJsonFragmentsToFolder(jsonFragments: string[], dir: string, key: string, index?: number, compressionLevel?: number): Promise<DataWithUrl>;
33
- abstract onDataReport(): void | Promise<void>;
34
- }
@@ -1,54 +0,0 @@
1
- import { Manifest, SDK } from '@rsdoctor/shared/types';
2
- import { RawSourceMap, SourceMapConsumer } from 'source-map';
3
- import { RsdoctorServer } from '../server/index.js';
4
- import { RsdoctorRspackSDKOptions } from './types.js';
5
- import { SDKCore } from './core.js';
6
- export * from '../utils/openBrowser.js';
7
- export * from '../utils/base.js';
8
- export { resolveClientDiffHtmlPath } from '../server/client.js';
9
- export declare class RsdoctorSDK<T extends RsdoctorRspackSDKOptions = RsdoctorRspackSDKOptions> extends SDKCore<T> implements SDK.RsdoctorBuilderSDKInstance {
10
- server: RsdoctorServer;
11
- extraConfig: SDK.SDKOptionsType | undefined;
12
- type: SDK.ToDataType;
13
- root: string;
14
- private _summary;
15
- private _configs;
16
- private _errors;
17
- private _loader;
18
- private _loaderStart;
19
- private _resolver;
20
- private _plugin;
21
- private _moduleGraph;
22
- private _chunkGraph;
23
- private _rawSourceMapCache;
24
- private _sourceMap;
25
- private _packageGraph;
26
- constructor(options: T);
27
- bootstrap(): Promise<void>;
28
- dispose(): Promise<void>;
29
- applyErrorFix(id: number): Promise<void>;
30
- clear(): void;
31
- clearSourceMapCache(): void;
32
- getSourceMap(file: string): Promise<SourceMapConsumer | undefined>;
33
- reportSourceMap(data: RawSourceMap): void;
34
- reportConfiguration(config: SDK.ConfigData[0]): void;
35
- reportError(errors: Error[]): void;
36
- reportLoader(data: SDK.LoaderData): void;
37
- reportLoaderStartOrEnd(data: SDK.ResourceLoaderData): void;
38
- reportResolver(data: SDK.ResolverData): void;
39
- reportPlugin(data: SDK.PluginData): void;
40
- reportModuleGraph(data: SDK.ModuleGraphInstance): void;
41
- reportPackageGraph(data: SDK.PackageGraphInstance): void;
42
- reportChunkGraph(data: SDK.ChunkGraphInstance): void;
43
- reportSummaryData(part: Partial<SDK.SummaryData>): void;
44
- createPackageGraph(): void;
45
- getBriefJsonPath(outputDir?: string): string | undefined;
46
- protected writeBriefJson(data: Manifest.RsdoctorBriefData): void;
47
- writeStore(options?: SDK.WriteStoreOptionsType): Promise<string>;
48
- getStoreData(): SDK.BuilderStoreData;
49
- getManifestData(): Manifest.RsdoctorManifestWithShardingFiles;
50
- getRuleContext(_options: SDK.RuntimeContextOptions): SDK.RuntimeContext;
51
- onDataReport(): void | Promise<void>;
52
- addRsdoctorDataToHTML(storeData: SDK.BuilderStoreData, htmlContent: string): string;
53
- inlineScriptsAndStyles(htmlFilePath: string): string;
54
- }
@@ -1,26 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- export interface DataWithUrl {
3
- name: string;
4
- files: {
5
- path: string;
6
- basename: string;
7
- content?: Buffer;
8
- }[] | string;
9
- }
10
- export interface RsdoctorSDKOptions {
11
- name: string;
12
- root: string;
13
- }
14
- /**
15
- * sdk options for builder.
16
- */
17
- export interface RsdoctorBuilderSDK extends RsdoctorSDKOptions {
18
- type?: SDK.ToDataType;
19
- /**
20
- * port for client server
21
- */
22
- port?: number;
23
- config?: SDK.SDKOptionsType;
24
- }
25
- export type RsdoctorRspackSDKOptions = RsdoctorBuilderSDK;
26
- export type RsdoctorEMOSDKOptions = RsdoctorSDKOptions;
@@ -1,5 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class AlertsAPI extends BaseAPI {
4
- getPackageRelationAlertDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPackageRelationAlertDetails>>;
5
- }
@@ -1,11 +0,0 @@
1
- import { Data } from '@rsdoctor/shared/common-browser';
2
- import { Manifest, SDK } from '@rsdoctor/shared/types';
3
- export declare class BaseAPI implements Manifest.ManifestDataLoader {
4
- [key: string | symbol]: any;
5
- readonly ctx: SDK.ServerAPI.APIContext;
6
- protected dataLoader: Data.APIDataLoader;
7
- constructor(sdk: SDK.RsdoctorSDKInstance, server: SDK.RsdoctorServerInstance);
8
- loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
9
- loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
10
- loadData(key: string): Promise<void>;
11
- }
@@ -1,6 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class BundleDiffAPI extends BaseAPI {
4
- getBundleDiffSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetBundleDiffSummary>>;
5
- bundleDiffManifest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.BundleDiffManifest>>;
6
- }
@@ -1,6 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class DataAPI extends BaseAPI {
4
- loadDataByKey(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.LoadDataByKey>>;
5
- sendMessageToClient(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.SendAPIDataToClient>>;
6
- }
@@ -1,5 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class FileSystemAPI extends BaseAPI {
4
- applyErrorFix(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ApplyErrorFix>>;
5
- }
@@ -1,12 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class GraphAPI extends BaseAPI {
4
- getAssetsSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetsSummary>>;
5
- getModuleGraphForAsset(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetAssetDetails>>;
6
- getChunksByModuleId(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetChunksByModuleId>>;
7
- getModuleDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleDetails>>;
8
- getDependencyByResolvedRequest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModulesByModuleIds>>;
9
- getModuleCodeByModuleId(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleCodeByModuleId>>;
10
- getModuleCodeByModuleIds(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetModuleCodeByModuleIds>>;
11
- getEntryModulesSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetEntryPoints>>;
12
- }
@@ -1,10 +0,0 @@
1
- export * from './alerts.js';
2
- export * from './bundle-diff.js';
3
- export { DataAPI } from './data.js';
4
- export * from './fs.js';
5
- export * from './loader.js';
6
- export * from './graph.js';
7
- export * from './plugin.js';
8
- export * from './project.js';
9
- export * from './renderer.js';
10
- export * from './resolver.js';
@@ -1,15 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class LoaderAPI extends BaseAPI {
4
- /** report loader data api */
5
- reportLoader(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ReportLoader>>;
6
- /** report sourcemap data api */
7
- reportSourceMap(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.ReportLoader>>;
8
- getLoaderNames(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderNames>>;
9
- getLoaderChartData(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderChartData>>;
10
- getLoaderFileTree(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileTree>>;
11
- getLoaderFileDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileDetails>>;
12
- getLoaderFolderStatistics(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFolderStatistics>>;
13
- getLoaderFileFirstInput(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileFirstInput>>;
14
- getLoaderFileInputAndOutput(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetLoaderFileInputAndOutput>>;
15
- }
@@ -1,6 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class PluginAPI extends BaseAPI {
4
- getPluginSummary(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginSummary>>;
5
- getPluginData(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetPluginData>>;
6
- }
@@ -1,8 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class ProjectAPI extends BaseAPI {
4
- env(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.Env>>;
5
- manifest(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.Manifest>>;
6
- getProjectInfo(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetProjectInfo>>;
7
- getClientRoutes(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetClientRoutes>>;
8
- }
@@ -1,6 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class RendererAPI extends BaseAPI {
4
- /** sdk manifest api */
5
- entryHtml(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.EntryHtml>>;
6
- }
@@ -1,6 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { BaseAPI } from './base.js';
3
- export declare class ResolverAPI extends BaseAPI {
4
- getResolverFileTree(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileTree>>;
5
- getResolverFileDetails(): Promise<SDK.ServerAPI.InferResponseType<SDK.ServerAPI.API.GetResolverFileDetails>>;
6
- }
@@ -1,3 +0,0 @@
1
- export declare const resolveClientHtmlPath: (innerClientPath?: string) => string;
2
- export declare const resolveClientDistPath: (innerClientPath?: string) => string;
3
- export declare const resolveClientDiffHtmlPath: (innerClientPath?: string) => string;
@@ -1,9 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- import { RsdoctorServer } from './index.js';
3
- export declare class RsdoctorFakeServer extends RsdoctorServer {
4
- protected sdk: SDK.RsdoctorBuilderSDKInstance;
5
- constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number);
6
- bootstrap(): Promise<void>;
7
- openClientPage(): Promise<void>;
8
- dispose: () => Promise<void>;
9
- }
@@ -1,44 +0,0 @@
1
- import { Common, SDK, Thirdparty, Client } from '@rsdoctor/shared/types';
2
- export * from './utils.js';
3
- export type ISocketType = {
4
- port: number;
5
- socketUrl: string;
6
- token: string;
7
- };
8
- export type RsdoctorServerOptions = {
9
- innerClientPath?: string;
10
- printServerUrl?: boolean;
11
- cors?: SDK.RsdoctorServerConfig['cors'];
12
- };
13
- export declare class RsdoctorServer implements SDK.RsdoctorServerInstance {
14
- protected sdk: SDK.RsdoctorBuilderSDKInstance;
15
- private _server;
16
- port: number;
17
- private _socket?;
18
- private disposed;
19
- private _router;
20
- private _innerClientPath;
21
- private _printServerUrl;
22
- private _cors;
23
- private _socketToken;
24
- constructor(sdk: SDK.RsdoctorBuilderSDKInstance, port?: number, config?: RsdoctorServerOptions);
25
- get app(): SDK.RsdoctorServerInstance['app'];
26
- get host(): string;
27
- get origin(): string;
28
- get socketUrl(): ISocketType;
29
- get innerClientPath(): string;
30
- private createInnerServer;
31
- private resolveCorsOptions;
32
- bootstrap(): Promise<void>;
33
- protected wrapNextHandleFunction(method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): Thirdparty.connect.NextHandleFunction;
34
- proxy(api: SDK.ServerAPI.API, method: 'GET' | 'POST', cb: (...args: Parameters<Thirdparty.connect.NextHandleFunction>) => Common.PlainObject | string): void;
35
- get: SDK.RsdoctorServerInstance['get'];
36
- post: SDK.RsdoctorServerInstance['post'];
37
- getClientUrl(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): string;
38
- getClientUrl(route?: 'homepage'): string;
39
- openClientPage(route: Client.RsdoctorClientRoutes, baselineUrl: string, currentUrl: string): Promise<void>;
40
- openClientPage(route?: 'homepage'): Promise<void>;
41
- sendAPIDataToClient<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, msg: SDK.ServerAPI.SocketResponseType<T>): void;
42
- broadcast(): Promise<void>;
43
- dispose: (exitCode?: number) => Promise<void>;
44
- }
@@ -1,6 +0,0 @@
1
- import type { Thirdparty } from '@rsdoctor/shared/types';
2
- interface JsonBodyParserOptions {
3
- limit?: number | string | ((req: Thirdparty.connect.IncomingMessage) => number | string);
4
- }
5
- export declare function jsonBodyParser(options?: JsonBodyParserOptions): Thirdparty.connect.NextHandleFunction;
6
- export {};
@@ -1,24 +0,0 @@
1
- import type { ServerResponse } from 'http';
2
- import { Common, SDK, Thirdparty } from '@rsdoctor/shared/types';
3
- import { BaseAPI } from './apis/base.js';
4
- interface RouterOptions {
5
- apis: Common.Constructor<typeof BaseAPI>[];
6
- sdk: SDK.RsdoctorBuilderSDKInstance;
7
- server: SDK.RsdoctorServerInstance;
8
- }
9
- export declare class Router {
10
- protected options: RouterOptions;
11
- static routes: {
12
- /**
13
- * - `key` is the constructor of object which used to match the API class
14
- */
15
- get: Map<new (sdk: SDK.RsdoctorSDKInstance, server: SDK.RsdoctorServerInstance) => BaseAPI, [apiKey: PropertyKey, pathname: string][]>;
16
- post: Map<new (sdk: SDK.RsdoctorSDKInstance, server: SDK.RsdoctorServerInstance) => BaseAPI, [apiKey: PropertyKey, pathname: string][]>;
17
- };
18
- static get(pathname: string): MethodDecorator;
19
- static post(pathname: string): MethodDecorator;
20
- constructor(options: RouterOptions);
21
- setup(): Promise<void>;
22
- wrapAPIFunction<T extends BaseAPI>(api: T, key: PropertyKey): (req: Thirdparty.connect.IncomingMessage, res: ServerResponse) => Promise<unknown>;
23
- }
24
- export {};
@@ -1,5 +0,0 @@
1
- export declare const DEFAULT_ALLOWED_CORS_ORIGINS: RegExp;
2
- export declare function isAllowedRequestOrigin(origin: string | string[] | undefined): boolean;
3
- export declare function isAllowedRequestHost(host: string | string[] | undefined): boolean;
4
- export declare function isAllowedCorsRequest(origin: string | string[] | undefined, host: string | string[] | undefined): boolean;
5
- export declare function isAllowedOpenInEditorToken(token: string | null, expectedToken: string): boolean;
@@ -1,15 +0,0 @@
1
- import { Data } from '@rsdoctor/shared/common-browser';
2
- import { Manifest, SDK } from '@rsdoctor/shared/types';
3
- interface SocketAPILoaderOptions {
4
- sdk: SDK.RsdoctorBuilderSDKInstance;
5
- }
6
- export declare class SocketAPILoader implements Manifest.ManifestDataLoader {
7
- protected options: SocketAPILoaderOptions;
8
- protected dataLoader: Data.APIDataLoader;
9
- constructor(options: SocketAPILoaderOptions);
10
- loadManifest(): Promise<Manifest.RsdoctorManifestWithShardingFiles>;
11
- loadData<T extends Manifest.RsdoctorManifestMappingKeys>(key: T): Promise<Manifest.InferManifestDataValue<T>>;
12
- loadData(key: string): Promise<void>;
13
- get loadAPIData(): <T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, body: SDK.ServerAPI.InferRequestBodyType<T>) => Promise<SDK.ServerAPI.InferResponseType<T>>;
14
- }
15
- export {};
@@ -1,48 +0,0 @@
1
- import { Common, SDK } from '@rsdoctor/shared/types';
2
- import type { Server } from 'http';
3
- import WebSocket, { WebSocketServer } from 'ws';
4
- import { SocketAPILoader } from './api.js';
5
- interface SocketOptions {
6
- sdk: SDK.RsdoctorBuilderSDKInstance;
7
- server: Server;
8
- port: number;
9
- token: string;
10
- }
11
- type Subscription = {
12
- api: SDK.ServerAPI.API;
13
- body: Common.PlainObject | null;
14
- };
15
- type SubscriptionRecord = Subscription & {
16
- count: number;
17
- };
18
- type ClientMessage = {
19
- type?: string;
20
- id?: string;
21
- api?: SDK.ServerAPI.API;
22
- body?: Common.PlainObject | null;
23
- };
24
- export declare class Socket {
25
- protected options: SocketOptions;
26
- protected server?: WebSocketServer;
27
- protected clients: Set<WebSocket>;
28
- protected loader: SocketAPILoader;
29
- protected map: Map<string, SubscriptionRecord>;
30
- protected clientSubscriptions: Map<WebSocket, Set<string>>;
31
- constructor(options: SocketOptions);
32
- bootstrap(): void;
33
- attachClient(client: WebSocket): void;
34
- handleClientMessage(raw: string, client?: WebSocket): Promise<void>;
35
- protected handleAPIRequestMessage(message: ClientMessage, client?: WebSocket): Promise<void>;
36
- getSubscriptions(): Subscription[];
37
- protected saveRequestToMap<T extends SDK.ServerAPI.API>(api: T, body?: SDK.ServerAPI.InferRequestBodyType<T, null> | null, client?: WebSocket): void;
38
- protected removeRequestFromMap<T extends SDK.ServerAPI.API>(api: T, body?: SDK.ServerAPI.InferRequestBodyType<T, null> | null, client?: WebSocket): void;
39
- protected removeClientSubscriptions(client: WebSocket): void;
40
- protected removeSubscriptionKey(key: string): void;
41
- protected getSubscriptionKey(api: SDK.ServerAPI.API, body: Common.PlainObject | null): string;
42
- protected getAPIResponse<T extends SDK.ServerAPI.API>(api: T, body: SDK.ServerAPI.InferRequestBodyType<T>): Promise<SDK.ServerAPI.SocketResponseType<SDK.ServerAPI.API>>;
43
- protected timer: NodeJS.Immediate | undefined;
44
- broadcast(): Promise<void>;
45
- sendAPIData<T extends SDK.ServerAPI.API | SDK.ServerAPI.APIExtends>(api: T, payload: SDK.ServerAPI.SocketResponseType<T>): void;
46
- dispose(): void;
47
- }
48
- export {};