@rsdoctor/webpack-plugin 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,11 +1,38 @@
1
- # Rsdoctor
1
+ # Rsdoctor plugin
2
2
 
3
- Rsdoctor is a tool for diagnosing and analyzing the build process and build artifacts to help developers quickly identify and solve problems.
3
+ This Rsdoctor plugin is an analysis plugin for the Webpack builder.
4
4
 
5
- It also supports Webpack and Rspack builders, as well as various build frameworks, such as Rsbuild.
5
+ ## features
6
+
7
+ - Rsdoctor is a one-stop tool for diagnosing and analyzing the build process and build artifacts.
8
+ - Rsdoctor is a tool that supports Webpack and Rspack build analysis.
9
+ - Rsdoctor is an analysis tool that can display the time-consuming and behavioral details of the compilation.
10
+ - Rsdoctor is a tool that provides bundle Diff and other anti-degradation capabilities simultaneously.
11
+
12
+ ## Note
13
+
14
+ This plugin is used by the `Webpack` repo to open Rsdoctor, [Quik Start](https://rsdoctor.dev/guide/start/quick-start).
15
+
16
+ Initialize the RsdoctorWebpackPlugin plugin in the [plugins](https://webpack.js.org/configuration/plugins/#plugins) section of the `webpack.config.js` file, as shown below:
17
+
18
+ ```js title="webpack.config.js"
19
+ const { RsdoctorWebpackPlugin } = require('@rsdoctor/webpack-plugin');
20
+
21
+ module.exports = {
22
+ // ...
23
+ plugins: [
24
+ process.env.RSDOCTOR &&
25
+ new RsdoctorWebpackPlugin({
26
+ // options
27
+ }),
28
+ ].filter(Boolean),
29
+ };
30
+ ```
6
31
 
7
32
  ## Documentation
8
33
 
34
+ https://rsdoctor.dev/
35
+
9
36
  ## Contributing
10
37
 
11
38
  Please read the [Contributing Guide](https://github.com/web-infra-dev/rsdoctor/blob/main/CONTRIBUTING.md).
@@ -3,4 +3,4 @@ export declare const pluginTapName = "RsdoctorWebpackPlugin";
3
3
  export declare const pluginTapPostOptions: Tap;
4
4
  export declare const pluginTapPreOptions: Tap;
5
5
  export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
6
- export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
6
+ export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './plugin';
2
2
  export * from './multiple';
3
- export { defineRule, LinterType } from '@rsdoctor/core/rules';
3
+ export { defineRule, LinterType } from '@rsdoctor/core/rules';
@@ -2,6 +2,6 @@ import type { Linter } from '@rsdoctor/types';
2
2
  import type { RsdoctorWebpackMultiplePluginOptions } from '@rsdoctor/core';
3
3
  import { RsdoctorWebpackPlugin } from './plugin';
4
4
  export declare class RsdoctorWebpackMultiplePlugin<Rules extends Linter.ExtendRuleData[]> extends RsdoctorWebpackPlugin<Rules> {
5
- private controller;
6
- constructor(options?: RsdoctorWebpackMultiplePluginOptions<Rules>);
7
- }
5
+ private controller;
6
+ constructor(options?: RsdoctorWebpackMultiplePluginOptions<Rules>);
7
+ }
package/dist/plugin.d.ts CHANGED
@@ -4,24 +4,24 @@ import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
4
4
  import { Linter } from '@rsdoctor/types';
5
5
  import type { Compiler } from 'webpack';
6
6
  export declare class RsdoctorWebpackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorPluginInstance<Compiler, Rules> {
7
- readonly name = "RsdoctorWebpackPlugin";
8
- readonly options: RsdoctorPluginOptionsNormalized<Rules>;
9
- readonly sdk: RsdoctorWebpackSDK;
10
- modulesGraph: ModuleGraph;
11
- private outsideInstance;
12
- _bootstrapTask: Promise<unknown>;
13
- protected browserIsOpened: boolean;
14
- chunkGraph: ChunkGraph;
15
- constructor(options?: RsdoctorWebpackPluginOptions<Rules>);
16
- apply(compiler: unknown): unknown;
17
- afterPlugins: (compiler: Compiler) => void;
18
- beforeRun: (compiler: Compiler) => Promise<void>;
19
- /**
20
- * @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
21
- * @param {Compiler} compiler
22
- * @return {*}
23
- * @memberof RsdoctorWebpackPlugin
24
- */
25
- ensureModulesChunksGraphApplied(compiler: Compiler): void;
26
- done: () => Promise<void>;
27
- }
7
+ readonly name = "RsdoctorWebpackPlugin";
8
+ readonly options: RsdoctorPluginOptionsNormalized<Rules>;
9
+ readonly sdk: RsdoctorWebpackSDK;
10
+ modulesGraph: ModuleGraph;
11
+ private outsideInstance;
12
+ _bootstrapTask: Promise<unknown>;
13
+ protected browserIsOpened: boolean;
14
+ chunkGraph: ChunkGraph;
15
+ constructor(options?: RsdoctorWebpackPluginOptions<Rules>);
16
+ apply(compiler: unknown): unknown;
17
+ afterPlugins: (compiler: Compiler) => void;
18
+ beforeRun: (compiler: Compiler) => Promise<void>;
19
+ /**
20
+ * @description Generate ModuleGraph and ChunkGraph from stats and webpack module apis;
21
+ * @param {Compiler} compiler
22
+ * @return {*}
23
+ * @memberof RsdoctorWebpackPlugin
24
+ */
25
+ ensureModulesChunksGraphApplied(compiler: Compiler): void;
26
+ done: () => Promise<void>;
27
+ }
@@ -2,36 +2,37 @@ import { InternalBasePlugin } from '@rsdoctor/core/plugins';
2
2
  import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
3
3
  import { SDK } from '@rsdoctor/types';
4
4
  import type { Compiler, ResolvePluginInstance, Resolver } from 'webpack';
5
- interface RsdoctorResolverPluginOptions {}
5
+ interface RsdoctorResolverPluginOptions {
6
+ }
6
7
  interface ResolveRequestContext {
7
- issuer: string;
8
+ issuer: string;
8
9
  }
9
10
  interface ResolveRequestWithContext {
10
- [key: string]: unknown;
11
- context: ResolveRequestContext;
11
+ [key: string]: unknown;
12
+ context: ResolveRequestContext;
12
13
  }
13
14
  export declare class RsdoctorResolverPlugin implements ResolvePluginInstance {
14
- protected options: RsdoctorResolverPluginOptions;
15
- protected sdk: RsdoctorWebpackSDK;
16
- protected tapOptions: {
17
- name: string;
18
- };
19
- protected contextMap: Map<string, [number, [number, number]]>;
20
- constructor(options: RsdoctorResolverPluginOptions, sdk: RsdoctorWebpackSDK);
21
- protected getResolverData(context: ResolveRequestContext, params: {
22
- request: string;
23
- query?: string;
24
- result?: string;
25
- error?: Error;
26
- stacks?: SDK.ResolveStackData[];
27
- }): SDK.PathResolverData | undefined;
28
- protected getResolveStackData(request: ResolveRequestWithContext, path: string, name?: string): SDK.ResolveStackData;
29
- protected getResolveRequest(request: string | undefined, ctx?: Parameters<Resolver['resolve']>[3]): string;
30
- apply(resolver: Resolver): void;
15
+ protected options: RsdoctorResolverPluginOptions;
16
+ protected sdk: RsdoctorWebpackSDK;
17
+ protected tapOptions: {
18
+ name: string;
19
+ };
20
+ protected contextMap: Map<string, [number, [number, number]]>;
21
+ constructor(options: RsdoctorResolverPluginOptions, sdk: RsdoctorWebpackSDK);
22
+ protected getResolverData(context: ResolveRequestContext, params: {
23
+ request: string;
24
+ query?: string;
25
+ result?: string;
26
+ error?: Error;
27
+ stacks?: SDK.ResolveStackData[];
28
+ }): SDK.PathResolverData | undefined;
29
+ protected getResolveStackData(request: ResolveRequestWithContext, path: string, name?: string): SDK.ResolveStackData;
30
+ protected getResolveRequest(request: string | undefined, ctx?: Parameters<Resolver['resolve']>[3]): string;
31
+ apply(resolver: Resolver): void;
31
32
  }
32
33
  export declare class InternalResolverPlugin extends InternalBasePlugin<Compiler> {
33
- readonly name = "resolver";
34
- apply(compiler: Compiler): void;
35
- afterPlugins: (compiler: Compiler) => void;
34
+ readonly name = "resolver";
35
+ apply(compiler: Compiler): void;
36
+ afterPlugins: (compiler: Compiler) => void;
36
37
  }
37
- export {};
38
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/webpack-plugin",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -16,10 +16,10 @@
16
16
  "fs-extra": "^11.1.1",
17
17
  "lodash": "^4.17.21",
18
18
  "webpack": "^5.89.0",
19
- "@rsdoctor/core": "0.1.0",
20
- "@rsdoctor/utils": "0.1.0",
21
- "@rsdoctor/graph": "0.1.0",
22
- "@rsdoctor/sdk": "0.1.0"
19
+ "@rsdoctor/core": "0.1.2",
20
+ "@rsdoctor/sdk": "0.1.2",
21
+ "@rsdoctor/graph": "0.1.2",
22
+ "@rsdoctor/utils": "0.1.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/fs-extra": "^11.0.2",
@@ -29,7 +29,7 @@
29
29
  "@types/webpack": "5.28.0",
30
30
  "tslib": "2.4.1",
31
31
  "typescript": "^5.2.2",
32
- "@rsdoctor/types": "0.1.0"
32
+ "@rsdoctor/types": "0.1.2"
33
33
  },
34
34
  "publishConfig": {
35
35
  "access": "public",