@rsdoctor/types 1.5.2 → 1.5.3
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/index.cjs +549 -0
- package/dist/index.js +492 -48
- package/dist/sdk/instance.d.ts +3 -0
- package/dist/sdk/module.d.ts +34 -0
- package/dist/sdk/package.d.ts +2 -2
- package/dist/sdk/result.d.ts +2 -1
- package/dist/sdk/server/apis/graph.d.ts +3 -2
- package/dist/sdk/server/apis/loader.d.ts +1 -1
- package/package.json +13 -6
- package/dist/babel.js +0 -2
- package/dist/client.js +0 -31
- package/dist/common.js +0 -2
- package/dist/config.js +0 -2
- package/dist/constants.js +0 -46
- package/dist/emo.js +0 -9
- package/dist/error.js +0 -10
- package/dist/esbuild.js +0 -2
- package/dist/linter/diagnostic.js +0 -5
- package/dist/linter/index.js +0 -18
- package/dist/linter/rule.js +0 -2
- package/dist/logger.js +0 -12
- package/dist/manifest.js +0 -17
- package/dist/modules.js +0 -2
- package/dist/plugin/baseCompiler.js +0 -2
- package/dist/plugin/baseLoader.js +0 -2
- package/dist/plugin/baseStats.js +0 -2
- package/dist/plugin/index.js +0 -23
- package/dist/plugin/internal-rules.js +0 -2
- package/dist/plugin/plugin.js +0 -2
- package/dist/plugin/rspack.js +0 -2
- package/dist/plugin/webpack.js +0 -2
- package/dist/rule/code/E1001.js +0 -31
- package/dist/rule/code/E1002.js +0 -39
- package/dist/rule/code/E1003.js +0 -39
- package/dist/rule/code/E1004.js +0 -15
- package/dist/rule/code/E1005.js +0 -31
- package/dist/rule/code/E1006.js +0 -33
- package/dist/rule/code/index.js +0 -65
- package/dist/rule/code/type.js +0 -23
- package/dist/rule/data.js +0 -2
- package/dist/rule/index.js +0 -18
- package/dist/sdk/chunk.js +0 -2
- package/dist/sdk/config.js +0 -2
- package/dist/sdk/context.js +0 -2
- package/dist/sdk/envinfo.js +0 -2
- package/dist/sdk/hooks.js +0 -2
- package/dist/sdk/index.js +0 -32
- package/dist/sdk/instance.js +0 -9
- package/dist/sdk/loader.js +0 -2
- package/dist/sdk/module.js +0 -31
- package/dist/sdk/package.js +0 -2
- package/dist/sdk/plugin.js +0 -2
- package/dist/sdk/process.js +0 -2
- package/dist/sdk/resolver.js +0 -2
- package/dist/sdk/result.js +0 -2
- package/dist/sdk/server/apis/alerts.js +0 -3
- package/dist/sdk/server/apis/graph.js +0 -3
- package/dist/sdk/server/apis/index.js +0 -87
- package/dist/sdk/server/apis/loader.js +0 -3
- package/dist/sdk/server/apis/pagination.js +0 -2
- package/dist/sdk/server/apis/plugin.js +0 -3
- package/dist/sdk/server/apis/project.js +0 -3
- package/dist/sdk/server/apis/resolver.js +0 -3
- package/dist/sdk/server/index.js +0 -37
- package/dist/sdk/statement.js +0 -147
- package/dist/sdk/summary.js +0 -2
- package/dist/sdk/treeShaking.js +0 -2
- package/dist/thirdparty.js +0 -2
package/dist/index.js
CHANGED
|
@@ -1,51 +1,495 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
1
|
+
var __webpack_require__ = {};
|
|
2
|
+
(()=>{
|
|
3
|
+
__webpack_require__.d = (exports, definition)=>{
|
|
4
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: definition[key]
|
|
7
|
+
});
|
|
26
8
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
9
|
+
})();
|
|
10
|
+
(()=>{
|
|
11
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
12
|
+
})();
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.r = (exports)=>{
|
|
15
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
16
|
+
value: 'Module'
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, '__esModule', {
|
|
19
|
+
value: true
|
|
20
|
+
});
|
|
33
21
|
};
|
|
34
22
|
})();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
var manifest_namespaceObject = {};
|
|
24
|
+
__webpack_require__.r(manifest_namespaceObject);
|
|
25
|
+
__webpack_require__.d(manifest_namespaceObject, {
|
|
26
|
+
RsdoctorManifestClientConstant: ()=>manifest_RsdoctorManifestClientConstant,
|
|
27
|
+
RsdoctorManifestClientRoutes: ()=>manifest_RsdoctorManifestClientRoutes
|
|
28
|
+
});
|
|
29
|
+
var esbuild_namespaceObject = {};
|
|
30
|
+
__webpack_require__.r(esbuild_namespaceObject);
|
|
31
|
+
var babel_namespaceObject = {};
|
|
32
|
+
__webpack_require__.r(babel_namespaceObject);
|
|
33
|
+
var common_namespaceObject = {};
|
|
34
|
+
__webpack_require__.r(common_namespaceObject);
|
|
35
|
+
var error_namespaceObject = {};
|
|
36
|
+
__webpack_require__.r(error_namespaceObject);
|
|
37
|
+
__webpack_require__.d(error_namespaceObject, {
|
|
38
|
+
ErrorLevel: ()=>error_ErrorLevel
|
|
39
|
+
});
|
|
40
|
+
var logger_namespaceObject = {};
|
|
41
|
+
__webpack_require__.r(logger_namespaceObject);
|
|
42
|
+
__webpack_require__.d(logger_namespaceObject, {
|
|
43
|
+
LogLevel: ()=>logger_LogLevel
|
|
44
|
+
});
|
|
45
|
+
var apis_namespaceObject = {};
|
|
46
|
+
__webpack_require__.r(apis_namespaceObject);
|
|
47
|
+
__webpack_require__.d(apis_namespaceObject, {
|
|
48
|
+
API: ()=>apis_API,
|
|
49
|
+
APIExtends: ()=>apis_APIExtends
|
|
50
|
+
});
|
|
51
|
+
var sdk_namespaceObject = {};
|
|
52
|
+
__webpack_require__.r(sdk_namespaceObject);
|
|
53
|
+
__webpack_require__.d(sdk_namespaceObject, {
|
|
54
|
+
DependencyKind: ()=>module_DependencyKind,
|
|
55
|
+
IMode: ()=>instance_IMode,
|
|
56
|
+
ModuleKind: ()=>module_ModuleKind,
|
|
57
|
+
ServerAPI: ()=>apis_namespaceObject,
|
|
58
|
+
StatementKind: ()=>statement_StatementKind,
|
|
59
|
+
ToDataType: ()=>module_ToDataType
|
|
60
|
+
});
|
|
61
|
+
var modules_namespaceObject = {};
|
|
62
|
+
__webpack_require__.r(modules_namespaceObject);
|
|
63
|
+
var linter_namespaceObject = {};
|
|
64
|
+
__webpack_require__.r(linter_namespaceObject);
|
|
65
|
+
__webpack_require__.d(linter_namespaceObject, {
|
|
66
|
+
Severity: ()=>error_ErrorLevel
|
|
67
|
+
});
|
|
68
|
+
var src_rule_namespaceObject = {};
|
|
69
|
+
__webpack_require__.r(src_rule_namespaceObject);
|
|
70
|
+
__webpack_require__.d(src_rule_namespaceObject, {
|
|
71
|
+
RsdoctorRuleClientConstant: ()=>code_RsdoctorRuleClientConstant,
|
|
72
|
+
RuleErrorMap: ()=>RuleErrorMap,
|
|
73
|
+
RuleMessageCategory: ()=>type_RuleMessageCategory,
|
|
74
|
+
RuleMessageCodeEnumerated: ()=>type_RuleMessageCodeEnumerated
|
|
75
|
+
});
|
|
76
|
+
var thirdparty_namespaceObject = {};
|
|
77
|
+
__webpack_require__.r(thirdparty_namespaceObject);
|
|
78
|
+
var client_namespaceObject = {};
|
|
79
|
+
__webpack_require__.r(client_namespaceObject);
|
|
80
|
+
__webpack_require__.d(client_namespaceObject, {
|
|
81
|
+
RsdoctorClientDiffState: ()=>client_RsdoctorClientDiffState,
|
|
82
|
+
RsdoctorClientRoutes: ()=>client_RsdoctorClientRoutes,
|
|
83
|
+
RsdoctorClientUrlQuery: ()=>client_RsdoctorClientUrlQuery
|
|
84
|
+
});
|
|
85
|
+
var constants_namespaceObject = {};
|
|
86
|
+
__webpack_require__.r(constants_namespaceObject);
|
|
87
|
+
__webpack_require__.d(constants_namespaceObject, {
|
|
88
|
+
BundleExtension: ()=>BundleExtension,
|
|
89
|
+
CSSExtension: ()=>CSSExtension,
|
|
90
|
+
FontExtensions: ()=>FontExtensions,
|
|
91
|
+
HtmlExtension: ()=>HtmlExtension,
|
|
92
|
+
ImgExtensions: ()=>ImgExtensions,
|
|
93
|
+
JSExtension: ()=>JSExtension,
|
|
94
|
+
JSExtensions: ()=>JSExtensions,
|
|
95
|
+
MapExtensions: ()=>MapExtensions,
|
|
96
|
+
MediaExtensions: ()=>MediaExtensions,
|
|
97
|
+
RsdoctorClientUrl: ()=>RsdoctorClientUrl,
|
|
98
|
+
RsdoctorMonitorDocBId: ()=>RsdoctorMonitorDocBId,
|
|
99
|
+
RsdoctorMonitorNodeBId: ()=>RsdoctorMonitorNodeBId,
|
|
100
|
+
RsdoctorMonitorWebBId: ()=>RsdoctorMonitorWebBId,
|
|
101
|
+
RsdoctorOutputFolder: ()=>RsdoctorOutputFolder,
|
|
102
|
+
RsdoctorOutputManifest: ()=>RsdoctorOutputManifest,
|
|
103
|
+
RsdoctorOutputManifestPath: ()=>RsdoctorOutputManifestPath,
|
|
104
|
+
RsdoctorProcessEnvDebugKey: ()=>RsdoctorProcessEnvDebugKey,
|
|
105
|
+
StatsFilePath: ()=>StatsFilePath,
|
|
106
|
+
WINDOW_RSDOCTOR_TAG: ()=>WINDOW_RSDOCTOR_TAG
|
|
107
|
+
});
|
|
108
|
+
var src_plugin_namespaceObject = {};
|
|
109
|
+
__webpack_require__.r(src_plugin_namespaceObject);
|
|
110
|
+
var src_config_namespaceObject = {};
|
|
111
|
+
__webpack_require__.r(src_config_namespaceObject);
|
|
112
|
+
var manifest_RsdoctorManifestClientRoutes = /*#__PURE__*/ function(RsdoctorManifestClientRoutes) {
|
|
113
|
+
RsdoctorManifestClientRoutes["Overall"] = "Overall";
|
|
114
|
+
RsdoctorManifestClientRoutes["WebpackLoaders"] = "Compile.WebpackLoaders";
|
|
115
|
+
RsdoctorManifestClientRoutes["ModuleResolve"] = "Compile.ModuleResolve";
|
|
116
|
+
RsdoctorManifestClientRoutes["WebpackPlugins"] = "Compile.WebpackPlugins";
|
|
117
|
+
RsdoctorManifestClientRoutes["BundleSize"] = "Bundle.BundleSize";
|
|
118
|
+
RsdoctorManifestClientRoutes["ModuleGraph"] = "Bundle.ModuleGraph";
|
|
119
|
+
RsdoctorManifestClientRoutes["TreeShaking"] = "Bundle.TreeShaking";
|
|
120
|
+
return RsdoctorManifestClientRoutes;
|
|
121
|
+
}({});
|
|
122
|
+
var manifest_RsdoctorManifestClientConstant = /*#__PURE__*/ function(RsdoctorManifestClientConstant) {
|
|
123
|
+
RsdoctorManifestClientConstant["WindowPropertyForManifestUrl"] = "__DEVTOOLS_MANIFEST_URL__";
|
|
124
|
+
return RsdoctorManifestClientConstant;
|
|
125
|
+
}({});
|
|
126
|
+
var error_ErrorLevel = /*#__PURE__*/ function(ErrorLevel) {
|
|
127
|
+
ErrorLevel[ErrorLevel["Ignore"] = 0] = "Ignore";
|
|
128
|
+
ErrorLevel[ErrorLevel["Warn"] = 1] = "Warn";
|
|
129
|
+
ErrorLevel[ErrorLevel["Error"] = 2] = "Error";
|
|
130
|
+
return ErrorLevel;
|
|
131
|
+
}({});
|
|
132
|
+
var logger_LogLevel = /*#__PURE__*/ function(LogLevel) {
|
|
133
|
+
LogLevel[LogLevel["Silent"] = 0] = "Silent";
|
|
134
|
+
LogLevel[LogLevel["Error"] = 1] = "Error";
|
|
135
|
+
LogLevel[LogLevel["Warning"] = 2] = "Warning";
|
|
136
|
+
LogLevel[LogLevel["Info"] = 3] = "Info";
|
|
137
|
+
LogLevel[LogLevel["Debug"] = 4] = "Debug";
|
|
138
|
+
LogLevel[LogLevel["Verbose"] = 5] = "Verbose";
|
|
139
|
+
return LogLevel;
|
|
140
|
+
}({});
|
|
141
|
+
var module_DependencyKind = /*#__PURE__*/ function(DependencyKind) {
|
|
142
|
+
DependencyKind[DependencyKind["Unknown"] = 0] = "Unknown";
|
|
143
|
+
DependencyKind[DependencyKind["ImportStatement"] = 1] = "ImportStatement";
|
|
144
|
+
DependencyKind[DependencyKind["DynamicImport"] = 2] = "DynamicImport";
|
|
145
|
+
DependencyKind[DependencyKind["RequireCall"] = 3] = "RequireCall";
|
|
146
|
+
DependencyKind[DependencyKind["AMDRequire"] = 4] = "AMDRequire";
|
|
147
|
+
return DependencyKind;
|
|
148
|
+
}({});
|
|
149
|
+
var module_ModuleKind = /*#__PURE__*/ function(ModuleKind) {
|
|
150
|
+
ModuleKind[ModuleKind["Normal"] = 0] = "Normal";
|
|
151
|
+
ModuleKind[ModuleKind["Concatenation"] = 1] = "Concatenation";
|
|
152
|
+
return ModuleKind;
|
|
153
|
+
}({});
|
|
154
|
+
var module_ToDataType = /*#__PURE__*/ function(ToDataType) {
|
|
155
|
+
ToDataType[ToDataType["NoCode"] = 0] = "NoCode";
|
|
156
|
+
ToDataType[ToDataType["Normal"] = 1] = "Normal";
|
|
157
|
+
ToDataType[ToDataType["NoSource"] = 2] = "NoSource";
|
|
158
|
+
ToDataType[ToDataType["NoSourceAndAssets"] = 3] = "NoSourceAndAssets";
|
|
159
|
+
ToDataType[ToDataType["All"] = 4] = "All";
|
|
160
|
+
return ToDataType;
|
|
161
|
+
}({});
|
|
162
|
+
var apis_API = /*#__PURE__*/ function(API) {
|
|
163
|
+
API["ApplyErrorFix"] = "/api/apply/error/fix";
|
|
164
|
+
API["Env"] = "/api/env";
|
|
165
|
+
API["EntryHtml"] = "/index.html";
|
|
166
|
+
API["Manifest"] = "/api/manifest.json";
|
|
167
|
+
API["LoadDataByKey"] = "/api/data/key";
|
|
168
|
+
API["SendAPIDataToClient"] = "/api/socket/send";
|
|
169
|
+
API["GetProjectInfo"] = "/api/project/info";
|
|
170
|
+
API["GetClientRoutes"] = "/api/routes";
|
|
171
|
+
API["ReportLoader"] = "/api/loader/report";
|
|
172
|
+
API["GetLoaderNames"] = "/api/loader/names";
|
|
173
|
+
API["GetLoaderChartData"] = "/api/loader/chart/data";
|
|
174
|
+
API["GetLoaderFileTree"] = "/api/loader/filetree";
|
|
175
|
+
API["GetLoaderFileDetails"] = "/api/loader/file";
|
|
176
|
+
API["GetLoaderFolderStatistics"] = "/api/loader/folder/statics";
|
|
177
|
+
API["GetLoaderFileFirstInput"] = "/api/loader/input";
|
|
178
|
+
API["GetLoaderFileInputAndOutput"] = "/api/loader/inputandoutput";
|
|
179
|
+
API["GetDirectoriesLoaders"] = "/api/loader/directories";
|
|
180
|
+
API["ReportSourceMap"] = "/api/sourcemap/report";
|
|
181
|
+
API["GetResolverFileTree"] = "/api/resolver/filetree";
|
|
182
|
+
API["GetResolverFileDetails"] = "/api/resolver/file";
|
|
183
|
+
API["GetPluginSummary"] = "/api/plugins/summary";
|
|
184
|
+
API["GetPluginData"] = "/api/plugins/data";
|
|
185
|
+
API["GetSummaryBundles"] = "/api/graph/bundles/summary";
|
|
186
|
+
API["GetChunkGraph"] = "/api/graph/chunks/graph";
|
|
187
|
+
API["GetAssetsSummary"] = "/api/graph/assets/summary";
|
|
188
|
+
API["GetAssetDetails"] = "/api/graph/asset/details";
|
|
189
|
+
API["GetChunksByModuleId"] = "/api/graph/chunk/module";
|
|
190
|
+
API["GetModuleDetails"] = "/api/graph/module/details";
|
|
191
|
+
API["GetModulesByModuleIds"] = "/api/graph/modules/ids";
|
|
192
|
+
API["GetEntryPoints"] = "/api/graph/entrypoints";
|
|
193
|
+
API["GetModuleCodeByModuleId"] = "/api/graph/module/code";
|
|
194
|
+
API["GetModuleCodeByModuleIds"] = "/api/graph/module/codes";
|
|
195
|
+
API["GetAllModuleGraph"] = "/api/graph/module/all";
|
|
196
|
+
API["GetAllChunkGraph"] = "/api/graph/chunk/all";
|
|
197
|
+
API["GetLayers"] = "/api/graph/layers";
|
|
198
|
+
API["GetSearchModules"] = "/api/search/modules";
|
|
199
|
+
API["GetSearchModuleInChunk"] = "/api/search/chunk/modules";
|
|
200
|
+
API["GetAllModuleGraphFilter"] = "/api/graph/module/filter";
|
|
201
|
+
API["GetModuleByName"] = "/api/graph/module/name";
|
|
202
|
+
API["GetModuleIssuerPath"] = "/api/graph/module/issuer_path";
|
|
203
|
+
API["GetPackageInfo"] = "/api/package/info";
|
|
204
|
+
API["GetPackageDependency"] = "/api/package/dependency";
|
|
205
|
+
API["GetPackageRelationAlertDetails"] = "/api/alerts/details/package/relation";
|
|
206
|
+
API["GetOverlayAlerts"] = "/api/alerts/overlay";
|
|
207
|
+
API["GetBundleAlerts"] = "/api/alerts/bundle";
|
|
208
|
+
API["BundleDiffManifest"] = "/api/bundle_diff/manifest.json";
|
|
209
|
+
API["GetBundleDiffSummary"] = "/api/bundle_diff/summary";
|
|
210
|
+
API["GetChunkGraphAI"] = "/api/graph/chunks/graph/ai";
|
|
211
|
+
API["GetChunkByIdAI"] = "/api/graph/chunk/id/ai";
|
|
212
|
+
return API;
|
|
213
|
+
}({});
|
|
214
|
+
var apis_APIExtends = /*#__PURE__*/ function(APIExtends) {
|
|
215
|
+
APIExtends["GetCompileProgress"] = "/api/progress";
|
|
216
|
+
return APIExtends;
|
|
217
|
+
}({});
|
|
218
|
+
var statement_StatementKind = /*#__PURE__*/ function(StatementKind) {
|
|
219
|
+
StatementKind[StatementKind["ImportDefault"] = 100] = "ImportDefault";
|
|
220
|
+
StatementKind[StatementKind["ImportNamed"] = 101] = "ImportNamed";
|
|
221
|
+
StatementKind[StatementKind["ImportDefaultWithNamed"] = 102] = "ImportDefaultWithNamed";
|
|
222
|
+
StatementKind[StatementKind["ImportDefaultWithNamespace"] = 103] = "ImportDefaultWithNamespace";
|
|
223
|
+
StatementKind[StatementKind["ImportNamespace"] = 104] = "ImportNamespace";
|
|
224
|
+
StatementKind[StatementKind["ImportSideEffect"] = 105] = "ImportSideEffect";
|
|
225
|
+
StatementKind[StatementKind["ImportDynamic"] = 106] = "ImportDynamic";
|
|
226
|
+
StatementKind[StatementKind["ExportDeclaration"] = 200] = "ExportDeclaration";
|
|
227
|
+
StatementKind[StatementKind["ExportList"] = 201] = "ExportList";
|
|
228
|
+
StatementKind[StatementKind["ExportDefault"] = 202] = "ExportDefault";
|
|
229
|
+
StatementKind[StatementKind["ExportAggregating"] = 203] = "ExportAggregating";
|
|
230
|
+
StatementKind[StatementKind["ExportNamespace"] = 204] = "ExportNamespace";
|
|
231
|
+
StatementKind[StatementKind["RequireCall"] = 300] = "RequireCall";
|
|
232
|
+
StatementKind[StatementKind["RequireName"] = 301] = "RequireName";
|
|
233
|
+
StatementKind[StatementKind["RequireExports"] = 302] = "RequireExports";
|
|
234
|
+
StatementKind[StatementKind["RequireExportAggregating"] = 303] = "RequireExportAggregating";
|
|
235
|
+
StatementKind[StatementKind["RequireExportName"] = 304] = "RequireExportName";
|
|
236
|
+
StatementKind[StatementKind["Unknown"] = 999] = "Unknown";
|
|
237
|
+
return StatementKind;
|
|
238
|
+
}({});
|
|
239
|
+
var instance_IMode = /*#__PURE__*/ function(IMode) {
|
|
240
|
+
IMode["brief"] = "brief";
|
|
241
|
+
IMode["lite"] = "lite";
|
|
242
|
+
IMode["normal"] = "normal";
|
|
243
|
+
return IMode;
|
|
244
|
+
}({});
|
|
245
|
+
const code = 'E1001';
|
|
246
|
+
const message = {
|
|
247
|
+
code,
|
|
248
|
+
title: 'Duplicate Packages',
|
|
249
|
+
type: 'markdown',
|
|
250
|
+
category: 'bundle',
|
|
251
|
+
description: `
|
|
252
|
+
#### Description
|
|
253
|
+
|
|
254
|
+
There is a same name package which is bundled in multiple versions in your application.
|
|
255
|
+
|
|
256
|
+
This negatively impacts the bundle size of your application.
|
|
257
|
+
|
|
258
|
+
#### General Solution
|
|
259
|
+
|
|
260
|
+
Add an entry in \`resolve.alias\` to configure Webpack to route any package references to a single specified path.
|
|
261
|
+
|
|
262
|
+
For example, if \`lodash\` is duplicated in your bundle, the following configuration would make all Lodash imports refer to the \`lodash\` instance found at \`./node_modules/lodash\`:
|
|
263
|
+
|
|
264
|
+
\`\`\`js
|
|
265
|
+
{
|
|
266
|
+
alias: {
|
|
267
|
+
lodash: path.resolve(__dirname, 'node_modules/lodash')
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
\`\`\`
|
|
271
|
+
`
|
|
272
|
+
};
|
|
273
|
+
const E1002_code = 'E1002';
|
|
274
|
+
const E1002_message = {
|
|
275
|
+
code: E1002_code,
|
|
276
|
+
title: 'Cross Chunks Packages',
|
|
277
|
+
type: 'markdown',
|
|
278
|
+
category: 'bundle',
|
|
279
|
+
description: `
|
|
280
|
+
#### Description
|
|
281
|
+
|
|
282
|
+
There is a package with the same version that is duplicated across different chunks in your application. This redundancy increases the overall bundle size, which is not optimal for performance.
|
|
283
|
+
|
|
284
|
+
#### General Solution
|
|
285
|
+
|
|
286
|
+
To address this issue, you can use Rspack's **SplitChunksPlugin** to extract common dependencies into a separate chunk. This ensures that the same package is not duplicated across multiple chunks, thereby reducing the bundle size.
|
|
287
|
+
|
|
288
|
+
For example, if **lodash** is being duplicated across different chunks, you can configure the **optimization.splitChunks** option in your Webpack configuration to extract **lodash** into a separate chunk:
|
|
289
|
+
|
|
290
|
+
\`\`\`
|
|
291
|
+
module.exports = {
|
|
292
|
+
optimization: {
|
|
293
|
+
splitChunks: {
|
|
294
|
+
cacheGroups: {
|
|
295
|
+
commons: {
|
|
296
|
+
test: /[\\/]node_modules[\\/]lodash[\\/]/,
|
|
297
|
+
name: 'lodash',
|
|
298
|
+
chunks: 'all',
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
};
|
|
304
|
+
\`\`\`
|
|
305
|
+
|
|
306
|
+
This configuration will automatically split out common dependencies (including those from \`node_modules\`) into separate chunks, ensuring that no package is duplicated across different chunks.
|
|
307
|
+
`
|
|
308
|
+
};
|
|
309
|
+
const E1003_code = 'E1003';
|
|
310
|
+
const E1003_message = {
|
|
311
|
+
code: E1003_code,
|
|
312
|
+
title: 'Loader Performance Optimization',
|
|
313
|
+
type: 'markdown',
|
|
314
|
+
category: 'compile',
|
|
315
|
+
description: `
|
|
316
|
+
#### Description
|
|
317
|
+
|
|
318
|
+
Usually the slow compile of most projects is due to the slow execution of the loaders.
|
|
319
|
+
|
|
320
|
+
And the loaders always pre-process many unnecessary files, such as \`node_modules files\` and \`already compiled files\`.
|
|
321
|
+
|
|
322
|
+
#### General Solution
|
|
323
|
+
|
|
324
|
+
Set \`exclude\` to the \`module.rules\` of webpack configuration for target loader.
|
|
325
|
+
|
|
326
|
+
For example, if \`node_modules/lodash\` is processed by the \`babel-loader\` that make the compile slowly:
|
|
327
|
+
|
|
328
|
+
\`\`\`
|
|
329
|
+
{
|
|
330
|
+
module: {
|
|
331
|
+
rules: [
|
|
332
|
+
{
|
|
333
|
+
test: /\\.js$/,
|
|
334
|
+
use: 'babel-loader',
|
|
335
|
+
exclude: [
|
|
336
|
+
/node_modules\\/lodash/
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
\`\`\`
|
|
343
|
+
`
|
|
344
|
+
};
|
|
345
|
+
const E1004_code = 'E1004';
|
|
346
|
+
const E1004_message = {
|
|
347
|
+
code: E1004_code,
|
|
348
|
+
title: 'ECMA Version Check',
|
|
349
|
+
type: 'markdown',
|
|
350
|
+
category: 'bundle',
|
|
351
|
+
description: `
|
|
352
|
+
#### Description
|
|
353
|
+
|
|
354
|
+
Detect if there is a newer version of ECMA syntax in the js bundle file
|
|
355
|
+
`
|
|
356
|
+
};
|
|
357
|
+
const E1005_code = 'E1005';
|
|
358
|
+
const E1005_message = {
|
|
359
|
+
code: E1005_code,
|
|
360
|
+
title: 'Default Import Check',
|
|
361
|
+
type: 'markdown',
|
|
362
|
+
category: 'compile',
|
|
363
|
+
description: `
|
|
364
|
+
#### Description
|
|
365
|
+
|
|
366
|
+
Usually webpack will automatically compatible different modules that has different types, but in a special case, the operation of compatibility will fail.
|
|
367
|
+
That is, when you use \`Default Import\` to import a cjs module, and this cjs module do not have the compatible statement, such as \`exports.default = \`.
|
|
368
|
+
|
|
369
|
+
#### General Solution
|
|
370
|
+
|
|
371
|
+
1. for cjs module, write a \`exports.default = \` statement for default export.
|
|
372
|
+
2. use \`Namespace Import\` for import the cjs module.
|
|
373
|
+
|
|
374
|
+
For example, for the package \`htmlparser2@7.2.0\`:
|
|
375
|
+
|
|
376
|
+
\`\`\`ts
|
|
377
|
+
// you should use this
|
|
378
|
+
import * as Parser from 'htmlparser2';
|
|
379
|
+
|
|
380
|
+
// can not use this
|
|
381
|
+
import Parser from 'htmlparser2';
|
|
382
|
+
\`\`\`
|
|
383
|
+
`
|
|
384
|
+
};
|
|
385
|
+
const E1006_code = 'E1006';
|
|
386
|
+
const E1006_message = {
|
|
387
|
+
code: E1006_code,
|
|
388
|
+
title: 'Module Mixed Chunks',
|
|
389
|
+
type: 'markdown',
|
|
390
|
+
category: 'bundle',
|
|
391
|
+
description: "\n#### Description\n\nWhen a module is included in both **initial chunks** and **async chunks**, the same module code is bundled into multiple chunks, increasing output size and potentially affecting first-screen load and cache efficiency.\n\n- **Initial chunks**: Chunks loaded with the main entry (e.g. entry points, synchronous `import` in the main bundle).\n- **Async chunks**: Chunks loaded on demand via dynamic `import()` or similar.\n\nIn the **Module Mixed Chunks** tab of Bundle Alerts, each entry shows the module path, **Initial Chunks** list, and **Async Chunks** list so you can locate duplicated modules.\n\n#### Common Causes\n\n- **Same module referenced in two ways**: The module is both synchronously imported in the main bundle or entry and dynamically `import()`ed elsewhere, so the bundler emits it in both initial and async chunks.\n- **A file is both an entry and an async chunk**: e.g. a utility module is configured as an entry and also `import()`ed in app code, so it appears in the entry's initial chunk and in a dynamically loaded async chunk.\n- **splitChunks overlapping with entry**: A path is split into an async chunk via `splitChunks` / `chunkSplit`, but that path is also an entry or a main-bundle dependency, leading to mixed chunk types.\n\n#### General Solution\n\n1. **Use a single import style**: Prefer one way to reference a module—either all synchronous imports (initial) or all dynamic `import()` (async). Avoid the same file being both synchronously imported in the main bundle and dynamically imported elsewhere.\n2. **Review entry vs dynamic loading**: If a file is both an entry and part of an async chunk, remove one of those usages or extract it into a single shared chunk via build config so both initial and async chunks reference it instead of duplicating it.\n3. **Adjust splitChunks**: Check rules for that module path in `optimization.splitChunks` (Rspack/Webpack) or `performance.chunkSplit` (Rsbuild), and avoid the same module being split into both initial and async chunks. Use `chunks: 'async'` or `chunks: 'initial'` where appropriate, or control which chunk type it goes into via `cacheGroups` and `test` / `chunks`.\n4. **Trace dependencies**: From the reported module path and chunk list, search the codebase for references to that module, distinguish sync vs dynamic imports, then converge to a single chunk type or extract a common chunk.\n"
|
|
392
|
+
};
|
|
393
|
+
var type_RuleMessageCodeEnumerated = /*#__PURE__*/ function(RuleMessageCodeEnumerated) {
|
|
394
|
+
RuleMessageCodeEnumerated["Extend"] = "EXTEND";
|
|
395
|
+
RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
|
|
396
|
+
return RuleMessageCodeEnumerated;
|
|
397
|
+
}({});
|
|
398
|
+
var type_RuleMessageCategory = /*#__PURE__*/ function(RuleMessageCategory) {
|
|
399
|
+
RuleMessageCategory["Compile"] = "compile";
|
|
400
|
+
RuleMessageCategory["Bundle"] = "bundle";
|
|
401
|
+
RuleMessageCategory["EMO"] = "emo";
|
|
402
|
+
return RuleMessageCategory;
|
|
403
|
+
}({});
|
|
404
|
+
const RuleErrorMap = {
|
|
405
|
+
["E1001"]: message,
|
|
406
|
+
["E1002"]: E1002_message,
|
|
407
|
+
["E1003"]: E1003_message,
|
|
408
|
+
["E1004"]: E1004_message,
|
|
409
|
+
["E1005"]: E1005_message,
|
|
410
|
+
["E1006"]: E1006_message
|
|
411
|
+
};
|
|
412
|
+
var code_RsdoctorRuleClientConstant = /*#__PURE__*/ function(RsdoctorRuleClientConstant) {
|
|
413
|
+
RsdoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
|
|
414
|
+
return RsdoctorRuleClientConstant;
|
|
415
|
+
}({});
|
|
416
|
+
var client_RsdoctorClientUrlQuery = /*#__PURE__*/ function(RsdoctorClientUrlQuery) {
|
|
417
|
+
RsdoctorClientUrlQuery["BundleDiffFiles"] = "__bundle_files__";
|
|
418
|
+
RsdoctorClientUrlQuery["ManifestFile"] = "manifest";
|
|
419
|
+
RsdoctorClientUrlQuery["EnableRoutes"] = "enableRoutes";
|
|
420
|
+
return RsdoctorClientUrlQuery;
|
|
421
|
+
}({});
|
|
422
|
+
var client_RsdoctorClientRoutes = /*#__PURE__*/ function(RsdoctorClientRoutes) {
|
|
423
|
+
RsdoctorClientRoutes["Home"] = "/";
|
|
424
|
+
RsdoctorClientRoutes["Overall"] = "/overall";
|
|
425
|
+
RsdoctorClientRoutes["WebpackLoaderOverall"] = "/webpack/loaders/overall";
|
|
426
|
+
RsdoctorClientRoutes["WebpackLoaderAnalysis"] = "/webpack/loaders/analysis";
|
|
427
|
+
RsdoctorClientRoutes["ModuleResolve"] = "/module/resolve";
|
|
428
|
+
RsdoctorClientRoutes["WebpackPlugins"] = "/webpack/plugins";
|
|
429
|
+
RsdoctorClientRoutes["BundleSize"] = "/bundle/size";
|
|
430
|
+
RsdoctorClientRoutes["ModuleAnalyze"] = "/module/analyze";
|
|
431
|
+
RsdoctorClientRoutes["TreeShaking"] = "/treeshaking";
|
|
432
|
+
RsdoctorClientRoutes["BundleDiff"] = "/resources/bundle/diff";
|
|
433
|
+
RsdoctorClientRoutes["RuleIndex"] = "/resources/rules";
|
|
434
|
+
RsdoctorClientRoutes["Uploader"] = "/resources/uploader";
|
|
435
|
+
RsdoctorClientRoutes["EmoCheck"] = "/emo/check";
|
|
436
|
+
return RsdoctorClientRoutes;
|
|
437
|
+
}({});
|
|
438
|
+
var client_RsdoctorClientDiffState = /*#__PURE__*/ function(RsdoctorClientDiffState) {
|
|
439
|
+
RsdoctorClientDiffState["Equal"] = "-";
|
|
440
|
+
RsdoctorClientDiffState["Up"] = "UP";
|
|
441
|
+
RsdoctorClientDiffState["Down"] = "DOWN";
|
|
442
|
+
return RsdoctorClientDiffState;
|
|
443
|
+
}({});
|
|
444
|
+
const JSExtension = '.js';
|
|
445
|
+
const BundleExtension = '.bundle';
|
|
446
|
+
const JSExtensions = [
|
|
447
|
+
JSExtension,
|
|
448
|
+
BundleExtension
|
|
449
|
+
];
|
|
450
|
+
const CSSExtension = '.css';
|
|
451
|
+
const HtmlExtension = '.html';
|
|
452
|
+
const ImgExtensions = [
|
|
453
|
+
'.png',
|
|
454
|
+
'.jpg',
|
|
455
|
+
'.svg',
|
|
456
|
+
'.webp',
|
|
457
|
+
'.jpeg',
|
|
458
|
+
'.gif',
|
|
459
|
+
'.bmp'
|
|
460
|
+
];
|
|
461
|
+
const MediaExtensions = [
|
|
462
|
+
'.mp3',
|
|
463
|
+
'.mp4',
|
|
464
|
+
'.avi',
|
|
465
|
+
'.wav',
|
|
466
|
+
'.flv',
|
|
467
|
+
'.mov',
|
|
468
|
+
'.mpg',
|
|
469
|
+
'.mpeg'
|
|
470
|
+
];
|
|
471
|
+
const FontExtensions = [
|
|
472
|
+
'.ttf',
|
|
473
|
+
'.fnt',
|
|
474
|
+
'.fon',
|
|
475
|
+
'.otf',
|
|
476
|
+
'.woff',
|
|
477
|
+
'.woff2'
|
|
478
|
+
];
|
|
479
|
+
const MapExtensions = [
|
|
480
|
+
'.js.map',
|
|
481
|
+
'.css.map',
|
|
482
|
+
'.ts.map',
|
|
483
|
+
'.LICENSE.txt'
|
|
484
|
+
];
|
|
485
|
+
const RsdoctorOutputFolder = '.rsdoctor';
|
|
486
|
+
const RsdoctorOutputManifest = 'manifest.json';
|
|
487
|
+
const RsdoctorOutputManifestPath = `${RsdoctorOutputFolder}/${RsdoctorOutputManifest}`;
|
|
488
|
+
const StatsFilePath = 'dist/stats.json';
|
|
489
|
+
const RsdoctorMonitorNodeBId = 'Rsdoctor';
|
|
490
|
+
const RsdoctorMonitorWebBId = 'Rsdoctor-Client';
|
|
491
|
+
const RsdoctorMonitorDocBId = 'Rsdoctor-Doc';
|
|
492
|
+
const RsdoctorProcessEnvDebugKey = 'rsdoctor';
|
|
493
|
+
const RsdoctorClientUrl = '';
|
|
494
|
+
const WINDOW_RSDOCTOR_TAG = '__RSDOCTOR__';
|
|
495
|
+
export { babel_namespaceObject as Babel, client_namespaceObject as Client, common_namespaceObject as Common, src_config_namespaceObject as Config, constants_namespaceObject as Constants, error_namespaceObject as Err, esbuild_namespaceObject as Esbuild, linter_namespaceObject as Linter, logger_namespaceObject as Logger, manifest_namespaceObject as Manifest, modules_namespaceObject as Modules, src_plugin_namespaceObject as Plugin, src_rule_namespaceObject as Rule, sdk_namespaceObject as SDK, thirdparty_namespaceObject as Thirdparty };
|
package/dist/sdk/instance.d.ts
CHANGED
package/dist/sdk/module.d.ts
CHANGED
|
@@ -25,6 +25,22 @@ export interface SourceRange {
|
|
|
25
25
|
start: SourcePosition;
|
|
26
26
|
end?: SourcePosition;
|
|
27
27
|
}
|
|
28
|
+
/** Side effect location from bundler (e.g. Rspack JsRsdoctorSideEffectLocation) */
|
|
29
|
+
export interface SideEffectLocationData {
|
|
30
|
+
location: string;
|
|
31
|
+
nodeType: string;
|
|
32
|
+
module: number;
|
|
33
|
+
request: string;
|
|
34
|
+
}
|
|
35
|
+
/** Side effect code snippet data */
|
|
36
|
+
export interface SideEffectCodeData {
|
|
37
|
+
/** Module ID */
|
|
38
|
+
moduleId: number;
|
|
39
|
+
/** Start line number (1-indexed) */
|
|
40
|
+
startLine: number;
|
|
41
|
+
/** Extracted source code snippet */
|
|
42
|
+
code: string;
|
|
43
|
+
}
|
|
28
44
|
/** Module size */
|
|
29
45
|
export interface ModuleSize {
|
|
30
46
|
sourceSize: number;
|
|
@@ -168,6 +184,16 @@ export interface ModuleInstance {
|
|
|
168
184
|
addBailoutReason(reason: string): void;
|
|
169
185
|
/** Get bailout reason */
|
|
170
186
|
getBailoutReason(): string[];
|
|
187
|
+
/** Side effect location data (e.g. from Rspack sideEffectsLocations) */
|
|
188
|
+
sideEffectLocations?: SideEffectLocationData[];
|
|
189
|
+
/** Add a side effect location */
|
|
190
|
+
addSideEffectLocation(location: SideEffectLocationData): void;
|
|
191
|
+
/** Get side effect locations */
|
|
192
|
+
getSideEffectLocations(): SideEffectLocationData[];
|
|
193
|
+
/** Add side effect code */
|
|
194
|
+
addSideEffectCode(codeData: SideEffectCodeData): void;
|
|
195
|
+
/** Get side effect codes */
|
|
196
|
+
getSideEffectCodes(): SideEffectCodeData[];
|
|
171
197
|
}
|
|
172
198
|
/** Depends on Metadata */
|
|
173
199
|
export interface DependencyBuildMeta {
|
|
@@ -288,6 +314,8 @@ export interface ModuleGraphInstance {
|
|
|
288
314
|
addVariable(data: VariableInstance): void;
|
|
289
315
|
/** Generate data */
|
|
290
316
|
toData(configs?: ModuleGraphToDataArgs): ModuleGraphData;
|
|
317
|
+
/** Generate tree shaking data */
|
|
318
|
+
toTreeShakingData(): TreeShakingData;
|
|
291
319
|
/** Generate data */
|
|
292
320
|
toCodeData(type?: ToDataType): ModuleCodeData;
|
|
293
321
|
setModules(modules: ModuleInstance[]): void;
|
|
@@ -319,8 +347,14 @@ export interface ModuleData extends Omit<NonFunctionProperties<ModuleInstance>,
|
|
|
319
347
|
meta?: Partial<Omit<ModuleBuildMeta, 'packageData'>>;
|
|
320
348
|
/** Issuer path */
|
|
321
349
|
issuerPath?: string[] | number[];
|
|
350
|
+
/** Side effect location data (e.g. from Rspack sideEffectsLocations) */
|
|
351
|
+
sideEffectLocations?: SideEffectLocationData[];
|
|
322
352
|
}
|
|
323
353
|
export type ModuleCodeData = Record<number, ModuleSource>;
|
|
354
|
+
/** Tree shaking analysis data */
|
|
355
|
+
export interface TreeShakingData {
|
|
356
|
+
sideEffectCodes: Record<number, SideEffectCodeData[]>;
|
|
357
|
+
}
|
|
324
358
|
export interface DependencyData extends Omit<NonFunctionProperties<DependencyInstance>, 'module' | 'dependency' | 'statements' | 'originDependency' | 'kindString' | 'resolveConcatenationModule' | 'meta'> {
|
|
325
359
|
/** Module Identifier */
|
|
326
360
|
module: number;
|
package/dist/sdk/package.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export type CrossChunksPackageType = {
|
|
|
21
21
|
};
|
|
22
22
|
export interface PackageInstance extends PackageBasicData {
|
|
23
23
|
id: number;
|
|
24
|
-
duplicates
|
|
24
|
+
duplicates?: CrossChunksPackageType[];
|
|
25
25
|
setDuplicates(data: CrossChunksPackageType): void;
|
|
26
26
|
/** Get all modules contained in the package */
|
|
27
27
|
getModules(): ModuleInstance[];
|
|
@@ -46,7 +46,7 @@ export interface PackageInstance extends PackageBasicData {
|
|
|
46
46
|
toData(): PackageData;
|
|
47
47
|
}
|
|
48
48
|
export interface PackageData extends NonFunctionProperties<PackageInstance> {
|
|
49
|
-
modules
|
|
49
|
+
modules?: number[];
|
|
50
50
|
size: ModuleSize;
|
|
51
51
|
}
|
|
52
52
|
export interface PackageDependencyInstance {
|
package/dist/sdk/result.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EmoCheckData } from '../emo';
|
|
2
2
|
import { LoaderData } from './loader';
|
|
3
|
-
import { ModuleGraphData, ModuleCodeData } from './module';
|
|
3
|
+
import { ModuleGraphData, ModuleCodeData, TreeShakingData } from './module';
|
|
4
4
|
import { ChunkGraphData } from './chunk';
|
|
5
5
|
import { ResolverData } from './resolver';
|
|
6
6
|
import { PluginData } from './plugin';
|
|
@@ -28,6 +28,7 @@ export interface BuilderStoreData extends StoreCommonData {
|
|
|
28
28
|
chunkGraph: ChunkGraphData;
|
|
29
29
|
packageGraph: PackageGraphData;
|
|
30
30
|
moduleCodeMap: ModuleCodeData;
|
|
31
|
+
treeShaking?: TreeShakingData;
|
|
31
32
|
otherReports?: OtherReports | undefined;
|
|
32
33
|
}
|
|
33
34
|
export interface EMOStoreData extends StoreCommonData {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { API } from './index';
|
|
2
|
-
import { ModuleData, ModuleGraphData } from '../../module';
|
|
3
1
|
import { RsdoctorClientAssetsSummary } from '../../../client';
|
|
4
2
|
import { AssetData, ChunkData, ChunkGraphData, EntryPointData } from '../../chunk';
|
|
3
|
+
import { ModuleData, ModuleGraphData, SideEffectCodeData } from '../../module';
|
|
4
|
+
import { API } from './index';
|
|
5
5
|
export interface GraphAPIResponse {
|
|
6
6
|
[API.GetAssetsSummary]: RsdoctorClientAssetsSummary;
|
|
7
7
|
[API.GetAssetDetails]: {
|
|
@@ -10,6 +10,7 @@ export interface GraphAPIResponse {
|
|
|
10
10
|
[API.GetChunksByModuleId]: ChunkData[];
|
|
11
11
|
[API.GetModuleDetails]: {
|
|
12
12
|
module: ModuleData;
|
|
13
|
+
sideEffectCodes?: SideEffectCodeData[];
|
|
13
14
|
} & Pick<ModuleGraphData, 'dependencies'>;
|
|
14
15
|
[API.GetModulesByModuleIds]: ModuleData[];
|
|
15
16
|
[API.GetEntryPoints]: EntryPointData[];
|