@rsdoctor/webpack-plugin 0.3.12-alpha.0 → 0.4.1

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":"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,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAa,MAAM,EAAY,MAAM,iBAAiB,CAAC;AAK9D,OAAO,KAAK,EAAE,QAAQ,EAA8B,MAAM,SAAS,CAAC;AAOpE,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,kBAAkB,CAAC;IAExC,SAAgB,gBAAgB,EAAE,OAAO,CAAC;IAEnC,YAAY,EAAE,WAAW,CAAC;IAEjC,OAAO,CAAC,eAAe,CAAS;IAEzB,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;IAsBzD,KAAK,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO;IA8D1B,YAAY,aAAc,QAAQ,KAAG,IAAI,CAiC9C;IAEK,SAAS,aAAoB,QAAQ,KAAG,OAAO,CAAC,IAAI,CAAC,CAS1D;IAEF;;;;;OAKG;IACI,+BAA+B,CAAC,Q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CA0BnC;CACH"}
package/dist/plugin.js CHANGED
@@ -67,7 +67,10 @@ class RsdoctorWebpackPlugin {
67
67
  config: configuration
68
68
  });
69
69
  this.sdk.setOutputDir(
70
- import_path.default.resolve(compiler.outputPath, `./${import_types.Constants.RsdoctorOutputFolder}`)
70
+ import_path.default.resolve(
71
+ this.options.reportDir || compiler.outputPath,
72
+ `./${import_types.Constants.RsdoctorOutputFolder}`
73
+ )
71
74
  );
72
75
  if (configuration.name) {
73
76
  this.sdk.setName(configuration.name);
@@ -78,8 +81,10 @@ class RsdoctorWebpackPlugin {
78
81
  return;
79
82
  await this._bootstrapTask.then(() => {
80
83
  if (!this.options.disableClientServer && !this.browserIsOpened) {
81
- this.browserIsOpened = true;
82
- this.sdk.server.openClientPage();
84
+ if (this.options.mode !== import_types.SDK.IMode[import_types.SDK.IMode.brief]) {
85
+ this.browserIsOpened = true;
86
+ this.sdk.server.openClientPage();
87
+ }
83
88
  }
84
89
  });
85
90
  };
@@ -92,8 +97,18 @@ class RsdoctorWebpackPlugin {
92
97
  if (this.options.disableClientServer) {
93
98
  await this.sdk.dispose();
94
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}`);
95
109
  }
96
110
  } catch (e) {
111
+ console.error(`[Rsdoctor] Webpack plugin this.done error`, e);
97
112
  }
98
113
  };
99
114
  this.options = (0, import_plugins.normalizeUserConfig)(options);
@@ -105,7 +120,9 @@ class RsdoctorWebpackPlugin {
105
120
  config: {
106
121
  disableTOSUpload: this.options.disableTOSUpload,
107
122
  innerClientPath: this.options.innerClientPath,
108
- printLog: this.options.printLog
123
+ printLog: this.options.printLog,
124
+ mode: this.options.mode ? this.options.mode : void 0,
125
+ brief: this.options.brief
109
126
  }
110
127
  });
111
128
  this.outsideInstance = Boolean(this.options.sdkInstance);
@@ -128,14 +145,7 @@ class RsdoctorWebpackPlugin {
128
145
  new import_resolver.InternalResolverPlugin(this).apply(compiler);
129
146
  }
130
147
  if (this.options.features.plugins) {
131
- if (import_common.Loader.isVue(compiler)) {
132
- this.sdk.addClientRoutes([
133
- import_types.Manifest.RsdoctorManifestClientRoutes.WebpackLoaders
134
- ]);
135
- new import_plugins.InternalLoaderPlugin(this).apply(compiler);
136
- } else {
137
- new import_plugins.InternalPluginsPlugin(this).apply(compiler);
138
- }
148
+ new import_plugins.InternalPluginsPlugin(this).apply(compiler);
139
149
  }
140
150
  if (this.options.features.bundle) {
141
151
  new import_plugins.InternalBundlePlugin(this).apply(compiler);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/webpack-plugin",
3
- "version": "0.3.12-alpha.0",
3
+ "version": "0.4.1",
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
  "fs-extra": "^11.1.1",
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/types": "0.3.12-alpha.0",
22
- "@rsdoctor/utils": "0.3.12-alpha.0"
18
+ "@rsdoctor/sdk": "0.4.1",
19
+ "@rsdoctor/types": "0.4.1",
20
+ "@rsdoctor/graph": "0.4.1",
21
+ "@rsdoctor/core": "0.4.1",
22
+ "@rsdoctor/utils": "0.4.1"
23
23
  },
24
24
  "devDependencies": {
25
25
  "webpack": "^5.89.0",