@rsdoctor/core 0.4.3 → 0.4.4

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.
@@ -1,6 +1,5 @@
1
1
  export * as Chunks from './chunks';
2
2
  export * as Utils from './utils';
3
- export * as Loader from './loader';
4
3
  export * as Types from '../../types';
5
4
  export * as ModuleGraph from './module-graph';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-utils/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/build-utils/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC"}
@@ -29,7 +29,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  var build_exports = {};
30
30
  __export(build_exports, {
31
31
  Chunks: () => Chunks,
32
- Loader: () => Loader,
33
32
  ModuleGraph: () => ModuleGraph,
34
33
  Types: () => Types,
35
34
  Utils: () => Utils
@@ -37,13 +36,11 @@ __export(build_exports, {
37
36
  module.exports = __toCommonJS(build_exports);
38
37
  var Chunks = __toESM(require("./chunks"));
39
38
  var Utils = __toESM(require("./utils"));
40
- var Loader = __toESM(require("./loader"));
41
39
  var Types = __toESM(require("../../types"));
42
40
  var ModuleGraph = __toESM(require("./module-graph"));
43
41
  // Annotate the CommonJS export names for ESM import in node:
44
42
  0 && (module.exports = {
45
43
  Chunks,
46
- Loader,
47
44
  ModuleGraph,
48
45
  Types,
49
46
  Utils
@@ -1,5 +1,4 @@
1
1
  export * from './loader';
2
2
  export * from './plugin';
3
3
  export * from './parseBundle';
4
- export * from '../loader/probeLoader';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
@@ -18,11 +18,9 @@ module.exports = __toCommonJS(utils_exports);
18
18
  __reExport(utils_exports, require("./loader"), module.exports);
19
19
  __reExport(utils_exports, require("./plugin"), module.exports);
20
20
  __reExport(utils_exports, require("./parseBundle"), module.exports);
21
- __reExport(utils_exports, require("../loader/probeLoader"), module.exports);
22
21
  // Annotate the CommonJS export names for ESM import in node:
23
22
  0 && (module.exports = {
24
23
  ...require("./loader"),
25
24
  ...require("./plugin"),
26
- ...require("./parseBundle"),
27
- ...require("../loader/probeLoader")
25
+ ...require("./parseBundle")
28
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/utils/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAQ,cAAc,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAQ/E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG;IACnD,IA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AM,CAAC,gBAAgB,EACpE,KAAK,EAAE,CAAC,EAAE,EACV,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,EAC1C,EAAE,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,gBAAgB,KAAK,OAAO,GAC1C,CAAC,EAAE,CAsDL;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,EAC9C,KAAK,EAAE,CACL,GAAG,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAC3B,SAAS,CAAC,EAAE,qBAAqB,KAC9B,IAAI,iDAsFV;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM;;EAMvC"}
@@ -177,14 +177,13 @@ function addProbeLoader2Rules(rules, appendRules, fn) {
177
177
  return rules.map((rule) => {
178
178
  if (!rule || typeof rule === "string")
179
179
  return rule;
180
- if (fn(rule) && !rule.use) {
180
+ if (fn(rule)) {
181
181
  const _rule = {
182
182
  ...rule,
183
183
  use: [
184
184
  {
185
185
  loader: rule.loader,
186
- options: rule.options,
187
- ident: "ident" in rule && rule.ident || void 0
186
+ options: rule.options
188
187
  }
189
188
  ],
190
189
  loader: void 0,
@@ -194,23 +193,11 @@ function addProbeLoader2Rules(rules, appendRules, fn) {
194
193
  }
195
194
  if (rule.use) {
196
195
  if (Array.isArray(rule.use)) {
197
- let indexList = [];
198
- rule.use.forEach((_r, index) => {
199
- if (fn(_r)) {
200
- indexList.push(index);
201
- }
202
- });
203
- let _rule2 = (0, import_lodash.cloneDeep)(rule);
204
- if (indexList.length) {
205
- indexList.forEach((i, _index) => {
206
- if (i !== void 0) {
207
- _rule2 = appendRules(_rule2, i + _index * 2);
208
- }
209
- });
196
+ const _index = (0, import_lodash.findIndex)(rule.use, (_r) => fn(_r));
197
+ if (_index > -1) {
198
+ return appendRules(rule, _index);
210
199
  }
211
- return _rule2;
212
- }
213
- if (typeof rule.use === "object" && !Array.isArray(rule.use) && typeof rule.use !== "function") {
200
+ } else if (typeof rule.use === "object" && !Array.isArray(rule.use) && typeof rule.use !== "function") {
214
201
  rule.use = [
215
202
  {
216
203
  ...rule.use
@@ -30,7 +30,7 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
30
30
  this.name = "bundleTag";
31
31
  }
32
32
  apply(compiler) {
33
- const supportBannerPlugin = !!this.options.supports?.banner;
33
+ const supportBannerPlugin = this.options.supports?.banner;
34
34
  compiler.hooks.compilation.tap(
35
35
  "RsdoctorTagBannerPlugin",
36
36
  (compilation) => {
@@ -40,7 +40,7 @@ class InternalBundleTagPlugin extends import_base.InternalBasePlugin {
40
40
  stage: -2e3
41
41
  },
42
42
  async () => {
43
- if (!compilation.options.plugins.map((p) => p && p.constructor.name).includes("BannerPlugin") && !supportBannerPlugin) {
43
+ if (!compilation.options.plugins.map((p) => p && p.constructor.name).includes("BannerPlugin") || supportBannerPlugin === false) {
44
44
  return;
45
45
  }
46
46
  import_logger.logger.info(
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,eAAe,EAChB,MAAM,SAAS,CAAC;AAMjB,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EACvE,MAAM,GAAE,4BAA4B,CAAC,KAAK,CAAM,GAC/C,+BAA+B,CAAC,KAAK,CAAC,CA6FxC;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EACA,wBAAwB,GACxB,gBAAgB,GAChB,sBAAsB,GACtB,IAAI,QAcT;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,QA+BnD;AAED,eAAO,MAAM,mBAAmB,mBACd,eAAe,QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,KAC3B,GAAG,CAAC,UAuBN,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/inner-plugins/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,KAAK,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,WAAW,EACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,EAC/B,eAAe,EAChB,MAAM,SAAS,CAAC;AAMjB,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,EACvE,MAAM,GAAE,4BAA4B,CAAC,KAAK,CAAM,GAC/C,+BAA+B,CAAC,KAAK,CAAC,CAiGxC;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EACA,wBAAwB,GACxB,gBAAgB,GAChB,sBAAsB,GACtB,IAAI,QAcT;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,QA+BnD;AAED,eAAO,MAAM,mBAAmB,mBACd,eAAe,QACzB,MAAM,OAAO,GAAG,CAAC,KAAK,KAC3B,GAAG,CAAC,UAuBN,CAAC"}
@@ -55,7 +55,11 @@ function normalizeUserConfig(config = {}) {
55
55
  },
56
56
  disableTOSUpload = false,
57
57
  innerClientPath = "",
58
- supports = { parseBundle: true, banner: false, generateTileGraph: true },
58
+ supports = {
59
+ parseBundle: true,
60
+ banner: void 0,
61
+ generateTileGraph: true
62
+ },
59
63
  port,
60
64
  printLog = { serverUrls: true },
61
65
  mode = "normal",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -64,17 +64,17 @@
64
64
  "dependencies": {
65
65
  "axios": "^1.7.2",
66
66
  "enhanced-resolve": "5.12.0",
67
- "filesize": "^10.1.4",
67
+ "filesize": "^10.1.6",
68
68
  "fs-extra": "^11.1.1",
69
69
  "lodash": "^4.17.21",
70
70
  "path-browserify": "1.0.1",
71
71
  "semver": "^7.6.3",
72
72
  "source-map": "^0.7.4",
73
73
  "webpack-bundle-analyzer": "^4.10.2",
74
- "@rsdoctor/graph": "0.4.3",
75
- "@rsdoctor/sdk": "0.4.3",
76
- "@rsdoctor/types": "0.4.3",
77
- "@rsdoctor/utils": "0.4.3"
74
+ "@rsdoctor/graph": "0.4.4",
75
+ "@rsdoctor/sdk": "0.4.4",
76
+ "@rsdoctor/types": "0.4.4",
77
+ "@rsdoctor/utils": "0.4.4"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@rspack/core": "0.7.5",
@@ -88,7 +88,7 @@
88
88
  "babel-loader": "9.1.3",
89
89
  "string-loader": "0.0.1",
90
90
  "ts-loader": "^9.5.1",
91
- "tslib": "2.4.1",
91
+ "tslib": "2.7.0",
92
92
  "typescript": "^5.2.2",
93
93
  "webpack": "^5.90.0",
94
94
  "@scripts/test-helper": "0.1.1"
@@ -102,6 +102,6 @@
102
102
  "dev": "npm run start",
103
103
  "build": "modern build",
104
104
  "start": "modern build -w",
105
- "test": "vitest run -u"
105
+ "test": "vitest run"
106
106
  }
107
107
  }
@@ -1,2 +0,0 @@
1
- export * from './probeLoaderPlugin';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/loader/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -1,22 +0,0 @@
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 loader_exports = {};
17
- module.exports = __toCommonJS(loader_exports);
18
- __reExport(loader_exports, require("./probeLoaderPlugin"), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require("./probeLoaderPlugin")
22
- });
@@ -1,5 +0,0 @@
1
- import { Plugin } from '@rsdoctor/types';
2
- import type { LoaderDefinitionFunction } from '@rspack/core';
3
- export declare const loaderModule: Plugin.LoaderDefinition<Parameters<LoaderDefinitionFunction>, {}>;
4
- export default loaderModule;
5
- //# sourceMappingURL=probeLoader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"probeLoader.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/loader/probeLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAO,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAI7D,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,gBAAgB,CAChD,UAAU,CAAC,wBAAwB,CAAC,EACpC,EAAE,CAwCH,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,76 +0,0 @@
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 probeLoader_exports = {};
30
- __export(probeLoader_exports, {
31
- default: () => probeLoader_default,
32
- loaderModule: () => loaderModule
33
- });
34
- module.exports = __toCommonJS(probeLoader_exports);
35
- var import__ = require("../..");
36
- var import_inner_plugins = require("../../../inner-plugins");
37
- var import_lodash = require("lodash");
38
- var import_path = __toESM(require("path"));
39
- const loaderModule = function(...args) {
40
- const time = Date.now();
41
- const code = args[0];
42
- const _options = this.getOptions();
43
- const sdk = (0, import_inner_plugins.getSDK)(_options.builderName);
44
- const loaderData = {
45
- resource: {
46
- path: this.resourcePath,
47
- query: import__.Build.Utils.parseQuery(this.resourceQuery),
48
- queryRaw: this.resourceQuery,
49
- ext: import_path.default.extname(this.resourcePath).slice(1)
50
- },
51
- loaders: [
52
- {
53
- loader: _options.loader,
54
- loaderIndex: this.loaderIndex,
55
- path: _options.loader,
56
- input: _options.type === "start" ? code : null,
57
- result: _options.type === "end" ? code : null,
58
- startAt: _options.type === "start" ? time : 0,
59
- endAt: _options.type === "end" ? time : 0,
60
- options: (0, import_lodash.omit)(_options.options, "type"),
61
- isPitch: false,
62
- sync: false,
63
- errors: [],
64
- pid: process.pid,
65
- ppid: process.ppid
66
- }
67
- ]
68
- };
69
- sdk.reportLoaderStartOrEnd(loaderData);
70
- this.callback(null, ...args);
71
- };
72
- var probeLoader_default = loaderModule;
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- loaderModule
76
- });
@@ -1,6 +0,0 @@
1
- import { Plugin } from '@rsdoctor/types';
2
- export declare class ProbeLoaderPlugin {
3
- apply(compiler: Plugin.BaseCompiler): void;
4
- private addProbeLoader;
5
- }
6
- //# sourceMappingURL=probeLoaderPlugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"probeLoaderPlugin.d.ts","sourceRoot":"","sources":["../../../../src/build-utils/build/loader/probeLoaderPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAUzC,qBAAa,iBAAiB;IAC5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;IAoBnC,OAAO,CAAC,cAAc;CA0DvB"}
@@ -1,111 +0,0 @@
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 probeLoaderPlugin_exports = {};
30
- __export(probeLoaderPlugin_exports, {
31
- ProbeLoaderPlugin: () => ProbeLoaderPlugin
32
- });
33
- module.exports = __toCommonJS(probeLoaderPlugin_exports);
34
- var import_common = require("@rsdoctor/utils/common");
35
- var import__ = require("../..");
36
- var import__2 = require("..");
37
- var import_path = __toESM(require("path"));
38
- const BuiltinLoaderName = "builtin:swc-loader";
39
- const ESMLoaderFile = ".mjs";
40
- class ProbeLoaderPlugin {
41
- apply(compiler) {
42
- compiler.hooks.beforeRun.tap(
43
- {
44
- name: "ProbeLoaderPlugin"
45
- },
46
- () => {
47
- this.addProbeLoader(compiler);
48
- }
49
- );
50
- compiler.hooks.watchRun.tap(
51
- {
52
- name: "ProbeLoaderPlugin"
53
- },
54
- () => {
55
- this.addProbeLoader(compiler);
56
- }
57
- );
58
- }
59
- addProbeLoader(compiler) {
60
- let rules = compiler.options.module.rules;
61
- const appendRule = (rule, index) => {
62
- if ("use" in rule && Array.isArray(rule.use)) {
63
- const _builtinRule = rule.use[index];
64
- const _options = typeof _builtinRule.options === "string" ? {} : { ..._builtinRule };
65
- rule.use.splice(index, 0, {
66
- loader: import_path.default.join(__dirname, "./probeLoader.js"),
67
- options: {
68
- ..._options,
69
- ident: void 0,
70
- type: "end",
71
- builderName: compiler.options.name
72
- }
73
- });
74
- rule.use.splice(index + 2, 0, {
75
- loader: import_path.default.join(__dirname, "./probeLoader.js"),
76
- options: {
77
- ..._options,
78
- ident: void 0,
79
- type: "start",
80
- builderName: compiler.options.name
81
- }
82
- });
83
- }
84
- return rule;
85
- };
86
- if (import_common.Loader.isVue(compiler)) {
87
- compiler.options.module.rules = import__2.Utils.addProbeLoader2Rules(
88
- rules,
89
- appendRule,
90
- (r) => !!r.loader
91
- );
92
- return;
93
- }
94
- rules = import__2.Utils.addProbeLoader2Rules(
95
- rules,
96
- appendRule,
97
- (r) => import__.Build.Utils.getLoaderNameMatch(r, BuiltinLoaderName, true)
98
- );
99
- compiler.options.module.rules = import__2.Utils.addProbeLoader2Rules(
100
- rules,
101
- appendRule,
102
- (r) => {
103
- return import__.Build.Utils.getLoaderNameMatch(r, ESMLoaderFile, false) || import__.Build.Utils.isESMLoader(r);
104
- }
105
- );
106
- }
107
- }
108
- // Annotate the CommonJS export names for ESM import in node:
109
- 0 && (module.exports = {
110
- ProbeLoaderPlugin
111
- });