@rsdoctor/rspack-plugin 0.3.1 → 0.3.3

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/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Compiler, Stats } from '@rspack/core';
1
+ import type { Compiler } from '@rspack/core';
2
2
  import { ModuleGraph } from '@rsdoctor/graph';
3
3
  import { RsdoctorSlaveSDK, RsdoctorWebpackSDK } from '@rsdoctor/sdk';
4
4
  import type { RsdoctorPluginInstance, RsdoctorPluginOptionsNormalized, RsdoctorRspackPluginOptions } from '@rsdoctor/core';
@@ -20,7 +20,7 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
20
20
  * @memberof RsdoctorWebpackPlugin
21
21
  */
22
22
  ensureModulesChunksGraphApplied(compiler: Compiler): void;
23
- done: (compiler: Compiler, stats: Stats) => Promise<void>;
24
- getRspackConfig(compiler: Compiler, version: string): void;
23
+ done: (compiler: Compiler) => Promise<void>;
24
+ getRspackConfig(compiler: Compiler): void;
25
25
  }
26
26
  //# sourceMappingURL=plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA8B,KAAK,EAAE,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAcrE,OAAO,KAAK,EACV,sBAAsB,EACtB,+BAA+B,EAC/B,2BAA2B,EAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,MAAM,EAIP,MAAM,iBAAiB,CAAC;AAOzB,qBAAa,oBAAoB,CAAC,KAAK,SAAS,MAAM,CAAC,cAAc,EAAE,CACrE,YAAW,sBAAsB,CAAC,QAAQ,EAAE,KAAK,CAA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AS,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;IAiBxD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IA+CjC;;;;;OAKG;IACI,+BAA+B,CAAC,QAAQ,EAAE,QAAQ;IAIlD,IAAI,aAAoB,QAAQ,KAAG,QAAQ,IAAI,CAAC,CA6BrD;IAEK,eAAe,CAAC,QAAQ,EAAE,QAAQ;CA2B1C"}
package/dist/plugin.js CHANGED
@@ -44,18 +44,8 @@ class RsdoctorRspackPlugin {
44
44
  constructor(options) {
45
45
  this.name = import_constants.pluginTapName;
46
46
  this.browserIsOpened = false;
47
- this.done = async (compiler, stats) => {
48
- const json = stats.toJson({
49
- all: false,
50
- version: true,
51
- chunks: true,
52
- modules: true,
53
- chunkModules: true,
54
- assets: true,
55
- builtAt: true,
56
- chunkRelations: true
57
- });
58
- this.getRspackConfig(compiler, json.rspackVersion || "");
47
+ this.done = async (compiler) => {
48
+ this.getRspackConfig(compiler);
59
49
  await this.sdk.bootstrap();
60
50
  this.sdk.addClientRoutes([
61
51
  import_types.Manifest.RsdoctorManifestClientRoutes.Overall
@@ -81,9 +71,10 @@ class RsdoctorRspackPlugin {
81
71
  };
82
72
  this.options = (0, import_plugins.normalizeUserConfig)(options);
83
73
  this.sdk = this.options.sdkInstance ?? new import_sdk.RsdoctorWebpackSDK({
74
+ port: this.options.port,
84
75
  name: import_constants.pluginTapName,
85
76
  root: process.cwd(),
86
- type: import_types.SDK.ToDataType.Normal,
77
+ type: this.options.reportCodeType,
87
78
  config: { disableTOSUpload: this.options.disableTOSUpload },
88
79
  innerClientPath: this.options.innerClientPath
89
80
  });
@@ -129,7 +120,7 @@ class RsdoctorRspackPlugin {
129
120
  ensureModulesChunksGraphApplied(compiler) {
130
121
  (0, import_plugins.ensureModulesChunksGraphFn)(compiler, this);
131
122
  }
132
- getRspackConfig(compiler, version) {
123
+ getRspackConfig(compiler) {
133
124
  if (compiler.isChild())
134
125
  return;
135
126
  const { plugins, infrastructureLogging, ...rest } = compiler.options;
@@ -140,9 +131,11 @@ class RsdoctorRspackPlugin {
140
131
  ..._rest,
141
132
  plugins: plugins.map((e) => e?.constructor.name)
142
133
  };
134
+ const rspackVersion = compiler.webpack?.rspackVersion;
135
+ const webpackVersion = compiler.webpack?.version;
143
136
  this.sdk.reportConfiguration({
144
- name: "rspack",
145
- version: version || "unknown",
137
+ name: rspackVersion ? "rspack" : "webpack",
138
+ version: rspackVersion || webpackVersion || "unknown",
146
139
  config: configuration
147
140
  });
148
141
  this.sdk.setOutputDir(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/rspack-plugin",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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.1",
19
- "@rsdoctor/graph": "0.3.1",
20
- "@rsdoctor/sdk": "0.3.1",
21
- "@rsdoctor/utils": "0.3.1",
22
- "@rsdoctor/types": "0.3.1"
18
+ "@rsdoctor/core": "0.3.3",
19
+ "@rsdoctor/graph": "0.3.3",
20
+ "@rsdoctor/sdk": "0.3.3",
21
+ "@rsdoctor/utils": "0.3.3",
22
+ "@rsdoctor/types": "0.3.3"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@rspack/core": "0.6.5",
@@ -31,7 +31,7 @@
31
31
  "typescript": "^5.2.2"
32
32
  },
33
33
  "peerDependencies": {
34
- "@rspack/core": "^0.6.5"
34
+ "@rspack/core": "0.x"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public",