@rsdoctor/webpack-plugin 1.1.9 → 1.2.0-beta.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.
package/dist/constants.js CHANGED
@@ -1,52 +1,64 @@
1
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 constants_exports = {};
20
- __export(constants_exports, {
21
- internalPluginTapPostOptions: () => internalPluginTapPostOptions,
22
- internalPluginTapPreOptions: () => internalPluginTapPreOptions,
23
- pluginTapName: () => pluginTapName,
24
- pluginTapPostOptions: () => pluginTapPostOptions,
25
- pluginTapPreOptions: () => pluginTapPreOptions
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ internalPluginTapPostOptions: ()=>internalPluginTapPostOptions,
28
+ internalPluginTapPreOptions: ()=>internalPluginTapPreOptions,
29
+ pluginTapName: ()=>pluginTapName,
30
+ pluginTapPostOptions: ()=>pluginTapPostOptions,
31
+ pluginTapPreOptions: ()=>pluginTapPreOptions
26
32
  });
27
- module.exports = __toCommonJS(constants_exports);
28
- const pluginTapName = "RsdoctorWebpackPlugin";
33
+ const pluginTapName = 'RsdoctorWebpackPlugin';
29
34
  const pluginTapPostOptions = {
30
- name: pluginTapName,
31
- stage: 999
35
+ name: pluginTapName,
36
+ stage: 999
32
37
  };
33
38
  const pluginTapPreOptions = {
34
- name: pluginTapName,
35
- stage: -999
39
+ name: pluginTapName,
40
+ stage: -999
36
41
  };
37
- const internalPluginTapPreOptions = (namespace) => ({
38
- name: `${pluginTapName}:${namespace}`,
39
- stage: -998
40
- });
41
- const internalPluginTapPostOptions = (namespace) => ({
42
- name: `${pluginTapName}:${namespace}`,
43
- stage: 1e3
44
- });
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- internalPluginTapPostOptions,
48
- internalPluginTapPreOptions,
49
- pluginTapName,
50
- pluginTapPostOptions,
51
- pluginTapPreOptions
42
+ const internalPluginTapPreOptions = (namespace)=>({
43
+ name: `${pluginTapName}:${namespace}`,
44
+ stage: -998
45
+ });
46
+ const internalPluginTapPostOptions = (namespace)=>({
47
+ name: `${pluginTapName}:${namespace}`,
48
+ stage: 1000
49
+ });
50
+ exports.internalPluginTapPostOptions = __webpack_exports__.internalPluginTapPostOptions;
51
+ exports.internalPluginTapPreOptions = __webpack_exports__.internalPluginTapPreOptions;
52
+ exports.pluginTapName = __webpack_exports__.pluginTapName;
53
+ exports.pluginTapPostOptions = __webpack_exports__.pluginTapPostOptions;
54
+ exports.pluginTapPreOptions = __webpack_exports__.pluginTapPreOptions;
55
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
56
+ "internalPluginTapPostOptions",
57
+ "internalPluginTapPreOptions",
58
+ "pluginTapName",
59
+ "pluginTapPostOptions",
60
+ "pluginTapPreOptions"
61
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
62
+ Object.defineProperty(exports, '__esModule', {
63
+ value: true
52
64
  });
package/dist/index.js CHANGED
@@ -1,35 +1,90 @@
1
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 });
2
+ var __webpack_modules__ = {
3
+ "./multiple": function(module) {
4
+ module.exports = require("./multiple.js");
5
+ },
6
+ "./plugin": function(module) {
7
+ module.exports = require("./plugin.js");
8
+ },
9
+ "@rsdoctor/core/rules": function(module) {
10
+ module.exports = require("@rsdoctor/core/rules");
11
+ }
9
12
  };
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
- var src_exports = {};
21
- __export(src_exports, {
22
- LinterType: () => import_rules.LinterType,
23
- defineRule: () => import_rules.defineRule
24
- });
25
- module.exports = __toCommonJS(src_exports);
26
- __reExport(src_exports, require("./plugin"), module.exports);
27
- __reExport(src_exports, require("./multiple"), module.exports);
28
- var import_rules = require("@rsdoctor/core/rules");
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- LinterType,
32
- defineRule,
33
- ...require("./plugin"),
34
- ...require("./multiple")
13
+ var __webpack_module_cache__ = {};
14
+ function __webpack_require__(moduleId) {
15
+ var cachedModule = __webpack_module_cache__[moduleId];
16
+ if (void 0 !== cachedModule) return cachedModule.exports;
17
+ var module = __webpack_module_cache__[moduleId] = {
18
+ exports: {}
19
+ };
20
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
21
+ return module.exports;
22
+ }
23
+ (()=>{
24
+ __webpack_require__.n = (module)=>{
25
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
26
+ __webpack_require__.d(getter, {
27
+ a: getter
28
+ });
29
+ return getter;
30
+ };
31
+ })();
32
+ (()=>{
33
+ __webpack_require__.d = (exports1, definition)=>{
34
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
35
+ enumerable: true,
36
+ get: definition[key]
37
+ });
38
+ };
39
+ })();
40
+ (()=>{
41
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
42
+ })();
43
+ (()=>{
44
+ __webpack_require__.r = (exports1)=>{
45
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
46
+ value: 'Module'
47
+ });
48
+ Object.defineProperty(exports1, '__esModule', {
49
+ value: true
50
+ });
51
+ };
52
+ })();
53
+ var __webpack_exports__ = {};
54
+ (()=>{
55
+ __webpack_require__.r(__webpack_exports__);
56
+ __webpack_require__.d(__webpack_exports__, {
57
+ LinterType: ()=>_rsdoctor_core_rules__WEBPACK_IMPORTED_MODULE_2__.LinterType,
58
+ defineRule: ()=>_rsdoctor_core_rules__WEBPACK_IMPORTED_MODULE_2__.defineRule
59
+ });
60
+ var _plugin__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./plugin");
61
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
62
+ for(var __WEBPACK_IMPORT_KEY__ in _plugin__WEBPACK_IMPORTED_MODULE_0__)if ([
63
+ "default",
64
+ "defineRule",
65
+ "LinterType"
66
+ ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
67
+ return _plugin__WEBPACK_IMPORTED_MODULE_0__[key];
68
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
69
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
70
+ var _multiple__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./multiple");
71
+ var __WEBPACK_REEXPORT_OBJECT__ = {};
72
+ for(var __WEBPACK_IMPORT_KEY__ in _multiple__WEBPACK_IMPORTED_MODULE_1__)if ([
73
+ "default",
74
+ "defineRule",
75
+ "LinterType"
76
+ ].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
77
+ return _multiple__WEBPACK_IMPORTED_MODULE_1__[key];
78
+ }).bind(0, __WEBPACK_IMPORT_KEY__);
79
+ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
80
+ var _rsdoctor_core_rules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("@rsdoctor/core/rules");
81
+ })();
82
+ exports.LinterType = __webpack_exports__.LinterType;
83
+ exports.defineRule = __webpack_exports__.defineRule;
84
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
85
+ "LinterType",
86
+ "defineRule"
87
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
88
+ Object.defineProperty(exports, '__esModule', {
89
+ value: true
35
90
  });
package/dist/multiple.js CHANGED
@@ -1,67 +1,81 @@
1
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 multiple_exports = {};
20
- __export(multiple_exports, {
21
- RsdoctorWebpackMultiplePlugin: () => RsdoctorWebpackMultiplePlugin
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ RsdoctorWebpackMultiplePlugin: ()=>RsdoctorWebpackMultiplePlugin
22
28
  });
23
- module.exports = __toCommonJS(multiple_exports);
24
- var import_sdk = require("@rsdoctor/sdk");
25
- var import_plugin = require("./plugin");
26
- var import_plugins = require("@rsdoctor/core/plugins");
27
- let globalController;
28
- class RsdoctorWebpackMultiplePlugin extends import_plugin.RsdoctorWebpackPlugin {
29
- constructor(options = {}) {
30
- const controller = (() => {
31
- if (globalController) {
32
- return globalController;
33
- }
34
- const controller2 = new import_sdk.RsdoctorSDKController();
35
- globalController = controller2;
36
- return controller2;
37
- })();
38
- const normallizedOptions = (0, import_plugins.normalizeUserConfig)(options);
39
- const instance = controller.createSlave({
40
- name: options.name || "Builder",
41
- stage: options.stage,
42
- extraConfig: {
43
- innerClientPath: normallizedOptions.innerClientPath,
44
- printLog: normallizedOptions.printLog,
45
- mode: normallizedOptions.mode ? normallizedOptions.mode : void 0,
46
- brief: normallizedOptions.brief,
47
- compressData: normallizedOptions.output.compressData
48
- },
49
- type: normallizedOptions.output.reportCodeType
50
- });
51
- super({
52
- ...options,
53
- sdkInstance: instance
29
+ const sdk_namespaceObject = require("@rsdoctor/sdk");
30
+ const external_plugin_js_namespaceObject = require("./plugin.js");
31
+ const plugins_namespaceObject = require("@rsdoctor/core/plugins");
32
+ function _define_property(obj, key, value) {
33
+ if (key in obj) Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
54
38
  });
55
- this.controller = controller;
56
- }
57
- apply(compiler) {
58
- if ("dependencies" in compiler.options) {
59
- this.sdk.dependencies = compiler.options.dependencies;
39
+ else obj[key] = value;
40
+ return obj;
41
+ }
42
+ let globalController;
43
+ class RsdoctorWebpackMultiplePlugin extends external_plugin_js_namespaceObject.RsdoctorWebpackPlugin {
44
+ apply(compiler) {
45
+ if ('dependencies' in compiler.options) this.sdk.dependencies = compiler.options.dependencies;
46
+ super.apply(compiler);
47
+ }
48
+ constructor(options = {}){
49
+ const controller = (()=>{
50
+ if (globalController) return globalController;
51
+ const controller = new sdk_namespaceObject.RsdoctorSDKController();
52
+ globalController = controller;
53
+ return controller;
54
+ })();
55
+ const normallizedOptions = (0, plugins_namespaceObject.normalizeUserConfig)(options);
56
+ const instance = controller.createSlave({
57
+ name: options.name || 'Builder',
58
+ stage: options.stage,
59
+ extraConfig: {
60
+ innerClientPath: normallizedOptions.innerClientPath,
61
+ printLog: normallizedOptions.printLog,
62
+ mode: normallizedOptions.mode ? normallizedOptions.mode : void 0,
63
+ brief: normallizedOptions.brief,
64
+ compressData: normallizedOptions.output.compressData
65
+ },
66
+ type: normallizedOptions.output.reportCodeType
67
+ });
68
+ super({
69
+ ...options,
70
+ sdkInstance: instance
71
+ }), _define_property(this, "controller", void 0);
72
+ this.controller = controller;
60
73
  }
61
- super.apply(compiler);
62
- }
63
74
  }
64
- // Annotate the CommonJS export names for ESM import in node:
65
- 0 && (module.exports = {
66
- RsdoctorWebpackMultiplePlugin
75
+ exports.RsdoctorWebpackMultiplePlugin = __webpack_exports__.RsdoctorWebpackMultiplePlugin;
76
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
77
+ "RsdoctorWebpackMultiplePlugin"
78
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
79
+ Object.defineProperty(exports, '__esModule', {
80
+ value: true
67
81
  });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,sBAAsB,EACtB,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAe,WAAW,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAa,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAKnE,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,SAAS,CAAC;AAQpE,qBAAa,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACtE,YAAW,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAElD,SAAgB,IAAI,2BAAiB;IAErC,SAAgB,OAAO,EAAE,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAEhE,SAAgB,GAAG,EAAE,WAAW,CAAC;IAEjC,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAEnC,YAAY,EAAE,WAAW,CAAC;IAE1B,cAAc,EAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,SAAS,CAAC,eAAe,UAAS;IAE3B,UAAU,EAAE,UAAU,CAAC;gBAElB,OAAO,CAAC,EAAE,4BAA4B,CAAC,KAAK,CAAC;IAwBzD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IA8D1B,YAAY,aAAc,QAAQ,KAAG,IAAI,CAoC9C;IAEK,SAAS,aAAoB,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAW1D;IAEF;;;;;OAKG;IACI,+BAA+B,CAAC,QAAQ,EAAE,QAAQ;IAIlD,IAAI,QAAa,OAAO,CAAC,IAAI,CAAC,CA0BnC;CACH"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,sBAAsB,EACtB,+BAA+B,EAC/B,4BAA4B,EAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAyB,WAAW,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAa,MAAM,EAAiB,MAAM,iBAAiB,CAAC;AAKnE,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,SAAS,CAAC;AAQpE,qBAAa,qBAAqB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACtE,YAAW,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAAC;IAElD,SAAgB,IAAI,2BAAiB;IAErC,SAAgB,OAAO,EAAE,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAEhE,SAAgB,GAAG,EAAE,WAAW,CAAC;IAEjC,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAEnC,YAAY,EAAE,WAAW,CAAC;IAE1B,cAAc,EAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,SAAS,CAAC,eAAe,UAAS;IAE3B,UAAU,EAAE,UAAU,CAAC;gBAElB,OAAO,CAAC,EAAE,4BAA4B,CAAC,KAAK,CAAC;IAwBzD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IA8D1B,YAAY,aAAc,QAAQ,KAAG,IAAI,CAqC9C;IAEK,SAAS,aAAoB,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAW1D;IAEF;;;;;OAKG;IACI,+BAA+B,CAAC,QAAQ,EAAE,QAAQ;IAIlD,IAAI,QAAa,OAAO,CAAC,IAAI,CAAC,CAgCnC;CACH"}
package/dist/plugin.js CHANGED
@@ -1,184 +1,178 @@
1
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 plugin_exports = {};
30
- __export(plugin_exports, {
31
- RsdoctorWebpackPlugin: () => RsdoctorWebpackPlugin
32
- });
33
- module.exports = __toCommonJS(plugin_exports);
34
- var import_plugins = require("@rsdoctor/core/plugins");
35
- var import_graph = require("@rsdoctor/graph");
36
- var import_sdk = require("@rsdoctor/sdk");
37
- var import_types = require("@rsdoctor/types");
38
- var import_build = require("@rsdoctor/utils/build");
39
- var import_logger = require("@rsdoctor/utils/logger");
40
- var import_lodash = require("lodash");
41
- var import_path = __toESM(require("path"));
42
- var import_constants = require("./constants");
43
- var import_resolver = require("./plugins/resolver");
44
- var import_plugins2 = require("@rsdoctor/core/plugins");
45
- var import_common = require("@rsdoctor/utils/common");
46
- var import_build_utils = require("@rsdoctor/core/build-utils");
47
- class RsdoctorWebpackPlugin {
48
- constructor(options) {
49
- this.name = import_constants.pluginTapName;
50
- this.browserIsOpened = false;
51
- this.afterPlugins = (compiler) => {
52
- if (compiler.isChild())
53
- return;
54
- const { plugins, infrastructureLogging, ...rest } = compiler.options;
55
- const _rest = (0, import_lodash.cloneDeep)(rest);
56
- (0, import_plugins.makeRulesSerializable)(_rest.module.defaultRules);
57
- (0, import_plugins.makeRulesSerializable)(_rest.module.rules);
58
- const configuration = {
59
- ..._rest,
60
- plugins: plugins.map((e) => e?.constructor.name)
61
- };
62
- const rspackVersion = compiler.webpack?.rspackVersion;
63
- const webpackVersion = compiler.webpack?.version;
64
- this.sdk.reportConfiguration({
65
- name: rspackVersion ? "rspack" : "webpack",
66
- version: rspackVersion || webpackVersion || "unknown",
67
- config: configuration
68
- });
69
- this.sdk.setOutputDir(
70
- import_path.default.resolve(
71
- this.options.output.reportDir || compiler.outputPath,
72
- `./${import_types.Constants.RsdoctorOutputFolder}`
73
- )
74
- );
75
- if (configuration.name) {
76
- this.sdk.setName(configuration.name);
77
- }
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
78
10
  };
79
- this.beforeRun = async (compiler) => {
80
- if (compiler.isChild())
81
- return;
82
- await this._bootstrapTask.then(() => {
83
- if (!this.options.disableClientServer && !this.browserIsOpened) {
84
- if (this.options.mode !== import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
85
- this.browserIsOpened = true;
86
- this.sdk.server.openClientPage();
87
- }
88
- }
89
- });
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
90
18
  };
91
- this.done = async () => {
92
- try {
93
- this.sdk.server.broadcast();
94
- (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[Before Write Manifest]");
95
- await this.sdk.writeStore();
96
- (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After Write Manifest]");
97
- if (this.options.disableClientServer) {
98
- await this.sdk.dispose();
99
- (0, import_logger.debug)(import_build.Process.getMemoryUsageMessage, "[After SDK Dispose]");
100
- } else if (this.options.mode === import_types.SDK.IMode[import_types.SDK.IMode.brief] && !this.options.disableClientServer) {
101
- const outputFilePath = import_path.default.resolve(
102
- this.sdk.outputDir,
103
- this.options.brief.reportHtmlName || "rsdoctor-report.html"
104
- );
105
- console.log(
106
- `${import_logger.chalk.green("[RSDOCTOR] generated brief report")}: ${outputFilePath}`
107
- );
108
- (0, import_sdk.openBrowser)(`file:///${outputFilePath}`);
109
- }
110
- } catch (e) {
111
- console.error(`[Rsdoctor] Webpack plugin this.done error`, e);
112
- }
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
113
31
  };
114
- this.options = (0, import_plugins.normalizeUserConfig)(options);
115
- this.sdk = this.options.sdkInstance ?? new import_sdk.RsdoctorSDK({
116
- port: this.options.port,
117
- name: import_constants.pluginTapName,
118
- root: process.cwd(),
119
- type: this.options.output.reportCodeType,
120
- config: {
121
- innerClientPath: this.options.innerClientPath,
122
- printLog: this.options.printLog,
123
- mode: this.options.mode,
124
- brief: this.options.brief,
125
- compressData: this.options.output.compressData
126
- }
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ RsdoctorWebpackPlugin: ()=>RsdoctorWebpackPlugin
37
+ });
38
+ const plugins_namespaceObject = require("@rsdoctor/core/plugins");
39
+ const graph_namespaceObject = require("@rsdoctor/graph");
40
+ const sdk_namespaceObject = require("@rsdoctor/sdk");
41
+ const types_namespaceObject = require("@rsdoctor/types");
42
+ const build_namespaceObject = require("@rsdoctor/utils/build");
43
+ const logger_namespaceObject = require("@rsdoctor/utils/logger");
44
+ const external_lodash_namespaceObject = require("lodash");
45
+ const external_path_namespaceObject = require("path");
46
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
47
+ const external_constants_js_namespaceObject = require("./constants.js");
48
+ const resolver_js_namespaceObject = require("./plugins/resolver.js");
49
+ const common_namespaceObject = require("@rsdoctor/utils/common");
50
+ const build_utils_namespaceObject = require("@rsdoctor/core/build-utils");
51
+ function _define_property(obj, key, value) {
52
+ if (key in obj) Object.defineProperty(obj, key, {
53
+ value: value,
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true
127
57
  });
128
- this.modulesGraph = new import_graph.ModuleGraph();
129
- this.chunkGraph = new import_graph.ChunkGraph();
130
- this.isRsdoctorPlugin = true;
131
- }
132
- apply(compiler) {
133
- if (!this._bootstrapTask) {
134
- this._bootstrapTask = this.sdk.bootstrap();
135
- }
136
- (0, import_plugins.setSDK)(this.sdk);
137
- new import_plugins.InternalSummaryPlugin(this).apply(compiler);
138
- if (this.options.features.loader) {
139
- new import_build_utils.Loader.ProbeLoaderPlugin().apply(compiler);
140
- this.sdk.addClientRoutes([
141
- import_types.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
142
- ]);
143
- if (!import_common.Loader.isVue(compiler)) {
144
- new import_plugins.InternalLoaderPlugin(this).apply(compiler);
145
- }
146
- }
147
- if (this.options.features.resolver) {
148
- new import_resolver.InternalResolverPlugin(this).apply(compiler);
58
+ else obj[key] = value;
59
+ return obj;
60
+ }
61
+ class RsdoctorWebpackPlugin {
62
+ apply(compiler) {
63
+ if (!this._bootstrapTask) this._bootstrapTask = this.sdk.bootstrap();
64
+ (0, plugins_namespaceObject.setSDK)(this.sdk);
65
+ new plugins_namespaceObject.InternalSummaryPlugin(this).apply(compiler);
66
+ if (this.options.features.loader) {
67
+ new build_utils_namespaceObject.Loader.ProbeLoaderPlugin().apply(compiler);
68
+ this.sdk.addClientRoutes([
69
+ types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
70
+ ]);
71
+ if (!common_namespaceObject.Loader.isVue(compiler)) new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler);
72
+ }
73
+ if (this.options.features.resolver) new resolver_js_namespaceObject.InternalResolverPlugin(this).apply(compiler);
74
+ if (this.options.features.plugins) new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler);
75
+ if (this.options.features.bundle) {
76
+ new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler);
77
+ new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler);
78
+ }
79
+ new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler);
80
+ new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler);
81
+ new plugins_namespaceObject.InternalProgressPlugin(this).apply(compiler);
82
+ compiler.hooks.afterPlugins.tap(external_constants_js_namespaceObject.pluginTapPostOptions, this.afterPlugins);
83
+ compiler.hooks.watchRun.tapPromise(external_constants_js_namespaceObject.pluginTapPostOptions, this.beforeRun);
84
+ compiler.hooks.beforeRun.tapPromise(external_constants_js_namespaceObject.pluginTapPostOptions, this.beforeRun);
85
+ compiler.hooks.done.tapPromise({
86
+ ...external_constants_js_namespaceObject.pluginTapPostOptions,
87
+ stage: external_constants_js_namespaceObject.pluginTapPostOptions.stage + 100
88
+ }, this.done.bind(this));
149
89
  }
150
- if (this.options.features.plugins) {
151
- new import_plugins.InternalPluginsPlugin(this).apply(compiler);
90
+ ensureModulesChunksGraphApplied(compiler) {
91
+ (0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
152
92
  }
153
- if (this.options.features.bundle) {
154
- new import_plugins.InternalBundlePlugin(this).apply(compiler);
155
- new import_plugins.InternalBundleTagPlugin(this).apply(compiler);
93
+ constructor(options){
94
+ _define_property(this, "name", external_constants_js_namespaceObject.pluginTapName);
95
+ _define_property(this, "options", void 0);
96
+ _define_property(this, "sdk", void 0);
97
+ _define_property(this, "isRsdoctorPlugin", void 0);
98
+ _define_property(this, "modulesGraph", void 0);
99
+ _define_property(this, "_bootstrapTask", void 0);
100
+ _define_property(this, "browserIsOpened", false);
101
+ _define_property(this, "chunkGraph", void 0);
102
+ _define_property(this, "afterPlugins", (compiler)=>{
103
+ var _compiler_webpack, _compiler_webpack1;
104
+ if (compiler.isChild()) return;
105
+ const { plugins, infrastructureLogging, ...rest } = compiler.options;
106
+ const _rest = (0, external_lodash_namespaceObject.cloneDeep)(rest);
107
+ (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.defaultRules);
108
+ (0, plugins_namespaceObject.makeRulesSerializable)(_rest.module.rules);
109
+ const configuration = {
110
+ ..._rest,
111
+ plugins: plugins.map((e)=>null == e ? void 0 : e.constructor.name)
112
+ };
113
+ const rspackVersion = null == (_compiler_webpack = compiler.webpack) ? void 0 : _compiler_webpack.rspackVersion;
114
+ const webpackVersion = null == (_compiler_webpack1 = compiler.webpack) ? void 0 : _compiler_webpack1.version;
115
+ this.sdk.reportConfiguration({
116
+ name: rspackVersion ? 'rspack' : 'webpack',
117
+ version: rspackVersion || webpackVersion || 'unknown',
118
+ config: configuration,
119
+ root: (0, sdk_namespaceObject.findRoot)() || ''
120
+ });
121
+ this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`));
122
+ if (configuration.name) this.sdk.setName(configuration.name);
123
+ });
124
+ _define_property(this, "beforeRun", async (compiler)=>{
125
+ if (compiler.isChild()) return;
126
+ await this._bootstrapTask.then(()=>{
127
+ if (!this.options.disableClientServer && !this.browserIsOpened) {
128
+ if (this.options.mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief]) {
129
+ this.browserIsOpened = true;
130
+ this.sdk.server.openClientPage();
131
+ }
132
+ }
133
+ });
134
+ });
135
+ _define_property(this, "done", async ()=>{
136
+ try {
137
+ this.sdk.server.broadcast();
138
+ logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`);
139
+ await this.sdk.writeStore();
140
+ logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Write Manifest]'`);
141
+ if (this.options.disableClientServer) {
142
+ await this.sdk.dispose();
143
+ logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`);
144
+ } else if (this.options.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] && !this.options.disableClientServer) {
145
+ const outputFilePath = external_path_default().resolve(this.sdk.outputDir, this.options.brief.reportHtmlName || 'rsdoctor-report.html');
146
+ console.log(`${logger_namespaceObject.chalk.green('[RSDOCTOR] generated brief report')}: ${outputFilePath}`);
147
+ (0, sdk_namespaceObject.openBrowser)(`file:///${outputFilePath}`);
148
+ }
149
+ } catch (e) {
150
+ console.error("[Rsdoctor] Webpack plugin this.done error", e);
151
+ }
152
+ });
153
+ this.options = (0, plugins_namespaceObject.normalizeUserConfig)(options);
154
+ this.sdk = this.options.sdkInstance ?? new sdk_namespaceObject.RsdoctorSDK({
155
+ port: this.options.port,
156
+ name: external_constants_js_namespaceObject.pluginTapName,
157
+ root: process.cwd(),
158
+ type: this.options.output.reportCodeType,
159
+ config: {
160
+ innerClientPath: this.options.innerClientPath,
161
+ printLog: this.options.printLog,
162
+ mode: this.options.mode,
163
+ brief: this.options.brief,
164
+ compressData: this.options.output.compressData
165
+ }
166
+ });
167
+ this.modulesGraph = new graph_namespaceObject.ModuleGraph();
168
+ this.chunkGraph = new graph_namespaceObject.ChunkGraph();
169
+ this.isRsdoctorPlugin = true;
156
170
  }
157
- new import_plugins.InternalErrorReporterPlugin(this).apply(compiler);
158
- new import_plugins.InternalRulesPlugin(this).apply(compiler);
159
- new import_plugins.InternalProgressPlugin(this).apply(compiler);
160
- compiler.hooks.afterPlugins.tap(import_constants.pluginTapPostOptions, this.afterPlugins);
161
- compiler.hooks.watchRun.tapPromise(import_constants.pluginTapPostOptions, this.beforeRun);
162
- compiler.hooks.beforeRun.tapPromise(import_constants.pluginTapPostOptions, this.beforeRun);
163
- compiler.hooks.done.tapPromise(
164
- {
165
- ...import_constants.pluginTapPostOptions,
166
- stage: import_constants.pluginTapPostOptions.stage + 100
167
- },
168
- this.done.bind(this)
169
- );
170
- }
171
- /**
172
- * @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
173
- * @param {Compiler} compiler
174
- * @return {*}
175
- * @memberof RsdoctorWebpackPlugin
176
- */
177
- ensureModulesChunksGraphApplied(compiler) {
178
- (0, import_plugins2.ensureModulesChunksGraphFn)(compiler, this);
179
- }
180
171
  }
181
- // Annotate the CommonJS export names for ESM import in node:
182
- 0 && (module.exports = {
183
- RsdoctorWebpackPlugin
172
+ exports.RsdoctorWebpackPlugin = __webpack_exports__.RsdoctorWebpackPlugin;
173
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
174
+ "RsdoctorWebpackPlugin"
175
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
176
+ Object.defineProperty(exports, '__esModule', {
177
+ value: true
184
178
  });
@@ -1,177 +1,187 @@
1
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 resolver_exports = {};
30
- __export(resolver_exports, {
31
- InternalResolverPlugin: () => InternalResolverPlugin,
32
- RsdoctorResolverPlugin: () => RsdoctorResolverPlugin
33
- });
34
- module.exports = __toCommonJS(resolver_exports);
35
- var import_plugins = require("@rsdoctor/core/plugins");
36
- var import_types = require("@rsdoctor/types");
37
- var import_common = require("@rsdoctor/utils/common");
38
- var import_path = __toESM(require("path"));
39
- class RsdoctorResolverPlugin {
40
- constructor(options, sdk) {
41
- this.options = options;
42
- this.sdk = sdk;
43
- this.tapOptions = {
44
- name: "RsdoctorResolverPlugin"
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
45
10
  };
46
- this.contextMap = /* @__PURE__ */ new Map();
47
- }
48
- getResolverData(context, params) {
49
- const ctx = this.contextMap.get(context.issuer);
50
- if (!ctx)
51
- return;
52
- const { request, query, result, error, stacks } = params;
53
- const [start, startHRTime] = ctx;
54
- const data = {
55
- isEntry: Boolean(context.issuer),
56
- issuerPath: context.issuer || "",
57
- request,
58
- startAt: start,
59
- endAt: import_common.Time.getCurrentTimestamp(start, startHRTime),
60
- pid: process.pid,
61
- ppid: process.ppid
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
62
18
  };
63
- if (query) {
64
- data.query = query;
65
- }
66
- if (result) {
67
- data.result = result;
68
- }
69
- if (error) {
70
- data.error = error;
71
- data.stacks = stacks || [];
72
- }
73
- return data;
74
- }
75
- getResolveStackData(request, path2, name = "anonymous") {
76
- const data = {
77
- name,
78
- // issuerPath: request.context.issuer,
79
- path: path2
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
80
31
  };
81
- const keys = [
82
- "request",
83
- "query",
84
- "fragment",
85
- "file",
86
- "module",
87
- "directory",
88
- "internal"
89
- ];
90
- keys.forEach((key) => {
91
- if (request[key]) {
92
- data[key] = request[key];
93
- }
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ InternalResolverPlugin: ()=>InternalResolverPlugin,
37
+ RsdoctorResolverPlugin: ()=>RsdoctorResolverPlugin
38
+ });
39
+ const plugins_namespaceObject = require("@rsdoctor/core/plugins");
40
+ const types_namespaceObject = require("@rsdoctor/types");
41
+ const common_namespaceObject = require("@rsdoctor/utils/common");
42
+ const external_path_namespaceObject = require("path");
43
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
44
+ function _define_property(obj, key, value) {
45
+ if (key in obj) Object.defineProperty(obj, key, {
46
+ value: value,
47
+ enumerable: true,
48
+ configurable: true,
49
+ writable: true
94
50
  });
95
- return data;
96
- }
97
- getResolveRequest(request, ctx) {
98
- if (request)
99
- return request;
100
- if (ctx?.stack) {
101
- const [target] = [...ctx.stack].map((e) => e.split(" ").map((e2) => e2.trim())).filter((e) => e.length > 2);
102
- if (target) {
103
- return target[target.length - 1];
104
- }
51
+ else obj[key] = value;
52
+ return obj;
53
+ }
54
+ class RsdoctorResolverPlugin {
55
+ getResolverData(context, params) {
56
+ const ctx = this.contextMap.get(context.issuer);
57
+ if (!ctx) return;
58
+ const { request, query, result, error, stacks } = params;
59
+ const [start, startHRTime] = ctx;
60
+ const data = {
61
+ isEntry: Boolean(context.issuer),
62
+ issuerPath: context.issuer || '',
63
+ request,
64
+ startAt: start,
65
+ endAt: common_namespaceObject.Time.getCurrentTimestamp(start, startHRTime),
66
+ pid: process.pid,
67
+ ppid: process.ppid
68
+ };
69
+ if (query) data.query = query;
70
+ if (result) data.result = result;
71
+ if (error) {
72
+ data.error = error;
73
+ data.stacks = stacks || [];
74
+ }
75
+ return data;
105
76
  }
106
- return "";
107
- }
108
- apply(resolver) {
109
- resolver.hooks.result.tap(this.tapOptions, (request, resolveCtx) => {
110
- const { context } = request;
111
- const ctx = this.contextMap.get(context.issuer);
112
- if (ctx) {
113
- const data = this.getResolverData(context, {
114
- request: this.getResolveRequest(request.request, resolveCtx),
115
- query: request.query,
116
- result: request.path
77
+ getResolveStackData(request, path, name = 'anonymous') {
78
+ const data = {
79
+ name,
80
+ path
81
+ };
82
+ const keys = [
83
+ 'request',
84
+ 'query',
85
+ 'fragment',
86
+ 'file',
87
+ 'module',
88
+ 'directory',
89
+ 'internal'
90
+ ];
91
+ keys.forEach((key)=>{
92
+ if (request[key]) data[key] = request[key];
117
93
  });
118
- data && this.sdk.reportResolver([data]);
119
- }
120
- });
121
- resolver.hooks.noResolve.tap(this.tapOptions, (request, error) => {
122
- const { context } = request;
123
- if (context.issuer) {
124
- const resolvedPaths = new Set(
125
- error.details.split("\n").map((e) => e.trim().split(" ")[0]).filter((e) => import_path.default.isAbsolute(e))
126
- );
127
- if (resolvedPaths.size) {
128
- if (this.contextMap.has(context.issuer)) {
129
- const stacks = [...resolvedPaths].map(
130
- (e) => this.getResolveStackData(
131
- request,
132
- e,
133
- "noResolve"
134
- )
135
- );
136
- const data = this.getResolverData(context, {
137
- request: this.getResolveRequest(request.request),
138
- query: request.query,
139
- error,
140
- stacks
141
- });
142
- data && this.sdk.reportResolver([data]);
143
- }
94
+ return data;
95
+ }
96
+ getResolveRequest(request, ctx) {
97
+ if (request) return request;
98
+ if (null == ctx ? void 0 : ctx.stack) {
99
+ const [target] = [
100
+ ...ctx.stack
101
+ ].map((e)=>e.split(' ').map((e)=>e.trim())).filter((e)=>e.length > 2);
102
+ if (target) return target[target.length - 1];
144
103
  }
145
- }
146
- });
147
- resolver.hooks.resolveStep.tap(this.tapOptions, (_, request) => {
148
- const { context } = request;
149
- if (context.issuer && !this.contextMap.has(context.issuer)) {
150
- this.contextMap.set(context.issuer, [Date.now(), process.hrtime()]);
151
- }
152
- });
153
- }
104
+ return '';
105
+ }
106
+ apply(resolver) {
107
+ resolver.hooks.result.tap(this.tapOptions, (request, resolveCtx)=>{
108
+ const { context } = request;
109
+ const ctx = this.contextMap.get(context.issuer);
110
+ if (ctx) {
111
+ const data = this.getResolverData(context, {
112
+ request: this.getResolveRequest(request.request, resolveCtx),
113
+ query: request.query,
114
+ result: request.path
115
+ });
116
+ data && this.sdk.reportResolver([
117
+ data
118
+ ]);
119
+ }
120
+ });
121
+ resolver.hooks.noResolve.tap(this.tapOptions, (request, error)=>{
122
+ const { context } = request;
123
+ if (context.issuer) {
124
+ const resolvedPaths = new Set(error.details.split('\n').map((e)=>e.trim().split(' ')[0]).filter((e)=>external_path_default().isAbsolute(e)));
125
+ if (resolvedPaths.size) {
126
+ if (this.contextMap.has(context.issuer)) {
127
+ const stacks = [
128
+ ...resolvedPaths
129
+ ].map((e)=>this.getResolveStackData(request, e, 'noResolve'));
130
+ const data = this.getResolverData(context, {
131
+ request: this.getResolveRequest(request.request),
132
+ query: request.query,
133
+ error,
134
+ stacks
135
+ });
136
+ data && this.sdk.reportResolver([
137
+ data
138
+ ]);
139
+ }
140
+ }
141
+ }
142
+ });
143
+ resolver.hooks.resolveStep.tap(this.tapOptions, (_, request)=>{
144
+ const { context } = request;
145
+ if (context.issuer && !this.contextMap.has(context.issuer)) this.contextMap.set(context.issuer, [
146
+ Date.now(),
147
+ process.hrtime()
148
+ ]);
149
+ });
150
+ }
151
+ constructor(options, sdk){
152
+ _define_property(this, "options", void 0);
153
+ _define_property(this, "sdk", void 0);
154
+ _define_property(this, "tapOptions", void 0);
155
+ _define_property(this, "contextMap", void 0);
156
+ this.options = options;
157
+ this.sdk = sdk;
158
+ this.tapOptions = {
159
+ name: 'RsdoctorResolverPlugin'
160
+ };
161
+ this.contextMap = new Map();
162
+ }
154
163
  }
155
- class InternalResolverPlugin extends import_plugins.InternalBasePlugin {
156
- constructor() {
157
- super(...arguments);
158
- this.name = "resolver";
159
- this.afterPlugins = (compiler) => {
160
- if (compiler.isChild())
161
- return;
162
- compiler.options.resolve.plugins = (compiler.options.resolve.plugins ?? []).concat(new RsdoctorResolverPlugin({}, this.sdk));
163
- this.sdk.addClientRoutes([
164
- import_types.Manifest.RsdoctorManifestClientRoutes.ModuleResolve
165
- ]);
166
- };
167
- }
168
- apply(compiler) {
169
- this.scheduler.ensureModulesChunksGraphApplied(compiler);
170
- compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins);
171
- }
164
+ class InternalResolverPlugin extends plugins_namespaceObject.InternalBasePlugin {
165
+ apply(compiler) {
166
+ this.scheduler.ensureModulesChunksGraphApplied(compiler);
167
+ compiler.hooks.afterPlugins.tap(this.tapPostOptions, this.afterPlugins);
168
+ }
169
+ constructor(...args){
170
+ super(...args), _define_property(this, "name", 'resolver'), _define_property(this, "afterPlugins", (compiler)=>{
171
+ if (compiler.isChild()) return;
172
+ compiler.options.resolve.plugins = (compiler.options.resolve.plugins ?? []).concat(new RsdoctorResolverPlugin({}, this.sdk));
173
+ this.sdk.addClientRoutes([
174
+ types_namespaceObject.Manifest.RsdoctorManifestClientRoutes.ModuleResolve
175
+ ]);
176
+ });
177
+ }
172
178
  }
173
- // Annotate the CommonJS export names for ESM import in node:
174
- 0 && (module.exports = {
175
- InternalResolverPlugin,
176
- RsdoctorResolverPlugin
179
+ exports.InternalResolverPlugin = __webpack_exports__.InternalResolverPlugin;
180
+ exports.RsdoctorResolverPlugin = __webpack_exports__.RsdoctorResolverPlugin;
181
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
182
+ "InternalResolverPlugin",
183
+ "RsdoctorResolverPlugin"
184
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
185
+ Object.defineProperty(exports, '__esModule', {
186
+ value: true
177
187
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/webpack-plugin",
3
- "version": "1.1.9",
3
+ "version": "1.2.0-beta.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -15,15 +15,16 @@
15
15
  "dependencies": {
16
16
  "fs-extra": "^11.1.1",
17
17
  "lodash": "^4.17.21",
18
- "@rsdoctor/core": "1.1.9",
19
- "@rsdoctor/graph": "1.1.9",
20
- "@rsdoctor/sdk": "1.1.9",
21
- "@rsdoctor/types": "1.1.9",
22
- "@rsdoctor/utils": "1.1.9"
18
+ "@rsdoctor/core": "1.2.0-beta.0",
19
+ "@rsdoctor/sdk": "1.2.0-beta.0",
20
+ "@rsdoctor/types": "1.2.0-beta.0",
21
+ "@rsdoctor/utils": "1.2.0-beta.0",
22
+ "@rsdoctor/graph": "1.2.0-beta.0"
23
23
  },
24
24
  "devDependencies": {
25
+ "@rslib/core": "^0.11.0",
25
26
  "@types/fs-extra": "^11.0.4",
26
- "@types/lodash": "^4.17.19",
27
+ "@types/lodash": "^4.17.20",
27
28
  "@types/node": "^22.8.1",
28
29
  "@types/tapable": "2.2.7",
29
30
  "tslib": "2.8.1",
@@ -40,8 +41,8 @@
40
41
  },
41
42
  "scripts": {
42
43
  "dev": "npm run start",
43
- "build": "modern build",
44
- "start": "modern build -w",
45
- "test": "vitest run"
44
+ "build": "rslib build",
45
+ "start": "rslib build -w",
46
+ "test": "rstest run"
46
47
  }
47
48
  }