@rsdoctor/webpack-plugin 1.3.5 → 1.3.6

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/index.cjs CHANGED
@@ -148,6 +148,7 @@ class RsdoctorWebpackPlugin {
148
148
  _bootstrapTask;
149
149
  browserIsOpened = !1;
150
150
  chunkGraph;
151
+ outsideInstance;
151
152
  constructor(options){
152
153
  this.options = (0, plugins_namespaceObject.normalizeUserConfig)(options);
153
154
  const { port, output, innerClientPath, printLog, sdkInstance } = this.options;
@@ -170,7 +171,7 @@ class RsdoctorWebpackPlugin {
170
171
  ]), common_namespaceObject.Loader.isVue(compiler) || new plugins_namespaceObject.InternalLoaderPlugin(this).apply(compiler)), this.options.features.resolver && new InternalResolverPlugin(this).apply(compiler), this.options.features.plugins && new plugins_namespaceObject.InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new plugins_namespaceObject.InternalBundlePlugin(this).apply(compiler), new plugins_namespaceObject.InternalBundleTagPlugin(this).apply(compiler)), new plugins_namespaceObject.InternalErrorReporterPlugin(this).apply(compiler), new plugins_namespaceObject.InternalRulesPlugin(this).apply(compiler), new plugins_namespaceObject.InternalProgressPlugin(this).apply(compiler), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins), compiler.hooks.watchRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.beforeRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.done.tapPromise({
171
172
  ...pluginTapPostOptions,
172
173
  stage: pluginTapPostOptions.stage + 100
173
- }, this.done.bind(this));
174
+ }, this.done.bind(this, compiler));
174
175
  }
175
176
  afterPlugins = (compiler)=>{
176
177
  if (compiler.isChild()) return;
@@ -190,9 +191,9 @@ class RsdoctorWebpackPlugin {
190
191
  ensureModulesChunksGraphApplied(compiler) {
191
192
  (0, plugins_namespaceObject.ensureModulesChunksGraphFn)(compiler, this);
192
193
  }
193
- done = async ()=>{
194
+ done = async (compiler)=>{
194
195
  try {
195
- this.sdk.server.broadcast(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), await this.sdk.writeStore(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer ? (await this.sdk.dispose(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || this.options.disableClientServer || (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer);
196
+ this.sdk.server.broadcast(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(external_path_default().resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] ? '' : `./${types_namespaceObject.Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer ? (await this.sdk.dispose(), logger_namespaceObject.logger.debug(`${build_namespaceObject.Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== types_namespaceObject.SDK.IMode[types_namespaceObject.SDK.IMode.brief] || this.options.disableClientServer || (0, plugins_namespaceObject.handleBriefModeReport)(this.sdk, this.options, this.options.disableClientServer);
196
197
  } catch (e) {
197
198
  console.error("[Rsdoctor] Webpack plugin this.done error", e);
198
199
  }
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Loader } from "@rsdoctor/core/build-utils";
3
3
  import { InternalBasePlugin, InternalBundlePlugin, InternalBundleTagPlugin, InternalErrorReporterPlugin, InternalLoaderPlugin, InternalPluginsPlugin, InternalProgressPlugin, InternalRulesPlugin, InternalSummaryPlugin, ensureModulesChunksGraphFn, handleBriefModeReport, normalizeUserConfig, processCompilerConfig, setSDK } from "@rsdoctor/core/plugins";
4
4
  import { ChunkGraph, ModuleGraph } from "@rsdoctor/graph";
5
5
  import { RsdoctorSDK, RsdoctorSDKController, findRoot } from "@rsdoctor/sdk";
6
- import { Manifest, SDK } from "@rsdoctor/types";
6
+ import { Constants, Manifest, SDK } from "@rsdoctor/types";
7
7
  import { Process } from "@rsdoctor/utils/build";
8
8
  import { Loader as common_Loader, Time } from "@rsdoctor/utils/common";
9
9
  import { logger } from "@rsdoctor/utils/logger";
@@ -124,6 +124,7 @@ class RsdoctorWebpackPlugin {
124
124
  _bootstrapTask;
125
125
  browserIsOpened = !1;
126
126
  chunkGraph;
127
+ outsideInstance;
127
128
  constructor(options){
128
129
  this.options = normalizeUserConfig(options);
129
130
  let { port, output, innerClientPath, printLog, sdkInstance } = this.options;
@@ -146,7 +147,7 @@ class RsdoctorWebpackPlugin {
146
147
  ]), common_Loader.isVue(compiler) || new InternalLoaderPlugin(this).apply(compiler)), this.options.features.resolver && new InternalResolverPlugin(this).apply(compiler), this.options.features.plugins && new InternalPluginsPlugin(this).apply(compiler), this.options.features.bundle && (new InternalBundlePlugin(this).apply(compiler), new InternalBundleTagPlugin(this).apply(compiler)), new InternalErrorReporterPlugin(this).apply(compiler), new InternalRulesPlugin(this).apply(compiler), new InternalProgressPlugin(this).apply(compiler), compiler.hooks.afterPlugins.tap(pluginTapPostOptions, this.afterPlugins), compiler.hooks.watchRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.beforeRun.tapPromise(pluginTapPostOptions, this.beforeRun), compiler.hooks.done.tapPromise({
147
148
  ...pluginTapPostOptions,
148
149
  stage: pluginTapPostOptions.stage + 100
149
- }, this.done.bind(this));
150
+ }, this.done.bind(this, compiler));
150
151
  }
151
152
  afterPlugins = (compiler)=>{
152
153
  if (compiler.isChild()) return;
@@ -166,9 +167,9 @@ class RsdoctorWebpackPlugin {
166
167
  ensureModulesChunksGraphApplied(compiler) {
167
168
  ensureModulesChunksGraphFn(compiler, this);
168
169
  }
169
- done = async ()=>{
170
+ done = async (compiler)=>{
170
171
  try {
171
- this.sdk.server.broadcast(), logger.debug(`${Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), await this.sdk.writeStore(), logger.debug(`${Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer ? (await this.sdk.dispose(), logger.debug(`${Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== SDK.IMode[SDK.IMode.brief] || this.options.disableClientServer || handleBriefModeReport(this.sdk, this.options, this.options.disableClientServer);
172
+ this.sdk.server.broadcast(), logger.debug(`${Process.getMemoryUsageMessage()}, '[Before Write Manifest]'`), this.outsideInstance && 'parent' in this.sdk && this.sdk.parent.master.setOutputDir(path_0.resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? '' : `./${Constants.RsdoctorOutputFolder}`)), this.sdk.setOutputDir(path_0.resolve(this.options.output.reportDir || compiler.outputPath, this.options.output.mode === SDK.IMode[SDK.IMode.brief] ? '' : `./${Constants.RsdoctorOutputFolder}`)), await this.sdk.writeStore(), logger.debug(`${Process.getMemoryUsageMessage()}, '[After Write Manifest]'`), this.options.disableClientServer ? (await this.sdk.dispose(), logger.debug(`${Process.getMemoryUsageMessage()}, '[After SDK Dispose]'`)) : this.options.output.mode !== SDK.IMode[SDK.IMode.brief] || this.options.disableClientServer || handleBriefModeReport(this.sdk, this.options, this.options.disableClientServer);
172
173
  } catch (e) {
173
174
  console.error("[Rsdoctor] Webpack plugin this.done error", e);
174
175
  }
package/dist/plugin.d.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  import type { RsdoctorPluginInstance } from '@rsdoctor/core/types';
2
2
  import { ChunkGraph, ModuleGraph } from '@rsdoctor/graph';
3
+ import { RsdoctorPrimarySDK } from '@rsdoctor/sdk';
3
4
  import { Linter, SDK, Plugin } from '@rsdoctor/types';
4
5
  import type { Compiler } from 'webpack';
5
6
  export declare class RsdoctorWebpackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorPluginInstance<Compiler, Rules> {
6
7
  readonly name = "RsdoctorWebpackPlugin";
7
8
  readonly options: Plugin.RsdoctorPluginOptionsNormalized<Rules>;
8
- readonly sdk: SDK.RsdoctorBuilderSDKInstance;
9
+ readonly sdk: SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK;
9
10
  readonly isRsdoctorPlugin: boolean;
10
11
  modulesGraph: ModuleGraph;
11
12
  _bootstrapTask: Promise<unknown>;
12
13
  protected browserIsOpened: boolean;
13
14
  chunkGraph: ChunkGraph;
15
+ outsideInstance: boolean | undefined;
14
16
  constructor(options?: Plugin.RsdoctorWebpackPluginOptions<Rules>);
15
17
  apply(compiler: unknown): unknown;
16
18
  afterPlugins: (compiler: Compiler) => void;
@@ -22,5 +24,5 @@ export declare class RsdoctorWebpackPlugin<Rules extends Linter.ExtendRuleData[]
22
24
  * @memberof RsdoctorWebpackPlugin
23
25
  */
24
26
  ensureModulesChunksGraphApplied(compiler: Compiler): void;
25
- done: () => Promise<void>;
27
+ done: (compiler: Plugin.BaseCompilerType<"webpack">) => Promise<void>;
26
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/webpack-plugin",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -21,11 +21,11 @@
21
21
  }
22
22
  },
23
23
  "dependencies": {
24
- "@rsdoctor/core": "1.3.5",
25
- "@rsdoctor/sdk": "1.3.5",
26
- "@rsdoctor/graph": "1.3.5",
27
- "@rsdoctor/types": "1.3.5",
28
- "@rsdoctor/utils": "1.3.5"
24
+ "@rsdoctor/core": "1.3.6",
25
+ "@rsdoctor/sdk": "1.3.6",
26
+ "@rsdoctor/types": "1.3.6",
27
+ "@rsdoctor/utils": "1.3.6",
28
+ "@rsdoctor/graph": "1.3.6"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^22.8.1",