@rsdoctor/core 0.1.1 → 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.
Files changed (74) hide show
  1. package/dist/build-utils/build/chunks/assetsModules.d.ts +2 -2
  2. package/dist/build-utils/build/chunks/chunkTransform.d.ts +2 -2
  3. package/dist/build-utils/build/chunks/generateTileGraph.d.ts +5 -5
  4. package/dist/build-utils/build/chunks/generateTileGraph.js +3 -9
  5. package/dist/build-utils/build/chunks/index.d.ts +1 -1
  6. package/dist/build-utils/build/index.d.ts +1 -1
  7. package/dist/build-utils/build/module-graph/index.d.ts +1 -1
  8. package/dist/build-utils/build/module-graph/parser.d.ts +1 -1
  9. package/dist/build-utils/build/module-graph/transform.d.ts +1 -1
  10. package/dist/build-utils/build/module-graph/treeShaking.d.ts +1 -1
  11. package/dist/build-utils/build/module-graph/utils.d.ts +1 -1
  12. package/dist/build-utils/build/module-graph/webpack/transform.d.ts +4 -4
  13. package/dist/build-utils/build/utils/index.d.ts +1 -1
  14. package/dist/build-utils/build/utils/loader.d.ts +7 -7
  15. package/dist/build-utils/build/utils/parseBundle.d.ts +2 -2
  16. package/dist/build-utils/build/utils/plugin.d.ts +1 -1
  17. package/dist/build-utils/common/chunks/assetsContent.d.ts +2 -2
  18. package/dist/build-utils/common/chunks/assetsModules.d.ts +8 -8
  19. package/dist/build-utils/common/chunks/chunkTransform.d.ts +2 -2
  20. package/dist/build-utils/common/chunks/index.d.ts +1 -1
  21. package/dist/build-utils/common/index.d.ts +1 -1
  22. package/dist/build-utils/common/module-graph/compatible.d.ts +1 -1
  23. package/dist/build-utils/common/module-graph/index.d.ts +1 -1
  24. package/dist/build-utils/common/module-graph/transform.d.ts +1 -4
  25. package/dist/build-utils/common/module-graph/utils.d.ts +3 -5
  26. package/dist/build-utils/common/trans-utils/index.d.ts +1 -1
  27. package/dist/build-utils/common/trans-utils/transStats.d.ts +3 -3
  28. package/dist/build-utils/common/webpack/compatible.d.ts +2 -2
  29. package/dist/build-utils/index.d.ts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/inner-plugins/constants.d.ts +1 -1
  32. package/dist/inner-plugins/index.d.ts +1 -1
  33. package/dist/inner-plugins/loaders/proxy.d.ts +2 -2
  34. package/dist/inner-plugins/plugins/base.d.ts +10 -10
  35. package/dist/inner-plugins/plugins/bundle.d.ts +11 -11
  36. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +2 -2
  37. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.js +9 -8
  38. package/dist/inner-plugins/plugins/errors.d.ts +7 -7
  39. package/dist/inner-plugins/plugins/index.d.ts +1 -1
  40. package/dist/inner-plugins/plugins/loader.d.ts +7 -7
  41. package/dist/inner-plugins/plugins/plugins.d.ts +5 -5
  42. package/dist/inner-plugins/plugins/progress.d.ts +4 -4
  43. package/dist/inner-plugins/plugins/rules.d.ts +5 -5
  44. package/dist/inner-plugins/plugins/summary.d.ts +11 -11
  45. package/dist/inner-plugins/utils/circleDetect.d.ts +3 -3
  46. package/dist/inner-plugins/utils/config.d.ts +2 -2
  47. package/dist/inner-plugins/utils/index.d.ts +1 -1
  48. package/dist/inner-plugins/utils/loader.d.ts +3 -3
  49. package/dist/inner-plugins/utils/plugin.d.ts +1 -1
  50. package/dist/inner-plugins/utils/sdk.d.ts +1 -1
  51. package/dist/rules/index.d.ts +1 -1
  52. package/dist/rules/linter.d.ts +6 -10
  53. package/dist/rules/rule.d.ts +20 -24
  54. package/dist/rules/rules/default-import-check/index.d.ts +1 -1
  55. package/dist/rules/rules/default-import-check/types.d.ts +3 -3
  56. package/dist/rules/rules/default-import-check/utils.d.ts +1 -1
  57. package/dist/rules/rules/duplicate-package/index.d.ts +1 -1
  58. package/dist/rules/rules/duplicate-package/types.d.ts +19 -19
  59. package/dist/rules/rules/duplicate-package/utils.d.ts +1 -1
  60. package/dist/rules/rules/ecma-version-check/index.d.ts +1 -1
  61. package/dist/rules/rules/ecma-version-check/types.d.ts +5 -5
  62. package/dist/rules/rules/ecma-version-check/utils.d.ts +1 -1
  63. package/dist/rules/rules/index.d.ts +1 -1
  64. package/dist/rules/rules/loader-performance-optimization/index.d.ts +1 -1
  65. package/dist/rules/rules/loader-performance-optimization/types.d.ts +18 -18
  66. package/dist/rules/rules/loader-performance-optimization/utils.d.ts +1 -1
  67. package/dist/rules/utils.d.ts +1 -1
  68. package/dist/types/chunks.d.ts +7 -7
  69. package/dist/types/index.d.ts +1 -1
  70. package/dist/types/loader.d.ts +15 -15
  71. package/dist/types/plugin.d.ts +58 -57
  72. package/dist/types/rules.d.ts +5 -5
  73. package/dist/types/webpack.d.ts +4 -4
  74. package/package.json +6 -6
@@ -1,11 +1,11 @@
1
1
  /// <reference types="lodash" />
2
2
  /// <reference types="node" />
3
3
  import { SDK, Plugin } from '@rsdoctor/types';
4
- import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from "../../types";
5
- import { Utils as BuildUtils, Types } from "../../build-utils/build";
4
+ import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types';
5
+ import { Utils as BuildUtils, Types } from '../../build-utils/build';
6
6
  export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
7
7
  export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): import("lodash").Omit<ProxyLoaderOptions, "__l__">;
8
8
  export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
9
9
  export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
10
10
  export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, cwd?: string, resolveLoader?: Plugin.Configuration['resolve']): T[];
11
- export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Types.SourceMapInput): Promise<SDK.LoaderData>;
11
+ export declare function reportLoader(ctx: Plugin.LoaderContext<ProxyLoaderOptions>, start: number, startHRTime: [number, number], isPitch: boolean, sync: boolean, code: string, err: Error | null | undefined, res: string | Buffer | null, sourceMap?: Types.SourceMapInput): Promise<SDK.LoaderData>;
@@ -2,4 +2,4 @@ import type { Hook } from 'tapable';
2
2
  import type { SDK } from '@rsdoctor/types';
3
3
  import type { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
4
4
  export declare function reportPluginData(sdk: RsdoctorWebpackSDK, hook: string, tapName: string, start: number, type: SDK.PluginHookData['type'], _res: unknown, err?: Error): void;
5
- export declare function interceptPluginHook(sdk: RsdoctorWebpackSDK, name: string, hook: Hook<any, any>): void;
5
+ export declare function interceptPluginHook(sdk: RsdoctorWebpackSDK, name: string, hook: Hook<any, any>): void;
@@ -1,3 +1,3 @@
1
1
  import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
2
2
  export declare function setSDK(t: RsdoctorWebpackSDK): void;
3
- export declare function getSDK(): RsdoctorWebpackSDK;
3
+ export declare function getSDK(): RsdoctorWebpackSDK;
@@ -1,3 +1,3 @@
1
1
  export * from './linter';
2
2
  export * from './rule';
3
- export { rules } from './rules';
3
+ export { rules } from './rules';
@@ -1,13 +1,9 @@
1
1
  import { Linter as LinterType, SDK } from '@rsdoctor/types';
2
2
  export { LinterType };
3
3
  export declare class Linter<Rules extends LinterType.ExtendRuleData[]> {
4
- private rules;
5
- constructor({
6
- rules,
7
- extends: extendRules,
8
- level
9
- }?: LinterType.Options<Rules>);
10
- private getRules;
11
- validate(context: SDK.RuntimeContext): Promise<LinterType.ValidateResult>;
12
- afterValidate(context: LinterType.InternalRuleCheckerContextForCheckEnd): Promise<void>;
13
- }
4
+ private rules;
5
+ constructor({ rules, extends: extendRules, level, }?: LinterType.Options<Rules>);
6
+ private getRules;
7
+ validate(context: SDK.RuntimeContext): Promise<LinterType.ValidateResult>;
8
+ afterValidate(context: LinterType.InternalRuleCheckerContextForCheckEnd): Promise<void>;
9
+ }
@@ -2,30 +2,26 @@ import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/types';
2
2
  import { LinterType } from './linter';
3
3
  type DefaultRuleConfig = Linter.DefaultRuleConfig;
4
4
  export declare class Rule<Config = DefaultRuleConfig> implements Linter.RuleMeta<Config> {
5
- static from<C>(data: Linter.ExtendRuleData<C>): Rule<C>;
6
- readonly meta: Linter.RuleMeta<Config>;
7
- private check;
8
- /**
9
- * execute when check end
10
- */
11
- private onCheckEnd;
12
- private _severity;
13
- private _config?;
14
- constructor(data: Linter.RuleData<Config>);
15
- get code(): RuleTypes.RuleMessageCode;
16
- get title(): string;
17
- get severity(): Linter.Severity;
18
- get config(): Config | undefined;
19
- get category(): "bundle" | RuleTypes.RuleMessageCategory | "compile" | "emo";
20
- setOption(opt: Linter.RuleConfigItem): void;
21
- match(level: Linter.Severity): boolean;
22
- validate(context: SDK.RuntimeContext): Promise<Linter.ValidateResult>;
23
- afterValidate({
24
- hooks,
25
- validateResult,
26
- data
27
- }: LinterType.InternalRuleCheckerContextForCheckEnd<Config>): Promise<void>;
5
+ static from<C>(data: Linter.ExtendRuleData<C>): Rule<C>;
6
+ readonly meta: Linter.RuleMeta<Config>;
7
+ private check;
8
+ /**
9
+ * execute when check end
10
+ */
11
+ private onCheckEnd;
12
+ private _severity;
13
+ private _config?;
14
+ constructor(data: Linter.RuleData<Config>);
15
+ get code(): RuleTypes.RuleMessageCode;
16
+ get title(): string;
17
+ get severity(): Linter.Severity;
18
+ get config(): Config | undefined;
19
+ get category(): "bundle" | RuleTypes.RuleMessageCategory | "compile" | "emo";
20
+ setOption(opt: Linter.RuleConfigItem): void;
21
+ match(level: Linter.Severity): boolean;
22
+ validate(context: SDK.RuntimeContext): Promise<Linter.ValidateResult>;
23
+ afterValidate({ hooks, validateResult, data, }: LinterType.InternalRuleCheckerContextForCheckEnd<Config>): Promise<void>;
28
24
  }
29
25
  export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.ExtendRuleConstructor<Title, T>): Linter.ExtendRuleData<T, Title>;
30
26
  export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.RuleConstructor<Title, T>): Linter.RuleData<T, Title>;
31
- export {};
27
+ export {};
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
2
  import type { Config } from './types';
3
3
  export type { Config } from './types';
4
- export declare const rule: Linter.RuleData<Config, "default-import-check">;
4
+ export declare const rule: Linter.RuleData<Config, "default-import-check">;
@@ -1,4 +1,4 @@
1
1
  export interface Config {
2
- /** Packages that need to be ignored */
3
- ignore: string[];
4
- }
2
+ /** Packages that need to be ignored */
3
+ ignore: string[];
4
+ }
@@ -7,4 +7,4 @@ export declare function getDefaultImportByRequest(node: Node.Program, request: s
7
7
  export declare function hasSameLeftInAssignStatement(node: Node.Program, compare: Node.SyntaxNode[]): Node.Pattern | undefined;
8
8
  export declare function importDeclarationToString(node: Node.ImportDeclaration): string;
9
9
  export declare function getFixData(module: SDK.ModuleInstance, node: Node.ImportDeclaration, originalRange: Range): Linter.FixData;
10
- export declare function getSourceRangeFromTransformedOffset(module: SDK.ModuleInstance, node: Node.SyntaxNode): Linter.ReportDocument | undefined;
10
+ export declare function getSourceRangeFromTransformedOffset(module: SDK.ModuleInstance, node: Node.SyntaxNode): Linter.ReportDocument | undefined;
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
2
  import { Config } from './types';
3
3
  export type { Config, CheckVersion } from './types';
4
- export declare const rule: Linter.RuleData<Config, "duplicate-package">;
4
+ export declare const rule: Linter.RuleData<Config, "duplicate-package">;
@@ -1,24 +1,24 @@
1
1
  export declare enum CheckVersion {
2
- null = 0,
3
- prerelease = 1,
4
- prepatch = 16,
5
- patch = 256,
6
- preminor = 4096,
7
- minor = 65536,
8
- premajor = 1048576,
9
- major = 16777216,
2
+ null = 0,
3
+ prerelease = 1,
4
+ prepatch = 16,
5
+ patch = 256,
6
+ preminor = 4096,
7
+ minor = 65536,
8
+ premajor = 1048576,
9
+ major = 16777216
10
10
  }
11
11
  export declare enum CheckVersionMap {
12
- null = 0,
13
- prerelease = 1,
14
- prepatch = 17,
15
- patch = 273,
16
- preminor = 4369,
17
- minor = 69905,
18
- premajor = 1118481,
19
- major = 17895697,
12
+ null = 0,
13
+ prerelease = 1,
14
+ prepatch = 17,
15
+ patch = 273,
16
+ preminor = 4369,
17
+ minor = 69905,
18
+ premajor = 1118481,
19
+ major = 17895697
20
20
  }
21
21
  export interface Config {
22
- checkVersion: keyof typeof CheckVersion;
23
- ignore: string[];
24
- }
22
+ checkVersion: keyof typeof CheckVersion;
23
+ ignore: string[];
24
+ }
@@ -1,3 +1,3 @@
1
1
  import type { SDK, Rule } from '@rsdoctor/types';
2
2
  export declare function getErrorMsg(packages: SDK.PackageInstance[], root: string): string;
3
- export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
3
+ export declare function getErrorDetail(pkg: SDK.PackageInstance, pkgGraph: SDK.PackageGraphInstance): Rule.PackageRelationData;
@@ -1,4 +1,4 @@
1
1
  import { Config } from './types';
2
2
  import { Linter } from '@rsdoctor/types';
3
3
  export type { Config } from './types';
4
- export declare const rule: Linter.RuleData<Config, "ecma-version-check">;
4
+ export declare const rule: Linter.RuleData<Config, "ecma-version-check">;
@@ -1,7 +1,7 @@
1
1
  import type { ECMAVersion } from '@rsdoctor/utils/ruleUtils';
2
2
  export interface Config {
3
- /** Check the ecma version */
4
- highestVersion: ECMAVersion;
5
- /** Js files that need to be ignored */
6
- ignore: string[];
7
- }
3
+ /** Check the ecma version */
4
+ highestVersion: ECMAVersion;
5
+ /** Js files that need to be ignored */
6
+ ignore: string[];
7
+ }
@@ -1,2 +1,2 @@
1
1
  import type { ECMAVersion } from '@rsdoctor/utils/ruleUtils';
2
- export declare function getVersionNumber(ECMAString: ECMAVersion): number | undefined;
2
+ export declare function getVersionNumber(ECMAString: ECMAVersion): number | undefined;
@@ -1 +1 @@
1
- export declare const rules: (import("@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package").Config, "duplicate-package"> | import("@rsdoctor/types/dist/linter").RuleData<import("./default-import-check").Config, "default-import-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization").Config, "loader-performance-optimization"> | import("@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check").Config, "ecma-version-check">)[];
1
+ export declare const rules: (import("@rsdoctor/types/dist/linter").RuleData<import("./duplicate-package").Config, "duplicate-package"> | import("@rsdoctor/types/dist/linter").RuleData<import("./default-import-check").Config, "default-import-check"> | import("@rsdoctor/types/dist/linter").RuleData<import("./loader-performance-optimization").Config, "loader-performance-optimization"> | import("@rsdoctor/types/dist/linter").RuleData<import("./ecma-version-check").Config, "ecma-version-check">)[];
@@ -1,4 +1,4 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
2
  import { Config } from './types';
3
3
  export type { Config } from './types';
4
- export declare const rule: Linter.RuleData<Config, "loader-performance-optimization">;
4
+ export declare const rule: Linter.RuleData<Config, "loader-performance-optimization">;
@@ -1,22 +1,22 @@
1
1
  import type { SDK } from '@rsdoctor/types';
2
2
  export interface Config {
3
- /**
4
- * loaders which should be ignore.
5
- */
6
- ignore: (string | RegExp)[];
7
- /**
8
- * threshold which the loader total costs.
9
- * @unit millisecond
10
- * @default 5000
11
- */
12
- threshold: number;
13
- /**
14
- * the file extensions which will be match in rule check.
15
- * @default ["js", "css", "jpg", "jpeg", "png", "gif", "webp", "svg"]
16
- */
17
- extensions: (string | RegExp)[];
3
+ /**
4
+ * loaders which should be ignore.
5
+ */
6
+ ignore: (string | RegExp)[];
7
+ /**
8
+ * threshold which the loader total costs.
9
+ * @unit millisecond
10
+ * @default 5000
11
+ */
12
+ threshold: number;
13
+ /**
14
+ * the file extensions which will be match in rule check.
15
+ * @default ["js", "css", "jpg", "jpeg", "png", "gif", "webp", "svg"]
16
+ */
17
+ extensions: (string | RegExp)[];
18
18
  }
19
19
  export interface LoaderMapValue extends SDK.LoaderTransformData {
20
- __resource__: SDK.ResourceData;
21
- __costs__: number;
22
- }
20
+ __resource__: SDK.ResourceData;
21
+ __costs__: number;
22
+ }
@@ -1 +1 @@
1
- export declare function match(str: string, partterns: (string | RegExp)[]): boolean;
1
+ export declare function match(str: string, partterns: (string | RegExp)[]): boolean;
@@ -1,3 +1,3 @@
1
1
  import { Linter } from '@rsdoctor/types';
2
2
  export declare function toSeverity(input: Linter.SeverityInput, defaultLevel: Linter.Severity): Linter.Severity;
3
- export declare function noop(): void;
3
+ export declare function noop(): void;
@@ -1,11 +1,11 @@
1
1
  import { Plugin } from '@rsdoctor/types';
2
2
  export type AssetsModules = {
3
- label?: string;
4
- isAsset?: boolean;
5
- modules?: Plugin.StatsModule[];
3
+ label?: string;
4
+ isAsset?: boolean;
5
+ modules?: Plugin.StatsModule[];
6
6
  };
7
7
  export type ParseBundle = (assetFile: string, modules: Plugin.StatsModule[]) => {
8
- modules?: Record<string, any>;
9
- src?: string;
10
- runtimeSrc?: string;
11
- };
8
+ modules?: Record<string, any>;
9
+ src?: string;
10
+ runtimeSrc?: string;
11
+ };
@@ -2,4 +2,4 @@ export * from './chunks';
2
2
  export * from './rules';
3
3
  export * from './webpack';
4
4
  export * from './loader';
5
- export * from './plugin';
5
+ export * from './plugin';
@@ -1,19 +1,19 @@
1
1
  import { Loader } from '@rsdoctor/utils/common';
2
2
  export interface ProxyLoaderInternalOptions {
3
- cwd: string;
4
- /**
5
- * the url host of http server(which used to collect data).
6
- */
7
- host: string;
8
- /**
9
- * correct loader path.
10
- */
11
- loader: string;
12
- /** include the loader option */
13
- hasOptions: boolean;
14
- skipLoaders: string[];
3
+ cwd: string;
4
+ /**
5
+ * the url host of http server(which used to collect data).
6
+ */
7
+ host: string;
8
+ /**
9
+ * correct loader path.
10
+ */
11
+ loader: string;
12
+ /** include the loader option */
13
+ hasOptions: boolean;
14
+ skipLoaders: string[];
15
15
  }
16
16
  export interface ProxyLoaderOptions {
17
- [key: string]: any;
18
- [Loader.LoaderInternalPropertyName]: ProxyLoaderInternalOptions;
19
- }
17
+ [key: string]: any;
18
+ [Loader.LoaderInternalPropertyName]: ProxyLoaderInternalOptions;
19
+ }
@@ -1,76 +1,77 @@
1
1
  import type { Linter as LinterType, Common, Plugin, SDK } from '@rsdoctor/types';
2
2
  import type { RsdoctorSlaveSDK, RsdoctorWebpackSDK } from '@rsdoctor/sdk';
3
3
  import { ChunkGraph, ModuleGraph } from '@rsdoctor/graph';
4
- import { rules } from "../rules/rules";
4
+ import { rules } from '../rules/rules';
5
5
  import { RuleData } from '@rsdoctor/types/dist/linter';
6
6
  type InternalRules = typeof rules[number] & RuleData[];
7
7
  export interface RsdoctorWebpackPluginOptions<Rules extends LinterType.ExtendRuleData[]> {
8
- /** Checker configuration */
9
- linter?: LinterType.Options<Rules, InternalRules>;
10
- /**
11
- * the switch for the Rsdoctor features.
12
- */
13
- features?: Plugin.RsdoctorWebpackPluginFeatures | Array<keyof Plugin.RsdoctorWebpackPluginFeatures>;
14
- /**
15
- * configuration of the interceptor for webpack loaders.
16
- * @description worked when the `features.loader === true`.
17
- */
18
- loaderInterceptorOptions?: {
8
+ /** Checker configuration */
9
+ linter?: LinterType.Options<Rules, InternalRules>;
19
10
  /**
20
- * loaders which you want to skip it (will not report the target loader data when webpack compile).
11
+ * the switch for the Rsdoctor features.
21
12
  */
22
- skipLoaders?: string[];
23
- };
24
- /**
25
- * turn on it if you don't need to see profile in browser.
26
- * @default false
27
- */
28
- disableClientServer?: boolean;
29
- /**
30
- * sdk instance of outside
31
- */
32
- sdkInstance?: RsdoctorWebpackSDK;
33
- /**
34
- * control the Rsdoctor reporter codes records.
35
- */
36
- reportCodeType?: {
37
- noModuleSource?: boolean;
38
- noAssetsAndModuleSource?: boolean;
39
- } | undefined;
40
- /**
41
- * control the Rsdoctor upload data to TOS.
42
- * @default false
43
- */
44
- disableTOSUpload?: boolean;
13
+ features?: Plugin.RsdoctorWebpackPluginFeatures | Array<keyof Plugin.RsdoctorWebpackPluginFeatures>;
14
+ /**
15
+ * configuration of the interceptor for webpack loaders.
16
+ * @description worked when the `features.loader === true`.
17
+ */
18
+ loaderInterceptorOptions?: {
19
+ /**
20
+ * loaders which you want to skip it (will not report the target loader data when webpack compile).
21
+ */
22
+ skipLoaders?: string[];
23
+ };
24
+ /**
25
+ * turn on it if you don't need to see profile in browser.
26
+ * @default false
27
+ */
28
+ disableClientServer?: boolean;
29
+ /**
30
+ * sdk instance of outside
31
+ */
32
+ sdkInstance?: RsdoctorWebpackSDK;
33
+ /**
34
+ * control the Rsdoctor reporter codes records.
35
+ */
36
+ reportCodeType?: {
37
+ noModuleSource?: boolean;
38
+ noAssetsAndModuleSource?: boolean;
39
+ } | undefined;
40
+ /**
41
+ * control the Rsdoctor upload data to TOS.
42
+ * @default false
43
+ */
44
+ disableTOSUpload?: boolean;
45
45
  }
46
46
  export interface RsdoctorWebpackMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance'>, Pick<ConstructorParameters<typeof RsdoctorSlaveSDK>[0], 'stage'> {
47
- /**
48
- * name of builder
49
- */
50
- name?: string;
47
+ /**
48
+ * name of builder
49
+ */
50
+ name?: string;
51
51
  }
52
52
  export interface RsdoctorPluginOptionsNormalized<Rules extends LinterType.ExtendRuleData[] = []> extends Common.DeepRequired<Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance' | 'linter' | 'reportCodeType'>> {
53
- features: Common.DeepRequired<Plugin.RsdoctorWebpackPluginFeatures>;
54
- linter: Required<LinterType.Options<Rules, InternalRules>>;
55
- sdkInstance?: RsdoctorWebpackSDK;
56
- reportCodeType?: SDK.ToDataType;
53
+ features: Common.DeepRequired<Plugin.RsdoctorWebpackPluginFeatures>;
54
+ linter: Required<LinterType.Options<Rules, InternalRules>>;
55
+ sdkInstance?: RsdoctorWebpackSDK;
56
+ reportCodeType?: SDK.ToDataType;
57
57
  }
58
58
  export interface BasePluginInstance<T extends Plugin.BaseCompiler> {
59
- apply: (compiler: T) => void;
60
- [k: string]: any;
59
+ apply: (compiler: T) => void;
60
+ [k: string]: any;
61
61
  }
62
62
  export interface InternalPlugin<T extends Plugin.BaseCompiler, Rules extends LinterType.ExtendRuleData[] = []> extends BasePluginInstance<T> {
63
- readonly name: string;
64
- readonly scheduler: RsdoctorPluginInstance<T, Rules>;
63
+ readonly name: string;
64
+ readonly scheduler: RsdoctorPluginInstance<T, Rules>;
65
65
  }
66
66
  export interface RsdoctorPluginInstance<T extends Plugin.BaseCompiler, Rules extends LinterType.ExtendRuleData[] = []> extends BasePluginInstance<T> {
67
- readonly name: string;
68
- readonly options: RsdoctorPluginOptionsNormalized<Rules>;
69
- readonly sdk: RsdoctorWebpackSDK;
70
- _modulesGraphApplied?: boolean;
71
- chunkGraph?: ChunkGraph;
72
- modulesGraph: ModuleGraph;
73
- ensureModulesChunksGraphApplied(compiler: T): void;
67
+ readonly name: string;
68
+ readonly options: RsdoctorPluginOptionsNormalized<Rules>;
69
+ readonly sdk: RsdoctorWebpackSDK;
70
+ _modulesGraphApplied?: boolean;
71
+ chunkGraph?: ChunkGraph;
72
+ modulesGraph: ModuleGraph;
73
+ ensureModulesChunksGraphApplied(compiler: T): void;
74
+ }
75
+ export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends RsdoctorWebpackPluginOptions<Rules> {
74
76
  }
75
- export interface RsdoctorRspackPluginOptions<Rules extends LinterType.ExtendRuleData[]> extends RsdoctorWebpackPluginOptions<Rules> {}
76
- export {};
77
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { RuleSetRule } from 'webpack';
2
2
  export interface Rule extends RuleSetRule {
3
- /**
4
- * https://webpack.js.org/configuration/module/#ruleloaders
5
- */
6
- loaders: RuleSetRule['use'];
7
- }
3
+ /**
4
+ * https://webpack.js.org/configuration/module/#ruleloaders
5
+ */
6
+ loaders: RuleSetRule['use'];
7
+ }
@@ -7,8 +7,8 @@ export type EntryPoint = GetMapValue<Compilation['entrypoints']>;
7
7
  export type ExportInfo = ReturnType<ModuleGraph['getExportInfo']>;
8
8
  export type ExportsInfo = ReturnType<ModuleGraph['getExportsInfo']>;
9
9
  export interface HarmonyImportSpecifierDependency extends Dependency {
10
- getIds(graph: ModuleGraph): string[];
11
- name: string;
12
- userRequest: string;
10
+ getIds(graph: ModuleGraph): string[];
11
+ name: string;
12
+ userRequest: string;
13
13
  }
14
- export {};
14
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -51,10 +51,10 @@
51
51
  "semver": "^7.5.4",
52
52
  "source-map": "^0.7.4",
53
53
  "webpack-bundle-analyzer": "^4.9.1",
54
- "@rsdoctor/sdk": "0.1.1",
55
- "@rsdoctor/graph": "0.1.1",
56
- "@rsdoctor/types": "0.1.1",
57
- "@rsdoctor/utils": "0.1.1"
54
+ "@rsdoctor/graph": "0.1.2",
55
+ "@rsdoctor/sdk": "0.1.2",
56
+ "@rsdoctor/utils": "0.1.2",
57
+ "@rsdoctor/types": "0.1.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/bytes": "3.1.1",
@@ -73,7 +73,7 @@
73
73
  "tslib": "2.4.1",
74
74
  "typescript": "^5.2.2",
75
75
  "webpack": "^5.89.0",
76
- "@rsdoctor/test-helper": "0.1.1"
76
+ "@scripts/test-helper": "0.1.1"
77
77
  },
78
78
  "publishConfig": {
79
79
  "access": "public",