@rsdoctor/types 0.0.2-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/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/babel.d.ts +13 -0
- package/dist/babel.js +2 -0
- package/dist/client.d.ts +108 -0
- package/dist/client.js +29 -0
- package/dist/common.d.ts +26 -0
- package/dist/common.js +2 -0
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +36 -0
- package/dist/emo.d.ts +28 -0
- package/dist/emo.js +9 -0
- package/dist/error.d.ts +137 -0
- package/dist/error.js +10 -0
- package/dist/esbuild.d.ts +30 -0
- package/dist/esbuild.js +2 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +40 -0
- package/dist/linter/diagnostic.d.ts +45 -0
- package/dist/linter/diagnostic.js +5 -0
- package/dist/linter/index.d.ts +2 -0
- package/dist/linter/index.js +18 -0
- package/dist/linter/rule.d.ts +107 -0
- package/dist/linter/rule.js +2 -0
- package/dist/logger.d.ts +34 -0
- package/dist/logger.js +15 -0
- package/dist/manifest.d.ts +55 -0
- package/dist/manifest.js +17 -0
- package/dist/modules.d.ts +7 -0
- package/dist/modules.js +2 -0
- package/dist/plugin/baseCompiler.d.ts +20 -0
- package/dist/plugin/baseCompiler.js +2 -0
- package/dist/plugin/baseLoader.d.ts +71 -0
- package/dist/plugin/baseLoader.js +2 -0
- package/dist/plugin/baseStats.d.ts +114 -0
- package/dist/plugin/baseStats.js +2 -0
- package/dist/plugin/index.d.ts +4 -0
- package/dist/plugin/index.js +20 -0
- package/dist/plugin/plugin.d.ts +32 -0
- package/dist/plugin/plugin.js +2 -0
- package/dist/rule/code/E1001.d.ts +3 -0
- package/dist/rule/code/E1001.js +31 -0
- package/dist/rule/code/E1002.d.ts +3 -0
- package/dist/rule/code/E1002.js +31 -0
- package/dist/rule/code/E1003.d.ts +3 -0
- package/dist/rule/code/E1003.js +39 -0
- package/dist/rule/code/E1004.d.ts +3 -0
- package/dist/rule/code/E1004.js +15 -0
- package/dist/rule/code/index.d.ts +23 -0
- package/dist/rule/code/index.js +51 -0
- package/dist/rule/code/type.d.ts +27 -0
- package/dist/rule/code/type.js +23 -0
- package/dist/rule/data.d.ts +132 -0
- package/dist/rule/data.js +2 -0
- package/dist/rule/index.d.ts +2 -0
- package/dist/rule/index.js +18 -0
- package/dist/sdk/chunk.d.ts +125 -0
- package/dist/sdk/chunk.js +2 -0
- package/dist/sdk/config.d.ts +8 -0
- package/dist/sdk/config.js +2 -0
- package/dist/sdk/context.d.ts +23 -0
- package/dist/sdk/context.js +2 -0
- package/dist/sdk/envinfo.d.ts +19 -0
- package/dist/sdk/envinfo.js +2 -0
- package/dist/sdk/hooks.d.ts +13 -0
- package/dist/sdk/hooks.js +2 -0
- package/dist/sdk/index.d.ts +16 -0
- package/dist/sdk/index.js +32 -0
- package/dist/sdk/instance.d.ts +149 -0
- package/dist/sdk/instance.js +2 -0
- package/dist/sdk/loader.d.ts +64 -0
- package/dist/sdk/loader.js +2 -0
- package/dist/sdk/module.d.ts +303 -0
- package/dist/sdk/module.js +28 -0
- package/dist/sdk/package.d.ts +113 -0
- package/dist/sdk/package.js +2 -0
- package/dist/sdk/plugin.d.ts +21 -0
- package/dist/sdk/plugin.js +2 -0
- package/dist/sdk/process.d.ts +10 -0
- package/dist/sdk/process.js +2 -0
- package/dist/sdk/resolver.d.ts +52 -0
- package/dist/sdk/resolver.js +2 -0
- package/dist/sdk/result.d.ts +41 -0
- package/dist/sdk/result.js +2 -0
- package/dist/sdk/server/apis/alerts.d.ts +26 -0
- package/dist/sdk/server/apis/alerts.js +3 -0
- package/dist/sdk/server/apis/graph.d.ts +41 -0
- package/dist/sdk/server/apis/graph.js +3 -0
- package/dist/sdk/server/apis/index.d.ts +128 -0
- package/dist/sdk/server/apis/index.js +72 -0
- package/dist/sdk/server/apis/loader.d.ts +46 -0
- package/dist/sdk/server/apis/loader.js +3 -0
- package/dist/sdk/server/apis/pagination.d.ts +11 -0
- package/dist/sdk/server/apis/pagination.js +2 -0
- package/dist/sdk/server/apis/plugin.d.ts +19 -0
- package/dist/sdk/server/apis/plugin.js +3 -0
- package/dist/sdk/server/apis/project.d.ts +16 -0
- package/dist/sdk/server/apis/project.js +3 -0
- package/dist/sdk/server/apis/resolver.d.ts +18 -0
- package/dist/sdk/server/apis/resolver.js +3 -0
- package/dist/sdk/server/index.d.ts +23 -0
- package/dist/sdk/server/index.js +27 -0
- package/dist/sdk/statement.d.ts +177 -0
- package/dist/sdk/statement.js +147 -0
- package/dist/sdk/summary.d.ts +18 -0
- package/dist/sdk/summary.js +2 -0
- package/dist/sdk/treeShaking.d.ts +152 -0
- package/dist/sdk/treeShaking.js +2 -0
- package/dist/thirdparty.d.ts +2 -0
- package/dist/thirdparty.js +2 -0
- package/package.json +39 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ProcessData } from './process';
|
|
2
|
+
export interface ResolveStackData {
|
|
3
|
+
/** Step name */
|
|
4
|
+
name: string;
|
|
5
|
+
/** trying to resolve path */
|
|
6
|
+
path: string;
|
|
7
|
+
/** Request parameters */
|
|
8
|
+
request?: string;
|
|
9
|
+
/** Request path parameter */
|
|
10
|
+
query?: string;
|
|
11
|
+
/** Request fragment connection */
|
|
12
|
+
fragment?: string;
|
|
13
|
+
/** Whether to request a module */
|
|
14
|
+
module?: boolean;
|
|
15
|
+
/** Whether to request a module */
|
|
16
|
+
file?: boolean;
|
|
17
|
+
/** Whether to request a folder */
|
|
18
|
+
directory?: boolean;
|
|
19
|
+
/** Whether to request internal module */
|
|
20
|
+
internal?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface PathResolverBaseData extends ProcessData {
|
|
23
|
+
/** Is it an entry file request */
|
|
24
|
+
isEntry: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The path to send the request
|
|
27
|
+
* - When the entry file is requested, it is represented as the project root directory
|
|
28
|
+
* - When requesting a file, it is represented as a file directory
|
|
29
|
+
*/
|
|
30
|
+
issuerPath: string;
|
|
31
|
+
/** Original request */
|
|
32
|
+
request: string;
|
|
33
|
+
/** Request parameters */
|
|
34
|
+
query?: string;
|
|
35
|
+
startAt: number;
|
|
36
|
+
endAt: number;
|
|
37
|
+
}
|
|
38
|
+
export interface PathResolverSuccessData extends PathResolverBaseData {
|
|
39
|
+
/**
|
|
40
|
+
* the resolved result.
|
|
41
|
+
*/
|
|
42
|
+
result: string;
|
|
43
|
+
}
|
|
44
|
+
export interface PathResolverFailData extends PathResolverBaseData {
|
|
45
|
+
error: Error;
|
|
46
|
+
/**
|
|
47
|
+
* stacks of the resolve paths which try to resolve.
|
|
48
|
+
*/
|
|
49
|
+
stacks: ResolveStackData[];
|
|
50
|
+
}
|
|
51
|
+
export type PathResolverData = PathResolverSuccessData | PathResolverFailData;
|
|
52
|
+
export type ResolverData = PathResolverData[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EmoCheckData } from '../emo';
|
|
2
|
+
import { LoaderData } from './loader';
|
|
3
|
+
import { ModuleGraphData, ModuleCodeData } from './module';
|
|
4
|
+
import { ChunkGraphData } from './chunk';
|
|
5
|
+
import { ResolverData } from './resolver';
|
|
6
|
+
import { PluginData } from './plugin';
|
|
7
|
+
import { SummaryData } from './summary';
|
|
8
|
+
import { ConfigData } from './config';
|
|
9
|
+
import { RuleStoreData } from '../rule';
|
|
10
|
+
import type { EnvInfo } from './envinfo';
|
|
11
|
+
import { PackageGraphData, OtherReports } from './package';
|
|
12
|
+
export type ErrorsData = RuleStoreData;
|
|
13
|
+
interface StoreCommonData {
|
|
14
|
+
hash: string;
|
|
15
|
+
root: string;
|
|
16
|
+
pid: number;
|
|
17
|
+
envinfo: EnvInfo;
|
|
18
|
+
}
|
|
19
|
+
export interface BuilderStoreData extends StoreCommonData {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
errors: ErrorsData;
|
|
22
|
+
configs: ConfigData;
|
|
23
|
+
summary: SummaryData;
|
|
24
|
+
resolver: ResolverData;
|
|
25
|
+
loader: LoaderData;
|
|
26
|
+
plugin: PluginData;
|
|
27
|
+
moduleGraph: ModuleGraphData;
|
|
28
|
+
chunkGraph: ChunkGraphData;
|
|
29
|
+
packageGraph: PackageGraphData;
|
|
30
|
+
moduleCodeMap: ModuleCodeData;
|
|
31
|
+
otherReports?: OtherReports | undefined;
|
|
32
|
+
}
|
|
33
|
+
export interface EMOStoreData extends StoreCommonData {
|
|
34
|
+
emoCheck: EmoCheckData;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
*/
|
|
39
|
+
export interface StoreData extends Partial<Omit<EMOStoreData, keyof StoreCommonData>>, BuilderStoreData {
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { API } from './index';
|
|
2
|
+
import { OverlayRuleStoreData, RuleStoreDataItem } from '../../../rule';
|
|
3
|
+
import { DependencyData, ModuleData, ModuleSource } from '../../module';
|
|
4
|
+
import { PackageBasicData } from '../../package';
|
|
5
|
+
export interface AlertsAPIResponse {
|
|
6
|
+
/**
|
|
7
|
+
* get the details of the alerts which type is "package-relation"
|
|
8
|
+
*/
|
|
9
|
+
[API.GetPackageRelationAlertDetails]: {
|
|
10
|
+
group: string | void;
|
|
11
|
+
module: ModuleData;
|
|
12
|
+
dependency: DependencyData;
|
|
13
|
+
relativePath: string;
|
|
14
|
+
moduleCode: ModuleSource;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* get the alerts list which use to display in overlay at the client page
|
|
18
|
+
*/
|
|
19
|
+
[API.GetOverlayAlerts]: OverlayRuleStoreData[];
|
|
20
|
+
}
|
|
21
|
+
export interface AlertsAPIResquestBody {
|
|
22
|
+
[API.GetPackageRelationAlertDetails]: {
|
|
23
|
+
id: RuleStoreDataItem['id'];
|
|
24
|
+
target: PackageBasicData;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { API } from './index';
|
|
2
|
+
import { ModuleData, ModuleGraphData } from '../../module';
|
|
3
|
+
import { DoctorClientAssetsSummary } from '../../../client';
|
|
4
|
+
import { AssetData, ChunkData, ChunkGraphData, EntryPointData } from '../../chunk';
|
|
5
|
+
export interface GraphAPIResponse {
|
|
6
|
+
[API.GetAssetsSummary]: DoctorClientAssetsSummary;
|
|
7
|
+
[API.GetAssetDetails]: {
|
|
8
|
+
asset: AssetData;
|
|
9
|
+
} & Pick<ModuleGraphData, 'modules'> & Pick<ChunkGraphData, 'chunks'>;
|
|
10
|
+
[API.GetChunksByModuleId]: ChunkData[];
|
|
11
|
+
[API.GetModuleDetails]: {
|
|
12
|
+
module: ModuleData;
|
|
13
|
+
} & Pick<ModuleGraphData, 'dependencies'>;
|
|
14
|
+
[API.GetModulesByModuleIds]: ModuleData[];
|
|
15
|
+
[API.GetEntryPoints]: EntryPointData[];
|
|
16
|
+
}
|
|
17
|
+
export interface GraphAPIResquestBody {
|
|
18
|
+
[API.GetAssetsSummary]: {
|
|
19
|
+
withFileContent?: boolean;
|
|
20
|
+
};
|
|
21
|
+
[API.GetAssetDetails]: {
|
|
22
|
+
assetPath: string;
|
|
23
|
+
};
|
|
24
|
+
[API.GetChunksByModuleId]: {
|
|
25
|
+
moduleId: number;
|
|
26
|
+
};
|
|
27
|
+
[API.GetModuleDetails]: {
|
|
28
|
+
moduleId: number;
|
|
29
|
+
};
|
|
30
|
+
[API.GetModulesByModuleIds]: {
|
|
31
|
+
moduleIds: number[];
|
|
32
|
+
};
|
|
33
|
+
[API.GetModuleCodeByModuleId]: {
|
|
34
|
+
moduleId: number;
|
|
35
|
+
};
|
|
36
|
+
[API.GetModuleCodeByModuleIds]: {
|
|
37
|
+
moduleIds: number[];
|
|
38
|
+
};
|
|
39
|
+
[API.GetAllModuleGraph]: {};
|
|
40
|
+
[API.GetAllChunkGraph]: {};
|
|
41
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/// <reference types="connect" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { ServerResponse } from 'http';
|
|
4
|
+
import { SDK } from 'src';
|
|
5
|
+
import { PlainObject, Get } from '../../../common';
|
|
6
|
+
import { connect } from '../../../thirdparty';
|
|
7
|
+
import { DoctorBuilderSDKInstance } from '../../index';
|
|
8
|
+
import { DoctorServerInstance } from '../index';
|
|
9
|
+
import { LoaderData } from '../../loader';
|
|
10
|
+
import { ProjectAPIResponse, ProjectAPIResquestBody } from './project';
|
|
11
|
+
import { LoaderAPIResponse, LoaderAPIResquestBody } from './loader';
|
|
12
|
+
import { ResolverAPIResponse, ResolverAPIResquestBody } from './resolver';
|
|
13
|
+
import { PluginAPIResponse, PluginAPIResquestBody } from './plugin';
|
|
14
|
+
import { GraphAPIResponse, GraphAPIResquestBody } from './graph';
|
|
15
|
+
import { AlertsAPIResponse, AlertsAPIResquestBody } from './alerts';
|
|
16
|
+
import { DoctorManifestMappingKeys } from '../../../manifest';
|
|
17
|
+
export * from './pagination';
|
|
18
|
+
export declare enum API {
|
|
19
|
+
ApplyErrorFix = "/api/apply/error/fix",
|
|
20
|
+
Env = "/api/env",
|
|
21
|
+
EntryHtml = "/index.html",
|
|
22
|
+
Manifest = "/api/manifest.json",
|
|
23
|
+
LoadDataByKey = "/api/data/key",
|
|
24
|
+
SendAPIDataToClient = "/api/socket/send",
|
|
25
|
+
/** Project API */
|
|
26
|
+
GetProjectInfo = "/api/project/info",
|
|
27
|
+
GetClientRoutes = "/api/routes",
|
|
28
|
+
/** Loader API */
|
|
29
|
+
ReportLoader = "/api/loader/report",
|
|
30
|
+
GetLoaderNames = "/api/loader/names",
|
|
31
|
+
GetLoaderChartData = "/api/loader/chart/data",
|
|
32
|
+
GetLoaderFileTree = "/api/loader/filetree",
|
|
33
|
+
GetLoaderFileDetails = "/api/loader/file",
|
|
34
|
+
GetLoaderFolderStatistics = "/api/loader/folder/statics",
|
|
35
|
+
GetLoaderFileFirstInput = "/api/loader/input",
|
|
36
|
+
GetLoaderFileInputAndOutput = "/api/loader/inputandoutput",
|
|
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
|
+
GetAssetsSummary = "/api/graph/assets/summary",
|
|
47
|
+
GetAssetDetails = "/api/graph/asset/details",
|
|
48
|
+
GetChunksByModuleId = "/api/graph/chunk/module",
|
|
49
|
+
GetModuleDetails = "/api/graph/module/details",
|
|
50
|
+
GetModulesByModuleIds = "/api/graph/modules/ids",
|
|
51
|
+
GetEntryPoints = "/api/graph/entrypoints",
|
|
52
|
+
GetModuleCodeByModuleId = "/api/graph/module/code",
|
|
53
|
+
GetModuleCodeByModuleIds = "/api/graph/module/codes",
|
|
54
|
+
GetAllModuleGraph = "/api/graph/module/all",
|
|
55
|
+
GetAllChunkGraph = "/api/graph/chunk/all",
|
|
56
|
+
/** Alerts API */
|
|
57
|
+
GetPackageRelationAlertDetails = "/api/alerts/details/package/relation",
|
|
58
|
+
GetOverlayAlerts = "/api/alerts/overlay",
|
|
59
|
+
/** BundleDiff API */
|
|
60
|
+
BundleDiffManifest = "/api/bundle_diff/manifest.json",
|
|
61
|
+
GetBundleDiffSummary = "/api/bundle_diff/summary",
|
|
62
|
+
GetTileReportHtml = "/api/tile/report"
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* api which used outside the sdk.
|
|
66
|
+
*/
|
|
67
|
+
export declare enum APIExtends {
|
|
68
|
+
GetCompileProgess = "/api/progress"
|
|
69
|
+
}
|
|
70
|
+
export interface SocketResponseType<T extends API | APIExtends = API> {
|
|
71
|
+
/**
|
|
72
|
+
* use to match for the event listener when there are different request body.
|
|
73
|
+
*/
|
|
74
|
+
req: {
|
|
75
|
+
api: T;
|
|
76
|
+
body: InferRequestBodyType<T>;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* api response
|
|
80
|
+
*/
|
|
81
|
+
res: InferResponseType<T>;
|
|
82
|
+
}
|
|
83
|
+
export interface ResponseTypes extends LoaderAPIResponse, ResolverAPIResponse, PluginAPIResponse, GraphAPIResponse, AlertsAPIResponse, ProjectAPIResponse {
|
|
84
|
+
[API.ReportLoader]: 'ok';
|
|
85
|
+
[API.EntryHtml]: string;
|
|
86
|
+
[API.Manifest]: string;
|
|
87
|
+
[API.ApplyErrorFix]: 'success';
|
|
88
|
+
[API.LoadDataByKey]: unknown;
|
|
89
|
+
[API.BundleDiffManifest]: SDK.BuilderStoreData;
|
|
90
|
+
[API.GetBundleDiffSummary]: {
|
|
91
|
+
root: string;
|
|
92
|
+
hash: string;
|
|
93
|
+
outputFilename: string;
|
|
94
|
+
errors: SDK.ErrorsData;
|
|
95
|
+
chunkGraph: SDK.ChunkGraphData;
|
|
96
|
+
moduleGraph: SDK.ModuleGraphData;
|
|
97
|
+
packageGraph: SDK.PackageGraphData;
|
|
98
|
+
moduleCodeMap: SDK.ModuleCodeData;
|
|
99
|
+
};
|
|
100
|
+
[API.GetModuleCodeByModuleId]: SDK.ModuleSource;
|
|
101
|
+
[API.GetModuleCodeByModuleIds]: SDK.ModuleCodeData;
|
|
102
|
+
[API.GetAllModuleGraph]: SDK.ModuleGraphData;
|
|
103
|
+
[API.GetAllChunkGraph]: SDK.ChunkGraphData;
|
|
104
|
+
}
|
|
105
|
+
export interface ResquestBodyTypes extends LoaderAPIResquestBody, ResolverAPIResquestBody, PluginAPIResquestBody, GraphAPIResquestBody, AlertsAPIResquestBody, ProjectAPIResquestBody {
|
|
106
|
+
[API.ReportLoader]: LoaderData;
|
|
107
|
+
[API.SendAPIDataToClient]: {
|
|
108
|
+
api: API;
|
|
109
|
+
data: unknown;
|
|
110
|
+
};
|
|
111
|
+
[API.LoadDataByKey]: {
|
|
112
|
+
/**
|
|
113
|
+
* @example 'plugin'
|
|
114
|
+
* @example 'moduleGraph.modules'
|
|
115
|
+
*/
|
|
116
|
+
key: DoctorManifestMappingKeys;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export type InferResponseType<T, F = void> = Get<ResponseTypes, T, F>;
|
|
120
|
+
export type InferRequestBodyType<T, F = void> = Get<ResquestBodyTypes, T, F>;
|
|
121
|
+
export interface APIContext {
|
|
122
|
+
server: DoctorServerInstance;
|
|
123
|
+
sdk: DoctorBuilderSDKInstance;
|
|
124
|
+
req: connect.IncomingMessage & {
|
|
125
|
+
body?: PlainObject;
|
|
126
|
+
};
|
|
127
|
+
res: ServerResponse;
|
|
128
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.APIExtends = exports.API = void 0;
|
|
18
|
+
__exportStar(require("./pagination"), exports);
|
|
19
|
+
var API;
|
|
20
|
+
(function (API) {
|
|
21
|
+
API["ApplyErrorFix"] = "/api/apply/error/fix";
|
|
22
|
+
API["Env"] = "/api/env";
|
|
23
|
+
API["EntryHtml"] = "/index.html";
|
|
24
|
+
API["Manifest"] = "/api/manifest.json";
|
|
25
|
+
API["LoadDataByKey"] = "/api/data/key";
|
|
26
|
+
API["SendAPIDataToClient"] = "/api/socket/send";
|
|
27
|
+
/** Project API */
|
|
28
|
+
API["GetProjectInfo"] = "/api/project/info";
|
|
29
|
+
API["GetClientRoutes"] = "/api/routes";
|
|
30
|
+
/** Loader API */
|
|
31
|
+
API["ReportLoader"] = "/api/loader/report";
|
|
32
|
+
API["GetLoaderNames"] = "/api/loader/names";
|
|
33
|
+
API["GetLoaderChartData"] = "/api/loader/chart/data";
|
|
34
|
+
API["GetLoaderFileTree"] = "/api/loader/filetree";
|
|
35
|
+
API["GetLoaderFileDetails"] = "/api/loader/file";
|
|
36
|
+
API["GetLoaderFolderStatistics"] = "/api/loader/folder/statics";
|
|
37
|
+
API["GetLoaderFileFirstInput"] = "/api/loader/input";
|
|
38
|
+
API["GetLoaderFileInputAndOutput"] = "/api/loader/inputandoutput";
|
|
39
|
+
/** SourceMap API */
|
|
40
|
+
API["ReportSourceMap"] = "/api/sourcemap/report";
|
|
41
|
+
/** Resolver API */
|
|
42
|
+
API["GetResolverFileTree"] = "/api/resolver/filetree";
|
|
43
|
+
API["GetResolverFileDetails"] = "/api/resolver/file";
|
|
44
|
+
/** Plugin API */
|
|
45
|
+
API["GetPluginSummary"] = "/api/plugins/summary";
|
|
46
|
+
API["GetPluginData"] = "/api/plugins/data";
|
|
47
|
+
/** Graph API */
|
|
48
|
+
API["GetAssetsSummary"] = "/api/graph/assets/summary";
|
|
49
|
+
API["GetAssetDetails"] = "/api/graph/asset/details";
|
|
50
|
+
API["GetChunksByModuleId"] = "/api/graph/chunk/module";
|
|
51
|
+
API["GetModuleDetails"] = "/api/graph/module/details";
|
|
52
|
+
API["GetModulesByModuleIds"] = "/api/graph/modules/ids";
|
|
53
|
+
API["GetEntryPoints"] = "/api/graph/entrypoints";
|
|
54
|
+
API["GetModuleCodeByModuleId"] = "/api/graph/module/code";
|
|
55
|
+
API["GetModuleCodeByModuleIds"] = "/api/graph/module/codes";
|
|
56
|
+
API["GetAllModuleGraph"] = "/api/graph/module/all";
|
|
57
|
+
API["GetAllChunkGraph"] = "/api/graph/chunk/all";
|
|
58
|
+
/** Alerts API */
|
|
59
|
+
API["GetPackageRelationAlertDetails"] = "/api/alerts/details/package/relation";
|
|
60
|
+
API["GetOverlayAlerts"] = "/api/alerts/overlay";
|
|
61
|
+
/** BundleDiff API */
|
|
62
|
+
API["BundleDiffManifest"] = "/api/bundle_diff/manifest.json";
|
|
63
|
+
API["GetBundleDiffSummary"] = "/api/bundle_diff/summary";
|
|
64
|
+
API["GetTileReportHtml"] = "/api/tile/report";
|
|
65
|
+
})(API || (exports.API = API = {}));
|
|
66
|
+
/**
|
|
67
|
+
* api which used outside the sdk.
|
|
68
|
+
*/
|
|
69
|
+
var APIExtends;
|
|
70
|
+
(function (APIExtends) {
|
|
71
|
+
APIExtends["GetCompileProgess"] = "/api/progress";
|
|
72
|
+
})(APIExtends || (exports.APIExtends = APIExtends = {}));
|
|
@@ -0,0 +1,46 @@
|
|
|
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.GetLoaderChartData]: Array<Pick<LoaderTransformData, 'loader' | 'isPitch' | 'startAt' | 'endAt' | 'pid' | 'sync'> & {
|
|
7
|
+
resource: Get<ResourceData, 'path'>;
|
|
8
|
+
costs: number;
|
|
9
|
+
}>;
|
|
10
|
+
[API.GetLoaderFileTree]: Array<Pick<ResourceData, 'path'> & {
|
|
11
|
+
loaders: Array<Pick<LoaderTransformData, 'loader' | 'path' | 'errors'> & {
|
|
12
|
+
costs: number;
|
|
13
|
+
}>;
|
|
14
|
+
}>;
|
|
15
|
+
[API.GetLoaderFileDetails]: {
|
|
16
|
+
resource: ResourceData;
|
|
17
|
+
loaders: (LoaderTransformData & {
|
|
18
|
+
costs: number;
|
|
19
|
+
})[];
|
|
20
|
+
};
|
|
21
|
+
[API.GetLoaderFolderStatistics]: Array<Pick<LoaderTransformData, 'loader' | 'path'> & {
|
|
22
|
+
files: number;
|
|
23
|
+
costs: number;
|
|
24
|
+
}>;
|
|
25
|
+
[API.GetLoaderFileFirstInput]: string;
|
|
26
|
+
[API.GetLoaderFileInputAndOutput]: {
|
|
27
|
+
input: string;
|
|
28
|
+
output: string;
|
|
29
|
+
};
|
|
30
|
+
[API.GetTileReportHtml]: string;
|
|
31
|
+
}
|
|
32
|
+
export interface LoaderAPIResquestBody {
|
|
33
|
+
[API.GetLoaderFileDetails]: Pick<ResourceData, 'path'>;
|
|
34
|
+
[API.GetLoaderFolderStatistics]: {
|
|
35
|
+
folder: string;
|
|
36
|
+
};
|
|
37
|
+
[API.GetLoaderFileFirstInput]: {
|
|
38
|
+
file: string;
|
|
39
|
+
};
|
|
40
|
+
[API.GetLoaderFileInputAndOutput]: {
|
|
41
|
+
file: string;
|
|
42
|
+
loader: string;
|
|
43
|
+
loaderIndex: number;
|
|
44
|
+
};
|
|
45
|
+
[API.GetTileReportHtml]: {};
|
|
46
|
+
}
|
|
@@ -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 PluginAPIResquestBody {
|
|
15
|
+
[API.GetPluginData]: {
|
|
16
|
+
hooks?: string[];
|
|
17
|
+
tapNames?: string[];
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DoctorManifestClientRoutes, DoctorManifestData } 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<DoctorManifestData, 'hash' | 'root' | 'pid' | 'summary' | 'configs' | 'envinfo' | 'errors'>;
|
|
9
|
+
[API.GetClientRoutes]: DoctorManifestClientRoutes[];
|
|
10
|
+
[APIExtends.GetCompileProgess]: {
|
|
11
|
+
percentage: number;
|
|
12
|
+
message: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export interface ProjectAPIResquestBody {
|
|
16
|
+
}
|
|
@@ -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 ResolverAPIResquestBody {
|
|
15
|
+
[API.GetResolverFileDetails]: {
|
|
16
|
+
filepath: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="connect" />
|
|
2
|
+
import { PlainObject } from '../../common';
|
|
3
|
+
import { connect } from '../../thirdparty';
|
|
4
|
+
import { DoctorClientRoutes } from '../../client';
|
|
5
|
+
import { API } from './apis';
|
|
6
|
+
export * as ServerAPI from './apis';
|
|
7
|
+
interface ClientUrlFunctionWithRouteDefined<T> {
|
|
8
|
+
(route: DoctorClientRoutes.BundleDiff, baselineUrl: string, currentUrl: string): T;
|
|
9
|
+
(route?: 'homepage'): T;
|
|
10
|
+
}
|
|
11
|
+
export interface DoctorServerInstance {
|
|
12
|
+
readonly app: connect.Server;
|
|
13
|
+
readonly port: number;
|
|
14
|
+
readonly origin: 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, msg: unknown): void | never;
|
|
21
|
+
bootstrap(): Promise<void>;
|
|
22
|
+
dispose(): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ServerAPI = void 0;
|
|
27
|
+
exports.ServerAPI = __importStar(require("./apis"));
|