@rsdoctor/core 2.0.0-beta.0 → 2.0.0-beta.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.
@@ -7,8 +7,9 @@ declare class RsdoctorCompilerContext implements RsdoctorRspackPluginInstance<Li
7
7
  readonly name = "RsdoctorRspackPlugin";
8
8
  readonly isRsdoctorPlugin = true;
9
9
  readonly modulesGraph: SDK.ModuleGraphInstance;
10
- bootstrapTask?: Promise<unknown>;
10
+ bootstrapTask?: Promise<void>;
11
11
  applied: boolean;
12
+ hasOpenedClientAutomatically: boolean;
12
13
  constructor(sdk: SDK.RsdoctorBuilderSDKInstance, options: RsdoctorRspackPluginOptionsNormalized<Linter.ExtendRuleData[]>);
13
14
  apply(): void;
14
15
  ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
@@ -20,7 +21,6 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
20
21
  readonly outsideInstance: boolean;
21
22
  private readonly childOptions;
22
23
  private readonly defaultName;
23
- private readonly defaultStage?;
24
24
  private readonly controller?;
25
25
  private readonly sessionLease?;
26
26
  private readonly primaryContext;
@@ -30,7 +30,7 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
30
30
  constructor(options?: RsdoctorRspackPluginOptions<Rules>);
31
31
  get sdk(): SDK.RsdoctorBuilderSDKInstance;
32
32
  get modulesGraph(): SDK.ModuleGraphInstance;
33
- get _bootstrapTask(): Promise<unknown>;
33
+ get _bootstrapTask(): Promise<void>;
34
34
  getCompilerSDK(name: string): SDK.RsdoctorBuilderSDKInstance | RsdoctorPrimarySDK | undefined;
35
35
  apply(compiler: unknown): unknown;
36
36
  ensureModulesChunksGraphApplied(compiler: Plugin.BaseCompilerType<'rspack'>): void;
@@ -39,6 +39,10 @@ export declare class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
39
39
  getRspackConfig(compiler: Plugin.BaseCompilerType<'rspack'>, context?: RsdoctorCompilerContext): void;
40
40
  private createCompilerContext;
41
41
  private getCompilerContext;
42
+ private ensureBootstrap;
43
+ private awaitBootstrap;
44
+ private clearBootstrapTask;
45
+ private disposeSDK;
42
46
  private getOutputDir;
43
47
  private getBriefReportFileName;
44
48
  private applyChildCompilerSupport;
@@ -11,7 +11,6 @@ export interface RsdoctorBuildSessionOptions {
11
11
  server: {
12
12
  port?: number;
13
13
  };
14
- port?: number;
15
14
  }
16
15
  export interface RsdoctorBuildSessionLease {
17
16
  controller: RsdoctorSDKController;
@@ -0,0 +1,2 @@
1
+ import type { Plugin, SDK } from '@rsdoctor/shared/types';
2
+ export declare function getWriteStoreOptions(compiler: Pick<Plugin.BaseCompiler, 'watchMode' | 'parentCompilation'>): SDK.WriteStoreOptionsType | undefined;
@@ -1,13 +1,10 @@
1
1
  import { ecmaVersion } from 'acorn';
2
2
  import { Node, ECMAVersion } from './types.js';
3
3
  /**
4
- * Is the node semantics the same?
5
- * @deprecated
6
- * - Recursively compare whether the content of the node itself is the same
7
- * - Ignore comments, positions, string symbols (single and double quotation marks)
8
- * - String templates and string addition will be considered different
4
+ * Recursively compare node semantics while ignoring comments, positions, and
5
+ * string quote styles. String templates and string addition remain distinct.
9
6
  */
10
- export declare function isSameSemantics(node1: Node.SyntaxNode, node2: Node.SyntaxNode): boolean;
7
+ export declare function isSameSyntax(node1: Node.SyntaxNode, node2: Node.SyntaxNode): boolean;
11
8
  /**
12
9
  * Get all default reference statements
13
10
  */
@@ -1,4 +1,4 @@
1
- import { Config } from './types.js';
1
+ import type { Config } from './types.js';
2
2
  import { Linter } from '@rsdoctor/shared/types';
3
3
  export type { Config } from './types.js';
4
4
  declare const title = "ecma-version-check";
@@ -1,4 +1,4 @@
1
- import { Manifest, SDK } from '@rsdoctor/shared/types';
1
+ import { Common, Manifest, SDK } from '@rsdoctor/shared/types';
2
2
  import { RsdoctorSDK } from '../sdk/index.js';
3
3
  import type { RsdoctorSDKController } from './controller.js';
4
4
  interface RsdoctorSlaveSDKOptions {
@@ -29,7 +29,7 @@ export declare class RsdoctorPrimarySDK extends RsdoctorSDK implements SDK.Rsdoc
29
29
  reportFileName: string;
30
30
  constructor({ name, displayName, compilerPath, parentCompilerPath, isChild, stage, controller, extraConfig, type, }: RsdoctorSlaveSDKOptions);
31
31
  get isMaster(): boolean;
32
- protected writePieces(): Promise<void>;
32
+ protected writePieces(_storeData: Common.PlainObject, options?: SDK.WriteStoreOptionsType): Promise<void>;
33
33
  protected writeManifest(): Promise<string>;
34
34
  refreshManifestSeries(): Promise<void>;
35
35
  getSeriesData(serverUrl?: boolean): Manifest.RsdoctorManifestSeriesData[];
@@ -24,10 +24,11 @@ export declare abstract class SDKCore<T extends RsdoctorSDKOptions> implements S
24
24
  getClientRoutes(): Manifest.RsdoctorManifestClientRoutes[];
25
25
  addClientRoutes(routes: Manifest.RsdoctorManifestClientRoutes[]): void;
26
26
  /** Upload analysis data pieces */
27
- protected writePieces(storeData: Common.PlainObject, _options?: SDK.WriteStoreOptionsType): Promise<void>;
27
+ protected writePieces(storeData: Common.PlainObject, options?: SDK.WriteStoreOptionsType): Promise<void>;
28
28
  /** Upload manifest file */
29
29
  protected writeManifest(): Promise<string>;
30
30
  saveManifest(data: Common.PlainObject, options: SDK.WriteStoreOptionsType): Promise<string>;
31
- protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number): Promise<DataWithUrl>;
31
+ protected writeToFolder(jsonStr: string, dir: string, key: string, index?: number, compressionLevel?: number): Promise<DataWithUrl>;
32
+ protected writeJsonFragmentsToFolder(jsonFragments: string[], dir: string, key: string, index?: number, compressionLevel?: number): Promise<DataWithUrl>;
32
33
  abstract onDataReport(): void | Promise<void>;
33
34
  }
@@ -4,7 +4,7 @@ export interface DataWithUrl {
4
4
  files: {
5
5
  path: string;
6
6
  basename: string;
7
- content: Buffer;
7
+ content?: Buffer;
8
8
  }[] | string;
9
9
  }
10
10
  export interface RsdoctorSDKOptions {
@@ -1,3 +1,4 @@
1
1
  export * from './constant.js';
2
2
  export * from './base.js';
3
3
  export * from './upload.js';
4
+ export * from './manifestSharding.js';
@@ -0,0 +1,16 @@
1
+ export declare const DEFAULT_MANIFEST_SHARD_SIZE: number;
2
+ interface WriteManifestShardsOptions {
3
+ index?: number;
4
+ shardSize?: number;
5
+ compressionLevel?: number;
6
+ }
7
+ export interface ManifestShardFile {
8
+ path: string;
9
+ basename: string;
10
+ }
11
+ /**
12
+ * Compress JSON fragments as one deflate stream, encode that stream as one
13
+ * continuous Base64 value, and write bounded physical shards.
14
+ */
15
+ export declare function writeManifestShards(jsonFragments: string[], folder: string, options?: WriteManifestShardsOptions): Promise<ManifestShardFile[]>;
16
+ export {};
@@ -1,5 +1,10 @@
1
1
  import { Loader } from '@rsdoctor/shared/common-browser';
2
2
  export interface ProxyLoaderInternalOptions {
3
+ /**
4
+ * A session marker registered as a loader build dependency so persistent
5
+ * caches are invalidated when a new Rsdoctor session starts.
6
+ */
7
+ cacheMarkerPath?: string;
3
8
  cwd: string;
4
9
  /**
5
10
  * the url host of http server(which used to collect data).
@@ -1,12 +1,4 @@
1
1
  import type { Linter, Linter as LinterType, Plugin, SDK } from '@rsdoctor/shared/types';
2
- export interface RsdoctorMultiplePluginOptions<Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[]> extends Omit<Plugin.RsdoctorRspackPluginOptions<Rules>, 'sdkInstance'>, Pick<{
3
- stage?: number;
4
- }, 'stage'> {
5
- /**
6
- * name of builder
7
- */
8
- name?: string;
9
- }
10
2
  export interface BasePluginInstance<T extends Plugin.BaseCompiler> {
11
3
  apply: (compiler: T) => void;
12
4
  [k: string]: any;
package/package.json CHANGED
@@ -1,21 +1,12 @@
1
1
  {
2
2
  "name": "@rsdoctor/core",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
7
7
  "directory": "packages/core"
8
8
  },
9
9
  "license": "MIT",
10
- "engines": {
11
- "node": ">=22.18.0"
12
- },
13
- "main": "dist/index.js",
14
- "types": "dist/index.d.ts",
15
- "files": [
16
- "dist",
17
- "static"
18
- ],
19
10
  "type": "module",
20
11
  "exports": {
21
12
  ".": {
@@ -27,6 +18,8 @@
27
18
  "default": "./dist/proxy-loader.js"
28
19
  }
29
20
  },
21
+ "main": "dist/index.js",
22
+ "types": "dist/index.d.ts",
30
23
  "typesVersions": {
31
24
  "*": {
32
25
  ".": [
@@ -37,6 +30,10 @@
37
30
  ]
38
31
  }
39
32
  },
33
+ "files": [
34
+ "dist",
35
+ "static"
36
+ ],
40
37
  "dependencies": {
41
38
  "@babel/code-frame": "7.26.2",
42
39
  "@rspack/lite-tapable": "^1.1.5",
@@ -45,41 +42,41 @@
45
42
  "acorn-import-attributes": "^1.9.5",
46
43
  "acorn-walk": "8.3.5",
47
44
  "browserslist-load-config": "^1.0.3",
48
- "caniuse-lite": "^1.0.30001809",
45
+ "caniuse-lite": "^1.0.30001810",
49
46
  "connect-next": "4.0.3",
47
+ "cors": "2.8.6",
50
48
  "envinfo": "7.21.0",
51
49
  "fs-extra": "^11.1.1",
52
50
  "get-port": "5.1.1",
51
+ "launch-editor": "^2.14.1",
53
52
  "lines-and-columns": "2.0.4",
54
- "open": "^11.0.0",
53
+ "open": "^11.0.2",
55
54
  "raw-body": "3.0.2",
56
55
  "rslog": "^2.1.3",
57
56
  "semver": "^7.8.5",
58
- "source-map": "^0.7.6",
59
- "cors": "2.8.6",
60
- "launch-editor": "^2.14.1",
61
57
  "sirv": "3.0.2",
58
+ "source-map": "^0.7.6",
62
59
  "ws": "8.21.3",
63
- "@rsdoctor/shared": "2.0.0-beta.0",
64
- "@rsdoctor/client": "2.0.0-beta.0"
60
+ "@rsdoctor/client": "2.0.0-beta.1",
61
+ "@rsdoctor/shared": "2.0.0-beta.1"
65
62
  },
66
63
  "devDependencies": {
67
64
  "@rsbuild/plugin-check-syntax": "^1.6.1",
68
- "@rspack/core": "^2.1.8",
65
+ "@rspack/core": "^2.1.10",
69
66
  "@types/babel__code-frame": "7.27.0",
67
+ "@types/cors": "2.8.19",
70
68
  "@types/envinfo": "7.8.4",
71
69
  "@types/fs-extra": "^11.0.4",
72
70
  "@types/node": "^24.12.3",
73
71
  "@types/semver": "^7.8.0",
72
+ "@types/ws": "^8.18.1",
74
73
  "babel-loader": "10.1.1",
75
- "filesize": "^11.0.22",
74
+ "filesize": "^11.0.23",
76
75
  "json-stream-stringify": "3.0.1",
77
76
  "string-loader": "0.0.1",
78
77
  "ts-loader": "^9.6.2",
79
78
  "tslib": "2.8.1",
80
79
  "typescript": "^7.0.2",
81
- "@types/cors": "2.8.19",
82
- "@types/ws": "^8.18.1",
83
80
  "@scripts/test-helper": "0.1.1"
84
81
  },
85
82
  "peerDependencies": {
@@ -90,14 +87,17 @@
90
87
  "optional": true
91
88
  }
92
89
  },
90
+ "engines": {
91
+ "node": ">=22.18.0"
92
+ },
93
93
  "publishConfig": {
94
94
  "access": "public",
95
95
  "registry": "https://registry.npmjs.org/"
96
96
  },
97
97
  "scripts": {
98
+ "build": "rs lib",
98
99
  "dev": "npm run start",
99
- "build": "rslib build",
100
- "start": "rslib build -w",
101
- "test": "rstest run"
100
+ "start": "rs lib -w",
101
+ "test": "rs test"
102
102
  }
103
103
  }
@@ -1,10 +0,0 @@
1
- import type { Linter } from '@rsdoctor/shared/types';
2
- import type { RsdoctorMultiplePluginOptions } from '../types/index.js';
3
- import { RsdoctorRspackPlugin } from './plugin.js';
4
- /**
5
- * @deprecated Use {@link RsdoctorRspackPlugin}. Multi-compiler builds are now
6
- * detected and isolated automatically.
7
- */
8
- export declare class RsdoctorRspackMultiplePlugin<Rules extends Linter.ExtendRuleData[]> extends RsdoctorRspackPlugin<Rules> {
9
- constructor(options?: RsdoctorMultiplePluginOptions<Rules>);
10
- }