@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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.message = exports.code = void 0;
|
|
4
|
+
exports.code = 'E1004';
|
|
5
|
+
exports.message = {
|
|
6
|
+
code: exports.code,
|
|
7
|
+
title: 'ECMA Version Check',
|
|
8
|
+
type: 'markdown',
|
|
9
|
+
category: 'bundle',
|
|
10
|
+
description: `
|
|
11
|
+
#### Description
|
|
12
|
+
|
|
13
|
+
Detect if there is a low version of ECMA syntax in the js bundle file
|
|
14
|
+
`,
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RuleMessage } from './type';
|
|
2
|
+
import * as E1001 from './E1001';
|
|
3
|
+
import * as E1002 from './E1002';
|
|
4
|
+
import * as E1003 from './E1003';
|
|
5
|
+
import * as E1004 from './E1004';
|
|
6
|
+
export type RuleErrorCodes = {
|
|
7
|
+
[E1001.code]: typeof E1001;
|
|
8
|
+
[E1002.code]: typeof E1002;
|
|
9
|
+
[E1003.code]: typeof E1003;
|
|
10
|
+
[E1004.code]: typeof E1004;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The format is E + "4 digits".
|
|
14
|
+
* - The first number represents the category:
|
|
15
|
+
* - 1 for Webpack build related indexes
|
|
16
|
+
* - ...
|
|
17
|
+
* - The rest of the numbers can be increased by adding zeros
|
|
18
|
+
*/
|
|
19
|
+
export declare const RuleErrorMap: Record<keyof RuleErrorCodes, RuleMessage>;
|
|
20
|
+
export declare enum DoctorRuleClientConstant {
|
|
21
|
+
UrlQueryForErrorCode = "code"
|
|
22
|
+
}
|
|
23
|
+
export * from './type';
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.DoctorRuleClientConstant = exports.RuleErrorMap = void 0;
|
|
30
|
+
const E1001 = __importStar(require("./E1001"));
|
|
31
|
+
const E1002 = __importStar(require("./E1002"));
|
|
32
|
+
const E1003 = __importStar(require("./E1003"));
|
|
33
|
+
const E1004 = __importStar(require("./E1004"));
|
|
34
|
+
/**
|
|
35
|
+
* The format is E + "4 digits".
|
|
36
|
+
* - The first number represents the category:
|
|
37
|
+
* - 1 for Webpack build related indexes
|
|
38
|
+
* - ...
|
|
39
|
+
* - The rest of the numbers can be increased by adding zeros
|
|
40
|
+
*/
|
|
41
|
+
exports.RuleErrorMap = {
|
|
42
|
+
[E1001.code]: E1001.message,
|
|
43
|
+
[E1002.code]: E1002.message,
|
|
44
|
+
[E1003.code]: E1003.message,
|
|
45
|
+
[E1004.code]: E1004.message,
|
|
46
|
+
};
|
|
47
|
+
var DoctorRuleClientConstant;
|
|
48
|
+
(function (DoctorRuleClientConstant) {
|
|
49
|
+
DoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
|
|
50
|
+
})(DoctorRuleClientConstant || (exports.DoctorRuleClientConstant = DoctorRuleClientConstant = {}));
|
|
51
|
+
__exportStar(require("./type"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RuleErrorCodes } from '.';
|
|
2
|
+
/**
|
|
3
|
+
* only defined the code which can be enumerated
|
|
4
|
+
*/
|
|
5
|
+
export declare enum RuleMessageCodeEnumerated {
|
|
6
|
+
/**
|
|
7
|
+
* others tools / frameworks errors, such as PIA
|
|
8
|
+
*/
|
|
9
|
+
Extend = "EXTEND",
|
|
10
|
+
/**
|
|
11
|
+
* errors show in the overlay at the client, such as Webpack compile errors in development
|
|
12
|
+
*/
|
|
13
|
+
Overlay = "OVERLAY"
|
|
14
|
+
}
|
|
15
|
+
export type RuleMessageCode = keyof RuleErrorCodes | `${RuleMessageCodeEnumerated}` | RuleMessageCodeEnumerated;
|
|
16
|
+
export declare enum RuleMessageCategory {
|
|
17
|
+
Compile = "compile",
|
|
18
|
+
Bundle = "bundle",
|
|
19
|
+
EMO = "emo"
|
|
20
|
+
}
|
|
21
|
+
export interface RuleMessage {
|
|
22
|
+
code: RuleMessageCode;
|
|
23
|
+
title: string;
|
|
24
|
+
type: 'text' | 'markdown';
|
|
25
|
+
category: `${RuleMessageCategory}` | RuleMessageCategory;
|
|
26
|
+
description: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleMessageCategory = exports.RuleMessageCodeEnumerated = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* only defined the code which can be enumerated
|
|
6
|
+
*/
|
|
7
|
+
var RuleMessageCodeEnumerated;
|
|
8
|
+
(function (RuleMessageCodeEnumerated) {
|
|
9
|
+
/**
|
|
10
|
+
* others tools / frameworks errors, such as PIA
|
|
11
|
+
*/
|
|
12
|
+
RuleMessageCodeEnumerated["Extend"] = "EXTEND";
|
|
13
|
+
/**
|
|
14
|
+
* errors show in the overlay at the client, such as Webpack compile errors in development
|
|
15
|
+
*/
|
|
16
|
+
RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
|
|
17
|
+
})(RuleMessageCodeEnumerated || (exports.RuleMessageCodeEnumerated = RuleMessageCodeEnumerated = {}));
|
|
18
|
+
var RuleMessageCategory;
|
|
19
|
+
(function (RuleMessageCategory) {
|
|
20
|
+
RuleMessageCategory["Compile"] = "compile";
|
|
21
|
+
RuleMessageCategory["Bundle"] = "bundle";
|
|
22
|
+
RuleMessageCategory["EMO"] = "emo";
|
|
23
|
+
})(RuleMessageCategory || (exports.RuleMessageCategory = RuleMessageCategory = {}));
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { WorkspaceCheckDataType } from '../emo';
|
|
2
|
+
import type { RuleMessage, RuleMessageCodeEnumerated } from './code';
|
|
3
|
+
import type { SourceRange } from '../sdk';
|
|
4
|
+
import type { PackageBasicData } from '../sdk/package';
|
|
5
|
+
export interface BaseRuleStoreData extends Pick<RuleMessage, 'code' | 'category'> {
|
|
6
|
+
/**
|
|
7
|
+
* unique of error
|
|
8
|
+
*/
|
|
9
|
+
id: number | string;
|
|
10
|
+
/**
|
|
11
|
+
* title of alerts
|
|
12
|
+
*/
|
|
13
|
+
title: string;
|
|
14
|
+
/**
|
|
15
|
+
* description of alerts
|
|
16
|
+
*/
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* level of error
|
|
20
|
+
*/
|
|
21
|
+
level: 'warn' | 'error';
|
|
22
|
+
/**
|
|
23
|
+
* rule doc link
|
|
24
|
+
*/
|
|
25
|
+
link?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface LinkRuleStoreData extends BaseRuleStoreData {
|
|
28
|
+
type: 'link';
|
|
29
|
+
}
|
|
30
|
+
export interface DependencyWithPackageData {
|
|
31
|
+
/**
|
|
32
|
+
* use to group files, such as different version of duplicate packages.
|
|
33
|
+
* @example
|
|
34
|
+
* [
|
|
35
|
+
* { group: "lodash@1.0.1", ... },
|
|
36
|
+
* { group: "lodash@1.0.1", ... },
|
|
37
|
+
* { group: "lodash@2.0.0", ... },
|
|
38
|
+
* ]
|
|
39
|
+
*/
|
|
40
|
+
group?: string;
|
|
41
|
+
/**
|
|
42
|
+
* module dependency id
|
|
43
|
+
*/
|
|
44
|
+
dependencyId: number;
|
|
45
|
+
}
|
|
46
|
+
export interface PackageRelationData {
|
|
47
|
+
/** Target package data */
|
|
48
|
+
target: PackageBasicData;
|
|
49
|
+
/** Target package size */
|
|
50
|
+
targetSize: {
|
|
51
|
+
sourceSize: number;
|
|
52
|
+
parsedSize: number;
|
|
53
|
+
};
|
|
54
|
+
/** package dependency chain */
|
|
55
|
+
dependencies: DependencyWithPackageData[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Generally serves to view package relationship detection rules.
|
|
59
|
+
*/
|
|
60
|
+
export interface PackageRelationDiffRuleStoreData extends BaseRuleStoreData {
|
|
61
|
+
type: 'package-relation';
|
|
62
|
+
packages: PackageRelationData[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* General service to view file relationship detection rules.
|
|
66
|
+
*/
|
|
67
|
+
export interface FileRelationRuleStoreData extends BaseRuleStoreData {
|
|
68
|
+
type: 'file-relation';
|
|
69
|
+
/** Target file */
|
|
70
|
+
target: string;
|
|
71
|
+
/** Dependency chain */
|
|
72
|
+
dependencies: number[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* the rule which code view only
|
|
76
|
+
*/
|
|
77
|
+
export interface CodeViewRuleStoreData extends BaseRuleStoreData {
|
|
78
|
+
type: 'code-view';
|
|
79
|
+
file: {
|
|
80
|
+
/**
|
|
81
|
+
* file path
|
|
82
|
+
*/
|
|
83
|
+
path: string;
|
|
84
|
+
/**
|
|
85
|
+
* the code content
|
|
86
|
+
*/
|
|
87
|
+
content: string;
|
|
88
|
+
/**
|
|
89
|
+
* fix highlight range in source
|
|
90
|
+
*/
|
|
91
|
+
ranges?: SourceRange[];
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* the rule which need to change the file code.
|
|
96
|
+
*/
|
|
97
|
+
export interface CodeChangeRuleStoreData extends BaseRuleStoreData {
|
|
98
|
+
type: 'code-change';
|
|
99
|
+
file: {
|
|
100
|
+
/**
|
|
101
|
+
* file path
|
|
102
|
+
*/
|
|
103
|
+
path: string;
|
|
104
|
+
/**
|
|
105
|
+
* the actual file content
|
|
106
|
+
*/
|
|
107
|
+
actual: string;
|
|
108
|
+
/**
|
|
109
|
+
* the expected file content
|
|
110
|
+
*/
|
|
111
|
+
expected: string;
|
|
112
|
+
/**
|
|
113
|
+
* fix code line in source
|
|
114
|
+
*/
|
|
115
|
+
line?: number;
|
|
116
|
+
/**
|
|
117
|
+
* whether this case is fixed
|
|
118
|
+
* - @default `false`
|
|
119
|
+
*/
|
|
120
|
+
isFixed?: boolean;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface EMORuleStoreData extends BaseRuleStoreData {
|
|
124
|
+
type: 'emo';
|
|
125
|
+
emoCheckData: WorkspaceCheckDataType;
|
|
126
|
+
}
|
|
127
|
+
export interface OverlayRuleStoreData extends BaseRuleStoreData {
|
|
128
|
+
code: RuleMessageCodeEnumerated.Overlay;
|
|
129
|
+
stack?: string;
|
|
130
|
+
}
|
|
131
|
+
export type RuleStoreDataItem = LinkRuleStoreData | FileRelationRuleStoreData | CodeChangeRuleStoreData | PackageRelationDiffRuleStoreData | CodeViewRuleStoreData | EMORuleStoreData;
|
|
132
|
+
export type RuleStoreData = RuleStoreDataItem[];
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
__exportStar(require("./code"), exports);
|
|
18
|
+
__exportStar(require("./data"), exports);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { NonFunctionProperties } from '../common';
|
|
2
|
+
import type { ModuleInstance, ToDataType } from './module';
|
|
3
|
+
export interface AssetInstance {
|
|
4
|
+
path: string;
|
|
5
|
+
size: number;
|
|
6
|
+
/** File belongs to Chunk */
|
|
7
|
+
chunks: ChunkInstance[];
|
|
8
|
+
/** File resource content */
|
|
9
|
+
content: string;
|
|
10
|
+
/** Generate data */
|
|
11
|
+
toData(type: ToDataType): AssetData;
|
|
12
|
+
}
|
|
13
|
+
export interface ChunkInstance {
|
|
14
|
+
/** Chunk Identifier */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Chunk Name */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Whether to load on the homepage */
|
|
19
|
+
initial: boolean;
|
|
20
|
+
size: number;
|
|
21
|
+
/** Is it an entrance */
|
|
22
|
+
entry: boolean;
|
|
23
|
+
/** Is it the entrance Chunk */
|
|
24
|
+
isEntry(): boolean;
|
|
25
|
+
/** Is the module a Chunk entrance */
|
|
26
|
+
isChunkEntryModule(module: ModuleInstance): boolean;
|
|
27
|
+
/** Does it contain modules */
|
|
28
|
+
hasModule(module: ModuleInstance): boolean;
|
|
29
|
+
/** Connection module */
|
|
30
|
+
addModule(module: ModuleInstance): void;
|
|
31
|
+
addAsset(asset: AssetInstance): void;
|
|
32
|
+
/** Add Dependency Chunk */
|
|
33
|
+
addDependency(dep: ChunkInstance): void;
|
|
34
|
+
/** Add Dependent Chunk */
|
|
35
|
+
addImported(imported: ChunkInstance): void;
|
|
36
|
+
/** Includes products */
|
|
37
|
+
getAssets(): AssetInstance[];
|
|
38
|
+
/** Contains original modules */
|
|
39
|
+
getModules(): ModuleInstance[];
|
|
40
|
+
/** Depends on Chunk */
|
|
41
|
+
getDependencies(): ChunkInstance[];
|
|
42
|
+
/** Add Dependent Chunk */
|
|
43
|
+
getImported(): ChunkInstance[];
|
|
44
|
+
/** add parsed chunk size */
|
|
45
|
+
setParsedSize(size: number): void;
|
|
46
|
+
/** Generate data */
|
|
47
|
+
toData(): ChunkData;
|
|
48
|
+
}
|
|
49
|
+
export interface ChunkGraphInstance {
|
|
50
|
+
/** Obtain product data */
|
|
51
|
+
getAssets(): AssetInstance[];
|
|
52
|
+
/** Get Chunk Data */
|
|
53
|
+
getChunks(): ChunkInstance[];
|
|
54
|
+
/** Add product data */
|
|
55
|
+
addAsset(...assets: AssetInstance[]): void;
|
|
56
|
+
/** Add Chunk Data */
|
|
57
|
+
addChunk(...chunks: ChunkInstance[]): void;
|
|
58
|
+
/** Get chunk by identifier */
|
|
59
|
+
getChunkById(id: string): ChunkInstance | undefined;
|
|
60
|
+
/** Get Chunk by Module */
|
|
61
|
+
getChunkByModule(module: ModuleInstance): ChunkInstance | undefined;
|
|
62
|
+
/** Get the file according to the path */
|
|
63
|
+
getAssetByPath(path: string): AssetInstance | undefined;
|
|
64
|
+
/** Get files based on Chunk */
|
|
65
|
+
getAssetsByChunk(chunk: ChunkInstance): AssetInstance[] | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* get the list of entry points
|
|
68
|
+
*/
|
|
69
|
+
getEntryPoints(): EntryPointInstance[];
|
|
70
|
+
/**
|
|
71
|
+
* add the entry point instance to chunk graph
|
|
72
|
+
*/
|
|
73
|
+
addEntryPoint(...entrypoint: EntryPointInstance[]): void;
|
|
74
|
+
/** Output pure data */
|
|
75
|
+
toData(type: ToDataType): ChunkGraphData;
|
|
76
|
+
}
|
|
77
|
+
export interface AssetData extends Omit<NonFunctionProperties<AssetInstance>, 'chunks'> {
|
|
78
|
+
/** Chunk Identifier to which the file belongs */
|
|
79
|
+
chunks: string[];
|
|
80
|
+
}
|
|
81
|
+
export interface ChunkGraphData extends NonFunctionProperties<ChunkGraphInstance> {
|
|
82
|
+
assets: AssetData[];
|
|
83
|
+
chunks: ChunkData[];
|
|
84
|
+
entrypoints: EntryPointData[];
|
|
85
|
+
}
|
|
86
|
+
export interface ChunkData extends Omit<NonFunctionProperties<ChunkInstance>, 'assets' | 'modules' | 'dependencies' | 'imported'> {
|
|
87
|
+
/** Is it the entrance Chunk */
|
|
88
|
+
entry: boolean;
|
|
89
|
+
/** Contains product path */
|
|
90
|
+
assets: string[];
|
|
91
|
+
/** contains the original module identifier */
|
|
92
|
+
modules: number[];
|
|
93
|
+
/** Depends on Chunk Identifier */
|
|
94
|
+
dependencies: string[];
|
|
95
|
+
/** Dependent Chunk Identifier */
|
|
96
|
+
imported: string[];
|
|
97
|
+
/** chunk parsed size */
|
|
98
|
+
parsedSize: number;
|
|
99
|
+
}
|
|
100
|
+
export interface EntryPointInstance {
|
|
101
|
+
name: string;
|
|
102
|
+
/**
|
|
103
|
+
* add asset which contained in this entry point
|
|
104
|
+
*/
|
|
105
|
+
addAsset(asset: AssetInstance): void;
|
|
106
|
+
/**
|
|
107
|
+
* add chunk which contained in this entry point
|
|
108
|
+
*/
|
|
109
|
+
addChunk(chunk: ChunkInstance): void;
|
|
110
|
+
toData(): EntryPointData;
|
|
111
|
+
}
|
|
112
|
+
export interface EntryPointData extends NonFunctionProperties<EntryPointInstance> {
|
|
113
|
+
/**
|
|
114
|
+
* id list for chunks which contained in this entry point.
|
|
115
|
+
*/
|
|
116
|
+
chunks: ChunkData['id'][];
|
|
117
|
+
/**
|
|
118
|
+
* path list for assets which contained in this entry point.
|
|
119
|
+
*/
|
|
120
|
+
assets: AssetData['path'][];
|
|
121
|
+
/**
|
|
122
|
+
* total size of assets
|
|
123
|
+
*/
|
|
124
|
+
size: number;
|
|
125
|
+
}
|
|
@@ -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,13 @@
|
|
|
1
|
+
import type { AsyncSeriesHook } from 'tapable';
|
|
2
|
+
import { DoctorManifestWithShardingFiles } from '../manifest';
|
|
3
|
+
/**
|
|
4
|
+
* sdk hooks map
|
|
5
|
+
*/
|
|
6
|
+
export interface Hooks {
|
|
7
|
+
afterSaveManifest: AsyncSeriesHook<[
|
|
8
|
+
{
|
|
9
|
+
manifestWithShardingFiles: DoctorManifestWithShardingFiles;
|
|
10
|
+
manifestDiskPath: string;
|
|
11
|
+
}
|
|
12
|
+
]>;
|
|
13
|
+
}
|
|
@@ -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,32 @@
|
|
|
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
|
+
__exportStar(require("./loader"), exports);
|
|
18
|
+
__exportStar(require("./resolver"), exports);
|
|
19
|
+
__exportStar(require("./plugin"), exports);
|
|
20
|
+
__exportStar(require("./module"), exports);
|
|
21
|
+
__exportStar(require("./chunk"), exports);
|
|
22
|
+
__exportStar(require("./result"), exports);
|
|
23
|
+
__exportStar(require("./summary"), exports);
|
|
24
|
+
__exportStar(require("./package"), exports);
|
|
25
|
+
__exportStar(require("./context"), exports);
|
|
26
|
+
__exportStar(require("./config"), exports);
|
|
27
|
+
__exportStar(require("./server"), exports);
|
|
28
|
+
__exportStar(require("./statement"), exports);
|
|
29
|
+
__exportStar(require("./treeShaking"), exports);
|
|
30
|
+
__exportStar(require("./envinfo"), exports);
|
|
31
|
+
__exportStar(require("./instance"), exports);
|
|
32
|
+
__exportStar(require("./hooks"), exports);
|