@rsdoctor/core 2.0.0-beta.4 → 2.0.0-rc.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.
Files changed (153) hide show
  1. package/dist/e.js +6422 -0
  2. package/dist/{630.js.LICENSE.txt → e.js.LICENSE.txt} +1 -1
  3. package/dist/index.d.ts +458 -7
  4. package/dist/index.js +2532 -1698
  5. package/dist/index.js.LICENSE.txt +8 -2
  6. package/dist/probe-loader.d.ts +13 -0
  7. package/dist/probe-loader.js +1 -1
  8. package/dist/proxy-loader.d.ts +36 -1
  9. package/dist/proxy-loader.js +2 -2
  10. package/dist/{26.js → r.js} +9244 -272
  11. package/dist/r.js.LICENSE.txt +57 -0
  12. package/dist/rslib-runtime.js +15 -13
  13. package/package.json +26 -26
  14. package/dist/630.js +0 -1280
  15. package/dist/build-utils/build/chunks/assetsModules.d.ts +0 -23
  16. package/dist/build-utils/build/chunks/index.d.ts +0 -2
  17. package/dist/build-utils/build/chunks/rspack/transform.d.ts +0 -13
  18. package/dist/build-utils/build/envinfo.d.ts +0 -13
  19. package/dist/build-utils/build/file/cache.d.ts +0 -5
  20. package/dist/build-utils/build/file/index.d.ts +0 -3
  21. package/dist/build-utils/build/file/sharding.d.ts +0 -21
  22. package/dist/build-utils/build/index.d.ts +0 -10
  23. package/dist/build-utils/build/json.d.ts +0 -3
  24. package/dist/build-utils/build/loader/index.d.ts +0 -2
  25. package/dist/build-utils/build/loader/probeLoader.d.ts +0 -9
  26. package/dist/build-utils/build/loader/probeLoaderPlugin.d.ts +0 -6
  27. package/dist/build-utils/build/module-graph/index.d.ts +0 -1
  28. package/dist/build-utils/build/module-graph/rspack/transform.d.ts +0 -26
  29. package/dist/build-utils/build/process.d.ts +0 -2
  30. package/dist/build-utils/build/server.d.ts +0 -14
  31. package/dist/build-utils/build/utils/index.d.ts +0 -3
  32. package/dist/build-utils/build/utils/loader.d.ts +0 -20
  33. package/dist/build-utils/build/utils/parseBundle.d.ts +0 -12
  34. package/dist/build-utils/build/utils/plugin.d.ts +0 -5
  35. package/dist/build-utils/index.d.ts +0 -11
  36. package/dist/common/global-config.d.ts +0 -21
  37. package/dist/compat.d.ts +0 -34
  38. package/dist/error/error.d.ts +0 -35
  39. package/dist/error/index.d.ts +0 -2
  40. package/dist/error/transform.d.ts +0 -3
  41. package/dist/error/utils.d.ts +0 -4
  42. package/dist/inner-plugins/constants.d.ts +0 -6
  43. package/dist/inner-plugins/index.d.ts +0 -2
  44. package/dist/inner-plugins/loaders/proxy.d.ts +0 -7
  45. package/dist/inner-plugins/plugins/base.d.ts +0 -12
  46. package/dist/inner-plugins/plugins/bundle.d.ts +0 -15
  47. package/dist/inner-plugins/plugins/ensureModulesChunkGraph.d.ts +0 -34
  48. package/dist/inner-plugins/plugins/errors.d.ts +0 -12
  49. package/dist/inner-plugins/plugins/index.d.ts +0 -10
  50. package/dist/inner-plugins/plugins/loader.d.ts +0 -12
  51. package/dist/inner-plugins/plugins/plugins.d.ts +0 -8
  52. package/dist/inner-plugins/plugins/progress.d.ts +0 -8
  53. package/dist/inner-plugins/plugins/resolver.d.ts +0 -12
  54. package/dist/inner-plugins/plugins/rspack.d.ts +0 -9
  55. package/dist/inner-plugins/plugins/rules.d.ts +0 -8
  56. package/dist/inner-plugins/plugins/sourcemapTool.d.ts +0 -52
  57. package/dist/inner-plugins/plugins/summary.d.ts +0 -15
  58. package/dist/inner-plugins/utils/circleDetect.d.ts +0 -4
  59. package/dist/inner-plugins/utils/config.d.ts +0 -6
  60. package/dist/inner-plugins/utils/index.d.ts +0 -9
  61. package/dist/inner-plugins/utils/loader.d.ts +0 -10
  62. package/dist/inner-plugins/utils/normalize-config.d.ts +0 -32
  63. package/dist/inner-plugins/utils/openBrowser.d.ts +0 -1
  64. package/dist/inner-plugins/utils/plugin-common.d.ts +0 -11
  65. package/dist/inner-plugins/utils/plugin.d.ts +0 -4
  66. package/dist/inner-plugins/utils/ruleWarnings.d.ts +0 -2
  67. package/dist/inner-plugins/utils/sdk.d.ts +0 -8
  68. package/dist/logger.d.ts +0 -9
  69. package/dist/rspack-plugin/constants.d.ts +0 -9
  70. package/dist/rspack-plugin/index.d.ts +0 -1
  71. package/dist/rspack-plugin/plugin.d.ts +0 -55
  72. package/dist/rspack-plugin/session.d.ts +0 -19
  73. package/dist/rspack-plugin/writeStore.d.ts +0 -2
  74. package/dist/rule-utils/document/document.d.ts +0 -16
  75. package/dist/rule-utils/document/index.d.ts +0 -3
  76. package/dist/rule-utils/document/server.d.ts +0 -4
  77. package/dist/rule-utils/document/types.d.ts +0 -31
  78. package/dist/rule-utils/index.d.ts +0 -2
  79. package/dist/rule-utils/parser/asserts.d.ts +0 -81
  80. package/dist/rule-utils/parser/index.d.ts +0 -4
  81. package/dist/rule-utils/parser/parser.d.ts +0 -118
  82. package/dist/rule-utils/parser/types.d.ts +0 -30
  83. package/dist/rule-utils/parser/utils.d.ts +0 -27
  84. package/dist/rules/index.d.ts +0 -3
  85. package/dist/rules/linter.d.ts +0 -9
  86. package/dist/rules/rule.d.ts +0 -27
  87. package/dist/rules/rules/cjs-require/index.d.ts +0 -4
  88. package/dist/rules/rules/cjs-require/types.d.ts +0 -7
  89. package/dist/rules/rules/cross-chunks-package/index.d.ts +0 -4
  90. package/dist/rules/rules/cross-chunks-package/types.d.ts +0 -3
  91. package/dist/rules/rules/cross-chunks-package/utils.d.ts +0 -1
  92. package/dist/rules/rules/default-import-check/index.d.ts +0 -4
  93. package/dist/rules/rules/default-import-check/types.d.ts +0 -4
  94. package/dist/rules/rules/default-import-check/utils.d.ts +0 -10
  95. package/dist/rules/rules/duplicate-package/index.d.ts +0 -4
  96. package/dist/rules/rules/duplicate-package/types.d.ts +0 -24
  97. package/dist/rules/rules/duplicate-package/utils.d.ts +0 -3
  98. package/dist/rules/rules/ecma-version-check/htmlParserStub.d.ts +0 -3
  99. package/dist/rules/rules/ecma-version-check/index.d.ts +0 -5
  100. package/dist/rules/rules/ecma-version-check/types.d.ts +0 -13
  101. package/dist/rules/rules/esm-resolved-to-cjs/index.d.ts +0 -4
  102. package/dist/rules/rules/esm-resolved-to-cjs/types.d.ts +0 -8
  103. package/dist/rules/rules/index.d.ts +0 -2
  104. package/dist/rules/rules/loader-performance-optimization/index.d.ts +0 -4
  105. package/dist/rules/rules/loader-performance-optimization/types.d.ts +0 -22
  106. package/dist/rules/rules/loader-performance-optimization/utils.d.ts +0 -1
  107. package/dist/rules/rules/module-mixed-chunks/index.d.ts +0 -4
  108. package/dist/rules/rules/module-mixed-chunks/types.d.ts +0 -3
  109. package/dist/rules/rules/side-effects-only-imports/index.d.ts +0 -4
  110. package/dist/rules/rules/side-effects-only-imports/types.d.ts +0 -9
  111. package/dist/rules/utils.d.ts +0 -3
  112. package/dist/sdk/index.d.ts +0 -2
  113. package/dist/sdk/multiple/controller.d.ts +0 -26
  114. package/dist/sdk/multiple/index.d.ts +0 -2
  115. package/dist/sdk/multiple/primary.d.ts +0 -41
  116. package/dist/sdk/multiple/server.d.ts +0 -7
  117. package/dist/sdk/sdk/core.d.ts +0 -34
  118. package/dist/sdk/sdk/index.d.ts +0 -54
  119. package/dist/sdk/sdk/types.d.ts +0 -26
  120. package/dist/sdk/server/apis/alerts.d.ts +0 -5
  121. package/dist/sdk/server/apis/base.d.ts +0 -11
  122. package/dist/sdk/server/apis/bundle-diff.d.ts +0 -6
  123. package/dist/sdk/server/apis/data.d.ts +0 -6
  124. package/dist/sdk/server/apis/fs.d.ts +0 -5
  125. package/dist/sdk/server/apis/graph.d.ts +0 -12
  126. package/dist/sdk/server/apis/index.d.ts +0 -10
  127. package/dist/sdk/server/apis/loader.d.ts +0 -15
  128. package/dist/sdk/server/apis/plugin.d.ts +0 -6
  129. package/dist/sdk/server/apis/project.d.ts +0 -8
  130. package/dist/sdk/server/apis/renderer.d.ts +0 -6
  131. package/dist/sdk/server/apis/resolver.d.ts +0 -6
  132. package/dist/sdk/server/client.d.ts +0 -3
  133. package/dist/sdk/server/fakeServer.d.ts +0 -9
  134. package/dist/sdk/server/index.d.ts +0 -44
  135. package/dist/sdk/server/json-body.d.ts +0 -6
  136. package/dist/sdk/server/router.d.ts +0 -24
  137. package/dist/sdk/server/security.d.ts +0 -5
  138. package/dist/sdk/server/socket/api.d.ts +0 -15
  139. package/dist/sdk/server/socket/index.d.ts +0 -48
  140. package/dist/sdk/server/utils.d.ts +0 -6
  141. package/dist/sdk/utils/base.d.ts +0 -1
  142. package/dist/sdk/utils/constant.d.ts +0 -1
  143. package/dist/sdk/utils/date.d.ts +0 -1
  144. package/dist/sdk/utils/index.d.ts +0 -4
  145. package/dist/sdk/utils/manifestSharding.d.ts +0 -16
  146. package/dist/sdk/utils/openBrowser.d.ts +0 -4
  147. package/dist/sdk/utils/upload.d.ts +0 -2
  148. package/dist/sdk/utils/writeJson.d.ts +0 -1
  149. package/dist/sdk.d.ts +0 -1
  150. package/dist/types/index.d.ts +0 -3
  151. package/dist/types/loader.d.ts +0 -24
  152. package/dist/types/plugin.d.ts +0 -22
  153. package/dist/types/rules.d.ts +0 -7
@@ -1,10 +0,0 @@
1
- import { SDK, Plugin } from '@rsdoctor/shared/types';
2
- import { ProxyLoaderInternalOptions, ProxyLoaderOptions } from '../../types/index.js';
3
- import { Utils as BuildUtils } from '../../build-utils/build/index.js';
4
- export declare function getInternalLoaderOptions(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ProxyLoaderInternalOptions;
5
- export declare function getLoaderOptionsWithoutInternalKeys(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): Record<string, any>;
6
- export declare function getOriginLoaderModule(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): ReturnType<typeof BuildUtils.loadLoaderModule>;
7
- export declare function shouldSkipLoader(loaderContext: Plugin.LoaderContext<ProxyLoaderOptions>): boolean;
8
- export type LoaderResolver = ReturnType<Plugin.BaseCompiler['resolverFactory']['get']>;
9
- export declare function interceptLoader<T extends Plugin.BuildRuleSetRule>(rules: T[], loaderPath: string, options: Omit<ProxyLoaderInternalOptions, 'loader' | 'hasOptions'>, loaderResolver: LoaderResolver, cwd?: string): T[];
10
- 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?: Plugin.SourceMapInput): Promise<SDK.LoaderData>;
@@ -1,32 +0,0 @@
1
- import { Config, Plugin, SDK } from '@rsdoctor/shared/types';
2
- import type { RuleSetCondition as RspackRuleSetCondition, RuleSetRule as RspackRuleSetRule } from '@rspack/core';
3
- /**
4
- * Process mode-specific configurations with priority logic
5
- */
6
- export declare function processModeConfigurations(finalMode: keyof typeof SDK.IMode, output: Config.IOutput<'brief' | 'normal'>): {
7
- finalBrief: {};
8
- finalNormalOptions: Config.NormalModeOptions;
9
- };
10
- /**
11
- * Process brief mode configuration.
12
- */
13
- export declare function processBriefHtmlModeConfig(output: Config.BriefModeConfig): Config.BriefModeOptions;
14
- /**
15
- * This function recursively processes rule set conditions to ensure they can be
16
- * properly serialized to JSON.
17
- *
18
- * @param item - The rule set condition to make serializable. Can be:
19
- * - RspackRuleSetCondition: Rspack rule conditions
20
- * - void: Undefined or null values
21
- *
22
- * @example
23
- * ```typescript
24
- * const condition = /\.js$/;
25
- * JSON.stringify(condition); // Error: Converting circular structure to JSON
26
- *
27
- * makeRuleSetSerializable(condition);
28
- * JSON.stringify(condition); // '"/\\.js$/"'
29
- * ```
30
- */
31
- export declare function makeRuleSetSerializable(item: RspackRuleSetCondition | void): void;
32
- export declare function makeRulesSerializable(rules: Plugin.RuleSetRule[] | RspackRuleSetRule['oneOf']): void;
@@ -1 +0,0 @@
1
- export declare function openBrowser(url: string, needEncodeURI?: boolean): Promise<boolean | undefined>;
@@ -1,11 +0,0 @@
1
- import type { Configuration } from '@rspack/core';
2
- /**
3
- * Safe cloneDeep implementation that skips read-only properties (getters without setters)
4
- * to avoid errors when cloning objects like AppContext that have read-only properties
5
- */
6
- export declare function safeCloneDeep<T>(value: T, visited?: WeakMap<WeakKey, any>): T;
7
- /**
8
- * Process compiler configuration to make it serializable
9
- */
10
- export declare function processCompilerConfig(config: any): Configuration;
11
- export declare function handleBriefModeReport(sdk: any, options: any, disableClientServer: boolean): Promise<void>;
@@ -1,4 +0,0 @@
1
- import type { SDK } from '@rsdoctor/shared/types';
2
- import { IHook } from '../../build-utils/build/utils/index.js';
3
- export declare function reportPluginData(sdk: SDK.RsdoctorBuilderSDKInstance, hook: string, tapName: string, start: number, type: SDK.PluginHookData['type'], _res: unknown, err?: Error): void;
4
- export declare function interceptPluginHook(sdk: SDK.RsdoctorBuilderSDKInstance, name: string, hook: IHook): void;
@@ -1,2 +0,0 @@
1
- import { DevToolError } from '../../error/index.js';
2
- export declare function summarizeRuleWarnings(warnings: DevToolError[]): DevToolError[];
@@ -1,8 +0,0 @@
1
- import { SDK } from '@rsdoctor/shared/types';
2
- declare global {
3
- var __rsdoctor_sdks__: SDK.RsdoctorBuilderSDKInstance[] | undefined;
4
- var __rsdoctor_sdk__: SDK.RsdoctorBuilderSDKInstance | undefined;
5
- }
6
- export declare function setSDK(t: SDK.RsdoctorBuilderSDKInstance): void;
7
- export declare function registerSDK(t: SDK.RsdoctorBuilderSDKInstance, asDefault?: boolean): void;
8
- export declare function getSDK(compilerId?: string): SDK.RsdoctorBuilderSDKInstance | undefined;
package/dist/logger.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { color } from 'rslog';
2
- /**
3
- * log debug message
4
- */
5
- export declare function debug(getMsg: () => string, prefix?: string): void;
6
- declare const rsdoctorLogger: import("rslog").Logger;
7
- declare function time(label: string): void;
8
- declare function timeEnd(label: string): void;
9
- export { time, timeEnd, color as chalk, rsdoctorLogger as logger };
@@ -1,9 +0,0 @@
1
- import type { Tap } from '@rspack/lite-tapable';
2
- export declare const pluginTapName = "RsdoctorRspackPlugin";
3
- export declare const pluginTapPostOptions: Tap;
4
- export declare const pluginTapPreOptions: Tap;
5
- export declare const internalPluginTapPreOptions: (namespace: string) => Tap;
6
- export declare const internalPluginTapPostOptions: (namespace: string) => Tap;
7
- export declare const pkg: {
8
- version: string;
9
- };
@@ -1 +0,0 @@
1
- export * from './plugin.js';
@@ -1,55 +0,0 @@
1
- import { RsdoctorPrimarySDK } from '../sdk/index.js';
2
- import type { RsdoctorRspackPluginInstance, RsdoctorRspackPluginOptions, RsdoctorRspackPluginOptionsNormalized } from '../types/index.js';
3
- import { Linter, Plugin, SDK } from '@rsdoctor/shared/types';
4
- declare class RsdoctorCompilerContext implements RsdoctorRspackPluginInstance<Linter.ExtendRuleData[]> {
5
- readonly sdk: SDK.RsdoctorBuilderSDKInstance;
6
- readonly options: RsdoctorRspackPluginOptionsNormalized<Linter.ExtendRuleData[]>;
7
- readonly name = "RsdoctorRspackPlugin";
8
- readonly isRsdoctorPlugin = true;
9
- readonly modulesGraph: SDK.ModuleGraphInstance;
10
- bootstrapTask?: Promise<void>;
11
- applied: boolean;
12
- hasOpenedClientAutomatically: boolean;
13
- constructor(sdk: SDK.RsdoctorBuilderSDKInstance, options: RsdoctorRspackPluginOptionsNormalized<Linter.ExtendRuleData[]>);
14
- apply(): void;
15
- ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
16
- }
17
- export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]> implements RsdoctorRspackPluginInstance<Rules> {
18
- readonly name = "RsdoctorRspackPlugin";
19
- readonly isRsdoctorPlugin = true;
20
- readonly options: RsdoctorRspackPluginOptionsNormalized<Rules>;
21
- readonly outsideInstance: boolean;
22
- private readonly childOptions;
23
- private readonly defaultName;
24
- private readonly controller?;
25
- private readonly sessionLease?;
26
- private readonly primaryContext;
27
- private readonly compilerContexts;
28
- private readonly childPlugins;
29
- private appliedCompilerCount;
30
- constructor(options?: RsdoctorRspackPluginOptions<Rules>);
31
- get sdk(): SDK.RsdoctorBuilderSDKInstance;
32
- get modulesGraph(): SDK.ModuleGraphInstance;
33
- get _bootstrapTask(): Promise<void>;
34
- getCompilerSDK(name: string): SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK | undefined;
35
- apply(compiler: unknown): unknown;
36
- ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
37
- afterPlugins: (compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext) => void;
38
- done: (compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext) => Promise<void>;
39
- getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext): void;
40
- private createCompilerContext;
41
- private getCompilerContext;
42
- private ensureBootstrap;
43
- private awaitBootstrap;
44
- private clearBootstrapTask;
45
- private disposeSDK;
46
- private getOutputDir;
47
- private getBriefReportFileName;
48
- private applyChildCompilerSupport;
49
- private registerChildCompiler;
50
- private removeInheritedRsdoctorTaps;
51
- private childDone;
52
- private shouldDisposeSDK;
53
- private releasePendingSessionOnRun;
54
- }
55
- export {};
@@ -1,19 +0,0 @@
1
- import { RsdoctorSDKController } from '../sdk/index.js';
2
- export interface RsdoctorBuildSessionOptions {
3
- multiCompiler: {
4
- enabled: boolean;
5
- group?: string;
6
- };
7
- output: {
8
- mode: string;
9
- reportDir: string;
10
- };
11
- server: {
12
- port?: number;
13
- };
14
- }
15
- export interface RsdoctorBuildSessionLease {
16
- controller: RsdoctorSDKController;
17
- release(): void;
18
- }
19
- export declare function acquireBuildSession(options: RsdoctorBuildSessionOptions): RsdoctorBuildSessionLease;
@@ -1,2 +0,0 @@
1
- import type { Plugin, SDK } from '@rsdoctor/shared/types';
2
- export declare function getWriteStoreOptions(compiler: Pick<Plugin.BaseCompiler, 'watchMode' | 'parentCompilation'>): SDK.WriteStoreOptionsType | undefined;
@@ -1,16 +0,0 @@
1
- import { Range, OffsetRange, Position, DocumentEditData } from './types.js';
2
- /** Document Catalogue */
3
- export declare class Document {
4
- /** Actual document content. */
5
- private _text;
6
- /** Get the displacement of the file position in the text. */
7
- positionAt: (offset: number) => Position | undefined;
8
- /** Get the position of the displacement point in the file. */
9
- offsetAt: (position: Position) => number | undefined;
10
- constructor(content: string);
11
- /** Generate location search */
12
- private createFinder;
13
- getText(range?: Range | OffsetRange): string;
14
- /** Edit document data */
15
- edit(data: DocumentEditData): string | undefined;
16
- }
@@ -1,3 +0,0 @@
1
- export * from './document.js';
2
- export * from './types.js';
3
- export * from './server.js';
@@ -1,4 +0,0 @@
1
- import { Document } from './document.js';
2
- /** Create Document */
3
- export declare function getDocument(content: string): Document;
4
- export declare function clearDocument(): void;
@@ -1,31 +0,0 @@
1
- /**
2
- * Location
3
- * - line starting point is 1
4
- * - column starting point is 0
5
- */
6
- export interface Position {
7
- line: number;
8
- column: number;
9
- }
10
- /** Location range */
11
- export interface Range {
12
- start: Position;
13
- end: Position;
14
- }
15
- /** Offset range */
16
- export interface OffsetRange {
17
- start: number;
18
- end: number;
19
- }
20
- /** Text repair data */
21
- export interface DocumentEditData {
22
- /** Modify the starting position of string in the original text */
23
- start: number | Position;
24
- /** Modify string in the key position of the original text */
25
- end: number | Position;
26
- /**
27
- * Replaced new text
28
- * - If empty, delete the original text
29
- */
30
- newText?: string;
31
- }
@@ -1,2 +0,0 @@
1
- export * from './document/index.js';
2
- export * from './parser/index.js';
@@ -1,81 +0,0 @@
1
- import { Node } from './types.js';
2
- export declare const asserts: {
3
- readonly isProgram: (node: unknown) => node is Node.Program;
4
- readonly isEmptyStatement: (node: unknown) => node is Node.EmptyStatement;
5
- readonly isBlockStatement: (node: unknown) => node is Node.BlockStatement;
6
- readonly isStaticBlock: (node: unknown) => node is Node.StaticBlock;
7
- readonly isExpressionStatement: (node: unknown) => node is Node.ExpressionStatement;
8
- readonly isIfStatement: (node: unknown) => node is Node.IfStatement;
9
- readonly isLabeledStatement: (node: unknown) => node is Node.LabeledStatement;
10
- readonly isBreakStatement: (node: unknown) => node is Node.BreakStatement;
11
- readonly isContinueStatement: (node: unknown) => node is Node.ContinueStatement;
12
- readonly isWithStatement: (node: unknown) => node is Node.WithStatement;
13
- readonly isSwitchStatement: (node: unknown) => node is Node.SwitchStatement;
14
- readonly isReturnStatement: (node: unknown) => node is Node.ReturnStatement;
15
- readonly isThrowStatement: (node: unknown) => node is Node.ThrowStatement;
16
- readonly isTryStatement: (node: unknown) => node is Node.TryStatement;
17
- readonly isWhileStatement: (node: unknown) => node is Node.WhileStatement;
18
- readonly isDoWhileStatement: (node: unknown) => node is Node.DoWhileStatement;
19
- readonly isForStatement: (node: unknown) => node is Node.ForStatement;
20
- readonly isForInStatement: (node: unknown) => node is Node.ForInStatement;
21
- readonly isForOfStatement: (node: unknown) => node is Node.ForOfStatement;
22
- readonly isDebuggerStatement: (node: unknown) => node is Node.DebuggerStatement;
23
- readonly isFunctionDeclaration: (node: unknown) => node is Node.FunctionDeclaration;
24
- readonly isVariableDeclaration: (node: unknown) => node is Node.VariableDeclaration;
25
- readonly isVariableDeclarator: (node: unknown) => node is Node.VariableDeclarator;
26
- readonly isChainExpression: (node: unknown) => node is Node.ChainExpression;
27
- readonly isThisExpression: (node: unknown) => node is Node.ThisExpression;
28
- readonly isArrayExpression: (node: unknown) => node is Node.ArrayExpression;
29
- readonly isObjectExpression: (node: unknown) => node is Node.ObjectExpression;
30
- readonly isPrivateIdentifier: (node: unknown) => node is Node.PrivateIdentifier;
31
- readonly isProperty: (node: unknown) => node is Node.Property;
32
- readonly isPropertyDefinition: (node: unknown) => node is Node.PropertyDefinition;
33
- readonly isFunctionExpression: (node: unknown) => node is Node.FunctionExpression;
34
- readonly isSequenceExpression: (node: unknown) => node is Node.SequenceExpression;
35
- readonly isUnaryExpression: (node: unknown) => node is Node.UnaryExpression;
36
- readonly isBinaryExpression: (node: unknown) => node is Node.BinaryExpression;
37
- readonly isAssignmentExpression: (node: unknown) => node is Node.AssignmentExpression;
38
- readonly isUpdateExpression: (node: unknown) => node is Node.UpdateExpression;
39
- readonly isLogicalExpression: (node: unknown) => node is Node.LogicalExpression;
40
- readonly isConditionalExpression: (node: unknown) => node is Node.ConditionalExpression;
41
- readonly isNewExpression: (node: unknown) => node is Node.NewExpression;
42
- readonly isSwitchCase: (node: unknown) => node is Node.SwitchCase;
43
- readonly isCatchClause: (node: unknown) => node is Node.CatchClause;
44
- readonly isIdentifier: (node: unknown) => node is Node.Identifier;
45
- readonly isLiteral: (node: unknown) => node is Node.Literal;
46
- readonly isSuper: (node: unknown) => node is Node.Super;
47
- readonly isSpreadElement: (node: unknown) => node is Node.SpreadElement;
48
- readonly isArrowFunctionExpression: (node: unknown) => node is Node.ArrowFunctionExpression;
49
- readonly isYieldExpression: (node: unknown) => node is Node.YieldExpression;
50
- readonly isTemplateLiteral: (node: unknown) => node is Node.TemplateLiteral;
51
- readonly isTaggedTemplateExpression: (node: unknown) => node is Node.TaggedTemplateExpression;
52
- readonly isTemplateElement: (node: unknown) => node is Node.TemplateElement;
53
- readonly isObjectPattern: (node: unknown) => node is Node.ObjectPattern;
54
- readonly isArrayPattern: (node: unknown) => node is Node.ArrayPattern;
55
- readonly isRestElement: (node: unknown) => node is Node.RestElement;
56
- readonly isAssignmentPattern: (node: unknown) => node is Node.AssignmentPattern;
57
- readonly isClassBody: (node: unknown) => node is Node.ClassBody;
58
- readonly isClassDeclaration: (node: unknown) => node is Node.ClassDeclaration;
59
- readonly isClassExpression: (node: unknown) => node is Node.ClassExpression;
60
- readonly isMetaProperty: (node: unknown) => node is Node.MetaProperty;
61
- readonly isImportDeclaration: (node: unknown) => node is Node.ImportDeclaration;
62
- readonly isImportSpecifier: (node: unknown) => node is Node.ImportSpecifier;
63
- readonly isImportExpression: (node: unknown) => node is Node.ImportExpression;
64
- readonly isImportDefaultSpecifier: (node: unknown) => node is Node.ImportDefaultSpecifier;
65
- readonly isImportNamespaceSpecifier: (node: unknown) => node is Node.ImportNamespaceSpecifier;
66
- readonly isExportNamedDeclaration: (node: unknown) => node is Node.ExportNamedDeclaration;
67
- readonly isExportSpecifier: (node: unknown) => node is Node.ExportSpecifier;
68
- readonly isExportDefaultDeclaration: (node: unknown) => node is Node.ExportDefaultDeclaration;
69
- readonly isExportAllDeclaration: (node: unknown) => node is Node.ExportAllDeclaration;
70
- readonly isAwaitExpression: (node: unknown) => node is Node.AwaitExpression;
71
- readonly isMethodDefinition: (node: unknown) => node is Node.MethodDefinition;
72
- readonly isMemberExpression: (node: unknown) => node is Node.MemberExpression;
73
- readonly isComment: (node: unknown) => node is Node.Comment;
74
- readonly isDirective: (node: unknown) => node is Node.Directive;
75
- readonly isSimpleCallExpression: (node: unknown) => node is Node.SimpleCallExpression;
76
- readonly isAssignmentProperty: (node: unknown) => node is Node.AssignmentProperty;
77
- readonly isSimpleLiteral: (node: unknown) => node is Node.SimpleLiteral;
78
- readonly isRegExpLiteral: (node: unknown) => node is Node.RegExpLiteral;
79
- readonly isBigIntLiteral: (node: unknown) => node is Node.BigIntLiteral;
80
- readonly isExportStatement: (node: unknown) => node is Node.ExportStatement;
81
- };
@@ -1,4 +0,0 @@
1
- export * from './asserts.js';
2
- export * from './parser.js';
3
- export * from './utils.js';
4
- export * from './types.js';
@@ -1,118 +0,0 @@
1
- import { Parser as AcornParser, Options, Position } from 'acorn';
2
- import * as walk from 'acorn-walk';
3
- import * as utils from './utils.js';
4
- import type { Node } from './types.js';
5
- export type { Options as ParseOptions } from 'acorn';
6
- export interface ParseError extends Error {
7
- loc?: Position;
8
- pos: number;
9
- raisedAt: number;
10
- }
11
- export declare const parser: {
12
- /** AST iterator */
13
- walk: typeof walk;
14
- /**
15
- * Compile code
16
- * - Output root node is `Node.Program`
17
- */
18
- parse: (input: string, options: Options) => Node.Program;
19
- /**
20
- * Compile the next first expression
21
- * - The output root node is `Node.ExpressionStatement`
22
- */
23
- parseExpressionAt: (input: string, pos: number, options: Options) => Node.ExpressionStatement;
24
- /**
25
- * add plugins for acorn
26
- */
27
- extend(...args: Parameters<typeof AcornParser.extend>): typeof AcornParser;
28
- /** Set of assertions */
29
- asserts: {
30
- readonly isProgram: (node: unknown) => node is Node.Program;
31
- readonly isEmptyStatement: (node: unknown) => node is Node.EmptyStatement;
32
- readonly isBlockStatement: (node: unknown) => node is Node.BlockStatement;
33
- readonly isStaticBlock: (node: unknown) => node is Node.StaticBlock;
34
- readonly isExpressionStatement: (node: unknown) => node is Node.ExpressionStatement;
35
- readonly isIfStatement: (node: unknown) => node is Node.IfStatement;
36
- readonly isLabeledStatement: (node: unknown) => node is Node.LabeledStatement;
37
- readonly isBreakStatement: (node: unknown) => node is Node.BreakStatement;
38
- readonly isContinueStatement: (node: unknown) => node is Node.ContinueStatement;
39
- readonly isWithStatement: (node: unknown) => node is Node.WithStatement;
40
- readonly isSwitchStatement: (node: unknown) => node is Node.SwitchStatement;
41
- readonly isReturnStatement: (node: unknown) => node is Node.ReturnStatement;
42
- readonly isThrowStatement: (node: unknown) => node is Node.ThrowStatement;
43
- readonly isTryStatement: (node: unknown) => node is Node.TryStatement;
44
- readonly isWhileStatement: (node: unknown) => node is Node.WhileStatement;
45
- readonly isDoWhileStatement: (node: unknown) => node is Node.DoWhileStatement;
46
- readonly isForStatement: (node: unknown) => node is Node.ForStatement;
47
- readonly isForInStatement: (node: unknown) => node is Node.ForInStatement;
48
- readonly isForOfStatement: (node: unknown) => node is Node.ForOfStatement;
49
- readonly isDebuggerStatement: (node: unknown) => node is Node.DebuggerStatement;
50
- readonly isFunctionDeclaration: (node: unknown) => node is Node.FunctionDeclaration;
51
- readonly isVariableDeclaration: (node: unknown) => node is Node.VariableDeclaration;
52
- readonly isVariableDeclarator: (node: unknown) => node is Node.VariableDeclarator;
53
- readonly isChainExpression: (node: unknown) => node is Node.ChainExpression;
54
- readonly isThisExpression: (node: unknown) => node is Node.ThisExpression;
55
- readonly isArrayExpression: (node: unknown) => node is Node.ArrayExpression;
56
- readonly isObjectExpression: (node: unknown) => node is Node.ObjectExpression;
57
- readonly isPrivateIdentifier: (node: unknown) => node is Node.PrivateIdentifier;
58
- readonly isProperty: (node: unknown) => node is Node.Property;
59
- readonly isPropertyDefinition: (node: unknown) => node is Node.PropertyDefinition;
60
- readonly isFunctionExpression: (node: unknown) => node is Node.FunctionExpression;
61
- readonly isSequenceExpression: (node: unknown) => node is Node.SequenceExpression;
62
- readonly isUnaryExpression: (node: unknown) => node is Node.UnaryExpression;
63
- readonly isBinaryExpression: (node: unknown) => node is Node.BinaryExpression;
64
- readonly isAssignmentExpression: (node: unknown) => node is Node.AssignmentExpression;
65
- readonly isUpdateExpression: (node: unknown) => node is Node.UpdateExpression;
66
- readonly isLogicalExpression: (node: unknown) => node is Node.LogicalExpression;
67
- readonly isConditionalExpression: (node: unknown) => node is Node.ConditionalExpression;
68
- readonly isNewExpression: (node: unknown) => node is Node.NewExpression;
69
- readonly isSwitchCase: (node: unknown) => node is Node.SwitchCase;
70
- readonly isCatchClause: (node: unknown) => node is Node.CatchClause;
71
- readonly isIdentifier: (node: unknown) => node is Node.Identifier;
72
- readonly isLiteral: (node: unknown) => node is Node.Literal;
73
- readonly isSuper: (node: unknown) => node is Node.Super;
74
- readonly isSpreadElement: (node: unknown) => node is Node.SpreadElement;
75
- readonly isArrowFunctionExpression: (node: unknown) => node is Node.ArrowFunctionExpression;
76
- readonly isYieldExpression: (node: unknown) => node is Node.YieldExpression;
77
- readonly isTemplateLiteral: (node: unknown) => node is Node.TemplateLiteral;
78
- readonly isTaggedTemplateExpression: (node: unknown) => node is Node.TaggedTemplateExpression;
79
- readonly isTemplateElement: (node: unknown) => node is Node.TemplateElement;
80
- readonly isObjectPattern: (node: unknown) => node is Node.ObjectPattern;
81
- readonly isArrayPattern: (node: unknown) => node is Node.ArrayPattern;
82
- readonly isRestElement: (node: unknown) => node is Node.RestElement;
83
- readonly isAssignmentPattern: (node: unknown) => node is Node.AssignmentPattern;
84
- readonly isClassBody: (node: unknown) => node is Node.ClassBody;
85
- readonly isClassDeclaration: (node: unknown) => node is Node.ClassDeclaration;
86
- readonly isClassExpression: (node: unknown) => node is Node.ClassExpression;
87
- readonly isMetaProperty: (node: unknown) => node is Node.MetaProperty;
88
- readonly isImportDeclaration: (node: unknown) => node is Node.ImportDeclaration;
89
- readonly isImportSpecifier: (node: unknown) => node is Node.ImportSpecifier;
90
- readonly isImportExpression: (node: unknown) => node is Node.ImportExpression;
91
- readonly isImportDefaultSpecifier: (node: unknown) => node is Node.ImportDefaultSpecifier;
92
- readonly isImportNamespaceSpecifier: (node: unknown) => node is Node.ImportNamespaceSpecifier;
93
- readonly isExportNamedDeclaration: (node: unknown) => node is Node.ExportNamedDeclaration;
94
- readonly isExportSpecifier: (node: unknown) => node is Node.ExportSpecifier;
95
- readonly isExportDefaultDeclaration: (node: unknown) => node is Node.ExportDefaultDeclaration;
96
- readonly isExportAllDeclaration: (node: unknown) => node is Node.ExportAllDeclaration;
97
- readonly isAwaitExpression: (node: unknown) => node is Node.AwaitExpression;
98
- readonly isMethodDefinition: (node: unknown) => node is Node.MethodDefinition;
99
- readonly isMemberExpression: (node: unknown) => node is Node.MemberExpression;
100
- readonly isComment: (node: unknown) => node is Node.Comment;
101
- readonly isDirective: (node: unknown) => node is Node.Directive;
102
- readonly isSimpleCallExpression: (node: unknown) => node is Node.SimpleCallExpression;
103
- readonly isAssignmentProperty: (node: unknown) => node is Node.AssignmentProperty;
104
- readonly isSimpleLiteral: (node: unknown) => node is Node.SimpleLiteral;
105
- readonly isRegExpLiteral: (node: unknown) => node is Node.RegExpLiteral;
106
- readonly isBigIntLiteral: (node: unknown) => node is Node.BigIntLiteral;
107
- readonly isExportStatement: (node: unknown) => node is Node.ExportStatement;
108
- };
109
- utils: typeof utils;
110
- /**
111
- * @internal
112
- * parser for internal packages
113
- */
114
- internal: {
115
- parse: (input: string, options: Options) => Node.Program;
116
- parseExpressionAt: (input: string, pos: number, options: Options) => Node.ExpressionStatement;
117
- };
118
- };
@@ -1,30 +0,0 @@
1
- import type * as Node from 'estree';
2
- export type { Node };
3
- export declare enum ECMAVersion {
4
- ES5 = "ES5",
5
- ES6 = "ES6",
6
- ES7P = "ES7+"
7
- }
8
- /**
9
- * estree supplement type
10
- * Mainly to match the node type of acorn
11
- * The main reason for not using the type of acorn directly is that the node type described by acorn itself is too simple
12
- */
13
- declare module 'estree' {
14
- interface BaseNode {
15
- start: number;
16
- end: number;
17
- loc?: SourceLocation | undefined;
18
- }
19
- interface Position {
20
- offset: number;
21
- }
22
- /** all syntax nodes */
23
- type SyntaxNode = Node.Comment | Node.Program | Node.Directive | Node.EmptyStatement | Node.BlockStatement | Node.StaticBlock | Node.ExpressionStatement | Node.IfStatement | Node.LabeledStatement | Node.BreakStatement | Node.ContinueStatement | Node.WithStatement | Node.SwitchStatement | Node.ReturnStatement | Node.ThrowStatement | Node.TryStatement | Node.WhileStatement | Node.DoWhileStatement | Node.ForStatement | Node.ForInStatement | Node.DebuggerStatement | Node.FunctionDeclaration | Node.VariableDeclaration | Node.VariableDeclarator | Node.ChainExpression | Node.ThisExpression | Node.ArrayExpression | Node.ObjectExpression | Node.PrivateIdentifier | Node.Property | Node.PropertyDefinition | Node.FunctionExpression | Node.SequenceExpression | Node.UnaryExpression | Node.BinaryExpression | Node.AssignmentExpression | Node.UpdateExpression | Node.LogicalExpression | Node.ConditionalExpression | Node.SimpleCallExpression | Node.NewExpression | Node.MemberExpression | Node.SwitchCase | Node.CatchClause | Node.Identifier | Node.SimpleLiteral | Node.RegExpLiteral | Node.BigIntLiteral | Node.ForOfStatement | Node.Super | Node.SpreadElement | Node.ArrowFunctionExpression | Node.YieldExpression | Node.TemplateLiteral | Node.TaggedTemplateExpression | Node.TemplateElement | Node.AssignmentProperty | Node.ObjectPattern | Node.ArrayPattern | Node.RestElement | Node.AssignmentPattern | Node.ClassBody | Node.MethodDefinition | Node.ClassDeclaration | Node.ClassExpression | Node.MetaProperty | Node.ImportDeclaration | Node.ImportSpecifier | Node.ImportExpression | Node.ImportDefaultSpecifier | Node.ImportNamespaceSpecifier | Node.ExportNamedDeclaration | Node.ExportSpecifier | Node.ExportDefaultDeclaration | Node.ExportAllDeclaration | Node.AwaitExpression;
24
- /** all operators */
25
- type SyntaxOperator = Node.UnaryOperator | Node.BinaryOperator | Node.LogicalOperator | Node.AssignmentOperator | Node.UpdateOperator;
26
- /** Block-scoped statement */
27
- type BlockScopeStatement = Node.StaticBlock | Node.BlockStatement | Node.ForInStatement | Node.ForOfStatement | Node.ForStatement | Node.CatchClause | Node.SwitchStatement;
28
- /** Export statement */
29
- type ExportStatement = Node.ExportAllDeclaration | Node.ExportDefaultDeclaration | Node.ExportNamedDeclaration;
30
- }
@@ -1,27 +0,0 @@
1
- import { ecmaVersion } from 'acorn';
2
- import { Node, ECMAVersion } from './types.js';
3
- /**
4
- * Recursively compare node semantics while ignoring comments, positions, and
5
- * string quote styles. String templates and string addition remain distinct.
6
- */
7
- export declare function isSameSyntax(node1: Node.SyntaxNode, node2: Node.SyntaxNode): boolean;
8
- /**
9
- * Get all default reference statements
10
- */
11
- export declare function getDefaultImports(node: Node.Program): Node.ImportDeclaration[];
12
- /** Get the literal in the text. */
13
- export declare function getIdentifierInPattern(name: string, node: Node.Pattern): Node.Identifier | undefined;
14
- /** Get the variable declaration statement identifier. */
15
- export declare function getIdentifierInDeclaration(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
16
- /** Get the reference declaration statement identifier. */
17
- export declare function getIdentifierInImport(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
18
- /** Get the export statement identifier. */
19
- export declare function getIdentifierInExport(name: string, node: Node.SyntaxNode): Node.Identifier | undefined;
20
- /** Determine that it can be resolved using the specified ECMA version */
21
- export declare function canParse(code: string, ecmaVersion: ecmaVersion): boolean;
22
- /** Determine whether it is all ES5 version code. */
23
- export declare function isES5(code: string): boolean;
24
- /** Determine whether it is all ES6 version code. */
25
- export declare function isES6(code: string): boolean;
26
- /** Detect ECMA version. */
27
- export declare function detectECMAVersion(code: string): ECMAVersion;
@@ -1,3 +0,0 @@
1
- export * from './linter.js';
2
- export * from './rule.js';
3
- export { rules } from './rules/index.js';
@@ -1,9 +0,0 @@
1
- import { Linter as LinterType, SDK } from '@rsdoctor/shared/types';
2
- export { LinterType };
3
- export declare class Linter<Rules extends LinterType.ExtendRuleData[]> {
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
- }
@@ -1,27 +0,0 @@
1
- import { Linter, SDK, Rule as RuleTypes } from '@rsdoctor/shared/types';
2
- import { LinterType } from './linter.js';
3
- type DefaultRuleConfig = Linter.DefaultRuleConfig;
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" | "compile" | "emo" | RuleTypes.RuleMessageCategory;
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>;
24
- }
25
- export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.ExtendRuleConstructor<Title, T>): Linter.ExtendRuleData<T, Title>;
26
- export declare function defineRule<Title extends Linter.DefaultRuleTitle, T = Linter.DefaultRuleConfig>(ruleCreator: Linter.RuleConstructor<Title, T>): Linter.RuleData<T, Title>;
27
- export {};
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import type { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "cjs-require">;
@@ -1,7 +0,0 @@
1
- export interface Config {
2
- /**
3
- * Module path patterns to ignore (applied to both issuer and required module paths).
4
- * Defaults to [].
5
- */
6
- ignore: string[];
7
- }
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "cross-chunks-package">;
@@ -1,3 +0,0 @@
1
- export interface Config {
2
- ignore: string[];
3
- }
@@ -1 +0,0 @@
1
- export declare function getErrorMsgForDupPckChunks(chunks: string[], pkgName: string): string;
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import type { Config } from './types.js';
3
- export type { Config } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "default-import-check">;
@@ -1,4 +0,0 @@
1
- export interface Config {
2
- /** Packages that need to be ignored */
3
- ignore: string[];
4
- }
@@ -1,10 +0,0 @@
1
- import { Node, Range } from '../../../rule-utils/index.js';
2
- import type { SDK, Linter } from '@rsdoctor/shared/types';
3
- export declare function getDefaultImportByRequest(node: Node.Program, request: string): Node.ImportDeclaration | undefined;
4
- /**
5
- * Determine that it contains the same left value assignment expression in the enumeration.
6
- */
7
- export declare function hasSameLeftInAssignStatement(node: Node.Program, compare: Node.SyntaxNode[]): Node.Pattern | undefined;
8
- export declare function importDeclarationToString(node: Node.ImportDeclaration): string;
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;
@@ -1,4 +0,0 @@
1
- import { Linter } from '@rsdoctor/shared/types';
2
- import type { Config } from './types.js';
3
- export type { Config, CheckVersion } from './types.js';
4
- export declare const rule: Linter.RuleData<Config, "duplicate-package">;