@rsdoctor/types 1.5.8 → 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,49 @@
|
|
|
1
|
+
import { RsdoctorClientAssetsSummary } from '../../../client';
|
|
2
|
+
import { AssetData, ChunkData, ChunkGraphData, EntryPointData } from '../../chunk';
|
|
3
|
+
import { ModuleData, ModuleGraphData, SideEffectCodeData } from '../../module';
|
|
4
|
+
import { API } from './index';
|
|
5
|
+
export interface GraphAPIResponse {
|
|
6
|
+
[API.GetAssetsSummary]: RsdoctorClientAssetsSummary;
|
|
7
|
+
[API.GetAssetDetails]: {
|
|
8
|
+
asset: AssetData;
|
|
9
|
+
} & Pick<ModuleGraphData, 'modules'> & Pick<ChunkGraphData, 'chunks'>;
|
|
10
|
+
[API.GetChunksByModuleId]: ChunkData[];
|
|
11
|
+
[API.GetModuleDetails]: {
|
|
12
|
+
module: ModuleData;
|
|
13
|
+
sideEffectCodes?: SideEffectCodeData[];
|
|
14
|
+
} & Pick<ModuleGraphData, 'dependencies'>;
|
|
15
|
+
[API.GetModulesByModuleIds]: ModuleData[];
|
|
16
|
+
[API.GetEntryPoints]: EntryPointData[];
|
|
17
|
+
}
|
|
18
|
+
export interface GraphAPIRequestBody {
|
|
19
|
+
[API.GetAssetsSummary]: {
|
|
20
|
+
withFileContent?: boolean;
|
|
21
|
+
};
|
|
22
|
+
[API.GetAssetDetails]: {
|
|
23
|
+
assetPath: string;
|
|
24
|
+
};
|
|
25
|
+
[API.GetChunksByModuleId]: {
|
|
26
|
+
moduleId: number;
|
|
27
|
+
};
|
|
28
|
+
[API.GetModuleDetails]: {
|
|
29
|
+
moduleId: number;
|
|
30
|
+
};
|
|
31
|
+
[API.GetModulesByModuleIds]: {
|
|
32
|
+
moduleIds: number[];
|
|
33
|
+
};
|
|
34
|
+
[API.GetModuleCodeByModuleId]: {
|
|
35
|
+
moduleId: number;
|
|
36
|
+
};
|
|
37
|
+
[API.GetModuleCodeByModuleIds]: {
|
|
38
|
+
moduleIds: number[];
|
|
39
|
+
};
|
|
40
|
+
[API.GetAllModuleGraph]: {};
|
|
41
|
+
[API.GetAllChunkGraph]: {};
|
|
42
|
+
[API.GetSearchModules]: {
|
|
43
|
+
moduleName: string;
|
|
44
|
+
};
|
|
45
|
+
[API.GetSearchModuleInChunk]: {
|
|
46
|
+
moduleName: string;
|
|
47
|
+
chunk: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { ServerResponse } from 'http';
|
|
2
|
+
import { PlainObject, Get } from '../../../common';
|
|
3
|
+
import { connect } from '../../../thirdparty';
|
|
4
|
+
import { RsdoctorBuilderSDKInstance } from '../../index';
|
|
5
|
+
import { RsdoctorServerInstance } from '../index';
|
|
6
|
+
import { LoaderData } from '../../loader';
|
|
7
|
+
import { ProjectAPIResponse, ProjectAPIRequestBody } from './project';
|
|
8
|
+
import { LoaderAPIResponse, LoaderAPIRequestBody } from './loader';
|
|
9
|
+
import { ResolverAPIResponse, ResolverAPIRequestBody } from './resolver';
|
|
10
|
+
import { PluginAPIResponse, PluginAPIRequestBody } from './plugin';
|
|
11
|
+
import { GraphAPIResponse, GraphAPIRequestBody } from './graph';
|
|
12
|
+
import { AlertsAPIResponse, AlertsAPIRequestBody } from './alerts';
|
|
13
|
+
import { RsdoctorManifestMappingKeys } from '../../../manifest';
|
|
14
|
+
import { SDK } from '../../../index';
|
|
15
|
+
import { StatsModule } from '../../../plugin';
|
|
16
|
+
export * from './pagination';
|
|
17
|
+
export declare enum API {
|
|
18
|
+
ApplyErrorFix = "/api/apply/error/fix",
|
|
19
|
+
Env = "/api/env",
|
|
20
|
+
EntryHtml = "/index.html",
|
|
21
|
+
Manifest = "/api/manifest.json",
|
|
22
|
+
LoadDataByKey = "/api/data/key",
|
|
23
|
+
SendAPIDataToClient = "/api/socket/send",
|
|
24
|
+
/** Project API */
|
|
25
|
+
GetProjectInfo = "/api/project/info",
|
|
26
|
+
GetClientRoutes = "/api/routes",
|
|
27
|
+
/** Loader API */
|
|
28
|
+
ReportLoader = "/api/loader/report",
|
|
29
|
+
GetLoaderNames = "/api/loader/names",
|
|
30
|
+
GetLoaderChartData = "/api/loader/chart/data",
|
|
31
|
+
GetLoaderFileTree = "/api/loader/filetree",
|
|
32
|
+
GetLoaderFileDetails = "/api/loader/file",
|
|
33
|
+
GetLoaderFolderStatistics = "/api/loader/folder/statics",
|
|
34
|
+
GetLoaderFileFirstInput = "/api/loader/input",
|
|
35
|
+
GetLoaderFileInputAndOutput = "/api/loader/inputandoutput",
|
|
36
|
+
GetDirectoriesLoaders = "/api/loader/directories",
|
|
37
|
+
/** SourceMap API */
|
|
38
|
+
ReportSourceMap = "/api/sourcemap/report",
|
|
39
|
+
/** Resolver API */
|
|
40
|
+
GetResolverFileTree = "/api/resolver/filetree",
|
|
41
|
+
GetResolverFileDetails = "/api/resolver/file",
|
|
42
|
+
/** Plugin API */
|
|
43
|
+
GetPluginSummary = "/api/plugins/summary",
|
|
44
|
+
GetPluginData = "/api/plugins/data",
|
|
45
|
+
/** Graph API */
|
|
46
|
+
GetSummaryBundles = "/api/graph/bundles/summary",
|
|
47
|
+
GetChunkGraph = "/api/graph/chunks/graph",
|
|
48
|
+
GetAssetsSummary = "/api/graph/assets/summary",
|
|
49
|
+
GetAssetDetails = "/api/graph/asset/details",
|
|
50
|
+
GetChunksByModuleId = "/api/graph/chunk/module",
|
|
51
|
+
GetModuleDetails = "/api/graph/module/details",
|
|
52
|
+
GetModulesByModuleIds = "/api/graph/modules/ids",
|
|
53
|
+
GetEntryPoints = "/api/graph/entrypoints",
|
|
54
|
+
GetModuleCodeByModuleId = "/api/graph/module/code",
|
|
55
|
+
GetModuleCodeByModuleIds = "/api/graph/module/codes",
|
|
56
|
+
GetAllModuleGraph = "/api/graph/module/all",
|
|
57
|
+
GetAllChunkGraph = "/api/graph/chunk/all",
|
|
58
|
+
GetLayers = "/api/graph/layers",
|
|
59
|
+
GetSearchModules = "/api/search/modules",
|
|
60
|
+
GetSearchModuleInChunk = "/api/search/chunk/modules",
|
|
61
|
+
GetAllModuleGraphFilter = "/api/graph/module/filter",
|
|
62
|
+
GetModuleByName = "/api/graph/module/name",
|
|
63
|
+
GetModuleIssuerPath = "/api/graph/module/issuer_path",
|
|
64
|
+
/** Package API */
|
|
65
|
+
GetPackageInfo = "/api/package/info",
|
|
66
|
+
GetPackageDependency = "/api/package/dependency",
|
|
67
|
+
/** Alerts API */
|
|
68
|
+
GetPackageRelationAlertDetails = "/api/alerts/details/package/relation",
|
|
69
|
+
GetOverlayAlerts = "/api/alerts/overlay",
|
|
70
|
+
GetBundleAlerts = "/api/alerts/bundle",
|
|
71
|
+
/** BundleDiff API */
|
|
72
|
+
BundleDiffManifest = "/api/bundle_diff/manifest.json",
|
|
73
|
+
GetBundleDiffSummary = "/api/bundle_diff/summary",
|
|
74
|
+
/** AI API */
|
|
75
|
+
GetChunkGraphAI = "/api/graph/chunks/graph/ai",
|
|
76
|
+
GetChunkByIdAI = "/api/graph/chunk/id/ai"
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* api which used outside the sdk.
|
|
80
|
+
*/
|
|
81
|
+
export declare enum APIExtends {
|
|
82
|
+
GetCompileProgress = "/api/progress"
|
|
83
|
+
}
|
|
84
|
+
export interface SocketResponseType<T extends API | APIExtends = API> {
|
|
85
|
+
/**
|
|
86
|
+
* use to match for the event listener when there are different request body.
|
|
87
|
+
*/
|
|
88
|
+
req: {
|
|
89
|
+
api: T;
|
|
90
|
+
body: InferRequestBodyType<T>;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* api response
|
|
94
|
+
*/
|
|
95
|
+
res: InferResponseType<T>;
|
|
96
|
+
}
|
|
97
|
+
export interface ResponseTypes extends LoaderAPIResponse, ResolverAPIResponse, PluginAPIResponse, GraphAPIResponse, AlertsAPIResponse, ProjectAPIResponse {
|
|
98
|
+
[API.ReportLoader]: 'ok';
|
|
99
|
+
[API.EntryHtml]: string;
|
|
100
|
+
[API.Manifest]: string;
|
|
101
|
+
[API.ApplyErrorFix]: 'success';
|
|
102
|
+
[API.LoadDataByKey]: unknown;
|
|
103
|
+
[API.BundleDiffManifest]: SDK.BuilderStoreData;
|
|
104
|
+
[API.GetBundleDiffSummary]: {
|
|
105
|
+
root: string;
|
|
106
|
+
hash: string;
|
|
107
|
+
outputFilename: string;
|
|
108
|
+
errors: SDK.ErrorsData;
|
|
109
|
+
chunkGraph: SDK.ChunkGraphData;
|
|
110
|
+
moduleGraph: SDK.ModuleGraphData;
|
|
111
|
+
packageGraph: SDK.PackageGraphData;
|
|
112
|
+
moduleCodeMap: SDK.ModuleCodeData;
|
|
113
|
+
cloudManifestUrl: string;
|
|
114
|
+
};
|
|
115
|
+
[API.GetChunkGraph]: SDK.ChunkData[];
|
|
116
|
+
[API.GetAllModuleGraphFilter]: SDK.ModuleData[];
|
|
117
|
+
[API.GetModuleCodeByModuleId]: SDK.ModuleSource;
|
|
118
|
+
[API.GetModuleCodeByModuleIds]: SDK.ModuleCodeData;
|
|
119
|
+
[API.GetAllModuleGraph]: SDK.ModuleData[];
|
|
120
|
+
[API.GetSearchModules]: Record<string, string>;
|
|
121
|
+
[API.GetSearchModuleInChunk]: {
|
|
122
|
+
id: string;
|
|
123
|
+
path: string;
|
|
124
|
+
relativePath: string;
|
|
125
|
+
}[];
|
|
126
|
+
[API.GetAllChunkGraph]: SDK.ChunkData[];
|
|
127
|
+
[API.GetModuleByName]: {
|
|
128
|
+
id: number;
|
|
129
|
+
path: string;
|
|
130
|
+
}[];
|
|
131
|
+
[API.GetModuleIssuerPath]: StatsModule['issuerPath'];
|
|
132
|
+
[API.GetPackageInfo]: SDK.PackageData[];
|
|
133
|
+
[API.GetPackageDependency]: SDK.PackageDependencyData[];
|
|
134
|
+
[API.GetChunkByIdAI]: ExtendedChunkData[];
|
|
135
|
+
[API.GetChunkGraphAI]: Omit<SDK.ChunkData, 'modules'>[];
|
|
136
|
+
[API.GetSummaryBundles]: {
|
|
137
|
+
asset: SDK.AssetData;
|
|
138
|
+
modules: SDK.ModuleData[];
|
|
139
|
+
}[];
|
|
140
|
+
}
|
|
141
|
+
export interface RequestBodyTypes extends LoaderAPIRequestBody, ResolverAPIRequestBody, PluginAPIRequestBody, GraphAPIRequestBody, AlertsAPIRequestBody, ProjectAPIRequestBody {
|
|
142
|
+
[API.ReportLoader]: LoaderData;
|
|
143
|
+
[API.ApplyErrorFix]: {
|
|
144
|
+
id: number;
|
|
145
|
+
};
|
|
146
|
+
[API.SendAPIDataToClient]: {
|
|
147
|
+
api: API;
|
|
148
|
+
data: unknown;
|
|
149
|
+
};
|
|
150
|
+
[API.LoadDataByKey]: {
|
|
151
|
+
/**
|
|
152
|
+
* @example 'plugin'
|
|
153
|
+
* @example 'moduleGraph.modules'
|
|
154
|
+
*/
|
|
155
|
+
key: RsdoctorManifestMappingKeys;
|
|
156
|
+
};
|
|
157
|
+
[API.GetModuleByName]: {
|
|
158
|
+
moduleName: string;
|
|
159
|
+
};
|
|
160
|
+
[API.GetModuleIssuerPath]: {
|
|
161
|
+
moduleId: string;
|
|
162
|
+
};
|
|
163
|
+
[API.GetPackageDependency]: {
|
|
164
|
+
packageId: string;
|
|
165
|
+
};
|
|
166
|
+
[API.GetChunkByIdAI]: {
|
|
167
|
+
chunkId: string;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export type InferResponseType<T, F = void> = Get<ResponseTypes, T, F>;
|
|
171
|
+
export type InferRequestBodyType<T, F = void> = Get<RequestBodyTypes, T, F>;
|
|
172
|
+
export interface APIContext {
|
|
173
|
+
server: RsdoctorServerInstance;
|
|
174
|
+
sdk: RsdoctorBuilderSDKInstance;
|
|
175
|
+
req: connect.IncomingMessage & {
|
|
176
|
+
body?: PlainObject;
|
|
177
|
+
};
|
|
178
|
+
res: ServerResponse;
|
|
179
|
+
}
|
|
180
|
+
export interface ExtendedChunkData extends SDK.ChunkData {
|
|
181
|
+
modulesInfo: {
|
|
182
|
+
id: number;
|
|
183
|
+
path: string;
|
|
184
|
+
size: SDK.ModuleSize;
|
|
185
|
+
chunks: string[];
|
|
186
|
+
kind: SDK.ModuleKind;
|
|
187
|
+
issuerPath: string[] | number[] | undefined;
|
|
188
|
+
}[];
|
|
189
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { API } from './index';
|
|
2
|
+
import { ResourceData, LoaderTransformData } from '../../loader';
|
|
3
|
+
import { Get } from '../../../common';
|
|
4
|
+
export interface LoaderAPIResponse {
|
|
5
|
+
[API.GetLoaderNames]: string[];
|
|
6
|
+
[API.GetLayers]: string[];
|
|
7
|
+
[API.GetLoaderChartData]: Array<Pick<LoaderTransformData, 'loader' | 'isPitch' | 'startAt' | 'endAt' | 'pid' | 'sync'> & {
|
|
8
|
+
resource: Get<ResourceData, 'path'>;
|
|
9
|
+
layer: Get<ResourceData, 'layer'>;
|
|
10
|
+
costs: number;
|
|
11
|
+
}>;
|
|
12
|
+
[API.GetLoaderFileTree]: Array<Pick<ResourceData, 'path' | 'layer'> & {
|
|
13
|
+
loaders: Array<Pick<LoaderTransformData, 'loader' | 'path' | 'errors'> & {
|
|
14
|
+
costs: number;
|
|
15
|
+
}>;
|
|
16
|
+
}>;
|
|
17
|
+
[API.GetLoaderFileDetails]: {
|
|
18
|
+
resource: ResourceData;
|
|
19
|
+
loaders: (Omit<LoaderTransformData, 'input' | 'result'> & {
|
|
20
|
+
costs: number;
|
|
21
|
+
})[];
|
|
22
|
+
};
|
|
23
|
+
[API.GetLoaderFolderStatistics]: Array<Pick<LoaderTransformData, 'loader' | 'path'> & {
|
|
24
|
+
files: number;
|
|
25
|
+
costs: number;
|
|
26
|
+
}>;
|
|
27
|
+
[API.GetLoaderFileFirstInput]: string;
|
|
28
|
+
[API.GetLoaderFileInputAndOutput]: {
|
|
29
|
+
input: string;
|
|
30
|
+
output: string;
|
|
31
|
+
};
|
|
32
|
+
[API.GetDirectoriesLoaders]: Array<{
|
|
33
|
+
directory: string;
|
|
34
|
+
stats: Array<Pick<LoaderTransformData, 'loader' | 'path'> & {
|
|
35
|
+
files: number;
|
|
36
|
+
costs: number;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
export interface LoaderAPIRequestBody {
|
|
41
|
+
[API.GetLoaderFileDetails]: Pick<ResourceData, 'path'>;
|
|
42
|
+
[API.GetLoaderFolderStatistics]: {
|
|
43
|
+
folder: string;
|
|
44
|
+
};
|
|
45
|
+
[API.GetLoaderFileFirstInput]: {
|
|
46
|
+
file: string;
|
|
47
|
+
};
|
|
48
|
+
[API.GetLoaderFileInputAndOutput]: {
|
|
49
|
+
file: string;
|
|
50
|
+
loader: string;
|
|
51
|
+
loaderIndex: number;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface PaginationRequest {
|
|
2
|
+
page?: number;
|
|
3
|
+
pageSize?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface PaginationResponse extends Required<PaginationRequest> {
|
|
6
|
+
hasNextPage: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface EnhanceWithPaginationResponse<T> {
|
|
9
|
+
data: T;
|
|
10
|
+
pagination: PaginationResponse;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { API } from './index';
|
|
2
|
+
import { PluginHookData } from '../../plugin';
|
|
3
|
+
export interface PluginAPIResponse {
|
|
4
|
+
[API.GetPluginSummary]: {
|
|
5
|
+
hooks: string[];
|
|
6
|
+
tapNames: string[];
|
|
7
|
+
};
|
|
8
|
+
[API.GetPluginData]: {
|
|
9
|
+
hook: string;
|
|
10
|
+
tapName: string;
|
|
11
|
+
data: Pick<PluginHookData, 'startAt' | 'endAt' | 'type' | 'costs'>[];
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
export interface PluginAPIRequestBody {
|
|
15
|
+
[API.GetPluginData]: {
|
|
16
|
+
hooks?: string[];
|
|
17
|
+
tapNames?: string[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RsdoctorManifestClientRoutes, RsdoctorManifestData } from '../../../manifest';
|
|
2
|
+
import { API, APIExtends } from './index';
|
|
3
|
+
export interface ProjectAPIResponse {
|
|
4
|
+
[API.Env]: {
|
|
5
|
+
ip: string;
|
|
6
|
+
port: number;
|
|
7
|
+
};
|
|
8
|
+
[API.GetProjectInfo]: Pick<RsdoctorManifestData, 'hash' | 'root' | 'pid' | 'summary' | 'configs' | 'envinfo' | 'errors'> & {
|
|
9
|
+
name?: string;
|
|
10
|
+
};
|
|
11
|
+
[API.GetClientRoutes]: RsdoctorManifestClientRoutes[];
|
|
12
|
+
[APIExtends.GetCompileProgress]: {
|
|
13
|
+
percentage: number;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface ProjectAPIRequestBody {
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { API } from './index';
|
|
2
|
+
import { PathResolverData } from '../../resolver';
|
|
3
|
+
export interface ResolverAPIResponse {
|
|
4
|
+
[API.GetResolverFileTree]: Array<Pick<PathResolverData, 'issuerPath'>>;
|
|
5
|
+
[API.GetResolverFileDetails]: {
|
|
6
|
+
filepath: string;
|
|
7
|
+
before: string;
|
|
8
|
+
after: string;
|
|
9
|
+
resolvers: (PathResolverData & {
|
|
10
|
+
costs: number;
|
|
11
|
+
})[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface ResolverAPIRequestBody {
|
|
15
|
+
[API.GetResolverFileDetails]: {
|
|
16
|
+
filepath: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PlainObject } from '../../common';
|
|
2
|
+
import { connect } from '../../thirdparty';
|
|
3
|
+
import { RsdoctorClientRoutes } from '../../client';
|
|
4
|
+
import { API, APIExtends } from './apis';
|
|
5
|
+
export * as ServerAPI from './apis';
|
|
6
|
+
interface ClientUrlFunctionWithRouteDefined<T> {
|
|
7
|
+
(route: RsdoctorClientRoutes.BundleDiff, baselineUrl: string, currentUrl: string): T;
|
|
8
|
+
(route?: 'homepage'): T;
|
|
9
|
+
}
|
|
10
|
+
export interface RsdoctorServerInstance {
|
|
11
|
+
readonly app: connect.Server;
|
|
12
|
+
readonly port: number;
|
|
13
|
+
readonly origin: string;
|
|
14
|
+
innerClientPath?: string;
|
|
15
|
+
get(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
|
|
16
|
+
post(route: string, cb: (...args: Parameters<connect.NextHandleFunction>) => string | PlainObject): connect.Server;
|
|
17
|
+
proxy(route: string, method: 'GET' | 'POST', cb: (...args: Parameters<connect.NextHandleFunction>) => PlainObject | string): void;
|
|
18
|
+
getClientUrl: ClientUrlFunctionWithRouteDefined<string>;
|
|
19
|
+
openClientPage: ClientUrlFunctionWithRouteDefined<Promise<void>>;
|
|
20
|
+
sendAPIDataToClient(api: API | APIExtends, msg: unknown): void | never;
|
|
21
|
+
broadcast(): void;
|
|
22
|
+
bootstrap(): Promise<void>;
|
|
23
|
+
dispose(): Promise<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import type { SourceRange, ModuleInstance } from './module';
|
|
2
|
+
import type { NonFunctionProperties } from '../common';
|
|
3
|
+
/** Statement position */
|
|
4
|
+
export interface StatementPosition {
|
|
5
|
+
/**
|
|
6
|
+
* Source code location
|
|
7
|
+
* - Because sourceMap may not exist, there may not be a value here
|
|
8
|
+
* There are many reasons why sourceMap does not exist, it may be a parsing failure, or it may be ignored during the loader conversion process
|
|
9
|
+
*/
|
|
10
|
+
source?: SourceRange;
|
|
11
|
+
/** Converted code position */
|
|
12
|
+
transformed: SourceRange;
|
|
13
|
+
}
|
|
14
|
+
/** statement category */
|
|
15
|
+
export declare enum StatementKind {
|
|
16
|
+
/**
|
|
17
|
+
* Import by default
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import defaultName from 'name';
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
ImportDefault = 100,
|
|
24
|
+
/**
|
|
25
|
+
* Named import
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { name1, name as name2 } from 'name';
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
ImportNamed = 101,
|
|
32
|
+
/**
|
|
33
|
+
* Default and named import
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import defaultName, { name1 } from 'name';
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
ImportDefaultWithNamed = 102,
|
|
40
|
+
/**
|
|
41
|
+
* Default and Namespace import
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import defaultName, * as name from 'name';
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
ImportDefaultWithNamespace = 103,
|
|
48
|
+
/**
|
|
49
|
+
* Namespace import
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* import * as namespaceName from 'name';
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
ImportNamespace = 104,
|
|
56
|
+
/**
|
|
57
|
+
* Side effects import
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import 'name';
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
ImportSideEffect = 105,
|
|
64
|
+
/**
|
|
65
|
+
* Dynamic import
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* import('name');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
ImportDynamic = 106,
|
|
72
|
+
/**
|
|
73
|
+
* Declare export
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* export const name = '123';
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
ExportDeclaration = 200,
|
|
80
|
+
/**
|
|
81
|
+
* List export
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* export { item1, item as item2 };
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
ExportList = 201,
|
|
88
|
+
/**
|
|
89
|
+
* Default export
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* export default name;
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
ExportDefault = 202,
|
|
96
|
+
/**
|
|
97
|
+
* Re-export
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* export { default as defaultName, item1, item as item2 } from 'name';
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
ExportAggregating = 203,
|
|
104
|
+
/**
|
|
105
|
+
* Re-export to Namespace
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* export * as namespaceName from 'name';
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
ExportNamespace = 204,
|
|
112
|
+
/**
|
|
113
|
+
* CJS module import
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* require('name');
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
RequireCall = 300,
|
|
120
|
+
/**
|
|
121
|
+
* CJS named import
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* require('name').name
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
RequireName = 301,
|
|
128
|
+
/**
|
|
129
|
+
* Overall export
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* module.exports = {};
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
RequireExports = 302,
|
|
136
|
+
/**
|
|
137
|
+
* CJS re-export
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* module.exports = require('name');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
RequireExportAggregating = 303,
|
|
144
|
+
/**
|
|
145
|
+
* Named export
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* export.name = '123';
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
RequireExportName = 304,
|
|
152
|
+
/**
|
|
153
|
+
* Unknown statement
|
|
154
|
+
*/
|
|
155
|
+
Unknown = 999
|
|
156
|
+
}
|
|
157
|
+
/** Statement class */
|
|
158
|
+
export interface StatementInstance {
|
|
159
|
+
/** Current statement position */
|
|
160
|
+
readonly position: StatementPosition;
|
|
161
|
+
/** Module where the statement is located */
|
|
162
|
+
readonly module: ModuleInstance;
|
|
163
|
+
/** Is it the same statement */
|
|
164
|
+
isSame(statement: StatementInstance): boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Get original location
|
|
167
|
+
* - When running for the first time and the Module contains sourceMap, it will be calculated
|
|
168
|
+
*/
|
|
169
|
+
getSourcePosition(): SourceRange | undefined;
|
|
170
|
+
/** Output data */
|
|
171
|
+
toData(): StatementData;
|
|
172
|
+
getLineCode(): string | undefined;
|
|
173
|
+
}
|
|
174
|
+
/** statement data */
|
|
175
|
+
export interface StatementData extends Omit<NonFunctionProperties<StatementInstance>, 'module'> {
|
|
176
|
+
/** Module number where the statement is located */
|
|
177
|
+
module: number;
|
|
178
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface SummaryCostsData {
|
|
2
|
+
/**
|
|
3
|
+
* such as 'bootstrap' / 'compile' / 'minify' or else.
|
|
4
|
+
*/
|
|
5
|
+
name: string;
|
|
6
|
+
/**
|
|
7
|
+
* the start timestamp of the data.
|
|
8
|
+
*/
|
|
9
|
+
startAt: number;
|
|
10
|
+
costs: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SummaryData {
|
|
13
|
+
/**
|
|
14
|
+
* costs of different data.
|
|
15
|
+
*/
|
|
16
|
+
costs: SummaryCostsData[];
|
|
17
|
+
}
|
|
18
|
+
export {};
|