@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.
Files changed (68) hide show
  1. package/dist/index.cjs +549 -0
  2. package/dist/index.js +492 -48
  3. package/dist/sdk/instance.d.ts +3 -0
  4. package/dist/sdk/module.d.ts +34 -0
  5. package/dist/sdk/package.d.ts +2 -2
  6. package/dist/sdk/result.d.ts +2 -1
  7. package/dist/sdk/server/apis/graph.d.ts +3 -2
  8. package/dist/sdk/server/apis/loader.d.ts +1 -1
  9. package/package.json +13 -6
  10. package/dist/babel.js +0 -2
  11. package/dist/client.js +0 -31
  12. package/dist/common.js +0 -2
  13. package/dist/config.js +0 -2
  14. package/dist/constants.js +0 -46
  15. package/dist/emo.js +0 -9
  16. package/dist/error.js +0 -10
  17. package/dist/esbuild.js +0 -2
  18. package/dist/linter/diagnostic.js +0 -5
  19. package/dist/linter/index.js +0 -18
  20. package/dist/linter/rule.js +0 -2
  21. package/dist/logger.js +0 -12
  22. package/dist/manifest.js +0 -17
  23. package/dist/modules.js +0 -2
  24. package/dist/plugin/baseCompiler.js +0 -2
  25. package/dist/plugin/baseLoader.js +0 -2
  26. package/dist/plugin/baseStats.js +0 -2
  27. package/dist/plugin/index.js +0 -23
  28. package/dist/plugin/internal-rules.js +0 -2
  29. package/dist/plugin/plugin.js +0 -2
  30. package/dist/plugin/rspack.js +0 -2
  31. package/dist/plugin/webpack.js +0 -2
  32. package/dist/rule/code/E1001.js +0 -31
  33. package/dist/rule/code/E1002.js +0 -39
  34. package/dist/rule/code/E1003.js +0 -39
  35. package/dist/rule/code/E1004.js +0 -15
  36. package/dist/rule/code/E1005.js +0 -31
  37. package/dist/rule/code/E1006.js +0 -33
  38. package/dist/rule/code/index.js +0 -65
  39. package/dist/rule/code/type.js +0 -23
  40. package/dist/rule/data.js +0 -2
  41. package/dist/rule/index.js +0 -18
  42. package/dist/sdk/chunk.js +0 -2
  43. package/dist/sdk/config.js +0 -2
  44. package/dist/sdk/context.js +0 -2
  45. package/dist/sdk/envinfo.js +0 -2
  46. package/dist/sdk/hooks.js +0 -2
  47. package/dist/sdk/index.js +0 -32
  48. package/dist/sdk/instance.js +0 -9
  49. package/dist/sdk/loader.js +0 -2
  50. package/dist/sdk/module.js +0 -31
  51. package/dist/sdk/package.js +0 -2
  52. package/dist/sdk/plugin.js +0 -2
  53. package/dist/sdk/process.js +0 -2
  54. package/dist/sdk/resolver.js +0 -2
  55. package/dist/sdk/result.js +0 -2
  56. package/dist/sdk/server/apis/alerts.js +0 -3
  57. package/dist/sdk/server/apis/graph.js +0 -3
  58. package/dist/sdk/server/apis/index.js +0 -87
  59. package/dist/sdk/server/apis/loader.js +0 -3
  60. package/dist/sdk/server/apis/pagination.js +0 -2
  61. package/dist/sdk/server/apis/plugin.js +0 -3
  62. package/dist/sdk/server/apis/project.js +0 -3
  63. package/dist/sdk/server/apis/resolver.js +0 -3
  64. package/dist/sdk/server/index.js +0 -37
  65. package/dist/sdk/statement.js +0 -147
  66. package/dist/sdk/summary.js +0 -2
  67. package/dist/sdk/treeShaking.js +0 -2
  68. package/dist/thirdparty.js +0 -2
package/dist/index.cjs ADDED
@@ -0,0 +1,549 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ Config: ()=>config_namespaceObject,
28
+ Linter: ()=>linter_namespaceObject,
29
+ Babel: ()=>babel_namespaceObject,
30
+ Modules: ()=>modules_namespaceObject,
31
+ Constants: ()=>constants_namespaceObject,
32
+ Err: ()=>error_namespaceObject,
33
+ Plugin: ()=>plugin_namespaceObject,
34
+ Rule: ()=>rule_namespaceObject,
35
+ Manifest: ()=>manifest_namespaceObject,
36
+ SDK: ()=>sdk_namespaceObject,
37
+ Logger: ()=>logger_namespaceObject,
38
+ Client: ()=>client_namespaceObject,
39
+ Esbuild: ()=>esbuild_namespaceObject,
40
+ Thirdparty: ()=>thirdparty_namespaceObject,
41
+ Common: ()=>common_namespaceObject
42
+ });
43
+ var manifest_namespaceObject = {};
44
+ __webpack_require__.r(manifest_namespaceObject);
45
+ __webpack_require__.d(manifest_namespaceObject, {
46
+ RsdoctorManifestClientConstant: ()=>manifest_RsdoctorManifestClientConstant,
47
+ RsdoctorManifestClientRoutes: ()=>manifest_RsdoctorManifestClientRoutes
48
+ });
49
+ var esbuild_namespaceObject = {};
50
+ __webpack_require__.r(esbuild_namespaceObject);
51
+ var babel_namespaceObject = {};
52
+ __webpack_require__.r(babel_namespaceObject);
53
+ var common_namespaceObject = {};
54
+ __webpack_require__.r(common_namespaceObject);
55
+ var error_namespaceObject = {};
56
+ __webpack_require__.r(error_namespaceObject);
57
+ __webpack_require__.d(error_namespaceObject, {
58
+ ErrorLevel: ()=>error_ErrorLevel
59
+ });
60
+ var logger_namespaceObject = {};
61
+ __webpack_require__.r(logger_namespaceObject);
62
+ __webpack_require__.d(logger_namespaceObject, {
63
+ LogLevel: ()=>logger_LogLevel
64
+ });
65
+ var apis_namespaceObject = {};
66
+ __webpack_require__.r(apis_namespaceObject);
67
+ __webpack_require__.d(apis_namespaceObject, {
68
+ API: ()=>apis_API,
69
+ APIExtends: ()=>apis_APIExtends
70
+ });
71
+ var sdk_namespaceObject = {};
72
+ __webpack_require__.r(sdk_namespaceObject);
73
+ __webpack_require__.d(sdk_namespaceObject, {
74
+ DependencyKind: ()=>module_DependencyKind,
75
+ IMode: ()=>instance_IMode,
76
+ ModuleKind: ()=>module_ModuleKind,
77
+ ServerAPI: ()=>apis_namespaceObject,
78
+ StatementKind: ()=>statement_StatementKind,
79
+ ToDataType: ()=>module_ToDataType
80
+ });
81
+ var modules_namespaceObject = {};
82
+ __webpack_require__.r(modules_namespaceObject);
83
+ var linter_namespaceObject = {};
84
+ __webpack_require__.r(linter_namespaceObject);
85
+ __webpack_require__.d(linter_namespaceObject, {
86
+ Severity: ()=>error_ErrorLevel
87
+ });
88
+ var rule_namespaceObject = {};
89
+ __webpack_require__.r(rule_namespaceObject);
90
+ __webpack_require__.d(rule_namespaceObject, {
91
+ RsdoctorRuleClientConstant: ()=>code_RsdoctorRuleClientConstant,
92
+ RuleErrorMap: ()=>RuleErrorMap,
93
+ RuleMessageCategory: ()=>type_RuleMessageCategory,
94
+ RuleMessageCodeEnumerated: ()=>type_RuleMessageCodeEnumerated
95
+ });
96
+ var thirdparty_namespaceObject = {};
97
+ __webpack_require__.r(thirdparty_namespaceObject);
98
+ var client_namespaceObject = {};
99
+ __webpack_require__.r(client_namespaceObject);
100
+ __webpack_require__.d(client_namespaceObject, {
101
+ RsdoctorClientDiffState: ()=>client_RsdoctorClientDiffState,
102
+ RsdoctorClientRoutes: ()=>client_RsdoctorClientRoutes,
103
+ RsdoctorClientUrlQuery: ()=>client_RsdoctorClientUrlQuery
104
+ });
105
+ var constants_namespaceObject = {};
106
+ __webpack_require__.r(constants_namespaceObject);
107
+ __webpack_require__.d(constants_namespaceObject, {
108
+ BundleExtension: ()=>BundleExtension,
109
+ CSSExtension: ()=>CSSExtension,
110
+ FontExtensions: ()=>FontExtensions,
111
+ HtmlExtension: ()=>HtmlExtension,
112
+ ImgExtensions: ()=>ImgExtensions,
113
+ JSExtension: ()=>JSExtension,
114
+ JSExtensions: ()=>JSExtensions,
115
+ MapExtensions: ()=>MapExtensions,
116
+ MediaExtensions: ()=>MediaExtensions,
117
+ RsdoctorClientUrl: ()=>RsdoctorClientUrl,
118
+ RsdoctorMonitorDocBId: ()=>RsdoctorMonitorDocBId,
119
+ RsdoctorMonitorNodeBId: ()=>RsdoctorMonitorNodeBId,
120
+ RsdoctorMonitorWebBId: ()=>RsdoctorMonitorWebBId,
121
+ RsdoctorOutputFolder: ()=>RsdoctorOutputFolder,
122
+ RsdoctorOutputManifest: ()=>RsdoctorOutputManifest,
123
+ RsdoctorOutputManifestPath: ()=>RsdoctorOutputManifestPath,
124
+ RsdoctorProcessEnvDebugKey: ()=>RsdoctorProcessEnvDebugKey,
125
+ StatsFilePath: ()=>StatsFilePath,
126
+ WINDOW_RSDOCTOR_TAG: ()=>WINDOW_RSDOCTOR_TAG
127
+ });
128
+ var plugin_namespaceObject = {};
129
+ __webpack_require__.r(plugin_namespaceObject);
130
+ var config_namespaceObject = {};
131
+ __webpack_require__.r(config_namespaceObject);
132
+ var manifest_RsdoctorManifestClientRoutes = /*#__PURE__*/ function(RsdoctorManifestClientRoutes) {
133
+ RsdoctorManifestClientRoutes["Overall"] = "Overall";
134
+ RsdoctorManifestClientRoutes["WebpackLoaders"] = "Compile.WebpackLoaders";
135
+ RsdoctorManifestClientRoutes["ModuleResolve"] = "Compile.ModuleResolve";
136
+ RsdoctorManifestClientRoutes["WebpackPlugins"] = "Compile.WebpackPlugins";
137
+ RsdoctorManifestClientRoutes["BundleSize"] = "Bundle.BundleSize";
138
+ RsdoctorManifestClientRoutes["ModuleGraph"] = "Bundle.ModuleGraph";
139
+ RsdoctorManifestClientRoutes["TreeShaking"] = "Bundle.TreeShaking";
140
+ return RsdoctorManifestClientRoutes;
141
+ }({});
142
+ var manifest_RsdoctorManifestClientConstant = /*#__PURE__*/ function(RsdoctorManifestClientConstant) {
143
+ RsdoctorManifestClientConstant["WindowPropertyForManifestUrl"] = "__DEVTOOLS_MANIFEST_URL__";
144
+ return RsdoctorManifestClientConstant;
145
+ }({});
146
+ var error_ErrorLevel = /*#__PURE__*/ function(ErrorLevel) {
147
+ ErrorLevel[ErrorLevel["Ignore"] = 0] = "Ignore";
148
+ ErrorLevel[ErrorLevel["Warn"] = 1] = "Warn";
149
+ ErrorLevel[ErrorLevel["Error"] = 2] = "Error";
150
+ return ErrorLevel;
151
+ }({});
152
+ var logger_LogLevel = /*#__PURE__*/ function(LogLevel) {
153
+ LogLevel[LogLevel["Silent"] = 0] = "Silent";
154
+ LogLevel[LogLevel["Error"] = 1] = "Error";
155
+ LogLevel[LogLevel["Warning"] = 2] = "Warning";
156
+ LogLevel[LogLevel["Info"] = 3] = "Info";
157
+ LogLevel[LogLevel["Debug"] = 4] = "Debug";
158
+ LogLevel[LogLevel["Verbose"] = 5] = "Verbose";
159
+ return LogLevel;
160
+ }({});
161
+ var module_DependencyKind = /*#__PURE__*/ function(DependencyKind) {
162
+ DependencyKind[DependencyKind["Unknown"] = 0] = "Unknown";
163
+ DependencyKind[DependencyKind["ImportStatement"] = 1] = "ImportStatement";
164
+ DependencyKind[DependencyKind["DynamicImport"] = 2] = "DynamicImport";
165
+ DependencyKind[DependencyKind["RequireCall"] = 3] = "RequireCall";
166
+ DependencyKind[DependencyKind["AMDRequire"] = 4] = "AMDRequire";
167
+ return DependencyKind;
168
+ }({});
169
+ var module_ModuleKind = /*#__PURE__*/ function(ModuleKind) {
170
+ ModuleKind[ModuleKind["Normal"] = 0] = "Normal";
171
+ ModuleKind[ModuleKind["Concatenation"] = 1] = "Concatenation";
172
+ return ModuleKind;
173
+ }({});
174
+ var module_ToDataType = /*#__PURE__*/ function(ToDataType) {
175
+ ToDataType[ToDataType["NoCode"] = 0] = "NoCode";
176
+ ToDataType[ToDataType["Normal"] = 1] = "Normal";
177
+ ToDataType[ToDataType["NoSource"] = 2] = "NoSource";
178
+ ToDataType[ToDataType["NoSourceAndAssets"] = 3] = "NoSourceAndAssets";
179
+ ToDataType[ToDataType["All"] = 4] = "All";
180
+ return ToDataType;
181
+ }({});
182
+ var apis_API = /*#__PURE__*/ function(API) {
183
+ API["ApplyErrorFix"] = "/api/apply/error/fix";
184
+ API["Env"] = "/api/env";
185
+ API["EntryHtml"] = "/index.html";
186
+ API["Manifest"] = "/api/manifest.json";
187
+ API["LoadDataByKey"] = "/api/data/key";
188
+ API["SendAPIDataToClient"] = "/api/socket/send";
189
+ API["GetProjectInfo"] = "/api/project/info";
190
+ API["GetClientRoutes"] = "/api/routes";
191
+ API["ReportLoader"] = "/api/loader/report";
192
+ API["GetLoaderNames"] = "/api/loader/names";
193
+ API["GetLoaderChartData"] = "/api/loader/chart/data";
194
+ API["GetLoaderFileTree"] = "/api/loader/filetree";
195
+ API["GetLoaderFileDetails"] = "/api/loader/file";
196
+ API["GetLoaderFolderStatistics"] = "/api/loader/folder/statics";
197
+ API["GetLoaderFileFirstInput"] = "/api/loader/input";
198
+ API["GetLoaderFileInputAndOutput"] = "/api/loader/inputandoutput";
199
+ API["GetDirectoriesLoaders"] = "/api/loader/directories";
200
+ API["ReportSourceMap"] = "/api/sourcemap/report";
201
+ API["GetResolverFileTree"] = "/api/resolver/filetree";
202
+ API["GetResolverFileDetails"] = "/api/resolver/file";
203
+ API["GetPluginSummary"] = "/api/plugins/summary";
204
+ API["GetPluginData"] = "/api/plugins/data";
205
+ API["GetSummaryBundles"] = "/api/graph/bundles/summary";
206
+ API["GetChunkGraph"] = "/api/graph/chunks/graph";
207
+ API["GetAssetsSummary"] = "/api/graph/assets/summary";
208
+ API["GetAssetDetails"] = "/api/graph/asset/details";
209
+ API["GetChunksByModuleId"] = "/api/graph/chunk/module";
210
+ API["GetModuleDetails"] = "/api/graph/module/details";
211
+ API["GetModulesByModuleIds"] = "/api/graph/modules/ids";
212
+ API["GetEntryPoints"] = "/api/graph/entrypoints";
213
+ API["GetModuleCodeByModuleId"] = "/api/graph/module/code";
214
+ API["GetModuleCodeByModuleIds"] = "/api/graph/module/codes";
215
+ API["GetAllModuleGraph"] = "/api/graph/module/all";
216
+ API["GetAllChunkGraph"] = "/api/graph/chunk/all";
217
+ API["GetLayers"] = "/api/graph/layers";
218
+ API["GetSearchModules"] = "/api/search/modules";
219
+ API["GetSearchModuleInChunk"] = "/api/search/chunk/modules";
220
+ API["GetAllModuleGraphFilter"] = "/api/graph/module/filter";
221
+ API["GetModuleByName"] = "/api/graph/module/name";
222
+ API["GetModuleIssuerPath"] = "/api/graph/module/issuer_path";
223
+ API["GetPackageInfo"] = "/api/package/info";
224
+ API["GetPackageDependency"] = "/api/package/dependency";
225
+ API["GetPackageRelationAlertDetails"] = "/api/alerts/details/package/relation";
226
+ API["GetOverlayAlerts"] = "/api/alerts/overlay";
227
+ API["GetBundleAlerts"] = "/api/alerts/bundle";
228
+ API["BundleDiffManifest"] = "/api/bundle_diff/manifest.json";
229
+ API["GetBundleDiffSummary"] = "/api/bundle_diff/summary";
230
+ API["GetChunkGraphAI"] = "/api/graph/chunks/graph/ai";
231
+ API["GetChunkByIdAI"] = "/api/graph/chunk/id/ai";
232
+ return API;
233
+ }({});
234
+ var apis_APIExtends = /*#__PURE__*/ function(APIExtends) {
235
+ APIExtends["GetCompileProgress"] = "/api/progress";
236
+ return APIExtends;
237
+ }({});
238
+ var statement_StatementKind = /*#__PURE__*/ function(StatementKind) {
239
+ StatementKind[StatementKind["ImportDefault"] = 100] = "ImportDefault";
240
+ StatementKind[StatementKind["ImportNamed"] = 101] = "ImportNamed";
241
+ StatementKind[StatementKind["ImportDefaultWithNamed"] = 102] = "ImportDefaultWithNamed";
242
+ StatementKind[StatementKind["ImportDefaultWithNamespace"] = 103] = "ImportDefaultWithNamespace";
243
+ StatementKind[StatementKind["ImportNamespace"] = 104] = "ImportNamespace";
244
+ StatementKind[StatementKind["ImportSideEffect"] = 105] = "ImportSideEffect";
245
+ StatementKind[StatementKind["ImportDynamic"] = 106] = "ImportDynamic";
246
+ StatementKind[StatementKind["ExportDeclaration"] = 200] = "ExportDeclaration";
247
+ StatementKind[StatementKind["ExportList"] = 201] = "ExportList";
248
+ StatementKind[StatementKind["ExportDefault"] = 202] = "ExportDefault";
249
+ StatementKind[StatementKind["ExportAggregating"] = 203] = "ExportAggregating";
250
+ StatementKind[StatementKind["ExportNamespace"] = 204] = "ExportNamespace";
251
+ StatementKind[StatementKind["RequireCall"] = 300] = "RequireCall";
252
+ StatementKind[StatementKind["RequireName"] = 301] = "RequireName";
253
+ StatementKind[StatementKind["RequireExports"] = 302] = "RequireExports";
254
+ StatementKind[StatementKind["RequireExportAggregating"] = 303] = "RequireExportAggregating";
255
+ StatementKind[StatementKind["RequireExportName"] = 304] = "RequireExportName";
256
+ StatementKind[StatementKind["Unknown"] = 999] = "Unknown";
257
+ return StatementKind;
258
+ }({});
259
+ var instance_IMode = /*#__PURE__*/ function(IMode) {
260
+ IMode["brief"] = "brief";
261
+ IMode["lite"] = "lite";
262
+ IMode["normal"] = "normal";
263
+ return IMode;
264
+ }({});
265
+ const code = 'E1001';
266
+ const message = {
267
+ code,
268
+ title: 'Duplicate Packages',
269
+ type: 'markdown',
270
+ category: 'bundle',
271
+ description: `
272
+ #### Description
273
+
274
+ There is a same name package which is bundled in multiple versions in your application.
275
+
276
+ This negatively impacts the bundle size of your application.
277
+
278
+ #### General Solution
279
+
280
+ Add an entry in \`resolve.alias\` to configure Webpack to route any package references to a single specified path.
281
+
282
+ 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\`:
283
+
284
+ \`\`\`js
285
+ {
286
+ alias: {
287
+ lodash: path.resolve(__dirname, 'node_modules/lodash')
288
+ }
289
+ }
290
+ \`\`\`
291
+ `
292
+ };
293
+ const E1002_code = 'E1002';
294
+ const E1002_message = {
295
+ code: E1002_code,
296
+ title: 'Cross Chunks Packages',
297
+ type: 'markdown',
298
+ category: 'bundle',
299
+ description: `
300
+ #### Description
301
+
302
+ 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.
303
+
304
+ #### General Solution
305
+
306
+ 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.
307
+
308
+ 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:
309
+
310
+ \`\`\`
311
+ module.exports = {
312
+ optimization: {
313
+ splitChunks: {
314
+ cacheGroups: {
315
+ commons: {
316
+ test: /[\\/]node_modules[\\/]lodash[\\/]/,
317
+ name: 'lodash',
318
+ chunks: 'all',
319
+ },
320
+ },
321
+ },
322
+ },
323
+ };
324
+ \`\`\`
325
+
326
+ 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.
327
+ `
328
+ };
329
+ const E1003_code = 'E1003';
330
+ const E1003_message = {
331
+ code: E1003_code,
332
+ title: 'Loader Performance Optimization',
333
+ type: 'markdown',
334
+ category: 'compile',
335
+ description: `
336
+ #### Description
337
+
338
+ Usually the slow compile of most projects is due to the slow execution of the loaders.
339
+
340
+ And the loaders always pre-process many unnecessary files, such as \`node_modules files\` and \`already compiled files\`.
341
+
342
+ #### General Solution
343
+
344
+ Set \`exclude\` to the \`module.rules\` of webpack configuration for target loader.
345
+
346
+ For example, if \`node_modules/lodash\` is processed by the \`babel-loader\` that make the compile slowly:
347
+
348
+ \`\`\`
349
+ {
350
+ module: {
351
+ rules: [
352
+ {
353
+ test: /\\.js$/,
354
+ use: 'babel-loader',
355
+ exclude: [
356
+ /node_modules\\/lodash/
357
+ ]
358
+ }
359
+ ]
360
+ }
361
+ }
362
+ \`\`\`
363
+ `
364
+ };
365
+ const E1004_code = 'E1004';
366
+ const E1004_message = {
367
+ code: E1004_code,
368
+ title: 'ECMA Version Check',
369
+ type: 'markdown',
370
+ category: 'bundle',
371
+ description: `
372
+ #### Description
373
+
374
+ Detect if there is a newer version of ECMA syntax in the js bundle file
375
+ `
376
+ };
377
+ const E1005_code = 'E1005';
378
+ const E1005_message = {
379
+ code: E1005_code,
380
+ title: 'Default Import Check',
381
+ type: 'markdown',
382
+ category: 'compile',
383
+ description: `
384
+ #### Description
385
+
386
+ Usually webpack will automatically compatible different modules that has different types, but in a special case, the operation of compatibility will fail.
387
+ 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 = \`.
388
+
389
+ #### General Solution
390
+
391
+ 1. for cjs module, write a \`exports.default = \` statement for default export.
392
+ 2. use \`Namespace Import\` for import the cjs module.
393
+
394
+ For example, for the package \`htmlparser2@7.2.0\`:
395
+
396
+ \`\`\`ts
397
+ // you should use this
398
+ import * as Parser from 'htmlparser2';
399
+
400
+ // can not use this
401
+ import Parser from 'htmlparser2';
402
+ \`\`\`
403
+ `
404
+ };
405
+ const E1006_code = 'E1006';
406
+ const E1006_message = {
407
+ code: E1006_code,
408
+ title: 'Module Mixed Chunks',
409
+ type: 'markdown',
410
+ category: 'bundle',
411
+ 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"
412
+ };
413
+ var type_RuleMessageCodeEnumerated = /*#__PURE__*/ function(RuleMessageCodeEnumerated) {
414
+ RuleMessageCodeEnumerated["Extend"] = "EXTEND";
415
+ RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
416
+ return RuleMessageCodeEnumerated;
417
+ }({});
418
+ var type_RuleMessageCategory = /*#__PURE__*/ function(RuleMessageCategory) {
419
+ RuleMessageCategory["Compile"] = "compile";
420
+ RuleMessageCategory["Bundle"] = "bundle";
421
+ RuleMessageCategory["EMO"] = "emo";
422
+ return RuleMessageCategory;
423
+ }({});
424
+ const RuleErrorMap = {
425
+ ["E1001"]: message,
426
+ ["E1002"]: E1002_message,
427
+ ["E1003"]: E1003_message,
428
+ ["E1004"]: E1004_message,
429
+ ["E1005"]: E1005_message,
430
+ ["E1006"]: E1006_message
431
+ };
432
+ var code_RsdoctorRuleClientConstant = /*#__PURE__*/ function(RsdoctorRuleClientConstant) {
433
+ RsdoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
434
+ return RsdoctorRuleClientConstant;
435
+ }({});
436
+ var client_RsdoctorClientUrlQuery = /*#__PURE__*/ function(RsdoctorClientUrlQuery) {
437
+ RsdoctorClientUrlQuery["BundleDiffFiles"] = "__bundle_files__";
438
+ RsdoctorClientUrlQuery["ManifestFile"] = "manifest";
439
+ RsdoctorClientUrlQuery["EnableRoutes"] = "enableRoutes";
440
+ return RsdoctorClientUrlQuery;
441
+ }({});
442
+ var client_RsdoctorClientRoutes = /*#__PURE__*/ function(RsdoctorClientRoutes) {
443
+ RsdoctorClientRoutes["Home"] = "/";
444
+ RsdoctorClientRoutes["Overall"] = "/overall";
445
+ RsdoctorClientRoutes["WebpackLoaderOverall"] = "/webpack/loaders/overall";
446
+ RsdoctorClientRoutes["WebpackLoaderAnalysis"] = "/webpack/loaders/analysis";
447
+ RsdoctorClientRoutes["ModuleResolve"] = "/module/resolve";
448
+ RsdoctorClientRoutes["WebpackPlugins"] = "/webpack/plugins";
449
+ RsdoctorClientRoutes["BundleSize"] = "/bundle/size";
450
+ RsdoctorClientRoutes["ModuleAnalyze"] = "/module/analyze";
451
+ RsdoctorClientRoutes["TreeShaking"] = "/treeshaking";
452
+ RsdoctorClientRoutes["BundleDiff"] = "/resources/bundle/diff";
453
+ RsdoctorClientRoutes["RuleIndex"] = "/resources/rules";
454
+ RsdoctorClientRoutes["Uploader"] = "/resources/uploader";
455
+ RsdoctorClientRoutes["EmoCheck"] = "/emo/check";
456
+ return RsdoctorClientRoutes;
457
+ }({});
458
+ var client_RsdoctorClientDiffState = /*#__PURE__*/ function(RsdoctorClientDiffState) {
459
+ RsdoctorClientDiffState["Equal"] = "-";
460
+ RsdoctorClientDiffState["Up"] = "UP";
461
+ RsdoctorClientDiffState["Down"] = "DOWN";
462
+ return RsdoctorClientDiffState;
463
+ }({});
464
+ const JSExtension = '.js';
465
+ const BundleExtension = '.bundle';
466
+ const JSExtensions = [
467
+ JSExtension,
468
+ BundleExtension
469
+ ];
470
+ const CSSExtension = '.css';
471
+ const HtmlExtension = '.html';
472
+ const ImgExtensions = [
473
+ '.png',
474
+ '.jpg',
475
+ '.svg',
476
+ '.webp',
477
+ '.jpeg',
478
+ '.gif',
479
+ '.bmp'
480
+ ];
481
+ const MediaExtensions = [
482
+ '.mp3',
483
+ '.mp4',
484
+ '.avi',
485
+ '.wav',
486
+ '.flv',
487
+ '.mov',
488
+ '.mpg',
489
+ '.mpeg'
490
+ ];
491
+ const FontExtensions = [
492
+ '.ttf',
493
+ '.fnt',
494
+ '.fon',
495
+ '.otf',
496
+ '.woff',
497
+ '.woff2'
498
+ ];
499
+ const MapExtensions = [
500
+ '.js.map',
501
+ '.css.map',
502
+ '.ts.map',
503
+ '.LICENSE.txt'
504
+ ];
505
+ const RsdoctorOutputFolder = '.rsdoctor';
506
+ const RsdoctorOutputManifest = 'manifest.json';
507
+ const RsdoctorOutputManifestPath = `${RsdoctorOutputFolder}/${RsdoctorOutputManifest}`;
508
+ const StatsFilePath = 'dist/stats.json';
509
+ const RsdoctorMonitorNodeBId = 'Rsdoctor';
510
+ const RsdoctorMonitorWebBId = 'Rsdoctor-Client';
511
+ const RsdoctorMonitorDocBId = 'Rsdoctor-Doc';
512
+ const RsdoctorProcessEnvDebugKey = 'rsdoctor';
513
+ const RsdoctorClientUrl = '';
514
+ const WINDOW_RSDOCTOR_TAG = '__RSDOCTOR__';
515
+ exports.Babel = __webpack_exports__.Babel;
516
+ exports.Client = __webpack_exports__.Client;
517
+ exports.Common = __webpack_exports__.Common;
518
+ exports.Config = __webpack_exports__.Config;
519
+ exports.Constants = __webpack_exports__.Constants;
520
+ exports.Err = __webpack_exports__.Err;
521
+ exports.Esbuild = __webpack_exports__.Esbuild;
522
+ exports.Linter = __webpack_exports__.Linter;
523
+ exports.Logger = __webpack_exports__.Logger;
524
+ exports.Manifest = __webpack_exports__.Manifest;
525
+ exports.Modules = __webpack_exports__.Modules;
526
+ exports.Plugin = __webpack_exports__.Plugin;
527
+ exports.Rule = __webpack_exports__.Rule;
528
+ exports.SDK = __webpack_exports__.SDK;
529
+ exports.Thirdparty = __webpack_exports__.Thirdparty;
530
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
531
+ "Babel",
532
+ "Client",
533
+ "Common",
534
+ "Config",
535
+ "Constants",
536
+ "Err",
537
+ "Esbuild",
538
+ "Linter",
539
+ "Logger",
540
+ "Manifest",
541
+ "Modules",
542
+ "Plugin",
543
+ "Rule",
544
+ "SDK",
545
+ "Thirdparty"
546
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
547
+ Object.defineProperty(exports, '__esModule', {
548
+ value: true
549
+ });