@rsdoctor/core 0.0.0-next-20240620044732

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 (219) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -0
  3. package/dist/build-utils/build/chunks/assetsModules.d.ts +4 -0
  4. package/dist/build-utils/build/chunks/assetsModules.d.ts.map +1 -0
  5. package/dist/build-utils/build/chunks/assetsModules.js +36 -0
  6. package/dist/build-utils/build/chunks/chunkTransform.d.ts +5 -0
  7. package/dist/build-utils/build/chunks/chunkTransform.d.ts.map +1 -0
  8. package/dist/build-utils/build/chunks/chunkTransform.js +31 -0
  9. package/dist/build-utils/build/chunks/generateTileGraph.d.ts +11 -0
  10. package/dist/build-utils/build/chunks/generateTileGraph.d.ts.map +1 -0
  11. package/dist/build-utils/build/chunks/generateTileGraph.js +71 -0
  12. package/dist/build-utils/build/chunks/index.d.ts +4 -0
  13. package/dist/build-utils/build/chunks/index.d.ts.map +1 -0
  14. package/dist/build-utils/build/chunks/index.js +26 -0
  15. package/dist/build-utils/build/index.d.ts +5 -0
  16. package/dist/build-utils/build/index.d.ts.map +1 -0
  17. package/dist/build-utils/build/index.js +47 -0
  18. package/dist/build-utils/build/module-graph/index.d.ts +4 -0
  19. package/dist/build-utils/build/module-graph/index.d.ts.map +1 -0
  20. package/dist/build-utils/build/module-graph/index.js +26 -0
  21. package/dist/build-utils/build/module-graph/parser.d.ts +3 -0
  22. package/dist/build-utils/build/module-graph/parser.d.ts.map +1 -0
  23. package/dist/build-utils/build/module-graph/parser.js +44 -0
  24. package/dist/build-utils/build/module-graph/transform.d.ts +5 -0
  25. package/dist/build-utils/build/module-graph/transform.d.ts.map +1 -0
  26. package/dist/build-utils/build/module-graph/transform.js +37 -0
  27. package/dist/build-utils/build/module-graph/treeShaking.d.ts +4 -0
  28. package/dist/build-utils/build/module-graph/treeShaking.d.ts.map +1 -0
  29. package/dist/build-utils/build/module-graph/treeShaking.js +132 -0
  30. package/dist/build-utils/build/module-graph/utils.d.ts +4 -0
  31. package/dist/build-utils/build/module-graph/utils.d.ts.map +1 -0
  32. package/dist/build-utils/build/module-graph/utils.js +113 -0
  33. package/dist/build-utils/build/module-graph/webpack/transform.d.ts +12 -0
  34. package/dist/build-utils/build/module-graph/webpack/transform.d.ts.map +1 -0
  35. package/dist/build-utils/build/module-graph/webpack/transform.js +195 -0
  36. package/dist/build-utils/build/utils/index.d.ts +4 -0
  37. package/dist/build-utils/build/utils/index.d.ts.map +1 -0
  38. package/dist/build-utils/build/utils/index.js +26 -0
  39. package/dist/build-utils/build/utils/loader.d.ts +19 -0
  40. package/dist/build-utils/build/utils/loader.d.ts.map +1 -0
  41. package/dist/build-utils/build/utils/loader.js +299 -0
  42. package/dist/build-utils/build/utils/parseBundle.d.ts +13 -0
  43. package/dist/build-utils/build/utils/parseBundle.d.ts.map +1 -0
  44. package/dist/build-utils/build/utils/parseBundle.js +367 -0
  45. package/dist/build-utils/build/utils/plugin.d.ts +6 -0
  46. package/dist/build-utils/build/utils/plugin.d.ts.map +1 -0
  47. package/dist/build-utils/build/utils/plugin.js +63 -0
  48. package/dist/build-utils/common/chunks/assetsContent.d.ts +5 -0
  49. package/dist/build-utils/common/chunks/assetsContent.d.ts.map +1 -0
  50. package/dist/build-utils/common/chunks/assetsContent.js +34 -0
  51. package/dist/build-utils/common/chunks/assetsModules.d.ts +24 -0
  52. package/dist/build-utils/common/chunks/assetsModules.d.ts.map +1 -0
  53. package/dist/build-utils/common/chunks/assetsModules.js +107 -0
  54. package/dist/build-utils/common/chunks/chunkTransform.d.ts +6 -0
  55. package/dist/build-utils/common/chunks/chunkTransform.d.ts.map +1 -0
  56. package/dist/build-utils/common/chunks/chunkTransform.js +73 -0
  57. package/dist/build-utils/common/chunks/index.d.ts +4 -0
  58. package/dist/build-utils/common/chunks/index.d.ts.map +1 -0
  59. package/dist/build-utils/common/chunks/index.js +26 -0
  60. package/dist/build-utils/common/index.d.ts +6 -0
  61. package/dist/build-utils/common/index.d.ts.map +1 -0
  62. package/dist/build-utils/common/index.js +50 -0
  63. package/dist/build-utils/common/module-graph/compatible.d.ts +10 -0
  64. package/dist/build-utils/common/module-graph/compatible.d.ts.map +1 -0
  65. package/dist/build-utils/common/module-graph/compatible.js +63 -0
  66. package/dist/build-utils/common/module-graph/index.d.ts +4 -0
  67. package/dist/build-utils/common/module-graph/index.d.ts.map +1 -0
  68. package/dist/build-utils/common/module-graph/index.js +26 -0
  69. package/dist/build-utils/common/module-graph/transform.d.ts +8 -0
  70. package/dist/build-utils/common/module-graph/transform.d.ts.map +1 -0
  71. package/dist/build-utils/common/module-graph/transform.js +200 -0
  72. package/dist/build-utils/common/module-graph/utils.d.ts +16 -0
  73. package/dist/build-utils/common/module-graph/utils.d.ts.map +1 -0
  74. package/dist/build-utils/common/module-graph/utils.js +62 -0
  75. package/dist/build-utils/common/trans-utils/index.d.ts +2 -0
  76. package/dist/build-utils/common/trans-utils/index.d.ts.map +1 -0
  77. package/dist/build-utils/common/trans-utils/index.js +22 -0
  78. package/dist/build-utils/common/trans-utils/transStats.d.ts +7 -0
  79. package/dist/build-utils/common/trans-utils/transStats.d.ts.map +1 -0
  80. package/dist/build-utils/common/trans-utils/transStats.js +35 -0
  81. package/dist/build-utils/common/webpack/compatible.d.ts +27 -0
  82. package/dist/build-utils/common/webpack/compatible.d.ts.map +1 -0
  83. package/dist/build-utils/common/webpack/compatible.js +181 -0
  84. package/dist/build-utils/index.d.ts +3 -0
  85. package/dist/build-utils/index.d.ts.map +1 -0
  86. package/dist/build-utils/index.js +41 -0
  87. package/dist/index.d.ts +4 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +43 -0
  90. package/dist/inner-plugins/constants.d.ts +7 -0
  91. package/dist/inner-plugins/constants.d.ts.map +1 -0
  92. package/dist/inner-plugins/constants.js +52 -0
  93. package/dist/inner-plugins/index.d.ts +3 -0
  94. package/dist/inner-plugins/index.d.ts.map +1 -0
  95. package/dist/inner-plugins/index.js +24 -0
  96. package/dist/inner-plugins/loaders/proxy.d.ts +5 -0
  97. package/dist/inner-plugins/loaders/proxy.d.ts.map +1 -0
  98. package/dist/inner-plugins/loaders/proxy.js +115 -0
  99. package/dist/inner-plugins/plugins/base.d.ts +14 -0
  100. package/dist/inner-plugins/plugins/base.d.ts.map +1 -0
  101. package/dist/inner-plugins/plugins/base.js +45 -0
  102. package/dist/inner-plugins/plugins/bundle.d.ts +15 -0
  103. package/dist/inner-plugins/plugins/bundle.d.ts.map +1 -0
  104. package/dist/inner-plugins/plugins/bundle.js +92 -0
  105. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts +7 -0
  106. package/dist/inner-plugins/plugins/bundleTagPlugin.d.ts.map +1 -0
  107. package/dist/inner-plugins/plugins/bundleTagPlugin.js +81 -0
  108. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +10 -0
  109. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts.map +1 -0
  110. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +126 -0
  111. package/dist/inner-plugins/plugins/errors.d.ts +12 -0
  112. package/dist/inner-plugins/plugins/errors.d.ts.map +1 -0
  113. package/dist/inner-plugins/plugins/errors.js +85 -0
  114. package/dist/inner-plugins/plugins/index.d.ts +11 -0
  115. package/dist/inner-plugins/plugins/index.d.ts.map +1 -0
  116. package/dist/inner-plugins/plugins/index.js +40 -0
  117. package/dist/inner-plugins/plugins/loader.d.ts +12 -0
  118. package/dist/inner-plugins/plugins/loader.d.ts.map +1 -0
  119. package/dist/inner-plugins/plugins/loader.js +161 -0
  120. package/dist/inner-plugins/plugins/plugins.d.ts +9 -0
  121. package/dist/inner-plugins/plugins/plugins.d.ts.map +1 -0
  122. package/dist/inner-plugins/plugins/plugins.js +60 -0
  123. package/dist/inner-plugins/plugins/progress.d.ts +9 -0
  124. package/dist/inner-plugins/plugins/progress.d.ts.map +1 -0
  125. package/dist/inner-plugins/plugins/progress.js +59 -0
  126. package/dist/inner-plugins/plugins/rules.d.ts +9 -0
  127. package/dist/inner-plugins/plugins/rules.d.ts.map +1 -0
  128. package/dist/inner-plugins/plugins/rules.js +85 -0
  129. package/dist/inner-plugins/plugins/summary.d.ts +15 -0
  130. package/dist/inner-plugins/plugins/summary.d.ts.map +1 -0
  131. package/dist/inner-plugins/plugins/summary.js +115 -0
  132. package/dist/inner-plugins/utils/circleDetect.d.ts +5 -0
  133. package/dist/inner-plugins/utils/circleDetect.d.ts.map +1 -0
  134. package/dist/inner-plugins/utils/circleDetect.js +42 -0
  135. package/dist/inner-plugins/utils/config.d.ts +8 -0
  136. package/dist/inner-plugins/utils/config.d.ts.map +1 -0
  137. package/dist/inner-plugins/utils/config.js +151 -0
  138. package/dist/inner-plugins/utils/index.d.ts +6 -0
  139. package/dist/inner-plugins/utils/index.d.ts.map +1 -0
  140. package/dist/inner-plugins/utils/index.js +30 -0
  141. package/dist/inner-plugins/utils/loader.d.ts +12 -0
  142. package/dist/inner-plugins/utils/loader.d.ts.map +1 -0
  143. package/dist/inner-plugins/utils/loader.js +201 -0
  144. package/dist/inner-plugins/utils/plugin.d.ts +6 -0
  145. package/dist/inner-plugins/utils/plugin.d.ts.map +1 -0
  146. package/dist/inner-plugins/utils/plugin.js +126 -0
  147. package/dist/inner-plugins/utils/sdk.d.ts +4 -0
  148. package/dist/inner-plugins/utils/sdk.d.ts.map +1 -0
  149. package/dist/inner-plugins/utils/sdk.js +43 -0
  150. package/dist/rules/index.d.ts +4 -0
  151. package/dist/rules/index.d.ts.map +1 -0
  152. package/dist/rules/index.js +33 -0
  153. package/dist/rules/linter.d.ts +10 -0
  154. package/dist/rules/linter.d.ts.map +1 -0
  155. package/dist/rules/linter.js +74 -0
  156. package/dist/rules/rule.d.ts +28 -0
  157. package/dist/rules/rule.d.ts.map +1 -0
  158. package/dist/rules/rule.js +143 -0
  159. package/dist/rules/rules/default-import-check/index.d.ts +5 -0
  160. package/dist/rules/rules/default-import-check/index.d.ts.map +1 -0
  161. package/dist/rules/rules/default-import-check/index.js +124 -0
  162. package/dist/rules/rules/default-import-check/types.d.ts +5 -0
  163. package/dist/rules/rules/default-import-check/types.d.ts.map +1 -0
  164. package/dist/rules/rules/default-import-check/types.js +16 -0
  165. package/dist/rules/rules/default-import-check/utils.d.ts +11 -0
  166. package/dist/rules/rules/default-import-check/utils.d.ts.map +1 -0
  167. package/dist/rules/rules/default-import-check/utils.js +93 -0
  168. package/dist/rules/rules/duplicate-package/index.d.ts +5 -0
  169. package/dist/rules/rules/duplicate-package/index.d.ts.map +1 -0
  170. package/dist/rules/rules/duplicate-package/index.js +71 -0
  171. package/dist/rules/rules/duplicate-package/types.d.ts +25 -0
  172. package/dist/rules/rules/duplicate-package/types.d.ts.map +1 -0
  173. package/dist/rules/rules/duplicate-package/types.js +51 -0
  174. package/dist/rules/rules/duplicate-package/utils.d.ts +4 -0
  175. package/dist/rules/rules/duplicate-package/utils.d.ts.map +1 -0
  176. package/dist/rules/rules/duplicate-package/utils.js +89 -0
  177. package/dist/rules/rules/ecma-version-check/index.d.ts +5 -0
  178. package/dist/rules/rules/ecma-version-check/index.d.ts.map +1 -0
  179. package/dist/rules/rules/ecma-version-check/index.js +82 -0
  180. package/dist/rules/rules/ecma-version-check/types.d.ts +8 -0
  181. package/dist/rules/rules/ecma-version-check/types.d.ts.map +1 -0
  182. package/dist/rules/rules/ecma-version-check/types.js +16 -0
  183. package/dist/rules/rules/ecma-version-check/utils.d.ts +3 -0
  184. package/dist/rules/rules/ecma-version-check/utils.d.ts.map +1 -0
  185. package/dist/rules/rules/ecma-version-check/utils.js +31 -0
  186. package/dist/rules/rules/index.d.ts +2 -0
  187. package/dist/rules/rules/index.d.ts.map +1 -0
  188. package/dist/rules/rules/index.js +37 -0
  189. package/dist/rules/rules/loader-performance-optimization/index.d.ts +5 -0
  190. package/dist/rules/rules/loader-performance-optimization/index.d.ts.map +1 -0
  191. package/dist/rules/rules/loader-performance-optimization/index.js +124 -0
  192. package/dist/rules/rules/loader-performance-optimization/types.d.ts +23 -0
  193. package/dist/rules/rules/loader-performance-optimization/types.d.ts.map +1 -0
  194. package/dist/rules/rules/loader-performance-optimization/types.js +16 -0
  195. package/dist/rules/rules/loader-performance-optimization/utils.d.ts +2 -0
  196. package/dist/rules/rules/loader-performance-optimization/utils.d.ts.map +1 -0
  197. package/dist/rules/rules/loader-performance-optimization/utils.js +38 -0
  198. package/dist/rules/utils.d.ts +4 -0
  199. package/dist/rules/utils.d.ts.map +1 -0
  200. package/dist/rules/utils.js +44 -0
  201. package/dist/types/chunks.d.ts +12 -0
  202. package/dist/types/chunks.d.ts.map +1 -0
  203. package/dist/types/chunks.js +16 -0
  204. package/dist/types/index.d.ts +6 -0
  205. package/dist/types/index.d.ts.map +1 -0
  206. package/dist/types/index.js +30 -0
  207. package/dist/types/loader.d.ts +20 -0
  208. package/dist/types/loader.d.ts.map +1 -0
  209. package/dist/types/loader.js +16 -0
  210. package/dist/types/plugin.d.ts +96 -0
  211. package/dist/types/plugin.d.ts.map +1 -0
  212. package/dist/types/plugin.js +16 -0
  213. package/dist/types/rules.d.ts +8 -0
  214. package/dist/types/rules.d.ts.map +1 -0
  215. package/dist/types/rules.js +16 -0
  216. package/dist/types/webpack.d.ts +15 -0
  217. package/dist/types/webpack.d.ts.map +1 -0
  218. package/dist/types/webpack.js +16 -0
  219. package/package.json +112 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var bundle_exports = {};
20
+ __export(bundle_exports, {
21
+ InternalBundlePlugin: () => InternalBundlePlugin
22
+ });
23
+ module.exports = __toCommonJS(bundle_exports);
24
+ var import_types = require("@rsdoctor/types");
25
+ var import_base = require("./base");
26
+ var import_common = require("../../build-utils/common");
27
+ class InternalBundlePlugin extends import_base.InternalBasePlugin {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.name = "bundle";
31
+ this.map = /* @__PURE__ */ new Map();
32
+ this.thisCompilation = (compilation) => {
33
+ if (compilation.hooks.processAssets && "afterOptimizeAssets" in compilation.hooks) {
34
+ compilation.hooks.afterOptimizeAssets.tap(
35
+ this.tapPostOptions,
36
+ (assets) => {
37
+ Object.keys(assets).forEach((file) => {
38
+ const v = this.ensureAssetContent(file);
39
+ v.content = assets[file].source().toString();
40
+ });
41
+ }
42
+ );
43
+ } else if (compilation.hooks.processAssets && "afterProcessAssets" in compilation.hooks) {
44
+ compilation.hooks.afterProcessAssets.tap(
45
+ this.tapPostOptions,
46
+ () => {
47
+ Object.keys(compilation.assets).forEach((file) => {
48
+ const v = this.ensureAssetContent(file);
49
+ v.content = compilation.assets[file].source().toString();
50
+ });
51
+ }
52
+ );
53
+ } else if ("afterOptimizeChunkAssets" in compilation.hooks) {
54
+ compilation.hooks.afterOptimizeChunkAssets.tap(
55
+ this.tapPostOptions,
56
+ (chunks) => {
57
+ [...chunks].reduce((t, chunk) => t.concat([...chunk.files]), []).forEach((file) => {
58
+ const v = this.ensureAssetContent(file);
59
+ v.content = compilation.assets[file].source().toString();
60
+ });
61
+ }
62
+ );
63
+ }
64
+ };
65
+ this.done = async () => {
66
+ if (this.scheduler.chunkGraph) {
67
+ import_common.Chunks.assetsContents(this.map, this.scheduler.chunkGraph);
68
+ }
69
+ this.sdk.addClientRoutes([
70
+ import_types.Manifest.RsdoctorManifestClientRoutes.ModuleGraph,
71
+ import_types.Manifest.RsdoctorManifestClientRoutes.BundleSize
72
+ ]);
73
+ };
74
+ }
75
+ apply(compiler) {
76
+ this.scheduler.ensureModulesChunksGraphApplied(compiler);
77
+ compiler.hooks.compilation.tap(this.tapPostOptions, this.thisCompilation);
78
+ compiler.hooks.done.tapPromise(this.tapPreOptions, this.done.bind(this));
79
+ }
80
+ ensureAssetContent(name) {
81
+ const asset = this.map.get(name);
82
+ if (asset)
83
+ return asset;
84
+ const v = { content: "" };
85
+ this.map.set(name, v);
86
+ return v;
87
+ }
88
+ }
89
+ // Annotate the CommonJS export names for ESM import in node:
90
+ 0 && (module.exports = {
91
+ InternalBundlePlugin
92
+ });
@@ -0,0 +1,7 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ export declare class InternalBundleTagPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
4
+ readonly name = "bundleTag";
5
+ apply(compiler: Plugin.BaseCompiler): void;
6
+ }
7
+ //# sourceMappingURL=bundleTagPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundleTagPlugin.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/bundleTagPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,qBAAa,uBAAuB,CAClC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,eAAe;IAE5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;CAmD3C"}
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var bundleTagPlugin_exports = {};
20
+ __export(bundleTagPlugin_exports, {
21
+ InternalBundleTagPlugin: () => InternalBundleTagPlugin
22
+ });
23
+ module.exports = __toCommonJS(bundleTagPlugin_exports);
24
+ var import_path = require("path");
25
+ var import_webpack_sources = require("webpack-sources");
26
+ var import_base = require("./base");
27
+ var import_logger = require("@rsdoctor/utils/logger");
28
+ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
29
+ constructor() {
30
+ super(...arguments);
31
+ this.name = "bundleTag";
32
+ }
33
+ apply(compiler) {
34
+ const supportBannerPlugin = !!this.options.supports?.banner;
35
+ compiler.hooks.compilation.tap("RsdoctorTagBannerPlugin", (compilation) => {
36
+ compilation.hooks.processAssets.tapPromise(
37
+ {
38
+ name: "RsdoctorTagBannerPlugin",
39
+ stage: -2e3
40
+ },
41
+ async () => {
42
+ if (!compilation.options.plugins.map((p) => p && p.constructor.name).includes("BannerPlugin") && !supportBannerPlugin) {
43
+ return;
44
+ }
45
+ import_logger.logger.info(
46
+ import_logger.chalk.bgMagenta(
47
+ "Rsdoctor BannerTagPlugin has open. Do not use Rsdoctor on production version."
48
+ )
49
+ );
50
+ const chunks = compilation.chunks;
51
+ for (let chunk of chunks) {
52
+ for (const file of chunk.files) {
53
+ if (!file || (0, import_path.extname)(file) !== ".js") {
54
+ continue;
55
+ }
56
+ compilation.updateAsset(
57
+ file,
58
+ // @ts-ignore
59
+ (old) => {
60
+ const concatSource = new import_webpack_sources.ConcatSource();
61
+ let header = "\n console.log('RSDOCTOR_START::');\n";
62
+ let footer = "\n console.log('RSDOCTOR_END::');\n";
63
+ concatSource.add(header);
64
+ concatSource.add(old);
65
+ concatSource.add(footer);
66
+ return concatSource;
67
+ },
68
+ () => {
69
+ }
70
+ );
71
+ }
72
+ }
73
+ }
74
+ );
75
+ });
76
+ }
77
+ }
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ InternalBundleTagPlugin
81
+ });
@@ -0,0 +1,10 @@
1
+ import { RsdoctorPluginInstance } from '../../types';
2
+ import { Linter, Plugin } from '@rsdoctor/types';
3
+ /**
4
+ * @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
5
+ * @param {Compiler} compiler
6
+ * @return {*}
7
+ * @memberof RsdoctorWebpackPlugin
8
+ */
9
+ export declare const ensureModulesChunksGraphFn: (compiler: Plugin.BaseCompiler, _this: RsdoctorPluginInstance<Plugin.BaseCompiler, Linter.ExtendRuleData[]>) => void;
10
+ //# sourceMappingURL=ensureModulesChunkGraph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensureModulesChunkGraph.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/ensureModulesChunkGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAuB,MAAM,iBAAiB,CAAC;AAWtE;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,aAC3B,OAAO,YAAY,SACtB,uBAAuB,OAAO,YAAY,EAAE,OAAO,cAAc,EAAE,CAAC,SAsF5E,CAAC"}
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ensureModulesChunkGraph_exports = {};
30
+ __export(ensureModulesChunkGraph_exports, {
31
+ ensureModulesChunksGraphFn: () => ensureModulesChunksGraphFn
32
+ });
33
+ module.exports = __toCommonJS(ensureModulesChunkGraph_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_types2 = require("@rsdoctor/types");
36
+ var import_build = require("@rsdoctor/utils/build");
37
+ var import_logger = require("@rsdoctor/utils/logger");
38
+ var import_fs_extra = __toESM(require("fs-extra"));
39
+ var import_build2 = require("../../build-utils/build");
40
+ var import_common = require("../../build-utils/common");
41
+ var import_constants = require("../constants");
42
+ const ensureModulesChunksGraphFn = (compiler, _this) => {
43
+ if (_this._modulesGraphApplied)
44
+ return;
45
+ _this._modulesGraphApplied = true;
46
+ const context = {
47
+ astCache: /* @__PURE__ */ new Map(),
48
+ packagePathMap: /* @__PURE__ */ new Map(),
49
+ getSourceMap: (file) => {
50
+ return _this.sdk.getSourceMap(file);
51
+ }
52
+ };
53
+ compiler.hooks.done.tapPromise(
54
+ (0, import_constants.internalPluginTapPreOptions)("moduleGraph"),
55
+ async (_stats) => {
56
+ const stats = _stats;
57
+ const statsJson = stats.toJson();
58
+ (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[Before Generate ModuleGraph]");
59
+ _this.chunkGraph = import_build2.Chunks.chunkTransform(/* @__PURE__ */ new Map(), statsJson);
60
+ _this.modulesGraph = await import_build2.ModuleGraph.getModuleGraphByStats(
61
+ stats.compilation,
62
+ statsJson,
63
+ process.cwd(),
64
+ _this.chunkGraph,
65
+ _this.options.features,
66
+ context
67
+ );
68
+ (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After Generate ModuleGraph]");
69
+ if (_this.options.features.treeShaking) {
70
+ _this.modulesGraph = import_build2.ModuleGraph.appendTreeShaking(
71
+ _this.modulesGraph,
72
+ stats.compilation
73
+ ) || _this.modulesGraph;
74
+ _this.sdk.addClientRoutes([
75
+ import_types2.Manifest.RsdoctorManifestClientRoutes.TreeShaking
76
+ ]);
77
+ (0, import_logger.debug)(
78
+ import_build.Process.getMemoryUsageMessage,
79
+ "[After AppendTreeShaking to ModuleGraph]"
80
+ );
81
+ }
82
+ const shouldParseBundle = _this.options.supports.parseBundle !== false;
83
+ await getModulesInfosByStats(
84
+ compiler,
85
+ statsJson,
86
+ _this.modulesGraph,
87
+ shouldParseBundle
88
+ );
89
+ (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After Transform ModuleGraph]");
90
+ _this.modulesGraph && await _this.sdk.reportModuleGraph(_this.modulesGraph);
91
+ await _this.sdk.reportChunkGraph(_this.chunkGraph);
92
+ const reportFilePath = await import_build2.Chunks.generateTileGraph(
93
+ statsJson,
94
+ {
95
+ reportFilename: import_path.default.join(
96
+ import_types2.Constants.RsdoctorOutputFolder,
97
+ import_build2.Chunks.TileGraphReportName
98
+ ),
99
+ reportTitle: "bundle-analyzer"
100
+ },
101
+ compiler.outputPath
102
+ );
103
+ reportFilePath && await _this.sdk.reportTileHtml(
104
+ import_fs_extra.default.readFileSync(reportFilePath, "utf-8")
105
+ );
106
+ }
107
+ );
108
+ };
109
+ async function getModulesInfosByStats(compiler, stats, moduleGraph, parseBundle) {
110
+ if (!moduleGraph) {
111
+ return;
112
+ }
113
+ try {
114
+ const parsedModulesData = await import_build2.Chunks.getAssetsModulesData(
115
+ stats,
116
+ compiler.outputPath,
117
+ parseBundle
118
+ ) || {};
119
+ import_common.Chunks.transformAssetsModulesData(parsedModulesData, moduleGraph);
120
+ } catch (e) {
121
+ }
122
+ }
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ ensureModulesChunksGraphFn
126
+ });
@@ -0,0 +1,12 @@
1
+ import { Rule, Err, Plugin } from '@rsdoctor/types';
2
+ import { InternalBasePlugin } from './base';
3
+ import { DevToolError } from '@rsdoctor/utils/error';
4
+ export declare class InternalErrorReporterPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
+ readonly name = "error-reporter";
6
+ apply(compiler: T): void;
7
+ done: (stats: Plugin.BaseStats) => Promise<void>;
8
+ handleWebpackError(err: Plugin.BuildError, category: Rule.RuleMessageCategory, level: keyof typeof Err.ErrorLevel): DevToolError;
9
+ reportWarnings(warnings: Plugin.BuildError[]): Promise<void>;
10
+ reportErrors(errors: Plugin.BuildWarning[]): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,2BAA2B,CACtC,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,oBAAoB;IAEjC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAIjB,IAAI,UAAiB,OAAO,SAAS,KAAG,QAAQ,IAAI,CAAC,CAiB1D;IAEK,kBAAkB,CACvB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAClC,KAAK,EAAE,MAAM,OAAO,GAAG,CAAC,UAAU;IAavB,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,UAAU,EAAE;IAW5C,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,EAAE;CAUxD"}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var errors_exports = {};
20
+ __export(errors_exports, {
21
+ InternalErrorReporterPlugin: () => InternalErrorReporterPlugin
22
+ });
23
+ module.exports = __toCommonJS(errors_exports);
24
+ var import_types = require("@rsdoctor/types");
25
+ var import_base = require("./base");
26
+ var import_error = require("@rsdoctor/utils/error");
27
+ class InternalErrorReporterPlugin extends import_base.InternalBasePlugin {
28
+ constructor() {
29
+ super(...arguments);
30
+ this.name = "error-reporter";
31
+ this.done = async (stats) => {
32
+ const tasks = [];
33
+ const statsData = stats.toJson({
34
+ all: false,
35
+ errors: true,
36
+ warnings: true
37
+ });
38
+ if (stats.hasErrors()) {
39
+ tasks.push(this.reportErrors(statsData.errors || []));
40
+ }
41
+ if (stats.hasWarnings()) {
42
+ tasks.push(this.reportWarnings(statsData.warnings || []));
43
+ }
44
+ await Promise.all(tasks);
45
+ };
46
+ }
47
+ apply(compiler) {
48
+ compiler.hooks.done.tapPromise(this.tapPreOptions, this.done);
49
+ }
50
+ handleWebpackError(err, category, level) {
51
+ return import_error.DevToolError.from(err, {
52
+ category,
53
+ code: import_types.Rule.RuleMessageCodeEnumerated.Overlay,
54
+ controller: { noStack: false },
55
+ detail: {
56
+ stack: "stack" in err ? err.stack : err.message
57
+ },
58
+ level
59
+ });
60
+ }
61
+ async reportWarnings(warnings) {
62
+ const arr = warnings.map((warning) => {
63
+ return this.handleWebpackError(
64
+ warning,
65
+ import_types.Rule.RuleMessageCategory.Compile,
66
+ "Warn"
67
+ );
68
+ });
69
+ this.sdk.reportError(arr);
70
+ }
71
+ async reportErrors(errors) {
72
+ const arr = errors.map((err) => {
73
+ return this.handleWebpackError(
74
+ err,
75
+ import_types.Rule.RuleMessageCategory.Bundle,
76
+ "Error"
77
+ );
78
+ });
79
+ this.sdk.reportError(arr);
80
+ }
81
+ }
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ InternalErrorReporterPlugin
85
+ });
@@ -0,0 +1,11 @@
1
+ export * from './loader';
2
+ export * from './plugins';
3
+ export * from './errors';
4
+ export * from './progress';
5
+ export * from './summary';
6
+ export * from './base';
7
+ export * from './bundle';
8
+ export * from './ensureModulesChunkGraph';
9
+ export * from './rules';
10
+ export * from './bundleTagPlugin';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var plugins_exports = {};
17
+ module.exports = __toCommonJS(plugins_exports);
18
+ __reExport(plugins_exports, require("./loader"), module.exports);
19
+ __reExport(plugins_exports, require("./plugins"), module.exports);
20
+ __reExport(plugins_exports, require("./errors"), module.exports);
21
+ __reExport(plugins_exports, require("./progress"), module.exports);
22
+ __reExport(plugins_exports, require("./summary"), module.exports);
23
+ __reExport(plugins_exports, require("./base"), module.exports);
24
+ __reExport(plugins_exports, require("./bundle"), module.exports);
25
+ __reExport(plugins_exports, require("./ensureModulesChunkGraph"), module.exports);
26
+ __reExport(plugins_exports, require("./rules"), module.exports);
27
+ __reExport(plugins_exports, require("./bundleTagPlugin"), module.exports);
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ ...require("./loader"),
31
+ ...require("./plugins"),
32
+ ...require("./errors"),
33
+ ...require("./progress"),
34
+ ...require("./summary"),
35
+ ...require("./base"),
36
+ ...require("./bundle"),
37
+ ...require("./ensureModulesChunkGraph"),
38
+ ...require("./rules"),
39
+ ...require("./bundleTagPlugin")
40
+ });
@@ -0,0 +1,12 @@
1
+ import { Plugin } from '@rsdoctor/types';
2
+ import { RuleSetRule } from 'webpack';
3
+ import { InternalBasePlugin } from './base';
4
+ export declare class InternalLoaderPlugin<T extends Plugin.BaseCompiler> extends InternalBasePlugin<T> {
5
+ readonly name = "loader";
6
+ readonly internalLoaderPath: string;
7
+ apply(compiler: T): void;
8
+ afterPlugins: (compiler: Plugin.BaseCompiler) => void;
9
+ compilation(compiler: Plugin.BaseCompiler, compilation: Plugin.BaseCompilation): void;
10
+ getInterceptRules(compiler: Plugin.BaseCompiler, rules: RuleSetRule[]): RuleSetRule[];
11
+ }
12
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/plugins/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAA+B,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,qBAAa,oBAAoB,CAC/B,CAAC,SAAS,MAAM,CAAC,YAAY,CAC7B,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,SAAgB,IAAI,YAAY;IAEhC,SAAgB,kBAAkB,SAAuC;IAElE,KAAK,CAAC,QAAQ,EAAE,CAAC;IAUjB,YAAY,aAAc,OAAO,YAAY,UAYlD;IAEK,WAAW,CAChB,QAAQ,EAAE,MAAM,CAAC,YAAY,EAC7B,WAAW,EAAE,MAAM,CAAC,eAAe;IA4G9B,iBAAiB,CACtB,QAAQ,EAAE,MAAM,CAAC,YAAY,EAC7B,KAAK,EAAE,WAAW,EAAE;CAcvB"}
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var loader_exports = {};
30
+ __export(loader_exports, {
31
+ InternalLoaderPlugin: () => InternalLoaderPlugin
32
+ });
33
+ module.exports = __toCommonJS(loader_exports);
34
+ var import_types = require("@rsdoctor/types");
35
+ var import_common = require("@rsdoctor/utils/common");
36
+ var import_lodash = require("lodash");
37
+ var import_utils = require("../utils");
38
+ var import_base = require("./base");
39
+ class InternalLoaderPlugin extends import_base.InternalBasePlugin {
40
+ constructor() {
41
+ super(...arguments);
42
+ this.name = "loader";
43
+ this.internalLoaderPath = require.resolve("../loaders/proxy");
44
+ this.afterPlugins = (compiler) => {
45
+ if (compiler.isChild())
46
+ return;
47
+ compiler.options.module.rules = this.getInterceptRules(
48
+ compiler,
49
+ compiler.options.module.rules
50
+ );
51
+ this.sdk.addClientRoutes([
52
+ import_types.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
53
+ ]);
54
+ };
55
+ }
56
+ apply(compiler) {
57
+ compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins);
58
+ compiler.hooks.compilation.tap(
59
+ this.tapPreOptions,
60
+ this.compilation.bind(this, compiler)
61
+ );
62
+ }
63
+ compilation(compiler, compilation) {
64
+ if (compiler.isChild())
65
+ return;
66
+ const wrapper = (callback) => (loaderContext, module2) => {
67
+ const proxyLoaders = module2.loaders || loaderContext?.loaders || [];
68
+ const originLoaders = proxyLoaders.map((loader) => {
69
+ const opts = loader.options || {};
70
+ if (opts[import_common.Loader.LoaderInternalPropertyName]) {
71
+ return {
72
+ ...loader,
73
+ loader: opts[import_common.Loader.LoaderInternalPropertyName].loader,
74
+ options: (0, import_lodash.omit)(opts, import_common.Loader.LoaderInternalPropertyName)
75
+ };
76
+ }
77
+ return loader;
78
+ });
79
+ const newLoaders = (0, import_lodash.cloneDeep)(originLoaders);
80
+ if (typeof compiler.options.cache === "object" && "version" in compiler.options.cache && typeof compiler.options.cache.version === "string" && compiler.options.cache.version.indexOf("next/dist/build") > -1) {
81
+ callback(loaderContext, module2);
82
+ } else {
83
+ const proxyModule = new Proxy(module2, {
84
+ get(target, p, receiver) {
85
+ if (p === "loaders")
86
+ return newLoaders;
87
+ return Reflect.get(target, p, receiver);
88
+ },
89
+ set(target, p, newValue, receiver) {
90
+ const _newValue = (0, import_lodash.cloneDeep)(newValue);
91
+ if (p === "loaders") {
92
+ if (Array.isArray(_newValue)) {
93
+ newLoaders.length = 0;
94
+ _newValue.forEach((e) => {
95
+ newLoaders.push(e);
96
+ });
97
+ }
98
+ }
99
+ return Reflect.set(target, p, _newValue, receiver);
100
+ },
101
+ deleteProperty(target, p) {
102
+ return Reflect.deleteProperty(target, p);
103
+ }
104
+ });
105
+ callback(loaderContext, proxyModule);
106
+ }
107
+ if (!(0, import_lodash.isEqual)(originLoaders, newLoaders)) {
108
+ const rules = this.getInterceptRules(
109
+ compiler,
110
+ newLoaders.map((e) => {
111
+ return {
112
+ loader: e.loader,
113
+ options: e.options
114
+ };
115
+ })
116
+ );
117
+ module2.loaders = rules.map((e, i) => {
118
+ return {
119
+ ...newLoaders[i],
120
+ loader: e.loader,
121
+ options: e.options
122
+ };
123
+ });
124
+ }
125
+ };
126
+ const interceptor = {
127
+ register(tap) {
128
+ const originFn = tap.fn;
129
+ if (typeof originFn === "function") {
130
+ tap.fn = wrapper(originFn);
131
+ }
132
+ return tap;
133
+ }
134
+ };
135
+ if (compiler.webpack?.NormalModule?.getCompilationHooks) {
136
+ compiler.webpack.NormalModule.getCompilationHooks(
137
+ compilation
138
+ ).loader.intercept(interceptor);
139
+ } else if ("normalModuleLoader" in compilation.hooks) {
140
+ "normalModuleLoader" in compilation.hooks && compilation.hooks.normalModuleLoader.intercept(interceptor);
141
+ }
142
+ }
143
+ getInterceptRules(compiler, rules) {
144
+ return (0, import_utils.interceptLoader)(
145
+ rules,
146
+ this.internalLoaderPath,
147
+ {
148
+ cwd: compiler.context || process.cwd(),
149
+ host: this.sdk.server.origin,
150
+ skipLoaders: this.options.loaderInterceptorOptions.skipLoaders
151
+ // not implement
152
+ },
153
+ this.sdk.root,
154
+ "resolveLoader" in compiler.options ? compiler.options.resolveLoader : {}
155
+ );
156
+ }
157
+ }
158
+ // Annotate the CommonJS export names for ESM import in node:
159
+ 0 && (module.exports = {
160
+ InternalLoaderPlugin
161
+ });