@rsdoctor/core 1.5.12 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/build-utils/build/module-graph/index.cjs +4 -18
  2. package/dist/build-utils/build/module-graph/index.d.cts +0 -2
  3. package/dist/build-utils/build/module-graph/index.d.ts +0 -2
  4. package/dist/build-utils/build/module-graph/index.js +0 -2
  5. package/dist/build-utils/build/module-graph/rspack/transform.cjs +1 -1
  6. package/dist/build-utils/build/module-graph/rspack/transform.js +1 -1
  7. package/dist/build-utils/build/module-graph/transform.cjs +2 -3
  8. package/dist/build-utils/build/module-graph/transform.d.cts +1 -2
  9. package/dist/build-utils/build/module-graph/transform.d.ts +1 -2
  10. package/dist/build-utils/build/module-graph/transform.js +2 -3
  11. package/dist/build-utils/build/utils/parseBundle.cjs +1 -1
  12. package/dist/build-utils/build/utils/parseBundle.js +1 -1
  13. package/dist/build-utils/build/utils/plugin.cjs +1 -2
  14. package/dist/build-utils/build/utils/plugin.js +1 -2
  15. package/dist/inner-plugins/constants.cjs +1 -1
  16. package/dist/inner-plugins/constants.d.cts +1 -1
  17. package/dist/inner-plugins/constants.d.ts +1 -1
  18. package/dist/inner-plugins/constants.js +1 -1
  19. package/dist/inner-plugins/plugins/bundle.cjs +1 -17
  20. package/dist/inner-plugins/plugins/bundle.js +1 -17
  21. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.cjs +3 -40
  22. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.cts +4 -6
  23. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +4 -6
  24. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +4 -41
  25. package/dist/inner-plugins/plugins/errors.cjs +3 -3
  26. package/dist/inner-plugins/plugins/errors.d.cts +1 -1
  27. package/dist/inner-plugins/plugins/errors.d.ts +1 -1
  28. package/dist/inner-plugins/plugins/errors.js +3 -3
  29. package/dist/inner-plugins/plugins/index.cjs +2 -9
  30. package/dist/inner-plugins/plugins/index.d.cts +0 -1
  31. package/dist/inner-plugins/plugins/index.d.ts +0 -1
  32. package/dist/inner-plugins/plugins/index.js +0 -1
  33. package/dist/inner-plugins/plugins/loader.cjs +1 -1
  34. package/dist/inner-plugins/plugins/loader.js +1 -1
  35. package/dist/inner-plugins/plugins/plugins.cjs +1 -1
  36. package/dist/inner-plugins/plugins/plugins.js +1 -1
  37. package/dist/inner-plugins/plugins/progress.cjs +14 -16
  38. package/dist/inner-plugins/plugins/progress.d.cts +1 -1
  39. package/dist/inner-plugins/plugins/progress.d.ts +1 -1
  40. package/dist/inner-plugins/plugins/progress.js +14 -16
  41. package/dist/inner-plugins/plugins/resolver.d.cts +1 -2
  42. package/dist/inner-plugins/plugins/resolver.d.ts +1 -2
  43. package/dist/inner-plugins/plugins/rules.cjs +3 -3
  44. package/dist/inner-plugins/plugins/rules.js +3 -3
  45. package/dist/inner-plugins/utils/config.cjs +0 -1
  46. package/dist/inner-plugins/utils/config.d.cts +1 -1
  47. package/dist/inner-plugins/utils/config.d.ts +1 -1
  48. package/dist/inner-plugins/utils/config.js +0 -1
  49. package/dist/inner-plugins/utils/loader.cjs +2 -2
  50. package/dist/inner-plugins/utils/loader.js +2 -2
  51. package/dist/inner-plugins/utils/normalize-config.d.cts +3 -6
  52. package/dist/inner-plugins/utils/normalize-config.d.ts +3 -6
  53. package/dist/rules/rules/cjs-require/index.cjs +2 -2
  54. package/dist/rules/rules/cjs-require/index.js +2 -2
  55. package/dist/rules/rules/esm-resolved-to-cjs/index.cjs +2 -17
  56. package/dist/rules/rules/esm-resolved-to-cjs/index.js +2 -17
  57. package/dist/rules/rules/loader-performance-optimization/index.cjs +1 -1
  58. package/dist/rules/rules/loader-performance-optimization/index.js +1 -1
  59. package/dist/rules/rules/module-mixed-chunks/index.cjs +1 -1
  60. package/dist/rules/rules/module-mixed-chunks/index.js +1 -1
  61. package/dist/rules/rules/side-effects-only-imports/index.cjs +1 -1
  62. package/dist/rules/rules/side-effects-only-imports/index.js +1 -1
  63. package/dist/types/plugin.d.cts +2 -2
  64. package/dist/types/plugin.d.ts +2 -2
  65. package/dist/types/rules.d.cts +4 -4
  66. package/dist/types/rules.d.ts +4 -4
  67. package/package.json +6 -7
  68. package/dist/build-utils/build/module-graph/treeShaking.cjs +0 -106
  69. package/dist/build-utils/build/module-graph/treeShaking.d.cts +0 -2
  70. package/dist/build-utils/build/module-graph/treeShaking.d.ts +0 -2
  71. package/dist/build-utils/build/module-graph/treeShaking.js +0 -73
  72. package/dist/build-utils/build/module-graph/webpack/transform.cjs +0 -170
  73. package/dist/build-utils/build/module-graph/webpack/transform.d.cts +0 -16
  74. package/dist/build-utils/build/module-graph/webpack/transform.d.ts +0 -16
  75. package/dist/build-utils/build/module-graph/webpack/transform.js +0 -124
  76. package/dist/inner-plugins/plugins/bundleTagPlugin.cjs +0 -84
  77. package/dist/inner-plugins/plugins/bundleTagPlugin.d.cts +0 -6
  78. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +0 -6
  79. package/dist/inner-plugins/plugins/bundleTagPlugin.js +0 -51
@@ -5,12 +5,6 @@ var __webpack_modules__ = {
5
5
  },
6
6
  "./transform" (module) {
7
7
  module.exports = require("./transform.cjs");
8
- },
9
- "./treeShaking" (module) {
10
- module.exports = require("./treeShaking.cjs");
11
- },
12
- "./webpack/transform" (module) {
13
- module.exports = require("./webpack/transform.cjs");
14
8
  }
15
9
  };
16
10
  var __webpack_module_cache__ = {};
@@ -56,21 +50,13 @@ function __webpack_require__(moduleId) {
56
50
  var __webpack_exports__ = {};
57
51
  (()=>{
58
52
  __webpack_require__.r(__webpack_exports__);
59
- var _webpack_transform__rspack_import_0 = __webpack_require__("./webpack/transform");
60
- var __rspack_reexport = {};
61
- for(const __rspack_import_key in _webpack_transform__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_webpack_transform__rspack_import_0[__rspack_import_key];
62
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
63
- var _transform__rspack_import_1 = __webpack_require__("./transform");
64
- var __rspack_reexport = {};
65
- for(const __rspack_import_key in _transform__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_transform__rspack_import_1[__rspack_import_key];
66
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
67
- var _treeShaking__rspack_import_2 = __webpack_require__("./treeShaking");
53
+ var _transform__rspack_import_0 = __webpack_require__("./transform");
68
54
  var __rspack_reexport = {};
69
- for(const __rspack_import_key in _treeShaking__rspack_import_2)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_treeShaking__rspack_import_2[__rspack_import_key];
55
+ for(const __rspack_import_key in _transform__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_transform__rspack_import_0[__rspack_import_key];
70
56
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
71
- var _rspack_transform__rspack_import_3 = __webpack_require__("./rspack/transform");
57
+ var _rspack_transform__rspack_import_1 = __webpack_require__("./rspack/transform");
72
58
  var __rspack_reexport = {};
73
- for(const __rspack_import_key in _rspack_transform__rspack_import_3)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_rspack_transform__rspack_import_3[__rspack_import_key];
59
+ for(const __rspack_import_key in _rspack_transform__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_rspack_transform__rspack_import_1[__rspack_import_key];
74
60
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
75
61
  })();
76
62
  for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -1,4 +1,2 @@
1
- export * from './webpack/transform';
2
1
  export * from './transform';
3
- export * from './treeShaking';
4
2
  export * from './rspack/transform';
@@ -1,4 +1,2 @@
1
- export * from './webpack/transform.js';
2
1
  export * from './transform.js';
3
- export * from './treeShaking.js';
4
2
  export * from './rspack/transform.js';
@@ -1,5 +1,3 @@
1
1
  import "node:module";
2
- export * from "./webpack/transform.js";
3
2
  export * from "./transform.js";
4
- export * from "./treeShaking.js";
5
3
  export * from "./rspack/transform.js";
@@ -111,7 +111,7 @@ function patchNativeModuleSources(mg, rawModuleSourcesPatch) {
111
111
  }
112
112
  const jsonModuleSizes = rawModuleSourcesPatch.jsonModuleSizes;
113
113
  if (jsonModuleSizes && jsonModuleSizes.length > 0) for (const jsonModuleSize of jsonModuleSizes){
114
- const module = mg.getModuleByWebpackId(jsonModuleSize.identifier);
114
+ const module = mg.getModuleByIdentifier(jsonModuleSize.identifier);
115
115
  if (module) module.setSize({
116
116
  parsedSize: jsonModuleSize.size
117
117
  });
@@ -81,7 +81,7 @@ function patchNativeModuleSources(mg, rawModuleSourcesPatch) {
81
81
  }
82
82
  const jsonModuleSizes = rawModuleSourcesPatch.jsonModuleSizes;
83
83
  if (jsonModuleSizes && jsonModuleSizes.length > 0) for (const jsonModuleSize of jsonModuleSizes){
84
- const module = mg.getModuleByWebpackId(jsonModuleSize.identifier);
84
+ const module = mg.getModuleByIdentifier(jsonModuleSize.identifier);
85
85
  if (module) module.setSize({
86
86
  parsedSize: jsonModuleSize.size
87
87
  });
@@ -27,9 +27,8 @@ __webpack_require__.d(__webpack_exports__, {
27
27
  getModuleGraphByStats: ()=>getModuleGraphByStats
28
28
  });
29
29
  const graph_namespaceObject = require("@rsdoctor/graph");
30
- const external_index_cjs_namespaceObject = require("./index.cjs");
31
- function getModuleGraphByStats(compilation, stats, root, chunkGraph, features, context) {
32
- return (0, external_index_cjs_namespaceObject.appendModuleGraphByCompilation)(compilation, graph_namespaceObject.ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph), features, context);
30
+ function getModuleGraphByStats(_compilation, stats, root, chunkGraph, _features) {
31
+ return graph_namespaceObject.ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph);
33
32
  }
34
33
  exports.getModuleGraphByStats = __webpack_exports__.getModuleGraphByStats;
35
34
  for(var __rspack_i in __webpack_exports__)if (-1 === [
@@ -1,4 +1,3 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { TransformContext } from '.';
3
2
  import { SDK } from '@rsdoctor/types';
4
- export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
3
+ export declare function getModuleGraphByStats(_compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, _features?: Plugin.RsdoctorRspackPluginFeatures): import("@rsdoctor/graph").ModuleGraph;
@@ -1,4 +1,3 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
- import { TransformContext } from './index.js';
3
2
  import { SDK } from '@rsdoctor/types';
4
- export declare function getModuleGraphByStats(compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, features?: Plugin.RsdoctorWebpackPluginFeatures, context?: TransformContext): Promise<SDK.ModuleGraphInstance>;
3
+ export declare function getModuleGraphByStats(_compilation: Plugin.BaseCompilation, stats: Plugin.StatsCompilation, root: string, chunkGraph: SDK.ChunkGraphInstance, _features?: Plugin.RsdoctorRspackPluginFeatures): import("@rsdoctor/graph").ModuleGraph;
@@ -1,7 +1,6 @@
1
1
  import "node:module";
2
2
  import { ModuleGraphTrans } from "@rsdoctor/graph";
3
- import { appendModuleGraphByCompilation } from "./index.js";
4
- function getModuleGraphByStats(compilation, stats, root, chunkGraph, features, context) {
5
- return appendModuleGraphByCompilation(compilation, ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph), features, context);
3
+ function getModuleGraphByStats(_compilation, stats, root, chunkGraph, _features) {
4
+ return ModuleGraphTrans.getModuleGraphByStats(stats, root, chunkGraph);
6
5
  }
7
6
  export { getModuleGraphByStats };
@@ -147,7 +147,7 @@ const parseBundle = (bundlePath, modulesData)=>{
147
147
  const size = moduleContent && Buffer.byteLength(moduleContent);
148
148
  const identifier = (0, compat_namespaceObject.find)(modulesData, {
149
149
  renderId: module
150
- })?.webpackId || '';
150
+ })?.identifier || '';
151
151
  modulesObj[identifier] = {
152
152
  size,
153
153
  sizeConvert: (0, external_filesize_namespaceObject.filesize)(size || 0),
@@ -110,7 +110,7 @@ const parseBundle = (bundlePath, modulesData)=>{
110
110
  const size = moduleContent && Buffer.byteLength(moduleContent);
111
111
  const identifier = find(modulesData, {
112
112
  renderId: module
113
- })?.webpackId || '';
113
+ })?.identifier || '';
114
114
  modulesObj[identifier] = {
115
115
  size,
116
116
  sizeConvert: filesize(size || 0),
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  interceptCompilerHooks: ()=>interceptCompilerHooks,
29
29
  shouldInterceptPluginHook: ()=>shouldInterceptPluginHook
30
30
  });
31
- const graph_namespaceObject = require("@rsdoctor/graph");
32
31
  function shouldInterceptPluginHook(hook) {
33
32
  if (hook && hook._fakeHook) return false;
34
33
  if (hook?.isUsed && 'function' == typeof hook.isUsed) return hook.isUsed();
@@ -43,7 +42,7 @@ function interceptCompilerHooks(compiler, interceptor) {
43
42
  }
44
43
  function interceptCompilationHooks(compilation, interceptor) {
45
44
  Object.keys(compilation.hooks).forEach((hook)=>{
46
- if ('normalModuleLoader' === hook && graph_namespaceObject.ModuleGraphTrans.isWebpack5orRspack(compilation)) return;
45
+ if ('normalModuleLoader' === hook) return;
47
46
  const v = compilation.hooks[hook];
48
47
  if (shouldInterceptPluginHook(v)) interceptor(hook, v, 'compilation');
49
48
  });
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- import { ModuleGraphTrans } from "@rsdoctor/graph";
3
2
  function shouldInterceptPluginHook(hook) {
4
3
  if (hook && hook._fakeHook) return false;
5
4
  if (hook?.isUsed && 'function' == typeof hook.isUsed) return hook.isUsed();
@@ -14,7 +13,7 @@ function interceptCompilerHooks(compiler, interceptor) {
14
13
  }
15
14
  function interceptCompilationHooks(compilation, interceptor) {
16
15
  Object.keys(compilation.hooks).forEach((hook)=>{
17
- if ('normalModuleLoader' === hook && ModuleGraphTrans.isWebpack5orRspack(compilation)) return;
16
+ if ('normalModuleLoader' === hook) return;
18
17
  const v = compilation.hooks[hook];
19
18
  if (shouldInterceptPluginHook(v)) interceptor(hook, v, 'compilation');
20
19
  });
@@ -30,7 +30,7 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  pluginTapPostOptions: ()=>pluginTapPostOptions,
31
31
  pluginTapPreOptions: ()=>pluginTapPreOptions
32
32
  });
33
- const pluginTapName = 'RsdoctorWebpackPlugin';
33
+ const pluginTapName = 'RsdoctorRspackPlugin';
34
34
  const pluginTapPostOptions = {
35
35
  name: pluginTapName,
36
36
  stage: 999
@@ -1,5 +1,5 @@
1
1
  import type { Tap } from 'tapable';
2
- export declare const pluginTapName = "RsdoctorWebpackPlugin";
2
+ export declare const pluginTapName = "RsdoctorRspackPlugin";
3
3
  export declare const pluginTapPostOptions: Tap;
4
4
  export declare const pluginTapPreOptions: Tap;
5
5
  export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
@@ -1,5 +1,5 @@
1
1
  import type { Tap } from 'tapable';
2
- export declare const pluginTapName = "RsdoctorWebpackPlugin";
2
+ export declare const pluginTapName = "RsdoctorRspackPlugin";
3
3
  export declare const pluginTapPostOptions: Tap;
4
4
  export declare const pluginTapPreOptions: Tap;
5
5
  export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
@@ -1,5 +1,5 @@
1
1
  import "node:module";
2
- const pluginTapName = 'RsdoctorWebpackPlugin';
2
+ const pluginTapName = 'RsdoctorRspackPlugin';
3
3
  const pluginTapPostOptions = {
4
4
  name: pluginTapName,
5
5
  stage: 999
@@ -64,28 +64,12 @@ class InternalBundlePlugin extends external_base_cjs_namespaceObject.InternalBas
64
64
  super(...args), this.name = 'bundle', this.map = new Map(), this.thisCompilation = (compilation)=>{
65
65
  (0, logger_namespaceObject.time)('InternalBundlePlugin.thisCompilation');
66
66
  try {
67
- if (compilation.hooks.processAssets && 'afterOptimizeAssets' in compilation.hooks) compilation.hooks.afterOptimizeAssets.tap(this.tapPostOptions, (assets)=>{
67
+ if (compilation.hooks.processAssets) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, (assets)=>{
68
68
  Object.keys(assets).forEach((file)=>{
69
69
  const v = this.ensureAssetContent(file);
70
70
  v.content = assets[file].source().toString();
71
71
  });
72
72
  });
73
- else if (compilation.hooks.processAssets && 'afterProcessAssets' in compilation.hooks) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, ()=>{
74
- Object.keys(compilation.assets).forEach((file)=>{
75
- const v = this.ensureAssetContent(file);
76
- v.content = compilation.assets[file].source().toString();
77
- });
78
- });
79
- else if ('afterOptimizeChunkAssets' in compilation.hooks) compilation.hooks.afterOptimizeChunkAssets.tap(this.tapPostOptions, (chunks)=>{
80
- [
81
- ...chunks
82
- ].reduce((t, chunk)=>t.concat([
83
- ...chunk.files
84
- ]), []).forEach((file)=>{
85
- const v = this.ensureAssetContent(file);
86
- v.content = compilation.assets[file].source().toString();
87
- });
88
- });
89
73
  } finally{
90
74
  (0, logger_namespaceObject.timeEnd)('InternalBundlePlugin.thisCompilation');
91
75
  }
@@ -37,28 +37,12 @@ class InternalBundlePlugin extends InternalBasePlugin {
37
37
  super(...args), this.name = 'bundle', this.map = new Map(), this.thisCompilation = (compilation)=>{
38
38
  time('InternalBundlePlugin.thisCompilation');
39
39
  try {
40
- if (compilation.hooks.processAssets && 'afterOptimizeAssets' in compilation.hooks) compilation.hooks.afterOptimizeAssets.tap(this.tapPostOptions, (assets)=>{
40
+ if (compilation.hooks.processAssets) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, (assets)=>{
41
41
  Object.keys(assets).forEach((file)=>{
42
42
  const v = this.ensureAssetContent(file);
43
43
  v.content = assets[file].source().toString();
44
44
  });
45
45
  });
46
- else if (compilation.hooks.processAssets && 'afterProcessAssets' in compilation.hooks) compilation.hooks.afterProcessAssets.tap(this.tapPostOptions, ()=>{
47
- Object.keys(compilation.assets).forEach((file)=>{
48
- const v = this.ensureAssetContent(file);
49
- v.content = compilation.assets[file].source().toString();
50
- });
51
- });
52
- else if ('afterOptimizeChunkAssets' in compilation.hooks) compilation.hooks.afterOptimizeChunkAssets.tap(this.tapPostOptions, (chunks)=>{
53
- [
54
- ...chunks
55
- ].reduce((t, chunk)=>t.concat([
56
- ...chunk.files
57
- ]), []).forEach((file)=>{
58
- const v = this.ensureAssetContent(file);
59
- v.content = compilation.assets[file].source().toString();
60
- });
61
- });
62
46
  } finally{
63
47
  timeEnd('InternalBundlePlugin.thisCompilation');
64
48
  }
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  ensureDevtools: ()=>ensureDevtools,
29
29
  ensureModulesChunksGraphFn: ()=>ensureModulesChunksGraphFn
30
30
  });
31
- const types_namespaceObject = require("@rsdoctor/types");
32
31
  const build_namespaceObject = require("@rsdoctor/utils/build");
33
32
  const logger_namespaceObject = require("@rsdoctor/utils/logger");
34
33
  const index_cjs_namespaceObject = require("../../build-utils/build/index.cjs");
@@ -39,16 +38,11 @@ let hasConsole = false;
39
38
  const ensureModulesChunksGraphFn = (compiler, _this)=>{
40
39
  if (_this._modulesGraphApplied) return;
41
40
  _this._modulesGraphApplied = true;
42
- const context = {
43
- astCache: new Map(),
44
- packagePathMap: new Map(),
45
- getSourceMap: (file)=>_this.sdk.getSourceMap(file)
46
- };
47
41
  const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
48
42
  if (RsdoctorRspackPlugin) (0, external_rspack_cjs_namespaceObject.applyRspackNativePlugin)(compiler, _this, RsdoctorRspackPlugin);
49
43
  if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
50
44
  compiler.hooks.done.tapPromise((0, external_constants_cjs_namespaceObject.internalPluginTapPreOptions)('moduleGraph'), async (_stats)=>{
51
- await doneHandler(_stats, _this, context, compiler);
45
+ await doneHandler(_stats, _this, compiler);
52
46
  });
53
47
  compiler.hooks.compilation.tap({
54
48
  ...external_constants_cjs_namespaceObject.pluginTapPostOptions,
@@ -63,12 +57,8 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
63
57
  await (0, external_sourcemapTool_cjs_namespaceObject.handleAfterEmitAssets)(compilation, _this, sourceMapFilenameRegex, namespace);
64
58
  });
65
59
  });
66
- compiler.hooks.emit.tapAsync({
67
- ...external_constants_cjs_namespaceObject.pluginTapPostOptions,
68
- stage: external_constants_cjs_namespaceObject.pluginTapPostOptions.stage + 100
69
- }, emitHandler.bind(null, _this, compiler));
70
60
  };
71
- async function doneHandler(_stats, _this, context, compiler) {
61
+ async function doneHandler(_stats, _this, compiler) {
72
62
  const stats = _stats;
73
63
  const getStatsJson = (()=>{
74
64
  let cached = null;
@@ -95,18 +85,8 @@ async function doneHandler(_stats, _this, context, compiler) {
95
85
  })();
96
86
  logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
97
87
  if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = index_cjs_namespaceObject.Chunks.chunkTransform(new Map(), getStatsJson());
98
- if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await index_cjs_namespaceObject.ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
88
+ if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await index_cjs_namespaceObject.ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features);
99
89
  logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
100
- if (_this.options.features.treeShaking) {
101
- if ('rspackVersion' in compiler.webpack) logger_namespaceObject.logger.info(logger_namespaceObject.chalk.yellow('Rspack currently does not support treeShaking capabilities.'));
102
- else {
103
- _this.modulesGraph = index_cjs_namespaceObject.ModuleGraph.appendTreeShaking(_this.modulesGraph, stats.compilation) || _this.modulesGraph;
104
- _this.sdk.addClientRoutes([
105
- types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.TreeShaking
106
- ]);
107
- }
108
- logger_namespaceObject.logger.debug(`${(build_namespaceObject.Process.getMemoryUsageMessage(), '[After AppendTreeShaking to ModuleGraph]')}`);
109
- }
110
90
  const shouldParseBundle = false !== _this.options.supports.parseBundle;
111
91
  await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
112
92
  logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
@@ -126,12 +106,6 @@ const ensureDevtools = (compiler)=>{
126
106
  hasConsole = true;
127
107
  return false;
128
108
  }
129
- if ('rspack' in compiler) return true;
130
- const sourceMapEnabled = 'string' == typeof devtool && /source-?map/i.test(devtool);
131
- if (!sourceMapEnabled) {
132
- logger_namespaceObject.logger.debug('SourceMap is not enabled. Skipping sourcemap processing.');
133
- return false;
134
- }
135
109
  return true;
136
110
  };
137
111
  async function getModulesInfos(compiler, moduleGraph, chunkGraph, parseBundle, sourceMapSets, assetsWithoutSourceMap) {
@@ -154,17 +128,6 @@ function calculateNamespaceAndRegex(compiler) {
154
128
  sourceMapFilenameRegex
155
129
  };
156
130
  }
157
- async function emitHandler(_this, compiler, compilation, callback) {
158
- if (!ensureDevtools(compiler)) return void callback();
159
- const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
160
- await (0, external_sourcemapTool_cjs_namespaceObject.handleEmitAssets)({
161
- compilation,
162
- pluginInstance: _this,
163
- sourceMapFilenameRegex,
164
- namespace
165
- });
166
- callback();
167
- }
168
131
  exports.calculateNamespaceAndRegex = __webpack_exports__.calculateNamespaceAndRegex;
169
132
  exports.ensureDevtools = __webpack_exports__.ensureDevtools;
170
133
  exports.ensureModulesChunksGraphFn = __webpack_exports__.ensureModulesChunksGraphFn;
@@ -12,22 +12,20 @@ export interface MappingItem {
12
12
  name: string | null;
13
13
  }
14
14
  /**
15
- * Main function to generate ModuleGraph and ChunkGraph from stats and Webpack module APIs.
16
- * Sets up hooks to process stats, generate graphs, handle tree shaking, and collect source maps.
17
- * @param compiler - The Webpack or Rspack compiler instance.
18
- * @param _this - The Rsdoctor plugin instance.
15
+ * Main function to generate ModuleGraph and ChunkGraph from Rspack native data
16
+ * or stats fallback, and collect source maps.
19
17
  */
20
18
  export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
21
19
  /**
22
20
  * Checks if source map processing is enabled and supported by the current compiler configuration.
23
21
  * Warns if eval-based source maps are used (unsupported).
24
- * @param compiler - The Webpack or Rspack compiler instance.
22
+ * @param compiler - The Rspack compiler instance.
25
23
  * @returns true if source maps are enabled and supported, false otherwise.
26
24
  */
27
25
  export declare const ensureDevtools: (compiler: Plugin.BaseCompiler) => boolean;
28
26
  /**
29
27
  * Calculates namespace and source map filename regex for source map resolution.
30
- * @param compiler - The Webpack or Rspack compiler instance.
28
+ * @param compiler - The Rspack compiler instance.
31
29
  * @returns An object containing namespace and sourceMapFilenameRegex.
32
30
  */
33
31
  export declare function calculateNamespaceAndRegex(compiler: Plugin.BaseCompiler): {
@@ -12,22 +12,20 @@ export interface MappingItem {
12
12
  name: string | null;
13
13
  }
14
14
  /**
15
- * Main function to generate ModuleGraph and ChunkGraph from stats and Webpack module APIs.
16
- * Sets up hooks to process stats, generate graphs, handle tree shaking, and collect source maps.
17
- * @param compiler - The Webpack or Rspack compiler instance.
18
- * @param _this - The Rsdoctor plugin instance.
15
+ * Main function to generate ModuleGraph and ChunkGraph from Rspack native data
16
+ * or stats fallback, and collect source maps.
19
17
  */
20
18
  export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
21
19
  /**
22
20
  * Checks if source map processing is enabled and supported by the current compiler configuration.
23
21
  * Warns if eval-based source maps are used (unsupported).
24
- * @param compiler - The Webpack or Rspack compiler instance.
22
+ * @param compiler - The Rspack compiler instance.
25
23
  * @returns true if source maps are enabled and supported, false otherwise.
26
24
  */
27
25
  export declare const ensureDevtools: (compiler: Plugin.BaseCompiler) => boolean;
28
26
  /**
29
27
  * Calculates namespace and source map filename regex for source map resolution.
30
- * @param compiler - The Webpack or Rspack compiler instance.
28
+ * @param compiler - The Rspack compiler instance.
31
29
  * @returns An object containing namespace and sourceMapFilenameRegex.
32
30
  */
33
31
  export declare function calculateNamespaceAndRegex(compiler: Plugin.BaseCompiler): {
@@ -1,25 +1,19 @@
1
1
  import "node:module";
2
- import { Manifest } from "@rsdoctor/types";
3
2
  import { Process } from "@rsdoctor/utils/build";
4
3
  import { chalk, logger } from "@rsdoctor/utils/logger";
5
4
  import { Chunks, ModuleGraph } from "../../build-utils/build/index.js";
6
5
  import { internalPluginTapPreOptions, pluginTapPostOptions } from "../constants.js";
7
6
  import { applyRspackNativePlugin } from "./rspack.js";
8
- import { handleAfterEmitAssets, handleEmitAssets } from "./sourcemapTool.js";
7
+ import { handleAfterEmitAssets } from "./sourcemapTool.js";
9
8
  let hasConsole = false;
10
9
  const ensureModulesChunksGraphFn = (compiler, _this)=>{
11
10
  if (_this._modulesGraphApplied) return;
12
11
  _this._modulesGraphApplied = true;
13
- const context = {
14
- astCache: new Map(),
15
- packagePathMap: new Map(),
16
- getSourceMap: (file)=>_this.sdk.getSourceMap(file)
17
- };
18
12
  const RsdoctorRspackPlugin = compiler.webpack.experiments?.RsdoctorPlugin;
19
13
  if (RsdoctorRspackPlugin) applyRspackNativePlugin(compiler, _this, RsdoctorRspackPlugin);
20
14
  if (!_this._realSourcePathCache) _this._realSourcePathCache = new Map();
21
15
  compiler.hooks.done.tapPromise(internalPluginTapPreOptions('moduleGraph'), async (_stats)=>{
22
- await doneHandler(_stats, _this, context, compiler);
16
+ await doneHandler(_stats, _this, compiler);
23
17
  });
24
18
  compiler.hooks.compilation.tap({
25
19
  ...pluginTapPostOptions,
@@ -34,12 +28,8 @@ const ensureModulesChunksGraphFn = (compiler, _this)=>{
34
28
  await handleAfterEmitAssets(compilation, _this, sourceMapFilenameRegex, namespace);
35
29
  });
36
30
  });
37
- compiler.hooks.emit.tapAsync({
38
- ...pluginTapPostOptions,
39
- stage: pluginTapPostOptions.stage + 100
40
- }, emitHandler.bind(null, _this, compiler));
41
31
  };
42
- async function doneHandler(_stats, _this, context, compiler) {
32
+ async function doneHandler(_stats, _this, compiler) {
43
33
  const stats = _stats;
44
34
  const getStatsJson = (()=>{
45
35
  let cached = null;
@@ -66,18 +56,8 @@ async function doneHandler(_stats, _this, context, compiler) {
66
56
  })();
67
57
  logger.debug(`${(Process.getMemoryUsageMessage(), '[Before Generate ModuleGraph]')}`);
68
58
  if (!_this.chunkGraph?.getChunks().length) _this.chunkGraph = Chunks.chunkTransform(new Map(), getStatsJson());
69
- if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features, context);
59
+ if (!_this.modulesGraph.getModules().length) _this.modulesGraph = await ModuleGraph.getModuleGraphByStats(stats.compilation, getStatsJson(), process.cwd(), _this.chunkGraph, _this.options.features);
70
60
  logger.debug(`${(Process.getMemoryUsageMessage(), '[After Generate ModuleGraph]')}`);
71
- if (_this.options.features.treeShaking) {
72
- if ('rspackVersion' in compiler.webpack) logger.info(chalk.yellow('Rspack currently does not support treeShaking capabilities.'));
73
- else {
74
- _this.modulesGraph = ModuleGraph.appendTreeShaking(_this.modulesGraph, stats.compilation) || _this.modulesGraph;
75
- _this.sdk.addClientRoutes([
76
- Manifest.RsdoctorManifestClientRoutes.TreeShaking
77
- ]);
78
- }
79
- logger.debug(`${(Process.getMemoryUsageMessage(), '[After AppendTreeShaking to ModuleGraph]')}`);
80
- }
81
61
  const shouldParseBundle = false !== _this.options.supports.parseBundle;
82
62
  await getModulesInfos(compiler, _this.modulesGraph, _this.chunkGraph, shouldParseBundle, _this.sourceMapSets, _this.assetsWithoutSourceMap);
83
63
  logger.debug(`${Process.getMemoryUsageMessage()}, '[After Transform ModuleGraph]'`);
@@ -97,12 +77,6 @@ const ensureDevtools = (compiler)=>{
97
77
  hasConsole = true;
98
78
  return false;
99
79
  }
100
- if ('rspack' in compiler) return true;
101
- const sourceMapEnabled = 'string' == typeof devtool && /source-?map/i.test(devtool);
102
- if (!sourceMapEnabled) {
103
- logger.debug('SourceMap is not enabled. Skipping sourcemap processing.');
104
- return false;
105
- }
106
80
  return true;
107
81
  };
108
82
  async function getModulesInfos(compiler, moduleGraph, chunkGraph, parseBundle, sourceMapSets, assetsWithoutSourceMap) {
@@ -125,15 +99,4 @@ function calculateNamespaceAndRegex(compiler) {
125
99
  sourceMapFilenameRegex
126
100
  };
127
101
  }
128
- async function emitHandler(_this, compiler, compilation, callback) {
129
- if (!ensureDevtools(compiler)) return void callback();
130
- const { namespace, sourceMapFilenameRegex } = calculateNamespaceAndRegex(compiler);
131
- await handleEmitAssets({
132
- compilation,
133
- pluginInstance: _this,
134
- sourceMapFilenameRegex,
135
- namespace
136
- });
137
- callback();
138
- }
139
102
  export { calculateNamespaceAndRegex, ensureDevtools, ensureModulesChunksGraphFn };
@@ -39,7 +39,7 @@ class InternalErrorReporterPlugin extends external_base_cjs_namespaceObject.Inte
39
39
  (0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.apply');
40
40
  }
41
41
  }
42
- handleWebpackError(err, category, level) {
42
+ handleBundlerError(err, category, level) {
43
43
  return error_namespaceObject.DevToolError.from(err, {
44
44
  category,
45
45
  code: types_namespaceObject.Rule.RuleMessageCodeEnumerated.Overlay,
@@ -55,7 +55,7 @@ class InternalErrorReporterPlugin extends external_base_cjs_namespaceObject.Inte
55
55
  async reportWarnings(warnings) {
56
56
  (0, logger_namespaceObject.time)('InternalErrorReporterPlugin.reportWarnings');
57
57
  try {
58
- const arr = warnings.map((warning)=>this.handleWebpackError(warning, types_namespaceObject.Rule.RuleMessageCategory.Compile, 'Warn'));
58
+ const arr = warnings.map((warning)=>this.handleBundlerError(warning, types_namespaceObject.Rule.RuleMessageCategory.Compile, 'Warn'));
59
59
  this.sdk.reportError(arr);
60
60
  } finally{
61
61
  (0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.reportWarnings');
@@ -64,7 +64,7 @@ class InternalErrorReporterPlugin extends external_base_cjs_namespaceObject.Inte
64
64
  async reportErrors(errors) {
65
65
  (0, logger_namespaceObject.time)('InternalErrorReporterPlugin.reportErrors');
66
66
  try {
67
- const arr = errors.map((err)=>this.handleWebpackError(err, types_namespaceObject.Rule.RuleMessageCategory.Bundle, 'Error'));
67
+ const arr = errors.map((err)=>this.handleBundlerError(err, types_namespaceObject.Rule.RuleMessageCategory.Bundle, 'Error'));
68
68
  this.sdk.reportError(arr);
69
69
  } finally{
70
70
  (0, logger_namespaceObject.timeEnd)('InternalErrorReporterPlugin.reportErrors');
@@ -5,7 +5,7 @@ export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler>
5
5
  readonly name = "error-reporter";
6
6
  apply(compiler: T): void;
7
7
  done: (stats: Plugin.BaseStats) => Promise<void>;
8
- handleWebpackError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
8
+ handleBundlerError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
9
9
  reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
10
10
  reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
11
11
  }
@@ -5,7 +5,7 @@ export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler>
5
5
  readonly name = "error-reporter";
6
6
  apply(compiler: T): void;
7
7
  done: (stats: Plugin.BaseStats) => Promise<void>;
8
- handleWebpackError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
8
+ handleBundlerError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
9
9
  reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
10
10
  reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
11
11
  }
@@ -12,7 +12,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
12
12
  timeEnd('InternalErrorReporterPlugin.apply');
13
13
  }
14
14
  }
15
- handleWebpackError(err, category, level) {
15
+ handleBundlerError(err, category, level) {
16
16
  return DevToolError.from(err, {
17
17
  category,
18
18
  code: Rule.RuleMessageCodeEnumerated.Overlay,
@@ -28,7 +28,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
28
28
  async reportWarnings(warnings) {
29
29
  time('InternalErrorReporterPlugin.reportWarnings');
30
30
  try {
31
- const arr = warnings.map((warning)=>this.handleWebpackError(warning, Rule.RuleMessageCategory.Compile, 'Warn'));
31
+ const arr = warnings.map((warning)=>this.handleBundlerError(warning, Rule.RuleMessageCategory.Compile, 'Warn'));
32
32
  this.sdk.reportError(arr);
33
33
  } finally{
34
34
  timeEnd('InternalErrorReporterPlugin.reportWarnings');
@@ -37,7 +37,7 @@ class InternalErrorReporterPlugin extends InternalBasePlugin {
37
37
  async reportErrors(errors) {
38
38
  time('InternalErrorReporterPlugin.reportErrors');
39
39
  try {
40
- const arr = errors.map((err)=>this.handleWebpackError(err, Rule.RuleMessageCategory.Bundle, 'Error'));
40
+ const arr = errors.map((err)=>this.handleBundlerError(err, Rule.RuleMessageCategory.Bundle, 'Error'));
41
41
  this.sdk.reportError(arr);
42
42
  } finally{
43
43
  timeEnd('InternalErrorReporterPlugin.reportErrors');
@@ -6,9 +6,6 @@ var __webpack_modules__ = {
6
6
  "./bundle" (module) {
7
7
  module.exports = require("./bundle.cjs");
8
8
  },
9
- "./bundleTagPlugin" (module) {
10
- module.exports = require("./bundleTagPlugin.cjs");
11
- },
12
9
  "./ensureModulesChunkGraph" (module) {
13
10
  module.exports = require("./ensureModulesChunkGraph.cjs");
14
11
  },
@@ -113,13 +110,9 @@ var __webpack_exports__ = {};
113
110
  var __rspack_reexport = {};
114
111
  for(const __rspack_import_key in _rules__rspack_import_8)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_rules__rspack_import_8[__rspack_import_key];
115
112
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
116
- var _bundleTagPlugin__rspack_import_9 = __webpack_require__("./bundleTagPlugin");
117
- var __rspack_reexport = {};
118
- for(const __rspack_import_key in _bundleTagPlugin__rspack_import_9)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_bundleTagPlugin__rspack_import_9[__rspack_import_key];
119
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
120
- var _resolver__rspack_import_10 = __webpack_require__("./resolver");
113
+ var _resolver__rspack_import_9 = __webpack_require__("./resolver");
121
114
  var __rspack_reexport = {};
122
- for(const __rspack_import_key in _resolver__rspack_import_10)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_resolver__rspack_import_10[__rspack_import_key];
115
+ for(const __rspack_import_key in _resolver__rspack_import_9)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_resolver__rspack_import_9[__rspack_import_key];
123
116
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
124
117
  })();
125
118
  for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -7,5 +7,4 @@ export * from './base';
7
7
  export * from './bundle';
8
8
  export * from './ensureModulesChunkGraph';
9
9
  export * from './rules';
10
- export * from './bundleTagPlugin';
11
10
  export * from './resolver';
@@ -7,5 +7,4 @@ export * from './base.js';
7
7
  export * from './bundle.js';
8
8
  export * from './ensureModulesChunkGraph.js';
9
9
  export * from './rules.js';
10
- export * from './bundleTagPlugin.js';
11
10
  export * from './resolver.js';