@rsdoctor/types 1.5.3 → 1.5.5

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 (49) hide show
  1. package/dist/error.d.ts +2 -2
  2. package/dist/index.cjs +28 -1
  3. package/dist/index.d.ts +15 -15
  4. package/dist/index.js +88 -82
  5. package/dist/linter/diagnostic.d.ts +5 -5
  6. package/dist/linter/index.d.ts +2 -2
  7. package/dist/linter/rule.d.ts +5 -5
  8. package/dist/manifest.d.ts +2 -2
  9. package/dist/modules.d.ts +1 -1
  10. package/dist/plugin/baseStats.d.ts +1 -1
  11. package/dist/plugin/index.d.ts +7 -7
  12. package/dist/plugin/internal-rules.d.ts +3 -3
  13. package/dist/plugin/plugin.d.ts +2 -2
  14. package/dist/rslib-runtime.js +37 -0
  15. package/dist/rule/code/E1001.d.ts +1 -1
  16. package/dist/rule/code/E1002.d.ts +1 -1
  17. package/dist/rule/code/E1003.d.ts +1 -1
  18. package/dist/rule/code/E1004.d.ts +1 -1
  19. package/dist/rule/code/E1005.d.ts +1 -1
  20. package/dist/rule/code/E1006.d.ts +1 -1
  21. package/dist/rule/code/E1007.d.ts +3 -0
  22. package/dist/rule/code/E1008.d.ts +3 -0
  23. package/dist/rule/code/E1009.d.ts +3 -0
  24. package/dist/rule/code/index.d.ts +14 -8
  25. package/dist/rule/code/type.d.ts +1 -1
  26. package/dist/rule/data.d.ts +68 -4
  27. package/dist/rule/index.d.ts +2 -2
  28. package/dist/sdk/chunk.d.ts +2 -2
  29. package/dist/sdk/context.d.ts +5 -5
  30. package/dist/sdk/hooks.d.ts +1 -1
  31. package/dist/sdk/index.d.ts +16 -16
  32. package/dist/sdk/instance.d.ts +15 -15
  33. package/dist/sdk/loader.d.ts +3 -3
  34. package/dist/sdk/module.d.ts +36 -7
  35. package/dist/sdk/package.d.ts +2 -2
  36. package/dist/sdk/plugin.d.ts +1 -1
  37. package/dist/sdk/resolver.d.ts +1 -1
  38. package/dist/sdk/result.d.ts +11 -11
  39. package/dist/sdk/server/apis/alerts.d.ts +4 -4
  40. package/dist/sdk/server/apis/graph.d.ts +4 -4
  41. package/dist/sdk/server/apis/index.d.ts +15 -15
  42. package/dist/sdk/server/apis/loader.d.ts +3 -3
  43. package/dist/sdk/server/apis/plugin.d.ts +2 -2
  44. package/dist/sdk/server/apis/project.d.ts +2 -2
  45. package/dist/sdk/server/apis/resolver.d.ts +2 -2
  46. package/dist/sdk/server/index.d.ts +5 -5
  47. package/dist/sdk/statement.d.ts +2 -2
  48. package/dist/sdk/treeShaking.d.ts +3 -3
  49. package/package.json +3 -3
package/dist/error.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { NonFunctionProperties } from './common';
2
- import type { BaseRuleStoreData } from './rule';
1
+ import type { NonFunctionProperties } from './common.js';
2
+ import type { BaseRuleStoreData } from './rule/index.js';
3
3
  /**
4
4
  * Position
5
5
  * - `line` start with `1`
package/dist/index.cjs CHANGED
@@ -410,6 +410,30 @@ const E1006_message = {
410
410
  category: 'bundle',
411
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
412
  };
413
+ const E1007_code = 'E1007';
414
+ const E1007_message = {
415
+ code: E1007_code,
416
+ title: 'Tree Shaking Side Effects Only',
417
+ type: 'markdown',
418
+ category: 'bundle',
419
+ description: "\n#### Description\n\nThis rule detects modules that are pulled in and bundled solely due to side effects. This is often caused by unintended tree-shaking failures (e.g. missing or incorrect `\"sideEffects\"` field in `package.json`, or non-tree-shakeable import patterns), resulting in the entire module being bundled even though none of its exports are used.\n\n#### Common Causes\n\n- The package's `package.json` is missing `\"sideEffects\": false` (or incorrectly set to `true`), preventing the bundler from pruning unused exports.\n- An import statement like `import 'some-module'` or `import './styles.css'` is being treated as a side-effect-only import, but the intended use was to consume exports.\n- Barrel files (index files that re-export many things) cause the whole module to be kept alive when only a side-effect import is present.\n\n#### General Solution\n\n1. **Audit import statements**: Make sure you are actually importing and using named exports from this module. Replace bare side-effect imports with explicit named imports when you intend to use the module's exports.\n2. **Set `\"sideEffects\"` correctly**: In the module's `package.json`, set `\"sideEffects\": false` if the module has no global side effects, so the bundler can safely tree-shake unused exports.\n3. **Avoid unintended side-effect imports**: Remove or convert `import 'module'` patterns to explicit `import { foo } from 'module'` patterns where the exports are needed.\n"
420
+ };
421
+ const E1008_code = 'E1008';
422
+ const E1008_message = {
423
+ code: E1008_code,
424
+ title: 'CJS Require Cannot Tree-Shake',
425
+ type: 'markdown',
426
+ category: 'bundle',
427
+ description: "\n#### Description\n\nThis rule detects `require()` calls that use the **CJS Require** dependency type, which prevents tree-shaking of the required module. Unlike `require('module').property` (CJS Full Require), a bare `require('module')` call forces the entire module to be bundled because the bundler cannot statically determine which exports are used.\n\n#### Common Causes\n\n- Using `const mod = require('some-module')` instead of destructuring at the require site.\n- Dynamically accessing properties of the required module at runtime rather than statically.\n\n#### General Solution\n\n1. **Use destructured require**: Replace `const mod = require('A')` with `const { foo } = require('A')` (CJS Full Require) so the bundler can track which exports are used.\n2. **Migrate to ESM**: Use `import { foo } from 'A'` to enable full tree-shaking support.\n3. **Use require with property access**: Replace `const mod = require('A'); mod.foo()` with `const foo = require('A').foo` to allow partial tree-shaking.\n"
428
+ };
429
+ const E1009_code = 'E1009';
430
+ const E1009_message = {
431
+ code: E1009_code,
432
+ title: 'ESM Import Resolved to CJS',
433
+ type: 'markdown',
434
+ category: 'bundle',
435
+ description: '\n#### Description\n\nThis rule detects cases where a package provides both **ESM** and **CJS** formats (via the `module` field or `exports["."]["import"]` in `package.json`), but the bundler resolved the ESM `import` statement to the **CJS** entry instead.\n\nThis prevents tree-shaking of the package, leading to larger bundle sizes than necessary.\n\n#### Common Causes\n\n- The bundler\'s `resolve.mainFields` does not include `module`, so it falls back to `main` (CJS).\n- The `resolve.conditionNames` does not include `import`, so `exports` conditions are resolved as `require`.\n- The package uses `exports` field but the bundler version does not support conditional exports.\n\n#### General Solution\n\n1. **Add `module` to `resolve.mainFields`**: Ensure your bundler config includes `"module"` before `"main"`.\n2. **Add `import` to `resolve.conditionNames`**: For packages using the `exports` field, ensure the `import` condition is listed.\n3. **Check bundler version**: Older versions of webpack/rspack may not support `exports` conditional resolution. Upgrade if necessary.\n'
436
+ };
413
437
  var type_RuleMessageCodeEnumerated = /*#__PURE__*/ function(RuleMessageCodeEnumerated) {
414
438
  RuleMessageCodeEnumerated["Extend"] = "EXTEND";
415
439
  RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
@@ -427,7 +451,10 @@ const RuleErrorMap = {
427
451
  ["E1003"]: E1003_message,
428
452
  ["E1004"]: E1004_message,
429
453
  ["E1005"]: E1005_message,
430
- ["E1006"]: E1006_message
454
+ ["E1006"]: E1006_message,
455
+ ["E1007"]: E1007_message,
456
+ ["E1008"]: E1008_message,
457
+ ["E1009"]: E1009_message
431
458
  };
432
459
  var code_RsdoctorRuleClientConstant = /*#__PURE__*/ function(RsdoctorRuleClientConstant) {
433
460
  RsdoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
package/dist/index.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- export * as Manifest from './manifest';
2
- export * as Esbuild from './esbuild';
3
- export * as Babel from './babel';
4
- export * as Common from './common';
5
- export * as Err from './error';
6
- export * as Logger from './logger';
7
- export * as SDK from './sdk';
8
- export * as Modules from './modules';
9
- export * as Linter from './linter';
10
- export * as Rule from './rule';
11
- export * as Thirdparty from './thirdparty';
12
- export * as Client from './client';
13
- export * as Constants from './constants';
14
- export * as Plugin from './plugin';
15
- export * as Config from './config';
1
+ export * as Manifest from './manifest.js';
2
+ export * as Esbuild from './esbuild.js';
3
+ export * as Babel from './babel.js';
4
+ export * as Common from './common.js';
5
+ export * as Err from './error.js';
6
+ export * as Logger from './logger.js';
7
+ export * as SDK from './sdk/index.js';
8
+ export * as Modules from './modules.js';
9
+ export * as Linter from './linter/index.js';
10
+ export * as Rule from './rule/index.js';
11
+ export * as Thirdparty from './thirdparty.js';
12
+ export * as Client from './client.js';
13
+ export * as Constants from './constants.js';
14
+ export * as Plugin from './plugin/index.js';
15
+ export * as Config from './config.js';
package/dist/index.js CHANGED
@@ -1,80 +1,6 @@
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
- });
8
- };
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
- });
21
- };
22
- })();
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);
1
+ import { __webpack_require__ } from "./rslib-runtime.js";
31
2
  var babel_namespaceObject = {};
32
3
  __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
4
  var client_namespaceObject = {};
79
5
  __webpack_require__.r(client_namespaceObject);
80
6
  __webpack_require__.d(client_namespaceObject, {
@@ -82,6 +8,10 @@ __webpack_require__.d(client_namespaceObject, {
82
8
  RsdoctorClientRoutes: ()=>client_RsdoctorClientRoutes,
83
9
  RsdoctorClientUrlQuery: ()=>client_RsdoctorClientUrlQuery
84
10
  });
11
+ var common_namespaceObject = {};
12
+ __webpack_require__.r(common_namespaceObject);
13
+ var config_namespaceObject = {};
14
+ __webpack_require__.r(config_namespaceObject);
85
15
  var constants_namespaceObject = {};
86
16
  __webpack_require__.r(constants_namespaceObject);
87
17
  __webpack_require__.d(constants_namespaceObject, {
@@ -105,10 +35,59 @@ __webpack_require__.d(constants_namespaceObject, {
105
35
  StatsFilePath: ()=>StatsFilePath,
106
36
  WINDOW_RSDOCTOR_TAG: ()=>WINDOW_RSDOCTOR_TAG
107
37
  });
108
- var src_plugin_namespaceObject = {};
109
- __webpack_require__.r(src_plugin_namespaceObject);
110
- var src_config_namespaceObject = {};
111
- __webpack_require__.r(src_config_namespaceObject);
38
+ var error_namespaceObject = {};
39
+ __webpack_require__.r(error_namespaceObject);
40
+ __webpack_require__.d(error_namespaceObject, {
41
+ ErrorLevel: ()=>error_ErrorLevel
42
+ });
43
+ var esbuild_namespaceObject = {};
44
+ __webpack_require__.r(esbuild_namespaceObject);
45
+ var linter_namespaceObject = {};
46
+ __webpack_require__.r(linter_namespaceObject);
47
+ __webpack_require__.d(linter_namespaceObject, {
48
+ Severity: ()=>error_ErrorLevel
49
+ });
50
+ var logger_namespaceObject = {};
51
+ __webpack_require__.r(logger_namespaceObject);
52
+ __webpack_require__.d(logger_namespaceObject, {
53
+ LogLevel: ()=>logger_LogLevel
54
+ });
55
+ var manifest_namespaceObject = {};
56
+ __webpack_require__.r(manifest_namespaceObject);
57
+ __webpack_require__.d(manifest_namespaceObject, {
58
+ RsdoctorManifestClientConstant: ()=>manifest_RsdoctorManifestClientConstant,
59
+ RsdoctorManifestClientRoutes: ()=>manifest_RsdoctorManifestClientRoutes
60
+ });
61
+ var modules_namespaceObject = {};
62
+ __webpack_require__.r(modules_namespaceObject);
63
+ var plugin_namespaceObject = {};
64
+ __webpack_require__.r(plugin_namespaceObject);
65
+ var rule_namespaceObject = {};
66
+ __webpack_require__.r(rule_namespaceObject);
67
+ __webpack_require__.d(rule_namespaceObject, {
68
+ RsdoctorRuleClientConstant: ()=>code_RsdoctorRuleClientConstant,
69
+ RuleErrorMap: ()=>RuleErrorMap,
70
+ RuleMessageCategory: ()=>type_RuleMessageCategory,
71
+ RuleMessageCodeEnumerated: ()=>type_RuleMessageCodeEnumerated
72
+ });
73
+ var sdk_namespaceObject = {};
74
+ __webpack_require__.r(sdk_namespaceObject);
75
+ __webpack_require__.d(sdk_namespaceObject, {
76
+ DependencyKind: ()=>module_DependencyKind,
77
+ IMode: ()=>instance_IMode,
78
+ ModuleKind: ()=>module_ModuleKind,
79
+ ServerAPI: ()=>apis_namespaceObject,
80
+ StatementKind: ()=>statement_StatementKind,
81
+ ToDataType: ()=>module_ToDataType
82
+ });
83
+ var apis_namespaceObject = {};
84
+ __webpack_require__.r(apis_namespaceObject);
85
+ __webpack_require__.d(apis_namespaceObject, {
86
+ API: ()=>apis_API,
87
+ APIExtends: ()=>apis_APIExtends
88
+ });
89
+ var thirdparty_namespaceObject = {};
90
+ __webpack_require__.r(thirdparty_namespaceObject);
112
91
  var manifest_RsdoctorManifestClientRoutes = /*#__PURE__*/ function(RsdoctorManifestClientRoutes) {
113
92
  RsdoctorManifestClientRoutes["Overall"] = "Overall";
114
93
  RsdoctorManifestClientRoutes["WebpackLoaders"] = "Compile.WebpackLoaders";
@@ -244,7 +223,7 @@ var instance_IMode = /*#__PURE__*/ function(IMode) {
244
223
  }({});
245
224
  const code = 'E1001';
246
225
  const message = {
247
- code,
226
+ code: code,
248
227
  title: 'Duplicate Packages',
249
228
  type: 'markdown',
250
229
  category: 'bundle',
@@ -390,6 +369,30 @@ const E1006_message = {
390
369
  category: 'bundle',
391
370
  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
371
  };
372
+ const E1007_code = 'E1007';
373
+ const E1007_message = {
374
+ code: E1007_code,
375
+ title: 'Tree Shaking Side Effects Only',
376
+ type: 'markdown',
377
+ category: 'bundle',
378
+ description: "\n#### Description\n\nThis rule detects modules that are pulled in and bundled solely due to side effects. This is often caused by unintended tree-shaking failures (e.g. missing or incorrect `\"sideEffects\"` field in `package.json`, or non-tree-shakeable import patterns), resulting in the entire module being bundled even though none of its exports are used.\n\n#### Common Causes\n\n- The package's `package.json` is missing `\"sideEffects\": false` (or incorrectly set to `true`), preventing the bundler from pruning unused exports.\n- An import statement like `import 'some-module'` or `import './styles.css'` is being treated as a side-effect-only import, but the intended use was to consume exports.\n- Barrel files (index files that re-export many things) cause the whole module to be kept alive when only a side-effect import is present.\n\n#### General Solution\n\n1. **Audit import statements**: Make sure you are actually importing and using named exports from this module. Replace bare side-effect imports with explicit named imports when you intend to use the module's exports.\n2. **Set `\"sideEffects\"` correctly**: In the module's `package.json`, set `\"sideEffects\": false` if the module has no global side effects, so the bundler can safely tree-shake unused exports.\n3. **Avoid unintended side-effect imports**: Remove or convert `import 'module'` patterns to explicit `import { foo } from 'module'` patterns where the exports are needed.\n"
379
+ };
380
+ const E1008_code = 'E1008';
381
+ const E1008_message = {
382
+ code: E1008_code,
383
+ title: 'CJS Require Cannot Tree-Shake',
384
+ type: 'markdown',
385
+ category: 'bundle',
386
+ description: "\n#### Description\n\nThis rule detects `require()` calls that use the **CJS Require** dependency type, which prevents tree-shaking of the required module. Unlike `require('module').property` (CJS Full Require), a bare `require('module')` call forces the entire module to be bundled because the bundler cannot statically determine which exports are used.\n\n#### Common Causes\n\n- Using `const mod = require('some-module')` instead of destructuring at the require site.\n- Dynamically accessing properties of the required module at runtime rather than statically.\n\n#### General Solution\n\n1. **Use destructured require**: Replace `const mod = require('A')` with `const { foo } = require('A')` (CJS Full Require) so the bundler can track which exports are used.\n2. **Migrate to ESM**: Use `import { foo } from 'A'` to enable full tree-shaking support.\n3. **Use require with property access**: Replace `const mod = require('A'); mod.foo()` with `const foo = require('A').foo` to allow partial tree-shaking.\n"
387
+ };
388
+ const E1009_code = 'E1009';
389
+ const E1009_message = {
390
+ code: E1009_code,
391
+ title: 'ESM Import Resolved to CJS',
392
+ type: 'markdown',
393
+ category: 'bundle',
394
+ description: '\n#### Description\n\nThis rule detects cases where a package provides both **ESM** and **CJS** formats (via the `module` field or `exports["."]["import"]` in `package.json`), but the bundler resolved the ESM `import` statement to the **CJS** entry instead.\n\nThis prevents tree-shaking of the package, leading to larger bundle sizes than necessary.\n\n#### Common Causes\n\n- The bundler\'s `resolve.mainFields` does not include `module`, so it falls back to `main` (CJS).\n- The `resolve.conditionNames` does not include `import`, so `exports` conditions are resolved as `require`.\n- The package uses `exports` field but the bundler version does not support conditional exports.\n\n#### General Solution\n\n1. **Add `module` to `resolve.mainFields`**: Ensure your bundler config includes `"module"` before `"main"`.\n2. **Add `import` to `resolve.conditionNames`**: For packages using the `exports` field, ensure the `import` condition is listed.\n3. **Check bundler version**: Older versions of webpack/rspack may not support `exports` conditional resolution. Upgrade if necessary.\n'
395
+ };
393
396
  var type_RuleMessageCodeEnumerated = /*#__PURE__*/ function(RuleMessageCodeEnumerated) {
394
397
  RuleMessageCodeEnumerated["Extend"] = "EXTEND";
395
398
  RuleMessageCodeEnumerated["Overlay"] = "OVERLAY";
@@ -407,7 +410,10 @@ const RuleErrorMap = {
407
410
  ["E1003"]: E1003_message,
408
411
  ["E1004"]: E1004_message,
409
412
  ["E1005"]: E1005_message,
410
- ["E1006"]: E1006_message
413
+ ["E1006"]: E1006_message,
414
+ ["E1007"]: E1007_message,
415
+ ["E1008"]: E1008_message,
416
+ ["E1009"]: E1009_message
411
417
  };
412
418
  var code_RsdoctorRuleClientConstant = /*#__PURE__*/ function(RsdoctorRuleClientConstant) {
413
419
  RsdoctorRuleClientConstant["UrlQueryForErrorCode"] = "code";
@@ -492,4 +498,4 @@ const RsdoctorMonitorDocBId = 'Rsdoctor-Doc';
492
498
  const RsdoctorProcessEnvDebugKey = 'rsdoctor';
493
499
  const RsdoctorClientUrl = '';
494
500
  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 };
501
+ export { babel_namespaceObject as Babel, client_namespaceObject as Client, common_namespaceObject as Common, 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, plugin_namespaceObject as Plugin, rule_namespaceObject as Rule, sdk_namespaceObject as SDK, thirdparty_namespaceObject as Thirdparty };
@@ -1,8 +1,8 @@
1
- import { RuleMessage, BaseRuleStoreData, RuleStoreDataItem } from '../rule';
2
- import { ErrorLevel as Severity, Range, FixData } from '../error';
3
- import { SeverityString } from './rule';
4
- export { ErrorLevel as Severity } from '../error';
5
- export type { Range, OffsetRange, Position, FixData } from '../error';
1
+ import { RuleMessage, BaseRuleStoreData, RuleStoreDataItem } from '../rule/index.js';
2
+ import { ErrorLevel as Severity, Range, FixData } from '../error.js';
3
+ import { SeverityString } from './rule.js';
4
+ export { ErrorLevel as Severity } from '../error.js';
5
+ export type { Range, OffsetRange, Position, FixData } from '../error.js';
6
6
  /** Diagnostic recommendations */
7
7
  export interface Suggestion {
8
8
  description: string;
@@ -1,2 +1,2 @@
1
- export * from './diagnostic';
2
- export * from './rule';
1
+ export * from './diagnostic.js';
2
+ export * from './rule.js';
@@ -1,8 +1,8 @@
1
- import type { ArrayToUnion, UnionToTuple } from '../common';
2
- import type { ErrorLevel as Severity } from '../error';
3
- import type { Hooks, RuntimeContext } from '../sdk';
4
- import type { ReportData, Diagnostic } from './diagnostic';
5
- import type { RuleMessage } from '../rule';
1
+ import type { ArrayToUnion, UnionToTuple } from '../common.js';
2
+ import type { ErrorLevel as Severity } from '../error.js';
3
+ import type { Hooks, RuntimeContext } from '../sdk/index.js';
4
+ import type { ReportData, Diagnostic } from './diagnostic.js';
5
+ import type { RuleMessage } from '../rule/index.js';
6
6
  /** Error level */
7
7
  export type SeverityString = keyof typeof Severity;
8
8
  /** Error level */
@@ -1,5 +1,5 @@
1
- import { PlainObject, ObjectPropertyNames } from './common';
2
- import { StoreData } from './sdk';
1
+ import { PlainObject, ObjectPropertyNames } from './common.js';
2
+ import { StoreData } from './sdk/index.js';
3
3
  export interface RsdoctorManifest {
4
4
  client: RsdoctorManifestClient;
5
5
  /**
package/dist/modules.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { StatsModule } from './plugin/baseStats';
1
+ import { StatsModule } from './plugin/baseStats.js';
2
2
  export type ChunkModuleMap = {
3
3
  isAsset: boolean;
4
4
  label: string;
@@ -1,4 +1,4 @@
1
- import { BaseCompilation } from './baseCompiler';
1
+ import { BaseCompilation } from './baseCompiler.js';
2
2
  interface StatsOptionsObj {
3
3
  all?: boolean;
4
4
  preset?: 'normal' | 'none' | 'verbose' | 'errors-only' | 'errors-warnings';
@@ -1,7 +1,7 @@
1
- export * from './baseCompiler';
2
- export * from './baseStats';
3
- export * from './plugin';
4
- export * from './baseLoader';
5
- export * from './rspack';
6
- export * from './internal-rules';
7
- export * from './webpack';
1
+ export * from './baseCompiler.js';
2
+ export * from './baseStats.js';
3
+ export * from './plugin.js';
4
+ export * from './baseLoader.js';
5
+ export * from './rspack.js';
6
+ export * from './internal-rules.js';
7
+ export * from './webpack.js';
@@ -1,4 +1,4 @@
1
- import { Linter } from '../index';
1
+ import { Linter } from '../index.js';
2
2
  export type InternalRules = Linter.RuleData[];
3
- export type InternalRuleId = 'E1001' | 'E1002' | 'E1003' | 'E1004' | 'E1005' | 'E1006';
4
- export type InternalRuleName = 'duplicate-package' | 'cross-chunks-package' | 'default-import-check' | 'ecma-version-check' | 'loader-performance-optimization' | 'module-mixed-chunks';
3
+ export type InternalRuleId = 'E1001' | 'E1002' | 'E1003' | 'E1004' | 'E1005' | 'E1006' | 'E1007';
4
+ export type InternalRuleName = 'duplicate-package' | 'cross-chunks-package' | 'default-import-check' | 'ecma-version-check' | 'loader-performance-optimization' | 'module-mixed-chunks' | 'tree-shaking-side-effects-only';
@@ -1,5 +1,5 @@
1
- import { Common, Config, Linter as LinterType, SDK } from '..';
2
- import { InternalRules } from './internal-rules';
1
+ import { Common, Config, Linter as LinterType, SDK } from '../index.js';
2
+ import { InternalRules } from './internal-rules.js';
3
3
  export interface RsdoctorWebpackPluginFeatures {
4
4
  /**
5
5
  * turn off it if you need not to analyze the executions of webpack loaders.
@@ -0,0 +1,37 @@
1
+ var __webpack_module_cache__ = {};
2
+ function __webpack_require__(moduleId) {
3
+ var cachedModule = __webpack_module_cache__[moduleId];
4
+ if (void 0 !== cachedModule) return cachedModule.exports;
5
+ var module = __webpack_module_cache__[moduleId] = {
6
+ exports: {}
7
+ };
8
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
9
+ return module.exports;
10
+ }
11
+ (()=>{
12
+ __webpack_require__.d = (exports, definition)=>{
13
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
14
+ enumerable: true,
15
+ get: definition[key]
16
+ });
17
+ };
18
+ })();
19
+ (()=>{
20
+ __webpack_require__.add = function(modules) {
21
+ Object.assign(__webpack_require__.m, modules);
22
+ };
23
+ })();
24
+ (()=>{
25
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ })();
27
+ (()=>{
28
+ __webpack_require__.r = (exports)=>{
29
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
30
+ value: 'Module'
31
+ });
32
+ Object.defineProperty(exports, '__esModule', {
33
+ value: true
34
+ });
35
+ };
36
+ })();
37
+ export { __webpack_require__ };
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1001";
3
3
  export declare const message: RuleMessage;
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1002";
3
3
  export declare const message: RuleMessage;
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1003";
3
3
  export declare const message: RuleMessage;
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1004";
3
3
  export declare const message: RuleMessage;
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1005";
3
3
  export declare const message: RuleMessage;
@@ -1,3 +1,3 @@
1
- import { RuleMessage } from './type';
1
+ import { RuleMessage } from './type.js';
2
2
  export declare const code = "E1006";
3
3
  export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type.js';
2
+ export declare const code = "E1007";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type.js';
2
+ export declare const code = "E1008";
3
+ export declare const message: RuleMessage;
@@ -0,0 +1,3 @@
1
+ import { RuleMessage } from './type.js';
2
+ export declare const code = "E1009";
3
+ export declare const message: RuleMessage;
@@ -1,10 +1,13 @@
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
- import * as E1005 from './E1005';
7
- import * as E1006 from './E1006';
1
+ import { RuleMessage } from './type.js';
2
+ import * as E1001 from './E1001.js';
3
+ import * as E1002 from './E1002.js';
4
+ import * as E1003 from './E1003.js';
5
+ import * as E1004 from './E1004.js';
6
+ import * as E1005 from './E1005.js';
7
+ import * as E1006 from './E1006.js';
8
+ import * as E1007 from './E1007.js';
9
+ import * as E1008 from './E1008.js';
10
+ import * as E1009 from './E1009.js';
8
11
  export type RuleErrorCodes = {
9
12
  [E1001.code]: typeof E1001;
10
13
  [E1002.code]: typeof E1002;
@@ -12,6 +15,9 @@ export type RuleErrorCodes = {
12
15
  [E1004.code]: typeof E1004;
13
16
  [E1005.code]: typeof E1005;
14
17
  [E1006.code]: typeof E1006;
18
+ [E1007.code]: typeof E1007;
19
+ [E1008.code]: typeof E1008;
20
+ [E1009.code]: typeof E1009;
15
21
  };
16
22
  /**
17
23
  * The format is E + "4 digits".
@@ -24,4 +30,4 @@ export declare const RuleErrorMap: Record<keyof RuleErrorCodes, RuleMessage>;
24
30
  export declare enum RsdoctorRuleClientConstant {
25
31
  UrlQueryForErrorCode = "code"
26
32
  }
27
- export * from './type';
33
+ export * from './type.js';
@@ -1,4 +1,4 @@
1
- import { RuleErrorCodes } from '.';
1
+ import { RuleErrorCodes } from './index.js';
2
2
  /**
3
3
  * only defined the code which can be enumerated
4
4
  */
@@ -1,6 +1,6 @@
1
- import type { RuleMessage, RuleMessageCodeEnumerated } from './code';
2
- import type { SourceRange } from '../sdk';
3
- import type { CrossChunksPackageType, PackageBasicData, PackageInstance } from '../sdk/package';
1
+ import type { RuleMessage, RuleMessageCodeEnumerated } from './code/index.js';
2
+ import type { SourceRange } from '../sdk/index.js';
3
+ import type { CrossChunksPackageType, PackageBasicData, PackageInstance } from '../sdk/package.js';
4
4
  export interface BaseRuleStoreData extends Pick<RuleMessage, 'code' | 'category'> {
5
5
  /**
6
6
  * unique of error
@@ -149,5 +149,69 @@ export interface ModuleMixedChunksRuleStoreData extends BaseRuleStoreData {
149
149
  name: string;
150
150
  }>;
151
151
  }
152
- export type RuleStoreDataItem = LinkRuleStoreData | FileRelationRuleStoreData | CodeChangeRuleStoreData | PackageRelationDiffRuleStoreData | CodeViewRuleStoreData | CrossChunksPackageRuleStoreData | ModuleMixedChunksRuleStoreData;
152
+ /**
153
+ * Rule for detecting modules that are only imported for their side effects,
154
+ * which may indicate unintended tree-shaking failures.
155
+ */
156
+ export interface ConnectionsOnlyImportsRuleStoreData extends BaseRuleStoreData {
157
+ type: 'tree-shaking-side-effects-only';
158
+ module: {
159
+ id: number | string;
160
+ path: string;
161
+ webpackId?: string | number;
162
+ };
163
+ connections: Array<{
164
+ originModule: number;
165
+ dependencyType: string;
166
+ userRequest: string;
167
+ }>;
168
+ }
169
+ /**
170
+ * Rule for detecting modules imported via CJS require (bare require() call),
171
+ * which prevents tree-shaking of the required module.
172
+ */
173
+ export interface CjsRequireRuleStoreData extends BaseRuleStoreData {
174
+ type: 'cjs-require';
175
+ /** The module that contains the require() call */
176
+ issuerModule: {
177
+ id: number | string;
178
+ path: string;
179
+ webpackId?: string | number;
180
+ };
181
+ /** The module being required */
182
+ requiredModule: {
183
+ id: number | string;
184
+ path: string;
185
+ webpackId?: string | number;
186
+ };
187
+ /** The original require string (e.g. 'lodash') */
188
+ request: string;
189
+ }
190
+ /**
191
+ * Rule for detecting ESM imports that were resolved to a CJS module
192
+ * even though the package provides an ESM entry.
193
+ */
194
+ export interface EsmResolvedToCjsRuleStoreData extends BaseRuleStoreData {
195
+ type: 'esm-resolved-to-cjs';
196
+ /** Package name */
197
+ packageName: string;
198
+ /** Package version */
199
+ packageVersion: string;
200
+ /** The ESM entry path declared in the package's package.json */
201
+ esmEntry: string;
202
+ /** The actual resolved (CJS) module */
203
+ resolvedModule: {
204
+ id: number | string;
205
+ path: string;
206
+ webpackId?: string | number;
207
+ };
208
+ /** All issuer modules that imported this package via ESM import */
209
+ issuers: Array<{
210
+ id: number | string;
211
+ path: string;
212
+ /** The import request string (e.g. 'lodash') */
213
+ request: string;
214
+ }>;
215
+ }
216
+ export type RuleStoreDataItem = LinkRuleStoreData | FileRelationRuleStoreData | CodeChangeRuleStoreData | PackageRelationDiffRuleStoreData | CodeViewRuleStoreData | CrossChunksPackageRuleStoreData | ModuleMixedChunksRuleStoreData | ConnectionsOnlyImportsRuleStoreData | CjsRequireRuleStoreData | EsmResolvedToCjsRuleStoreData;
153
217
  export type RuleStoreData = RuleStoreDataItem[];
@@ -1,2 +1,2 @@
1
- export * from './code';
2
- export * from './data';
1
+ export * from './code/index.js';
2
+ export * from './data.js';
@@ -1,5 +1,5 @@
1
- import type { NonFunctionProperties } from '../common';
2
- import type { ModuleInstance, ToDataType } from './module';
1
+ import type { NonFunctionProperties } from '../common.js';
2
+ import type { ModuleInstance, ToDataType } from './module.js';
3
3
  export interface AssetInstance {
4
4
  id: number;
5
5
  path: string;
@@ -1,8 +1,8 @@
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';
1
+ import type { ChunkGraphInstance } from './chunk.js';
2
+ import type { ModuleGraphInstance } from './module.js';
3
+ import type { PackageGraphInstance, OtherReports } from './package.js';
4
+ import { ConfigData } from './config.js';
5
+ import { LoaderData } from './loader.js';
6
6
  export interface RuntimeContext {
7
7
  /** Project root directory */
8
8
  root: string;
@@ -1,5 +1,5 @@
1
1
  import type { AsyncSeriesHook } from 'tapable';
2
- import { RsdoctorManifestWithShardingFiles } from '../manifest';
2
+ import { RsdoctorManifestWithShardingFiles } from '../manifest.js';
3
3
  /**
4
4
  * sdk hooks map
5
5
  */
@@ -1,16 +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';
1
+ export * from './loader.js';
2
+ export * from './resolver.js';
3
+ export * from './plugin.js';
4
+ export * from './module.js';
5
+ export * from './chunk.js';
6
+ export * from './result.js';
7
+ export * from './summary.js';
8
+ export * from './package.js';
9
+ export * from './context.js';
10
+ export * from './config.js';
11
+ export * from './server/index.js';
12
+ export * from './statement.js';
13
+ export * from './treeShaking.js';
14
+ export * from './envinfo.js';
15
+ export * from './instance.js';
16
+ export * from './hooks.js';
@@ -1,19 +1,19 @@
1
1
  import type { SourceMapConsumer, RawSourceMap } from 'source-map';
2
- import { LoaderData, ResourceLoaderData } from './loader';
3
- import { ResolverData } from './resolver';
4
- import { PluginData } from './plugin';
5
- import { BuilderStoreData, EMOStoreData } from './result';
6
- import { ModuleGraphInstance, ToDataType } from './module';
7
- import { RsdoctorManifestClientRoutes, RsdoctorManifestWithShardingFiles } from '../manifest';
8
- import { RuntimeContext, RuntimeContextOptions } from './context';
9
- import { Hooks } from './hooks';
10
- import { ChunkGraphInstance } from './chunk';
11
- import { RsdoctorServerInstance } from './server';
12
- import { PlainObject } from '../common';
13
- import { BriefModeOptions } from '../config';
14
- import { EmoCheckData } from '../emo';
15
- import { SummaryData } from './summary';
16
- import { ConfigData } from './config';
2
+ import { LoaderData, ResourceLoaderData } from './loader.js';
3
+ import { ResolverData } from './resolver.js';
4
+ import { PluginData } from './plugin.js';
5
+ import { BuilderStoreData, EMOStoreData } from './result.js';
6
+ import { ModuleGraphInstance, ToDataType } from './module.js';
7
+ import { RsdoctorManifestClientRoutes, RsdoctorManifestWithShardingFiles } from '../manifest.js';
8
+ import { RuntimeContext, RuntimeContextOptions } from './context.js';
9
+ import { Hooks } from './hooks.js';
10
+ import { ChunkGraphInstance } from './chunk.js';
11
+ import { RsdoctorServerInstance } from './server/index.js';
12
+ import { PlainObject } from '../common.js';
13
+ import { BriefModeOptions } from '../config.js';
14
+ import { EmoCheckData } from '../emo.js';
15
+ import { SummaryData } from './summary.js';
16
+ import { ConfigData } from './config.js';
17
17
  export type WriteStoreOptionsType = {};
18
18
  export declare enum IMode {
19
19
  brief = "brief",
@@ -1,6 +1,6 @@
1
- import { PlainObject } from '../common';
2
- import { DevToolErrorInstance } from '../error';
3
- import { ProcessData } from './process';
1
+ import { PlainObject } from '../common.js';
2
+ import { DevToolErrorInstance } from '../error.js';
3
+ import { ProcessData } from './process.js';
4
4
  /** Single Loader conversion data for processing files */
5
5
  export interface LoaderTransformData extends ProcessData {
6
6
  /** loader name */
@@ -1,12 +1,12 @@
1
1
  import type { Program } from 'estree';
2
2
  import type { SourceMapConsumer } from 'source-map';
3
- import type { NonFunctionProperties } from '../common';
4
- import type { ChunkInstance } from './chunk';
5
- import type { BriefModeOptions } from '../config';
6
- import type { StatementInstance, StatementData } from './statement';
7
- import type { PackageData } from './package';
8
- import type { ModuleGraphModuleInstance, ModuleGraphModuleData, ExportData, ExportInstance, SideEffectData, SideEffectInstance, VariableData, VariableInstance } from './treeShaking';
9
- import type { StatsModule } from '../plugin';
3
+ import type { NonFunctionProperties } from '../common.js';
4
+ import type { ChunkInstance } from './chunk.js';
5
+ import type { BriefModeOptions } from '../config.js';
6
+ import type { StatementInstance, StatementData } from './statement.js';
7
+ import type { PackageData } from './package.js';
8
+ import type { ModuleGraphModuleInstance, ModuleGraphModuleData, ExportData, ExportInstance, SideEffectData, SideEffectInstance, VariableData, VariableInstance } from './treeShaking.js';
9
+ import type { StatsModule } from '../plugin/index.js';
10
10
  export declare enum DependencyKind {
11
11
  Unknown = 0,
12
12
  ImportStatement = 1,
@@ -32,6 +32,16 @@ export interface SideEffectLocationData {
32
32
  module: number;
33
33
  request: string;
34
34
  }
35
+ /** Pre-computed side-effects-only import result (from Rust analysis) */
36
+ export interface ConnectionsOnlyImportData {
37
+ moduleUkey: number;
38
+ modulePath: string;
39
+ connections: Array<{
40
+ originModule?: number;
41
+ dependencyType: string;
42
+ userRequest: string;
43
+ }>;
44
+ }
35
45
  /** Side effect code snippet data */
36
46
  export interface SideEffectCodeData {
37
47
  /** Module ID */
@@ -239,6 +249,10 @@ export interface DependencyInstance {
239
249
  * - string enumeration
240
250
  */
241
251
  readonly kindString: keyof typeof DependencyKind;
252
+ /**
253
+ * Original dependency type string from the bundler (e.g. 'cjs require', 'cjs full require', 'esm import')
254
+ */
255
+ typeString?: string;
242
256
  /** Whether to connect to the aggregation module */
243
257
  readonly resolveConcatenationModule: boolean;
244
258
  /** quote statement */
@@ -320,6 +334,8 @@ export interface ModuleGraphInstance {
320
334
  toCodeData(type?: ToDataType): ModuleCodeData;
321
335
  setModules(modules: ModuleInstance[]): void;
322
336
  setDependencies(dependencies: DependencyInstance[]): void;
337
+ setConnectionsOnlyImports(items: ConnectionsOnlyImportData[]): void;
338
+ getConnectionsOnlyImports(): ConnectionsOnlyImportData[];
323
339
  }
324
340
  export interface ModuleData extends Omit<NonFunctionProperties<ModuleInstance>, 'rootModule' | 'isEntry' | 'concatenationModules' | 'meta' | 'issuerPath'> {
325
341
  /** chunk identifier */
@@ -365,6 +381,18 @@ export interface DependencyData extends Omit<NonFunctionProperties<DependencyIns
365
381
  /** quote statement */
366
382
  statements: StatementData[];
367
383
  }
384
+ /** Module connection data from rspack module graph */
385
+ export interface ConnectionData {
386
+ ukey: number;
387
+ dependencyId: string;
388
+ module: number;
389
+ originModule?: number;
390
+ resolvedModule: number;
391
+ dependencyType: string;
392
+ userRequest: string;
393
+ loc?: string;
394
+ active: boolean;
395
+ }
368
396
  export interface ModuleGraphData {
369
397
  dependencies: DependencyData[];
370
398
  modules: ModuleData[];
@@ -373,4 +401,5 @@ export interface ModuleGraphData {
373
401
  sideEffects: SideEffectData[];
374
402
  variables: VariableData[];
375
403
  layers?: string[];
404
+ connections?: ConnectionData[];
376
405
  }
@@ -1,5 +1,5 @@
1
- import type { ModuleInstance, DependencyInstance, ModuleSize } from './module';
2
- import type { NonFunctionProperties } from '../common';
1
+ import type { ModuleInstance, DependencyInstance, ModuleSize } from './module.js';
2
+ import type { NonFunctionProperties } from '../common.js';
3
3
  export interface PackageJSONData {
4
4
  /** package name */
5
5
  name: string;
@@ -1,4 +1,4 @@
1
- import { DevToolErrorInstance } from '../error';
1
+ import { DevToolErrorInstance } from '../error.js';
2
2
  export interface PluginHookData {
3
3
  /** hook tap name */
4
4
  tapName: string;
@@ -1,4 +1,4 @@
1
- import { ProcessData } from './process';
1
+ import { ProcessData } from './process.js';
2
2
  export interface ResolveStackData {
3
3
  /** Step name */
4
4
  name: string;
@@ -1,14 +1,14 @@
1
- import { EmoCheckData } from '../emo';
2
- import { LoaderData } from './loader';
3
- import { ModuleGraphData, ModuleCodeData, TreeShakingData } 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';
1
+ import { EmoCheckData } from '../emo.js';
2
+ import { LoaderData } from './loader.js';
3
+ import { ModuleGraphData, ModuleCodeData, TreeShakingData } from './module.js';
4
+ import { ChunkGraphData } from './chunk.js';
5
+ import { ResolverData } from './resolver.js';
6
+ import { PluginData } from './plugin.js';
7
+ import { SummaryData } from './summary.js';
8
+ import { ConfigData } from './config.js';
9
+ import { RuleStoreData } from '../rule/index.js';
10
+ import type { EnvInfo } from './envinfo.js';
11
+ import { PackageGraphData, OtherReports } from './package.js';
12
12
  export type ErrorsData = RuleStoreData;
13
13
  interface StoreCommonData {
14
14
  hash: string;
@@ -1,7 +1,7 @@
1
- import { API } from './index';
2
- import { OverlayRuleStoreData, RuleStoreDataItem } from '../../../rule';
3
- import { DependencyData, ModuleData, ModuleSource } from '../../module';
4
- import { PackageBasicData } from '../../package';
1
+ import { API } from './index.js';
2
+ import { OverlayRuleStoreData, RuleStoreDataItem } from '../../../rule/index.js';
3
+ import { DependencyData, ModuleData, ModuleSource } from '../../module.js';
4
+ import { PackageBasicData } from '../../package.js';
5
5
  export interface AlertsAPIResponse {
6
6
  /**
7
7
  * get the details of the alerts which type is "package-relation"
@@ -1,7 +1,7 @@
1
- import { RsdoctorClientAssetsSummary } from '../../../client';
2
- import { AssetData, ChunkData, ChunkGraphData, EntryPointData } from '../../chunk';
3
- import { ModuleData, ModuleGraphData, SideEffectCodeData } from '../../module';
4
- import { API } from './index';
1
+ import { RsdoctorClientAssetsSummary } from '../../../client.js';
2
+ import { AssetData, ChunkData, ChunkGraphData, EntryPointData } from '../../chunk.js';
3
+ import { ModuleData, ModuleGraphData, SideEffectCodeData } from '../../module.js';
4
+ import { API } from './index.js';
5
5
  export interface GraphAPIResponse {
6
6
  [API.GetAssetsSummary]: RsdoctorClientAssetsSummary;
7
7
  [API.GetAssetDetails]: {
@@ -1,19 +1,19 @@
1
1
  import { ServerResponse } from 'http';
2
- import { PlainObject, Get } from '../../../common';
3
- import { connect } from '../../../thirdparty';
4
- import { RsdoctorBuilderSDKInstance } from '../../index';
5
- import { RsdoctorServerInstance } from '../index';
6
- import { LoaderData } from '../../loader';
7
- import { ProjectAPIResponse, ProjectAPIRequestBody } from './project';
8
- import { LoaderAPIResponse, LoaderAPIRequestBody } from './loader';
9
- import { ResolverAPIResponse, ResolverAPIRequestBody } from './resolver';
10
- import { PluginAPIResponse, PluginAPIRequestBody } from './plugin';
11
- import { GraphAPIResponse, GraphAPIRequestBody } from './graph';
12
- import { AlertsAPIResponse, AlertsAPIRequestBody } from './alerts';
13
- import { RsdoctorManifestMappingKeys } from '../../../manifest';
14
- import { SDK } from '../../../index';
15
- import { StatsModule } from '../../../plugin';
16
- export * from './pagination';
2
+ import { PlainObject, Get } from '../../../common.js';
3
+ import { connect } from '../../../thirdparty.js';
4
+ import { RsdoctorBuilderSDKInstance } from '../../index.js';
5
+ import { RsdoctorServerInstance } from '../index.js';
6
+ import { LoaderData } from '../../loader.js';
7
+ import { ProjectAPIResponse, ProjectAPIRequestBody } from './project.js';
8
+ import { LoaderAPIResponse, LoaderAPIRequestBody } from './loader.js';
9
+ import { ResolverAPIResponse, ResolverAPIRequestBody } from './resolver.js';
10
+ import { PluginAPIResponse, PluginAPIRequestBody } from './plugin.js';
11
+ import { GraphAPIResponse, GraphAPIRequestBody } from './graph.js';
12
+ import { AlertsAPIResponse, AlertsAPIRequestBody } from './alerts.js';
13
+ import { RsdoctorManifestMappingKeys } from '../../../manifest.js';
14
+ import { SDK } from '../../../index.js';
15
+ import { StatsModule } from '../../../plugin/index.js';
16
+ export * from './pagination.js';
17
17
  export declare enum API {
18
18
  ApplyErrorFix = "/api/apply/error/fix",
19
19
  Env = "/api/env",
@@ -1,6 +1,6 @@
1
- import { API } from './index';
2
- import { ResourceData, LoaderTransformData } from '../../loader';
3
- import { Get } from '../../../common';
1
+ import { API } from './index.js';
2
+ import { ResourceData, LoaderTransformData } from '../../loader.js';
3
+ import { Get } from '../../../common.js';
4
4
  export interface LoaderAPIResponse {
5
5
  [API.GetLoaderNames]: string[];
6
6
  [API.GetLayers]: string[];
@@ -1,5 +1,5 @@
1
- import { API } from './index';
2
- import { PluginHookData } from '../../plugin';
1
+ import { API } from './index.js';
2
+ import { PluginHookData } from '../../plugin.js';
3
3
  export interface PluginAPIResponse {
4
4
  [API.GetPluginSummary]: {
5
5
  hooks: string[];
@@ -1,5 +1,5 @@
1
- import { RsdoctorManifestClientRoutes, RsdoctorManifestData } from '../../../manifest';
2
- import { API, APIExtends } from './index';
1
+ import { RsdoctorManifestClientRoutes, RsdoctorManifestData } from '../../../manifest.js';
2
+ import { API, APIExtends } from './index.js';
3
3
  export interface ProjectAPIResponse {
4
4
  [API.Env]: {
5
5
  ip: string;
@@ -1,5 +1,5 @@
1
- import { API } from './index';
2
- import { PathResolverData } from '../../resolver';
1
+ import { API } from './index.js';
2
+ import { PathResolverData } from '../../resolver.js';
3
3
  export interface ResolverAPIResponse {
4
4
  [API.GetResolverFileTree]: Array<Pick<PathResolverData, 'issuerPath'>>;
5
5
  [API.GetResolverFileDetails]: {
@@ -1,8 +1,8 @@
1
- import { PlainObject } from '../../common';
2
- import { connect } from '../../thirdparty';
3
- import { RsdoctorClientRoutes } from '../../client';
4
- import { API, APIExtends } from './apis';
5
- export * as ServerAPI from './apis';
1
+ import { PlainObject } from '../../common.js';
2
+ import { connect } from '../../thirdparty.js';
3
+ import { RsdoctorClientRoutes } from '../../client.js';
4
+ import { API, APIExtends } from './apis/index.js';
5
+ export * as ServerAPI from './apis/index.js';
6
6
  interface ClientUrlFunctionWithRouteDefined<T> {
7
7
  (route: RsdoctorClientRoutes.BundleDiff, baselineUrl: string, currentUrl: string): T;
8
8
  (route?: 'homepage'): T;
@@ -1,5 +1,5 @@
1
- import type { SourceRange, ModuleInstance } from './module';
2
- import type { NonFunctionProperties } from '../common';
1
+ import type { SourceRange, ModuleInstance } from './module.js';
2
+ import type { NonFunctionProperties } from '../common.js';
3
3
  /** Statement position */
4
4
  export interface StatementPosition {
5
5
  /**
@@ -1,6 +1,6 @@
1
- import type { ModuleInstance, DependencyInstance } from './module';
2
- import type { StatementInstance, StatementData } from './statement';
3
- import type { NonFunctionProperties } from '../common';
1
+ import type { ModuleInstance, DependencyInstance } from './module.js';
2
+ import type { StatementInstance, StatementData } from './statement.js';
3
+ import type { NonFunctionProperties } from '../common.js';
4
4
  /** Variable data */
5
5
  export interface VariableInstance {
6
6
  /** Variable number */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/types",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -23,11 +23,11 @@
23
23
  "dependencies": {
24
24
  "@types/connect": "3.4.38",
25
25
  "@types/estree": "1.0.5",
26
- "@types/tapable": "2.2.7",
26
+ "@types/tapable": "2.3.0",
27
27
  "source-map": "^0.7.6"
28
28
  },
29
29
  "devDependencies": {
30
- "@rspack/core": "2.0.0-beta.5",
30
+ "@rspack/core": "2.0.0-beta.7",
31
31
  "@types/node": "^22.8.1",
32
32
  "@types/react": "^18.3.28",
33
33
  "tslib": "2.8.1",