@rsdoctor/cli 1.5.8 → 1.5.10
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/commands/analyze.d.cts +12 -0
- package/dist/commands/bundle-diff.d.cts +16 -0
- package/dist/commands/index.d.cts +2 -0
- package/dist/commands/stats-analyze.d.cts +12 -0
- package/dist/constants.d.cts +11 -0
- package/dist/fetch-http.d.cts +3 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +6 -0
- package/dist/index.js +2 -2
- package/dist/types.d.cts +21 -0
- package/dist/utils.d.cts +9 -0
- package/dist/utils.test.d.cts +1 -0
- package/package.json +15 -10
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SDK } from '@rsdoctor/types';
|
|
2
|
+
import { RsdoctorSDK } from '@rsdoctor/sdk';
|
|
3
|
+
import { Command } from '../types';
|
|
4
|
+
import { Commands } from '../constants';
|
|
5
|
+
interface Options {
|
|
6
|
+
profile: string;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
port?: number;
|
|
9
|
+
type?: SDK.ToDataType;
|
|
10
|
+
}
|
|
11
|
+
export declare const analyze: Command<Commands.Analyze, Options, RsdoctorSDK>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from '../types';
|
|
2
|
+
import { Commands } from '../constants';
|
|
3
|
+
import { RsdoctorSDK } from '@rsdoctor/sdk';
|
|
4
|
+
interface Options {
|
|
5
|
+
current: string;
|
|
6
|
+
baseline: string;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
html?: boolean;
|
|
9
|
+
json?: boolean | string;
|
|
10
|
+
output?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const bundleDiff: Command<Commands.BundleDiff, Options, RsdoctorSDK<{
|
|
13
|
+
name: string;
|
|
14
|
+
root: string;
|
|
15
|
+
}> | null>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RsdoctorSDK } from '@rsdoctor/sdk';
|
|
2
|
+
import { SDK } from '@rsdoctor/types';
|
|
3
|
+
import { Commands } from '../constants';
|
|
4
|
+
import { Command } from '../types';
|
|
5
|
+
interface Options {
|
|
6
|
+
profile: string;
|
|
7
|
+
open?: boolean;
|
|
8
|
+
port?: number;
|
|
9
|
+
type?: SDK.ToDataType;
|
|
10
|
+
}
|
|
11
|
+
export declare const statsAnalyze: Command<Commands.StatsAnalyze, Options, RsdoctorSDK>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum Commands {
|
|
2
|
+
Analyze = "analyze",
|
|
3
|
+
BundleDiff = "bundle-diff",
|
|
4
|
+
StatsAnalyze = "stats-analyze"
|
|
5
|
+
}
|
|
6
|
+
export declare const pkg: {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
bin: Record<string, string>;
|
|
10
|
+
};
|
|
11
|
+
export declare const bin: string;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Fetch } from '@rsdoctor/utils/common';
|
|
2
|
+
/** Thin wrapper so tests can `rs.mock('./fetch-http')` without depending on `Fetch.getFetch` internals. */
|
|
3
|
+
export declare function fetchWithTimeout(url: string, options: Parameters<typeof Fetch.fetchWithTimeout>[1]): Promise<Response>;
|
package/dist/index.cjs
CHANGED
|
@@ -496,7 +496,7 @@ for(var __rspack_i in (()=>{
|
|
|
496
496
|
async function loadShardingFileWithSpinner(uri, cwd, spinner) {
|
|
497
497
|
return loadShardingFile(uri, cwd).then((res)=>(spinner.text = `loaded "${uri}"`, res));
|
|
498
498
|
}
|
|
499
|
-
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.
|
|
499
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.10","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"type":"module","dependencies":{"ora":"^5.4.1","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","@rsdoctor/graph":"workspace:*"},"devDependencies":{"@rsdoctor/client":"workspace:*","cac":"^7.0.0","typescript":"catalog:","picocolors":"catalog:"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
500
500
|
let constants_bin = Object.keys(package_namespaceObject.bin)[0], analyze = enhanceCommand(({ cwd, name, bin })=>({
|
|
501
501
|
command: "analyze",
|
|
502
502
|
description: `
|
|
@@ -518,7 +518,7 @@ example: ${bin} analyze --profile "${types_namespaceObject.Constants.RsdoctorOut
|
|
|
518
518
|
} catch (error) {
|
|
519
519
|
try {
|
|
520
520
|
dataValue = await common_namespaceObject.Manifest.fetchShardingFiles(json.cloudData || {}, (url)=>loadShardingFileWithSpinner(url, cwd, spinner));
|
|
521
|
-
} catch
|
|
521
|
+
} catch {
|
|
522
522
|
throw spinner.fail((0, picocolors.red)(error.message)), error;
|
|
523
523
|
}
|
|
524
524
|
}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { analyze, bundleDiff } from './commands';
|
|
2
|
+
import { GetCommandArgumentsType } from './types';
|
|
3
|
+
import { Commands } from './constants';
|
|
4
|
+
export declare function execute<T extends GetCommandArgumentsType<typeof analyze>>(command: Commands.Analyze | `${Commands.Analyze}`, options: T['options']): Promise<T['result']>;
|
|
5
|
+
export declare function execute<T extends GetCommandArgumentsType<typeof bundleDiff>>(command: Commands.BundleDiff | `${Commands.BundleDiff}`, options: T['options']): Promise<T['result']>;
|
|
6
|
+
export declare function execute(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -475,7 +475,7 @@ async function loadShardingFile(uri, cwd) {
|
|
|
475
475
|
async function loadShardingFileWithSpinner(uri, cwd, spinner) {
|
|
476
476
|
return loadShardingFile(uri, cwd).then((res)=>(spinner.text = `loaded "${uri}"`, res));
|
|
477
477
|
}
|
|
478
|
-
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.
|
|
478
|
+
var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.10","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"license":"MIT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"dev":"npm run start","build":"rslib build","start":"rslib build -w","test":"rstest run"},"type":"module","dependencies":{"ora":"^5.4.1","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","@rsdoctor/graph":"workspace:*"},"devDependencies":{"@rsdoctor/client":"workspace:*","cac":"^7.0.0","typescript":"catalog:","picocolors":"catalog:"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
|
|
479
479
|
let constants_bin = Object.keys(package_namespaceObject.bin)[0], picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"), analyze = (fn = ({ cwd, name, bin })=>({
|
|
480
480
|
command: "analyze",
|
|
481
481
|
description: `
|
|
@@ -497,7 +497,7 @@ example: ${bin} analyze --profile "${Constants.RsdoctorOutputManifestPath}"
|
|
|
497
497
|
} catch (error) {
|
|
498
498
|
try {
|
|
499
499
|
dataValue = await Manifest.fetchShardingFiles(json.cloudData || {}, (url)=>loadShardingFileWithSpinner(url, cwd, spinner));
|
|
500
|
-
} catch
|
|
500
|
+
} catch {
|
|
501
501
|
throw spinner.fail((0, picocolors.red)(error.message)), error;
|
|
502
502
|
}
|
|
503
503
|
}
|
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Common } from '@rsdoctor/types';
|
|
2
|
+
import type { Command as CACCommand } from 'cac';
|
|
3
|
+
export interface Command<CMD, Options = Common.PlainObject, Result = unknown> {
|
|
4
|
+
(ctx: CommandContext): CommandOutput<CMD, Options, Result>;
|
|
5
|
+
}
|
|
6
|
+
export interface CommandContext {
|
|
7
|
+
name: string;
|
|
8
|
+
bin: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
}
|
|
11
|
+
export interface CommandOutput<CMD, Options, Result> {
|
|
12
|
+
command: CMD;
|
|
13
|
+
description: string;
|
|
14
|
+
options(cli: CACCommand): void;
|
|
15
|
+
action(args: Options): Result | Promise<Result>;
|
|
16
|
+
}
|
|
17
|
+
export type GetCommandArgumentsType<T> = T extends Command<infer C, infer Options, infer Result> ? {
|
|
18
|
+
command: C;
|
|
19
|
+
options: Options;
|
|
20
|
+
result: Result;
|
|
21
|
+
} : unknown;
|
package/dist/utils.d.cts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ora } from 'ora';
|
|
2
|
+
import { Command } from './types';
|
|
3
|
+
import { Common } from '@rsdoctor/types';
|
|
4
|
+
export declare function enhanceCommand<CMD extends string, Options, Result>(fn: Command<CMD, Options, Result>): Command<CMD, Options, Result>;
|
|
5
|
+
export declare function fetchText(url: string): Promise<string>;
|
|
6
|
+
export declare function readFile(url: string, cwd: string): Promise<string>;
|
|
7
|
+
export declare function loadJSON<T extends Common.PlainObject>(uri: string, cwd: string): Promise<T>;
|
|
8
|
+
export declare function loadShardingFile(uri: string, cwd: string): Promise<string>;
|
|
9
|
+
export declare function loadShardingFileWithSpinner(uri: string, cwd: string, spinner: Ora): Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/cli",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -15,9 +15,14 @@
|
|
|
15
15
|
],
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
"import": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"require": {
|
|
23
|
+
"types": "./dist/index.d.cts",
|
|
24
|
+
"default": "./dist/index.cjs"
|
|
25
|
+
}
|
|
21
26
|
}
|
|
22
27
|
},
|
|
23
28
|
"license": "MIT",
|
|
@@ -26,19 +31,19 @@
|
|
|
26
31
|
"type": "module",
|
|
27
32
|
"dependencies": {
|
|
28
33
|
"ora": "^5.4.1",
|
|
29
|
-
"@rsdoctor/sdk": "1.5.
|
|
30
|
-
"@rsdoctor/
|
|
31
|
-
"@rsdoctor/
|
|
32
|
-
"@rsdoctor/
|
|
34
|
+
"@rsdoctor/sdk": "1.5.10",
|
|
35
|
+
"@rsdoctor/types": "1.5.10",
|
|
36
|
+
"@rsdoctor/graph": "1.5.10",
|
|
37
|
+
"@rsdoctor/utils": "1.5.10"
|
|
33
38
|
},
|
|
34
39
|
"devDependencies": {
|
|
35
40
|
"cac": "^7.0.0",
|
|
36
41
|
"typescript": "^5.9.2",
|
|
37
42
|
"picocolors": "^1.1.1",
|
|
38
|
-
"@rsdoctor/client": "1.5.
|
|
43
|
+
"@rsdoctor/client": "1.5.10"
|
|
39
44
|
},
|
|
40
45
|
"peerDependencies": {
|
|
41
|
-
"@rsdoctor/client": "1.5.
|
|
46
|
+
"@rsdoctor/client": "1.5.10"
|
|
42
47
|
},
|
|
43
48
|
"publishConfig": {
|
|
44
49
|
"access": "public",
|