@rsdoctor/cli 1.5.6-canary.0 → 1.5.6

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.
@@ -6,7 +6,6 @@ interface Options {
6
6
  baseline: string;
7
7
  open?: boolean;
8
8
  html?: boolean;
9
- json?: boolean | string;
10
9
  output?: string;
11
10
  }
12
11
  export declare const bundleDiff: Command<Commands.BundleDiff, Options, RsdoctorSDK<{
package/dist/index.cjs CHANGED
@@ -4295,7 +4295,7 @@ for(var __rspack_i in (()=>{
4295
4295
  async function loadShardingFileWithSpinner(uri, cwd, spinner) {
4296
4296
  return loadShardingFile(uri, cwd).then((res)=>(spinner.text = `loaded "${uri}"`, res));
4297
4297
  }
4298
- var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.6-canary.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","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/core":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","@rsdoctor/graph":"workspace:*"},"devDependencies":{"@rsdoctor/client":"workspace:*","cac":"^7.0.0","typescript":"^5.9.2","axios":"^1.13.6","picocolors":"^1.1.1"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
4298
+ var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.6","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","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":"^5.9.2","axios":"^1.13.6","picocolors":"^1.1.1"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
4299
4299
  let constants_bin = Object.keys(package_namespaceObject.bin)[0], analyze = enhanceCommand(({ cwd, name, bin })=>({
4300
4300
  command: "analyze",
4301
4301
  description: `
@@ -4345,9 +4345,9 @@ use ${name} to open the bundle diff result in browser for analysis.
4345
4345
  example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4346
4346
  `.trim(),
4347
4347
  options (cli) {
4348
- cli.option('--current <path>', 'the url or file path of the profile json as the current').option('--baseline <path>', 'the url or file path of the profile json as the baseline').option('--html', 'output as a standalone HTML file').option('--json [path]', 'output as a JSON file, optionally specify file path (default: rsdoctor-diff.json)').option('--output <path>', 'output file path for HTML/JSON mode (default: rsdoctor-diff.html or rsdoctor-diff.json)');
4348
+ cli.option('--current <path>', 'the url or file path of the profile json as the current').option('--baseline <path>', 'the url or file path of the profile json as the baseline').option('--html', 'output as a standalone HTML file').option('--output <path>', 'output file path for HTML mode (default: rsdoctor-diff.html)');
4349
4349
  },
4350
- async action ({ baseline, current, open = !0, html = !1, json = !1, output }) {
4350
+ async action ({ baseline, current, open = !0, html = !1, output = 'rsdoctor-diff.html' }) {
4351
4351
  let baselineDataValue, currentDataValue, spinner = external_ora_default()({
4352
4352
  prefixText: (0, picocolors.cyan)(`[${name}]`)
4353
4353
  }).start();
@@ -4377,15 +4377,6 @@ example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4377
4377
  if (currentData.cloudData) spinner.text = 'load the "currentData.cloudData" instead of the "currentData.data"', currentDataValue = await common_namespaceObject.Manifest.fetchShardingFiles(currentData.cloudData, (url)=>loadShardingFileWithSpinner(url, cwd, spinner));
4378
4378
  else throw spinner.fail((0, picocolors.red)(error.message)), error;
4379
4379
  }
4380
- if (json) {
4381
- spinner.text = 'Generating JSON output file...';
4382
- let outputPath = external_path_default().resolve(cwd, 'string' == typeof json ? json : 'rsdoctor-diff.json');
4383
- external_fs_default().mkdirSync(external_path_default().dirname(outputPath), {
4384
- recursive: !0
4385
- });
4386
- let jsonData = common_namespaceObject.Graph.getBundleDiffResult(baselineDataValue, currentDataValue);
4387
- return external_fs_default().writeFileSync(outputPath, JSON.stringify(jsonData, null, 2), 'utf-8'), spinner.succeed(`Generated JSON output file at: ${outputPath}`), null;
4388
- }
4389
4380
  if (!html) {
4390
4381
  spinner.text = "start server";
4391
4382
  let baselineSdk = new sdk_namespaceObject.RsdoctorSDK({
@@ -4446,7 +4437,7 @@ example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4446
4437
  `window.${types_namespaceObject.Constants.WINDOW_RSDOCTOR_TAG}.mode = 'diff';`
4447
4438
  ].map((script)=>`<script>${script}</script>`).join('\n');
4448
4439
  htmlContent = htmlContent.replace('<body>', `<body>${compressTextScripts}`);
4449
- let outputPath = external_path_default().resolve(cwd, output || 'rsdoctor-diff.html');
4440
+ let outputPath = external_path_default().resolve(cwd, output);
4450
4441
  external_fs_default().mkdirSync(external_path_default().dirname(outputPath), {
4451
4442
  recursive: !0
4452
4443
  }), external_fs_default().writeFileSync(outputPath, htmlContent, 'utf-8'), spinner.succeed(`Generated standalone HTML file at: ${outputPath}`);
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import * as __rspack_external_tty from "tty";
12
12
  import url_0, * as __rspack_external_url from "url";
13
13
  import util, * as __rspack_external_util from "util";
14
14
  import { __webpack_require__ } from "./rslib-runtime.js";
15
- import { Algorithm, Graph, Manifest, Url } from "@rsdoctor/utils/common";
15
+ import { Algorithm, Manifest, Url } from "@rsdoctor/utils/common";
16
16
  import { Client, Constants, Manifest as types_Manifest, SDK } from "@rsdoctor/types";
17
17
  import { RsdoctorSDK } from "@rsdoctor/sdk";
18
18
  import ora from "ora";
@@ -4208,7 +4208,7 @@ axios.Axios = Axios, axios.CanceledError = cancel_CanceledError, axios.CancelTok
4208
4208
  }, axios.isAxiosError = function(payload) {
4209
4209
  return utils.isObject(payload) && !0 === payload.isAxiosError;
4210
4210
  }, axios.mergeConfig = mergeConfig, axios.AxiosHeaders = AxiosHeaders, axios.formToJSON = (thing)=>helpers_formDataToJSON(utils.isHTMLForm(thing) ? new FormData(thing) : thing), axios.getAdapter = adapters_adapters_getAdapter, axios.HttpStatusCode = HttpStatusCode, axios.default = axios;
4211
- var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.6-canary.0","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","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/core":"workspace:*","@rsdoctor/sdk":"workspace:*","@rsdoctor/types":"workspace:*","@rsdoctor/utils":"workspace:*","@rsdoctor/graph":"workspace:*"},"devDependencies":{"@rsdoctor/client":"workspace:*","cac":"^7.0.0","typescript":"^5.9.2","axios":"^1.13.6","picocolors":"^1.1.1"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
4211
+ var package_namespaceObject = JSON.parse('{"name":"@rsdoctor/cli","version":"1.5.6","repository":{"type":"git","url":"https://github.com/web-infra-dev/rsdoctor","directory":"packages/cli"},"bin":{"rsdoctor":"./bin/rsdoctor"},"files":["bin","dist"],"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","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":"^5.9.2","axios":"^1.13.6","picocolors":"^1.1.1"},"peerDependencies":{"@rsdoctor/client":"workspace:*"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"}}');
4212
4212
  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 })=>({
4213
4213
  command: "analyze",
4214
4214
  description: `
@@ -4256,9 +4256,9 @@ use ${name} to open the bundle diff result in browser for analysis.
4256
4256
  example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4257
4257
  `.trim(),
4258
4258
  options (cli) {
4259
- cli.option('--current <path>', 'the url or file path of the profile json as the current').option('--baseline <path>', 'the url or file path of the profile json as the baseline').option('--html', 'output as a standalone HTML file').option('--json [path]', 'output as a JSON file, optionally specify file path (default: rsdoctor-diff.json)').option('--output <path>', 'output file path for HTML/JSON mode (default: rsdoctor-diff.html or rsdoctor-diff.json)');
4259
+ cli.option('--current <path>', 'the url or file path of the profile json as the current').option('--baseline <path>', 'the url or file path of the profile json as the baseline').option('--html', 'output as a standalone HTML file').option('--output <path>', 'output file path for HTML mode (default: rsdoctor-diff.html)');
4260
4260
  },
4261
- async action ({ baseline, current, open = !0, html = !1, json = !1, output }) {
4261
+ async action ({ baseline, current, open = !0, html = !1, output = 'rsdoctor-diff.html' }) {
4262
4262
  let baselineDataValue, currentDataValue, spinner = ora({
4263
4263
  prefixText: (0, picocolors.cyan)(`[${name}]`)
4264
4264
  }).start();
@@ -4288,15 +4288,6 @@ example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4288
4288
  if (currentData.cloudData) spinner.text = 'load the "currentData.cloudData" instead of the "currentData.data"', currentDataValue = await Manifest.fetchShardingFiles(currentData.cloudData, (url)=>loadShardingFileWithSpinner(url, cwd, spinner));
4289
4289
  else throw spinner.fail((0, picocolors.red)(error.message)), error;
4290
4290
  }
4291
- if (json) {
4292
- spinner.text = 'Generating JSON output file...';
4293
- let outputPath = path_0.resolve(cwd, 'string' == typeof json ? json : 'rsdoctor-diff.json');
4294
- fs.mkdirSync(path_0.dirname(outputPath), {
4295
- recursive: !0
4296
- });
4297
- let jsonData = Graph.getBundleDiffResult(baselineDataValue, currentDataValue);
4298
- return fs.writeFileSync(outputPath, JSON.stringify(jsonData, null, 2), 'utf-8'), spinner.succeed(`Generated JSON output file at: ${outputPath}`), null;
4299
- }
4300
4291
  if (!html) {
4301
4292
  spinner.text = "start server";
4302
4293
  let baselineSdk = new RsdoctorSDK({
@@ -4357,7 +4348,7 @@ example: ${bin} bundle-diff --baseline="x.json" --current="x.json"
4357
4348
  `window.${Constants.WINDOW_RSDOCTOR_TAG}.mode = 'diff';`
4358
4349
  ].map((script)=>`<script>${script}</script>`).join('\n');
4359
4350
  htmlContent = htmlContent.replace('<body>', `<body>${compressTextScripts}`);
4360
- let outputPath = path_0.resolve(cwd, output || 'rsdoctor-diff.html');
4351
+ let outputPath = path_0.resolve(cwd, output);
4361
4352
  fs.mkdirSync(path_0.dirname(outputPath), {
4362
4353
  recursive: !0
4363
4354
  }), fs.writeFileSync(outputPath, htmlContent, 'utf-8'), spinner.succeed(`Generated standalone HTML file at: ${outputPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsdoctor/cli",
3
- "version": "1.5.6-canary.0",
3
+ "version": "1.5.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/rsdoctor",
@@ -26,21 +26,20 @@
26
26
  "type": "module",
27
27
  "dependencies": {
28
28
  "ora": "^5.4.1",
29
- "@rsdoctor/core": "1.5.6-canary.0",
30
- "@rsdoctor/types": "1.5.6-canary.0",
31
- "@rsdoctor/sdk": "1.5.6-canary.0",
32
- "@rsdoctor/utils": "1.5.6-canary.0",
33
- "@rsdoctor/graph": "1.5.6-canary.0"
29
+ "@rsdoctor/sdk": "1.5.6",
30
+ "@rsdoctor/types": "1.5.6",
31
+ "@rsdoctor/utils": "1.5.6",
32
+ "@rsdoctor/graph": "1.5.6"
34
33
  },
35
34
  "devDependencies": {
36
35
  "cac": "^7.0.0",
37
36
  "typescript": "^5.9.2",
38
37
  "axios": "^1.13.6",
39
38
  "picocolors": "^1.1.1",
40
- "@rsdoctor/client": "1.5.6-canary.0"
39
+ "@rsdoctor/client": "1.5.6"
41
40
  },
42
41
  "peerDependencies": {
43
- "@rsdoctor/client": "1.5.6-canary.0"
42
+ "@rsdoctor/client": "1.5.6"
44
43
  },
45
44
  "publishConfig": {
46
45
  "access": "public",