@rsdoctor/rspack-plugin 0.3.12-alpha.0 → 0.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAcrE,OAAO,KAAK,EACV,4BAA4B,EAC5B,+BAA+B,EAC/B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,MAAM,EAGN,MAAM,EACP,MAAM,iBAAiB,CAAC;AAOzB,qBAAa,oBAAoB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACrE,YAAW,4BAA4B,CAAC,KAAK,CAAC;IAE9C,SAAgB,IAAI,0BAAiB;IAErC,SAAgB,GAAG,EAAE,kBAAkB,GAAG,gBAAgB,CAAC;IAE3D,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAEnC,cAAc,EAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEzC,SAAS,CAAC,eAAe,UAAS;IAE3B,YAAY,EAAE,WAAW,CAAC;IAE1B,OAAO,EAAE,+BAA+B,CAAC,KAAK,CAAC,CAAC;IAEhD,eAAe,EAAE,OAAO,CAAC;gBAEpB,OAAO,CAAC,EAAE,2BAA2B,CAAC,KAAK,CAAC;IA+BxD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IAgEjC;;;;;OAKG;IACI,+BAA+B,CACpC,QAAQ,EAAE,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC;IAKtC,IAAI,aACC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,KAC1C,OAAO,CAAC,IAAI,CAAC,CA6Bd;IAEK,eAAe,CAAC,QAAQ,EAAE,MAAM,C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");
40
40
  var import_lodash = require("lodash");
41
41
  var import_probeLoaderPlugin = require("./probeLoaderPlugin");
42
42
  var import_common = require("@rsdoctor/utils/common");
43
+ var import_logger = require("@rsdoctor/utils/logger");
43
44
  class RsdoctorRspackPlugin {
44
45
  constructor(options) {
45
46
  this.name = import_constants.pluginTapName;
@@ -53,17 +54,31 @@ class RsdoctorRspackPlugin {
53
54
  if (this.outsideInstance && "parent" in this.sdk) {
54
55
  this.sdk.parent.master.setOutputDir(
55
56
  import_path.default.resolve(
56
- compiler.outputPath,
57
+ this.options.reportDir || compiler.outputPath,
57
58
  `./${import_types.Constants.RsdoctorOutputFolder}`
58
59
  )
59
60
  );
60
61
  }
61
62
  this.sdk.setOutputDir(
62
- import_path.default.resolve(compiler.outputPath, `./${import_types.Constants.RsdoctorOutputFolder}`)
63
+ import_path.default.resolve(
64
+ this.options.reportDir || compiler.outputPath,
65
+ `./${import_types.Constants.RsdoctorOutputFolder}`
66
+ )
63
67
  );
64
68
  await this.sdk.writeStore();
65
69
  if (!this.options.disableClientServer) {
66
- await this.sdk.server.openClientPage("homepage");
70
+ if (this.options.mode === import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
71
+ const outputFilePath = import_path.default.resolve(
72
+ this.sdk.outputDir,
73
+ this.options.brief.reportHtmlName || "rsdoctor-report.html"
74
+ );
75
+ console.log(
76
+ `${import_logger.chalk.green("[RSDOCTOR] generated brief report")}: ${outputFilePath}`
77
+ );
78
+ (0, import_sdk.openBrowser)(`file:///${outputFilePath}`);
79
+ } else {
80
+ await this.sdk.server.openClientPage("homepage");
81
+ }
67
82
  }
68
83
  if (this.options.disableClientServer) {
69
84
  await this.sdk.dispose();
@@ -86,7 +101,9 @@ class RsdoctorRspackPlugin {
86
101
  config: {
87
102
  disableTOSUpload: this.options.disableTOSUpload,
88
103
  innerClientPath: this.options.innerClientPath,
89
- printLog: this.options.printLog
104
+ printLog: this.options.printLog,
105
+ mode: this.options.mode ? this.options.mode : void 0,
106
+ brief: this.options.brief
90
107
  }
91
108
  });
92
109
  this.outsideInstance = Boolean(this.options.sdkInstance);
@@ -111,16 +128,11 @@ class RsdoctorRspackPlugin {
111
128
  new import_plugins.InternalSummaryPlugin(this).apply(
112
129
  compiler
113
130
  );
114
- if (this.options.features.loader) {
131
+ if (this.options.features.loader && !import_common.Loader.isVue(compiler)) {
115
132
  new import_probeLoaderPlugin.ProbeLoaderPlugin().apply(compiler);
116
- this.sdk.addClientRoutes([
117
- import_types.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
118
- ]);
119
- if (!import_common.Loader.isVue(compiler)) {
120
- new import_plugins.InternalLoaderPlugin(this).apply(
121
- compiler
122
- );
123
- }
133
+ new import_plugins.InternalLoaderPlugin(this).apply(
134
+ compiler
135
+ );
124
136
  }
125
137
  if (this.options.features.plugins) {
126
138
  new import_plugins.InternalPluginsPlugin(this).apply(
@@ -166,7 +178,10 @@ class RsdoctorRspackPlugin {
166
178
  config: configuration
167
179
  });
168
180
  this.sdk.setOutputDir(
169
- import_path.default.resolve(compiler.outputPath, `./${import_types.Constants.RsdoctorOutputFolder}`)
181
+ import_path.default.resolve(
182
+ this.options.reportDir || compiler.outputPath,
183
+ `./${import_types.Constants.RsdoctorOutputFolder}`
184
+ )
170
185
  );
171
186
  }
172
187
  }
@@ -1 +1 @@
1
- {"version":3,"file":"probeLoaderPlugin.d.ts","sourceRoot":"","sources":["../src/probeLoaderPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAQzC,qBAAa,iBAAiB;IAC5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;IAoBnC,OAAO,CAAC,cAAc;CA0DvB"}
1
+ {"version":3,"file":"probeLoaderPlugin.d.ts","sourceRoot":"","sources":["../src/probeLoaderPlugin.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAOzC,qBAAa,iBAAiB;IAC5B,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,YAAY;IAoBnC,OAAO,CAAC,cAAc;CA+CvB"}
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(probeLoaderPlugin_exports);
34
34
  var import_build_utils = require("@rsdoctor/core/build-utils");
35
35
  var import_path = __toESM(require("path"));
36
36
  var import_core = require("@rsdoctor/core");
37
- var import_common = require("@rsdoctor/utils/common");
38
37
  const BuiltinLoaderName = "builtin:swc-loader";
39
38
  const ESMLoaderFile = ".mjs";
40
39
  class ProbeLoaderPlugin {
@@ -66,7 +65,6 @@ class ProbeLoaderPlugin {
66
65
  loader: import_path.default.join(__dirname, "./probeLoader.js"),
67
66
  options: {
68
67
  ..._options,
69
- ident: void 0,
70
68
  type: "end",
71
69
  builderName: compiler.options.name
72
70
  }
@@ -75,7 +73,6 @@ class ProbeLoaderPlugin {
75
73
  loader: import_path.default.join(__dirname, "./probeLoader.js"),
76
74
  options: {
77
75
  ..._options,
78
- ident: void 0,
79
76
  type: "start",
80
77
  builderName: compiler.options.name
81
78
  }
@@ -83,14 +80,6 @@ class ProbeLoaderPlugin {
83
80
  }
84
81
  return rule;
85
82
  };
86
- if (import_common.Loader.isVue(compiler)) {
87
- compiler.options.module.rules = import_build_utils.Utils.addProbeLoader2Rules(
88
- rules,
89
- appendRule,
90
- (r) => !!r.loader
91
- );
92
- return;
93
- }
94
83
  compiler.options.module.rules = import_build_utils.Utils.addProbeLoader2Rules(
95
84
  rules,
96
85
  appendRule,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/rspack-plugin",
3
- "version": "0.3.12-alpha.0",
3
+ "version": "0.4.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "loader-utils": "^2.0.4",
17
17
  "lodash": "^4.17.21",
18
- "@rsdoctor/core": "0.3.12-alpha.0",
19
- "@rsdoctor/graph": "0.3.12-alpha.0",
20
- "@rsdoctor/sdk": "0.3.12-alpha.0",
21
- "@rsdoctor/utils": "0.3.12-alpha.0",
22
- "@rsdoctor/types": "0.3.12-alpha.0"
18
+ "@rsdoctor/core": "0.4.0",
19
+ "@rsdoctor/graph": "0.4.0",
20
+ "@rsdoctor/sdk": "0.4.0",
21
+ "@rsdoctor/utils": "0.4.0",
22
+ "@rsdoctor/types": "0.4.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@rspack/core": "0.7.5",