@rsdoctor/types 1.5.9 → 1.5.10
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/babel.d.cts +13 -0
- package/dist/client.d.cts +164 -0
- package/dist/common.d.cts +26 -0
- package/dist/config.d.cts +75 -0
- package/dist/constants.d.cts +19 -0
- package/dist/emo.d.cts +28 -0
- package/dist/error.d.cts +137 -0
- package/dist/esbuild.d.cts +30 -0
- package/dist/index.d.cts +15 -0
- package/dist/linter/diagnostic.d.cts +48 -0
- package/dist/linter/index.d.cts +2 -0
- package/dist/linter/rule.d.cts +105 -0
- package/dist/logger.d.cts +9 -0
- package/dist/manifest.d.cts +68 -0
- package/dist/modules.d.cts +7 -0
- package/dist/plugin/baseCompiler.d.cts +33 -0
- package/dist/plugin/baseLoader.d.cts +78 -0
- package/dist/plugin/baseStats.d.cts +139 -0
- package/dist/plugin/index.d.cts +7 -0
- package/dist/plugin/internal-rules.d.cts +4 -0
- package/dist/plugin/plugin.d.cts +159 -0
- package/dist/plugin/rspack.d.cts +37 -0
- package/dist/plugin/webpack.d.cts +13 -0
- package/dist/rule/code/E1001.d.cts +3 -0
- package/dist/rule/code/E1002.d.cts +3 -0
- package/dist/rule/code/E1003.d.cts +3 -0
- package/dist/rule/code/E1004.d.cts +3 -0
- package/dist/rule/code/E1005.d.cts +3 -0
- package/dist/rule/code/E1006.d.cts +3 -0
- package/dist/rule/code/E1007.d.cts +3 -0
- package/dist/rule/code/E1008.d.cts +3 -0
- package/dist/rule/code/E1009.d.cts +3 -0
- package/dist/rule/code/index.d.cts +33 -0
- package/dist/rule/code/type.d.cts +27 -0
- package/dist/rule/data.d.cts +217 -0
- package/dist/rule/index.d.cts +2 -0
- package/dist/sdk/chunk.d.cts +142 -0
- package/dist/sdk/config.d.cts +12 -0
- package/dist/sdk/context.d.cts +23 -0
- package/dist/sdk/envinfo.d.cts +19 -0
- package/dist/sdk/hooks.d.cts +14 -0
- package/dist/sdk/index.d.cts +16 -0
- package/dist/sdk/instance.d.cts +110 -0
- package/dist/sdk/loader.d.cts +70 -0
- package/dist/sdk/module.d.cts +405 -0
- package/dist/sdk/package.d.cts +124 -0
- package/dist/sdk/plugin.d.cts +21 -0
- package/dist/sdk/process.d.cts +10 -0
- package/dist/sdk/resolver.d.cts +52 -0
- package/dist/sdk/result.d.cts +42 -0
- package/dist/sdk/server/apis/alerts.d.cts +30 -0
- package/dist/sdk/server/apis/graph.d.cts +49 -0
- package/dist/sdk/server/apis/index.d.cts +189 -0
- package/dist/sdk/server/apis/loader.d.cts +53 -0
- package/dist/sdk/server/apis/pagination.d.cts +11 -0
- package/dist/sdk/server/apis/plugin.d.cts +19 -0
- package/dist/sdk/server/apis/project.d.cts +18 -0
- package/dist/sdk/server/apis/resolver.d.cts +18 -0
- package/dist/sdk/server/index.d.cts +24 -0
- package/dist/sdk/statement.d.cts +178 -0
- package/dist/sdk/summary.d.cts +18 -0
- package/dist/sdk/treeShaking.d.cts +152 -0
- package/dist/thirdparty.d.cts +2 -0
- package/package.json +10 -5
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { RuleMessage, RuleMessageCodeEnumerated } from './code';
|
|
2
|
+
import type { SourceRange } from '../sdk';
|
|
3
|
+
import type { CrossChunksPackageType, PackageBasicData, PackageInstance } from '../sdk/package';
|
|
4
|
+
export interface BaseRuleStoreData extends Pick<RuleMessage, 'code' | 'category'> {
|
|
5
|
+
/**
|
|
6
|
+
* unique of error
|
|
7
|
+
*/
|
|
8
|
+
id: number | string;
|
|
9
|
+
/**
|
|
10
|
+
* title of alerts
|
|
11
|
+
*/
|
|
12
|
+
title: string;
|
|
13
|
+
/**
|
|
14
|
+
* description of alerts
|
|
15
|
+
*/
|
|
16
|
+
description?: string;
|
|
17
|
+
/**
|
|
18
|
+
* level of error
|
|
19
|
+
*/
|
|
20
|
+
level: 'warn' | 'error';
|
|
21
|
+
/**
|
|
22
|
+
* rule doc link
|
|
23
|
+
*/
|
|
24
|
+
link?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface LinkRuleStoreData extends BaseRuleStoreData {
|
|
27
|
+
type: 'link';
|
|
28
|
+
}
|
|
29
|
+
export interface DependencyWithPackageData {
|
|
30
|
+
/**
|
|
31
|
+
* use to group files, such as different version of duplicate packages.
|
|
32
|
+
* @example
|
|
33
|
+
* [
|
|
34
|
+
* { group: "lodash@1.0.1", ... },
|
|
35
|
+
* { group: "lodash@1.0.1", ... },
|
|
36
|
+
* { group: "lodash@2.0.0", ... },
|
|
37
|
+
* ]
|
|
38
|
+
*/
|
|
39
|
+
group?: string;
|
|
40
|
+
/**
|
|
41
|
+
* module dependency id
|
|
42
|
+
*/
|
|
43
|
+
dependencyId: number;
|
|
44
|
+
}
|
|
45
|
+
export interface PackageRelationData {
|
|
46
|
+
/** Target package data */
|
|
47
|
+
target: PackageBasicData;
|
|
48
|
+
/** Target package size */
|
|
49
|
+
targetSize: {
|
|
50
|
+
sourceSize: number;
|
|
51
|
+
parsedSize: number;
|
|
52
|
+
};
|
|
53
|
+
/** package dependency chain */
|
|
54
|
+
dependencies: DependencyWithPackageData[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Generally serves to view package relationship detection rules.
|
|
58
|
+
*/
|
|
59
|
+
export interface PackageRelationDiffRuleStoreData extends BaseRuleStoreData {
|
|
60
|
+
type: 'package-relation';
|
|
61
|
+
packages: PackageRelationData[];
|
|
62
|
+
}
|
|
63
|
+
export interface CrossChunksPackageRuleStoreData extends BaseRuleStoreData {
|
|
64
|
+
type: 'cross-chunks-package';
|
|
65
|
+
chunks: CrossChunksPackageType[];
|
|
66
|
+
package: Pick<PackageInstance, 'id' | 'name' | 'version'> & {
|
|
67
|
+
size: ReturnType<PackageInstance['getSize']>;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* General service to view file relationship detection rules.
|
|
72
|
+
*/
|
|
73
|
+
export interface FileRelationRuleStoreData extends BaseRuleStoreData {
|
|
74
|
+
type: 'file-relation';
|
|
75
|
+
/** Target file */
|
|
76
|
+
target: string;
|
|
77
|
+
/** Dependency chain */
|
|
78
|
+
dependencies: number[];
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* the rule which code view only
|
|
82
|
+
*/
|
|
83
|
+
export interface CodeViewRuleStoreData extends BaseRuleStoreData {
|
|
84
|
+
type: 'code-view';
|
|
85
|
+
file: {
|
|
86
|
+
/**
|
|
87
|
+
* file path
|
|
88
|
+
*/
|
|
89
|
+
path: string;
|
|
90
|
+
/**
|
|
91
|
+
* the code content
|
|
92
|
+
*/
|
|
93
|
+
content: string;
|
|
94
|
+
/**
|
|
95
|
+
* fix highlight range in source
|
|
96
|
+
*/
|
|
97
|
+
ranges?: SourceRange[];
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* the rule which need to change the file code.
|
|
102
|
+
*/
|
|
103
|
+
export interface CodeChangeRuleStoreData extends BaseRuleStoreData {
|
|
104
|
+
type: 'code-change';
|
|
105
|
+
file: {
|
|
106
|
+
/**
|
|
107
|
+
* file path
|
|
108
|
+
*/
|
|
109
|
+
path: string;
|
|
110
|
+
/**
|
|
111
|
+
* the actual file content
|
|
112
|
+
*/
|
|
113
|
+
actual: string;
|
|
114
|
+
/**
|
|
115
|
+
* the expected file content
|
|
116
|
+
*/
|
|
117
|
+
expected: string;
|
|
118
|
+
/**
|
|
119
|
+
* fix code line in source
|
|
120
|
+
*/
|
|
121
|
+
line?: number;
|
|
122
|
+
/**
|
|
123
|
+
* whether this case is fixed
|
|
124
|
+
* - @default `false`
|
|
125
|
+
*/
|
|
126
|
+
isFixed?: boolean;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface OverlayRuleStoreData extends BaseRuleStoreData {
|
|
130
|
+
code: RuleMessageCodeEnumerated.Overlay;
|
|
131
|
+
stack?: string;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Rule for detecting modules that are included in both initial and async chunks.
|
|
135
|
+
*/
|
|
136
|
+
export interface ModuleMixedChunksRuleStoreData extends BaseRuleStoreData {
|
|
137
|
+
type: 'module-mixed-chunks';
|
|
138
|
+
module: {
|
|
139
|
+
id: number | string;
|
|
140
|
+
path: string;
|
|
141
|
+
webpackId?: string | number;
|
|
142
|
+
};
|
|
143
|
+
initialChunks: Array<{
|
|
144
|
+
id: string;
|
|
145
|
+
name: string;
|
|
146
|
+
}>;
|
|
147
|
+
asyncChunks: Array<{
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
}>;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Rule for detecting modules that are only imported for their side effects,
|
|
154
|
+
* which may indicate unintended tree-shaking failures.
|
|
155
|
+
*/
|
|
156
|
+
export interface ConnectionsOnlyImportsRuleStoreData extends BaseRuleStoreData {
|
|
157
|
+
type: 'tree-shaking-side-effects-only';
|
|
158
|
+
module: {
|
|
159
|
+
id: number | string;
|
|
160
|
+
path: string;
|
|
161
|
+
webpackId?: string | number;
|
|
162
|
+
};
|
|
163
|
+
connections: Array<{
|
|
164
|
+
originModule: number;
|
|
165
|
+
dependencyType: string;
|
|
166
|
+
userRequest: string;
|
|
167
|
+
}>;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Rule for detecting modules imported via CJS require (bare require() call),
|
|
171
|
+
* which prevents tree-shaking of the required module.
|
|
172
|
+
*/
|
|
173
|
+
export interface CjsRequireRuleStoreData extends BaseRuleStoreData {
|
|
174
|
+
type: 'cjs-require';
|
|
175
|
+
/** The module that contains the require() call */
|
|
176
|
+
issuerModule: {
|
|
177
|
+
id: number | string;
|
|
178
|
+
path: string;
|
|
179
|
+
webpackId?: string | number;
|
|
180
|
+
};
|
|
181
|
+
/** The module being required */
|
|
182
|
+
requiredModule: {
|
|
183
|
+
id: number | string;
|
|
184
|
+
path: string;
|
|
185
|
+
webpackId?: string | number;
|
|
186
|
+
};
|
|
187
|
+
/** The original require string (e.g. 'lodash') */
|
|
188
|
+
request: string;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Rule for detecting ESM imports that were resolved to a CJS module
|
|
192
|
+
* even though the package provides an ESM entry.
|
|
193
|
+
*/
|
|
194
|
+
export interface EsmResolvedToCjsRuleStoreData extends BaseRuleStoreData {
|
|
195
|
+
type: 'esm-resolved-to-cjs';
|
|
196
|
+
/** Package name */
|
|
197
|
+
packageName: string;
|
|
198
|
+
/** Package version */
|
|
199
|
+
packageVersion: string;
|
|
200
|
+
/** The ESM entry path declared in the package's package.json */
|
|
201
|
+
esmEntry: string;
|
|
202
|
+
/** The actual resolved (CJS) module */
|
|
203
|
+
resolvedModule: {
|
|
204
|
+
id: number | string;
|
|
205
|
+
path: string;
|
|
206
|
+
webpackId?: string | number;
|
|
207
|
+
};
|
|
208
|
+
/** All issuer modules that imported this package via ESM import */
|
|
209
|
+
issuers: Array<{
|
|
210
|
+
id: number | string;
|
|
211
|
+
path: string;
|
|
212
|
+
/** The import request string (e.g. 'lodash') */
|
|
213
|
+
request: string;
|
|
214
|
+
}>;
|
|
215
|
+
}
|
|
216
|
+
export type RuleStoreDataItem = LinkRuleStoreData | FileRelationRuleStoreData | CodeChangeRuleStoreData | PackageRelationDiffRuleStoreData | CodeViewRuleStoreData | CrossChunksPackageRuleStoreData | ModuleMixedChunksRuleStoreData | ConnectionsOnlyImportsRuleStoreData | CjsRequireRuleStoreData | EsmResolvedToCjsRuleStoreData;
|
|
217
|
+
export type RuleStoreData = RuleStoreDataItem[];
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { NonFunctionProperties } from '../common';
|
|
2
|
+
import type { ModuleInstance, ToDataType } from './module';
|
|
3
|
+
export interface AssetInstance {
|
|
4
|
+
id: number;
|
|
5
|
+
path: string;
|
|
6
|
+
size: number;
|
|
7
|
+
/** File belongs to Chunk */
|
|
8
|
+
chunks: ChunkInstance[];
|
|
9
|
+
/** File resource content */
|
|
10
|
+
content: string;
|
|
11
|
+
gzipSize: number | undefined;
|
|
12
|
+
/** Generate data */
|
|
13
|
+
toData(type: ToDataType): AssetData;
|
|
14
|
+
setId(id: number): void;
|
|
15
|
+
setChunks(chunks: ChunkInstance[]): void;
|
|
16
|
+
setGzipSize(content: string): void;
|
|
17
|
+
}
|
|
18
|
+
export interface ChunkInstance {
|
|
19
|
+
/** Chunk Identifier */
|
|
20
|
+
id: string;
|
|
21
|
+
/** Chunk Name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Whether to load on the homepage */
|
|
24
|
+
initial: boolean;
|
|
25
|
+
size: number;
|
|
26
|
+
/** Is it an entrance */
|
|
27
|
+
entry: boolean;
|
|
28
|
+
/** Is it the entrance Chunk */
|
|
29
|
+
isEntry(): boolean;
|
|
30
|
+
/** Is the module a Chunk entrance */
|
|
31
|
+
isChunkEntryModule(module: ModuleInstance): boolean;
|
|
32
|
+
/** Does it contain modules */
|
|
33
|
+
hasModule(module: ModuleInstance): boolean;
|
|
34
|
+
/** Connection module */
|
|
35
|
+
addModule(module: ModuleInstance): void;
|
|
36
|
+
addAsset(asset: AssetInstance): void;
|
|
37
|
+
/** Add Dependency Chunk */
|
|
38
|
+
addDependency(dep: ChunkInstance): void;
|
|
39
|
+
/** Add Dependent Chunk */
|
|
40
|
+
addImported(imported: ChunkInstance): void;
|
|
41
|
+
/** Includes products */
|
|
42
|
+
getAssets(): AssetInstance[];
|
|
43
|
+
/** Contains original modules */
|
|
44
|
+
getModules(): ModuleInstance[];
|
|
45
|
+
/** Depends on Chunk */
|
|
46
|
+
getDependencies(): ChunkInstance[];
|
|
47
|
+
/** Add Dependent Chunk */
|
|
48
|
+
getImported(): ChunkInstance[];
|
|
49
|
+
/** add parsed chunk size */
|
|
50
|
+
setParsedSize(size: number): void;
|
|
51
|
+
/** Generate data */
|
|
52
|
+
toData(): ChunkData;
|
|
53
|
+
setAssets(assets: AssetInstance[]): void;
|
|
54
|
+
setModules(modules: ModuleInstance[]): void;
|
|
55
|
+
setDependencies(dependencies: ChunkInstance[]): void;
|
|
56
|
+
setImported(imported: ChunkInstance[]): void;
|
|
57
|
+
}
|
|
58
|
+
export interface ChunkGraphInstance {
|
|
59
|
+
/** Obtain product data */
|
|
60
|
+
getAssets(): AssetInstance[];
|
|
61
|
+
/** Get Chunk Data */
|
|
62
|
+
getChunks(): ChunkInstance[];
|
|
63
|
+
/** Add product data */
|
|
64
|
+
addAsset(...assets: AssetInstance[]): void;
|
|
65
|
+
/** Add Chunk Data */
|
|
66
|
+
addChunk(...chunks: ChunkInstance[]): void;
|
|
67
|
+
/** Get chunk by identifier */
|
|
68
|
+
getChunkById(id: string): ChunkInstance | undefined;
|
|
69
|
+
getAssetById(id: number): AssetInstance | undefined;
|
|
70
|
+
/** Get the file according to the path */
|
|
71
|
+
getAssetByPath(path: string): AssetInstance | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* get the list of entry points
|
|
74
|
+
*/
|
|
75
|
+
getEntryPoints(): EntryPointInstance[];
|
|
76
|
+
/**
|
|
77
|
+
* get the entry point by id
|
|
78
|
+
*/
|
|
79
|
+
getEntryPointById(id: number): EntryPointInstance | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* add the entry point instance to chunk graph
|
|
82
|
+
*/
|
|
83
|
+
addEntryPoint(...entrypoint: EntryPointInstance[]): void;
|
|
84
|
+
/** Output pure data */
|
|
85
|
+
toData(type: ToDataType): ChunkGraphData;
|
|
86
|
+
setChunks(chunks: ChunkInstance[]): void;
|
|
87
|
+
setAssets(assets: AssetInstance[]): void;
|
|
88
|
+
setEntrypoints(entrypoints: EntryPointInstance[]): void;
|
|
89
|
+
}
|
|
90
|
+
export interface AssetData extends Omit<NonFunctionProperties<AssetInstance>, 'chunks'> {
|
|
91
|
+
/** Chunk Identifier to which the file belongs */
|
|
92
|
+
chunks: string[];
|
|
93
|
+
}
|
|
94
|
+
export interface ChunkGraphData extends NonFunctionProperties<ChunkGraphInstance> {
|
|
95
|
+
assets: AssetData[];
|
|
96
|
+
chunks: ChunkData[];
|
|
97
|
+
entrypoints: EntryPointData[];
|
|
98
|
+
}
|
|
99
|
+
export interface ChunkData extends Omit<NonFunctionProperties<ChunkInstance>, 'assets' | 'modules' | 'dependencies' | 'imported'> {
|
|
100
|
+
/** Is it the entrance Chunk */
|
|
101
|
+
entry: boolean;
|
|
102
|
+
/** Contains product path */
|
|
103
|
+
assets: string[];
|
|
104
|
+
/** contains the original module identifier */
|
|
105
|
+
modules: number[];
|
|
106
|
+
/** Depends on Chunk Identifier */
|
|
107
|
+
dependencies: string[];
|
|
108
|
+
/** Dependent Chunk Identifier */
|
|
109
|
+
imported: string[];
|
|
110
|
+
/** chunk parsed size */
|
|
111
|
+
parsedSize: number;
|
|
112
|
+
}
|
|
113
|
+
export interface EntryPointInstance {
|
|
114
|
+
id: number;
|
|
115
|
+
name: string;
|
|
116
|
+
/**
|
|
117
|
+
* add asset which contained in this entry point
|
|
118
|
+
*/
|
|
119
|
+
addAsset(asset: AssetInstance): void;
|
|
120
|
+
/**
|
|
121
|
+
* add chunk which contained in this entry point
|
|
122
|
+
*/
|
|
123
|
+
addChunk(chunk: ChunkInstance): void;
|
|
124
|
+
toData(): EntryPointData;
|
|
125
|
+
setId(id: number): void;
|
|
126
|
+
setChunks(chunks: ChunkInstance[]): void;
|
|
127
|
+
setAssets(assets: AssetInstance[]): void;
|
|
128
|
+
}
|
|
129
|
+
export interface EntryPointData extends NonFunctionProperties<EntryPointInstance> {
|
|
130
|
+
/**
|
|
131
|
+
* id list for chunks which contained in this entry point.
|
|
132
|
+
*/
|
|
133
|
+
chunks: ChunkData['id'][];
|
|
134
|
+
/**
|
|
135
|
+
* path list for assets which contained in this entry point.
|
|
136
|
+
*/
|
|
137
|
+
assets: AssetData['path'][];
|
|
138
|
+
/**
|
|
139
|
+
* total size of assets
|
|
140
|
+
*/
|
|
141
|
+
size: number;
|
|
142
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Configuration } from 'webpack';
|
|
2
|
+
import type { Configuration as RspackConfiguration } from '@rspack/core';
|
|
3
|
+
type RspackConfigurationWrapper = any extends RspackConfiguration ? never : RspackConfiguration;
|
|
4
|
+
export interface WebpackConfigData {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string | number;
|
|
7
|
+
bin?: string;
|
|
8
|
+
config: Configuration | RspackConfigurationWrapper;
|
|
9
|
+
root: string;
|
|
10
|
+
}
|
|
11
|
+
export type ConfigData = WebpackConfigData[];
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChunkGraphInstance } from './chunk';
|
|
2
|
+
import type { ModuleGraphInstance } from './module';
|
|
3
|
+
import type { PackageGraphInstance, OtherReports } from './package';
|
|
4
|
+
import { ConfigData } from './config';
|
|
5
|
+
import { LoaderData } from './loader';
|
|
6
|
+
export interface RuntimeContext {
|
|
7
|
+
/** Project root directory */
|
|
8
|
+
root: string;
|
|
9
|
+
/** Project configuration */
|
|
10
|
+
configs: ConfigData;
|
|
11
|
+
/** build error */
|
|
12
|
+
errors: Error[];
|
|
13
|
+
/** Chunk chart */
|
|
14
|
+
chunkGraph: ChunkGraphInstance;
|
|
15
|
+
/** Module diagram */
|
|
16
|
+
moduleGraph: ModuleGraphInstance;
|
|
17
|
+
/** Dependency graph */
|
|
18
|
+
packageGraph: PackageGraphInstance;
|
|
19
|
+
loader: LoaderData;
|
|
20
|
+
otherReports?: OtherReports | undefined;
|
|
21
|
+
}
|
|
22
|
+
export interface RuntimeContextOptions {
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface EnvInfo {
|
|
2
|
+
/**
|
|
3
|
+
* @example "macOS 11.4"
|
|
4
|
+
*/
|
|
5
|
+
os: string;
|
|
6
|
+
/**
|
|
7
|
+
* @example "(12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz"
|
|
8
|
+
*/
|
|
9
|
+
cpu: string;
|
|
10
|
+
/**
|
|
11
|
+
* @example "1.07 GB / 32.00 GB"
|
|
12
|
+
*/
|
|
13
|
+
memory: string;
|
|
14
|
+
nodeVersion: string;
|
|
15
|
+
yarnVersion: string;
|
|
16
|
+
npmVersion: string;
|
|
17
|
+
pnpmVersion: string;
|
|
18
|
+
[key: string]: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AsyncSeriesHook } from 'tapable';
|
|
2
|
+
import { RsdoctorManifestWithShardingFiles } from '../manifest';
|
|
3
|
+
/**
|
|
4
|
+
* sdk hooks map
|
|
5
|
+
*/
|
|
6
|
+
export interface Hooks {
|
|
7
|
+
afterSaveManifest: AsyncSeriesHook<[
|
|
8
|
+
{
|
|
9
|
+
manifestWithShardingFiles: RsdoctorManifestWithShardingFiles;
|
|
10
|
+
manifestDiskPath: string;
|
|
11
|
+
manifestCloudPath?: string;
|
|
12
|
+
}
|
|
13
|
+
]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export * from './loader';
|
|
2
|
+
export * from './resolver';
|
|
3
|
+
export * from './plugin';
|
|
4
|
+
export * from './module';
|
|
5
|
+
export * from './chunk';
|
|
6
|
+
export * from './result';
|
|
7
|
+
export * from './summary';
|
|
8
|
+
export * from './package';
|
|
9
|
+
export * from './context';
|
|
10
|
+
export * from './config';
|
|
11
|
+
export * from './server';
|
|
12
|
+
export * from './statement';
|
|
13
|
+
export * from './treeShaking';
|
|
14
|
+
export * from './envinfo';
|
|
15
|
+
export * from './instance';
|
|
16
|
+
export * from './hooks';
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { SourceMapConsumer, RawSourceMap } from 'source-map';
|
|
2
|
+
import { LoaderData, ResourceLoaderData } from './loader';
|
|
3
|
+
import { ResolverData } from './resolver';
|
|
4
|
+
import { PluginData } from './plugin';
|
|
5
|
+
import { BuilderStoreData, EMOStoreData } from './result';
|
|
6
|
+
import { ModuleGraphInstance, ToDataType } from './module';
|
|
7
|
+
import { RsdoctorManifestClientRoutes, RsdoctorManifestWithShardingFiles } from '../manifest';
|
|
8
|
+
import { RuntimeContext, RuntimeContextOptions } from './context';
|
|
9
|
+
import { Hooks } from './hooks';
|
|
10
|
+
import { ChunkGraphInstance } from './chunk';
|
|
11
|
+
import { RsdoctorServerInstance } from './server';
|
|
12
|
+
import { PlainObject } from '../common';
|
|
13
|
+
import { BriefModeOptions } from '../config';
|
|
14
|
+
import { EmoCheckData } from '../emo';
|
|
15
|
+
import { SummaryData } from './summary';
|
|
16
|
+
import { ConfigData } from './config';
|
|
17
|
+
export type WriteStoreOptionsType = {};
|
|
18
|
+
export declare enum IMode {
|
|
19
|
+
brief = "brief",
|
|
20
|
+
lite = "lite",
|
|
21
|
+
normal = "normal"
|
|
22
|
+
}
|
|
23
|
+
export interface RsdoctorBuilderSDKInstance extends RsdoctorSDKInstance {
|
|
24
|
+
readonly server: RsdoctorServerInstance;
|
|
25
|
+
type: ToDataType;
|
|
26
|
+
/** Report configuration information */
|
|
27
|
+
reportConfiguration(config: ConfigData[0]): void;
|
|
28
|
+
/** Report error message */
|
|
29
|
+
reportError(errors: Error[]): void;
|
|
30
|
+
/** Report error message */
|
|
31
|
+
reportLoader(data: LoaderData): void;
|
|
32
|
+
/** Report loader message before or after some builtin loader */
|
|
33
|
+
reportLoaderStartOrEnd(data: ResourceLoaderData): void;
|
|
34
|
+
/** Report path request information */
|
|
35
|
+
reportResolver(data: ResolverData): void;
|
|
36
|
+
/** Report plugin information */
|
|
37
|
+
reportPlugin(data: PluginData): void;
|
|
38
|
+
/** Report module chart data */
|
|
39
|
+
reportModuleGraph(data: ModuleGraphInstance): void;
|
|
40
|
+
reportChunkGraph(data: ChunkGraphInstance): void;
|
|
41
|
+
/** report the data of summary */
|
|
42
|
+
reportSummaryData(part: Partial<SummaryData>): void;
|
|
43
|
+
/** Report sourceMap data */
|
|
44
|
+
reportSourceMap(data: RawSourceMap): void;
|
|
45
|
+
getClientRoutes(): RsdoctorManifestClientRoutes[];
|
|
46
|
+
addClientRoutes(routes: RsdoctorManifestClientRoutes[]): void;
|
|
47
|
+
/** Application error modification */
|
|
48
|
+
applyErrorFix(id: number): Promise<void>;
|
|
49
|
+
/** Get build result data */
|
|
50
|
+
getStoreData(): BuilderStoreData;
|
|
51
|
+
/** Get build resource entry file */
|
|
52
|
+
getManifestData(): RsdoctorManifestWithShardingFiles;
|
|
53
|
+
/** Get rule context */
|
|
54
|
+
getRuleContext(options: RuntimeContextOptions): RuntimeContext;
|
|
55
|
+
/** Get SourceMap from cache */
|
|
56
|
+
getSourceMap(file: string): Promise<SourceMapConsumer | undefined>;
|
|
57
|
+
/** clear cache */
|
|
58
|
+
clearSourceMapCache(): void;
|
|
59
|
+
/** Clear all data */
|
|
60
|
+
clear(): void;
|
|
61
|
+
/** Write store data to files */
|
|
62
|
+
writeStore(options?: WriteStoreOptionsType): Promise<string>;
|
|
63
|
+
}
|
|
64
|
+
export interface RsdoctorEMOSDKInstance extends RsdoctorSDKInstance {
|
|
65
|
+
reportEmoData(data: EmoCheckData): void;
|
|
66
|
+
getStoreData(): EMOStoreData;
|
|
67
|
+
}
|
|
68
|
+
export interface RsdoctorSDKInstance {
|
|
69
|
+
readonly name: string;
|
|
70
|
+
readonly root: string;
|
|
71
|
+
readonly extraConfig: SDKOptionsType | undefined;
|
|
72
|
+
readonly hooks: Hooks;
|
|
73
|
+
/**
|
|
74
|
+
* folder of manifest
|
|
75
|
+
* - used to save the manifest.json and sharding files.
|
|
76
|
+
* @default ".rsdoctor"
|
|
77
|
+
*/
|
|
78
|
+
readonly outputDir: string;
|
|
79
|
+
/** manifest local path */
|
|
80
|
+
diskManifestPath: string;
|
|
81
|
+
/** start */
|
|
82
|
+
bootstrap(): Promise<void>;
|
|
83
|
+
dispose(): Promise<void>;
|
|
84
|
+
/** Change output path */
|
|
85
|
+
setOutputDir(outputDir: string): void;
|
|
86
|
+
/** Change build name */
|
|
87
|
+
setName(name: string): void;
|
|
88
|
+
setHash(hash: string): void;
|
|
89
|
+
getHash(): string;
|
|
90
|
+
/**
|
|
91
|
+
* write the manifest to a folder
|
|
92
|
+
* - use this.outputDir
|
|
93
|
+
* @returns the absolute path of manifest.json.
|
|
94
|
+
*/
|
|
95
|
+
saveManifest(storeData: PlainObject, options: WriteStoreOptionsType): Promise<string>;
|
|
96
|
+
}
|
|
97
|
+
export interface IPrintLog {
|
|
98
|
+
serverUrls: boolean;
|
|
99
|
+
}
|
|
100
|
+
export type SDKOptionsType = {
|
|
101
|
+
innerClientPath?: string;
|
|
102
|
+
disableClientServer?: boolean;
|
|
103
|
+
noServer?: boolean;
|
|
104
|
+
printLog?: IPrintLog;
|
|
105
|
+
mode?: keyof typeof IMode;
|
|
106
|
+
brief?: BriefModeOptions;
|
|
107
|
+
features?: {
|
|
108
|
+
treeShaking?: boolean;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { PlainObject } from '../common';
|
|
2
|
+
import { DevToolErrorInstance } from '../error';
|
|
3
|
+
import { ProcessData } from './process';
|
|
4
|
+
/** Single Loader conversion data for processing files */
|
|
5
|
+
export interface LoaderTransformData extends ProcessData {
|
|
6
|
+
/** loader name */
|
|
7
|
+
loader: string;
|
|
8
|
+
/**
|
|
9
|
+
* loader index
|
|
10
|
+
*/
|
|
11
|
+
loaderIndex: number;
|
|
12
|
+
/** loader path */
|
|
13
|
+
path: string;
|
|
14
|
+
input: string | null | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* - isPitch: true: the result of loader.pitch()
|
|
17
|
+
* - isPitch: false: the code result of loader()
|
|
18
|
+
*/
|
|
19
|
+
result: string | null | undefined;
|
|
20
|
+
/** Timestamp when called */
|
|
21
|
+
startAt: number;
|
|
22
|
+
endAt: number;
|
|
23
|
+
/** loader configuration */
|
|
24
|
+
options: PlainObject;
|
|
25
|
+
/** pitching loader */
|
|
26
|
+
isPitch: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* is sync
|
|
29
|
+
*/
|
|
30
|
+
sync: boolean;
|
|
31
|
+
/** Error during conversion */
|
|
32
|
+
errors: DevToolErrorInstance[];
|
|
33
|
+
/** module layer */
|
|
34
|
+
layer?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Original file data */
|
|
37
|
+
export interface ResourceData {
|
|
38
|
+
/**
|
|
39
|
+
* Resource path
|
|
40
|
+
* @example '/abc/resource.js'
|
|
41
|
+
*/
|
|
42
|
+
path: string;
|
|
43
|
+
/**
|
|
44
|
+
* Resource parameters
|
|
45
|
+
* @example '?rrr'
|
|
46
|
+
*/
|
|
47
|
+
queryRaw: string;
|
|
48
|
+
/**
|
|
49
|
+
* Resource parameter object
|
|
50
|
+
* @example '{ abc: true }'
|
|
51
|
+
*/
|
|
52
|
+
query: PlainObject;
|
|
53
|
+
/**
|
|
54
|
+
* @example 'js'
|
|
55
|
+
* @example 'txt'
|
|
56
|
+
*/
|
|
57
|
+
ext: string;
|
|
58
|
+
/**
|
|
59
|
+
* Resource module layer
|
|
60
|
+
*/
|
|
61
|
+
layer?: string;
|
|
62
|
+
}
|
|
63
|
+
/** File conversion process data */
|
|
64
|
+
export interface ResourceLoaderData {
|
|
65
|
+
/** File data */
|
|
66
|
+
resource: ResourceData;
|
|
67
|
+
/** Passing loader */
|
|
68
|
+
loaders: LoaderTransformData[];
|
|
69
|
+
}
|
|
70
|
+
export type LoaderData = ResourceLoaderData[];
|