@simon_he/pi 0.0.93 → 0.0.94

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/index.cjs CHANGED
@@ -61,20 +61,19 @@ var __privateWrapper = (obj, member, setter, getter) => ({
61
61
  }
62
62
  });
63
63
 
64
- // node_modules/picocolors/picocolors.js
64
+ // node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
65
65
  var require_picocolors = __commonJS({
66
- "node_modules/picocolors/picocolors.js"(exports, module2) {
67
- var argv = process.argv || [];
68
- var env3 = process.env;
69
- var isColorSupported = !("NO_COLOR" in env3 || argv.includes("--no-color")) && ("FORCE_COLOR" in env3 || argv.includes("--color") || process.platform === "win32" || require != null && require("tty").isatty(1) && env3.TERM !== "dumb" || "CI" in env3);
66
+ "node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module2) {
67
+ var p = process || {};
68
+ var argv = p.argv || [];
69
+ var env3 = p.env || {};
70
+ var isColorSupported = !(!!env3.NO_COLOR || argv.includes("--no-color")) && (!!env3.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env3.TERM !== "dumb" || !!env3.CI);
70
71
  var formatter = (open, close, replace = open) => (input) => {
71
- let string = "" + input;
72
- let index = string.indexOf(close, open.length);
72
+ let string = "" + input, index = string.indexOf(close, open.length);
73
73
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
74
74
  };
75
75
  var replaceClose = (string, close, replace, index) => {
76
- let result = "";
77
- let cursor = 0;
76
+ let result = "", cursor = 0;
78
77
  do {
79
78
  result += string.substring(cursor, index) + replace;
80
79
  cursor = index + close.length;
@@ -83,50 +82,50 @@ var require_picocolors = __commonJS({
83
82
  return result + string.substring(cursor);
84
83
  };
85
84
  var createColors = (enabled = isColorSupported) => {
86
- let init = enabled ? formatter : () => String;
85
+ let f = enabled ? formatter : () => String;
87
86
  return {
88
87
  isColorSupported: enabled,
89
- reset: init("\x1B[0m", "\x1B[0m"),
90
- bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
91
- dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
92
- italic: init("\x1B[3m", "\x1B[23m"),
93
- underline: init("\x1B[4m", "\x1B[24m"),
94
- inverse: init("\x1B[7m", "\x1B[27m"),
95
- hidden: init("\x1B[8m", "\x1B[28m"),
96
- strikethrough: init("\x1B[9m", "\x1B[29m"),
97
- black: init("\x1B[30m", "\x1B[39m"),
98
- red: init("\x1B[31m", "\x1B[39m"),
99
- green: init("\x1B[32m", "\x1B[39m"),
100
- yellow: init("\x1B[33m", "\x1B[39m"),
101
- blue: init("\x1B[34m", "\x1B[39m"),
102
- magenta: init("\x1B[35m", "\x1B[39m"),
103
- cyan: init("\x1B[36m", "\x1B[39m"),
104
- white: init("\x1B[37m", "\x1B[39m"),
105
- gray: init("\x1B[90m", "\x1B[39m"),
106
- bgBlack: init("\x1B[40m", "\x1B[49m"),
107
- bgRed: init("\x1B[41m", "\x1B[49m"),
108
- bgGreen: init("\x1B[42m", "\x1B[49m"),
109
- bgYellow: init("\x1B[43m", "\x1B[49m"),
110
- bgBlue: init("\x1B[44m", "\x1B[49m"),
111
- bgMagenta: init("\x1B[45m", "\x1B[49m"),
112
- bgCyan: init("\x1B[46m", "\x1B[49m"),
113
- bgWhite: init("\x1B[47m", "\x1B[49m"),
114
- blackBright: init("\x1B[90m", "\x1B[39m"),
115
- redBright: init("\x1B[91m", "\x1B[39m"),
116
- greenBright: init("\x1B[92m", "\x1B[39m"),
117
- yellowBright: init("\x1B[93m", "\x1B[39m"),
118
- blueBright: init("\x1B[94m", "\x1B[39m"),
119
- magentaBright: init("\x1B[95m", "\x1B[39m"),
120
- cyanBright: init("\x1B[96m", "\x1B[39m"),
121
- whiteBright: init("\x1B[97m", "\x1B[39m"),
122
- bgBlackBright: init("\x1B[100m", "\x1B[49m"),
123
- bgRedBright: init("\x1B[101m", "\x1B[49m"),
124
- bgGreenBright: init("\x1B[102m", "\x1B[49m"),
125
- bgYellowBright: init("\x1B[103m", "\x1B[49m"),
126
- bgBlueBright: init("\x1B[104m", "\x1B[49m"),
127
- bgMagentaBright: init("\x1B[105m", "\x1B[49m"),
128
- bgCyanBright: init("\x1B[106m", "\x1B[49m"),
129
- bgWhiteBright: init("\x1B[107m", "\x1B[49m")
88
+ reset: f("\x1B[0m", "\x1B[0m"),
89
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
90
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
91
+ italic: f("\x1B[3m", "\x1B[23m"),
92
+ underline: f("\x1B[4m", "\x1B[24m"),
93
+ inverse: f("\x1B[7m", "\x1B[27m"),
94
+ hidden: f("\x1B[8m", "\x1B[28m"),
95
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
96
+ black: f("\x1B[30m", "\x1B[39m"),
97
+ red: f("\x1B[31m", "\x1B[39m"),
98
+ green: f("\x1B[32m", "\x1B[39m"),
99
+ yellow: f("\x1B[33m", "\x1B[39m"),
100
+ blue: f("\x1B[34m", "\x1B[39m"),
101
+ magenta: f("\x1B[35m", "\x1B[39m"),
102
+ cyan: f("\x1B[36m", "\x1B[39m"),
103
+ white: f("\x1B[37m", "\x1B[39m"),
104
+ gray: f("\x1B[90m", "\x1B[39m"),
105
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
106
+ bgRed: f("\x1B[41m", "\x1B[49m"),
107
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
108
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
109
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
110
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
111
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
112
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
113
+ blackBright: f("\x1B[90m", "\x1B[39m"),
114
+ redBright: f("\x1B[91m", "\x1B[39m"),
115
+ greenBright: f("\x1B[92m", "\x1B[39m"),
116
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
117
+ blueBright: f("\x1B[94m", "\x1B[39m"),
118
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
119
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
120
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
121
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
122
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
123
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
124
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
125
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
126
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
127
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
128
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
130
129
  };
131
130
  };
132
131
  module2.exports = createColors();
@@ -5681,13 +5680,15 @@ __export(src_exports, {
5681
5680
  });
5682
5681
  module.exports = __toCommonJS(src_exports);
5683
5682
  var import_process4 = __toESM(require("process"), 1);
5684
- var import_lazy_js_utils13 = require("lazy-js-utils");
5683
+ var import_node13 = require("lazy-js-utils/dist/node");
5684
+ var import_lazy_js_utils2 = require("lazy-js-utils");
5685
5685
  var import_picocolors8 = __toESM(require_picocolors(), 1);
5686
5686
  var import_fast_glob = __toESM(require("fast-glob"), 1);
5687
5687
  var import_ccommand3 = require("ccommand");
5688
5688
 
5689
5689
  // src/utils.ts
5690
5690
  var import_path = __toESM(require("path"), 1);
5691
+ var import_node = require("lazy-js-utils/dist/node");
5691
5692
  var import_lazy_js_utils = require("lazy-js-utils");
5692
5693
 
5693
5694
  // node_modules/.pnpm/ora@6.3.1/node_modules/ora/index.js
@@ -7165,7 +7166,7 @@ async function getParams(params) {
7165
7166
  var _a, _b;
7166
7167
  const root = process.cwd();
7167
7168
  try {
7168
- switch (await (0, import_lazy_js_utils.getPkgTool)()) {
7169
+ switch (await (0, import_node.getPkgTool)()) {
7169
7170
  case "pnpm":
7170
7171
  if (!(0, import_lazy_js_utils.isFile)(import_path.default.resolve(root, "./pnpm-workspace.yaml"))) {
7171
7172
  if (DW.test(params))
@@ -7192,7 +7193,7 @@ async function getParams(params) {
7192
7193
  return params.replace(W, " -w");
7193
7194
  return params;
7194
7195
  case "yarn":
7195
- if (!((_a = await (0, import_lazy_js_utils.getPkg)(import_path.default.resolve(root, "./package.json"))) == null ? void 0 : _a.workspaces)) {
7196
+ if (!((_a = await (0, import_node.getPkg)(import_path.default.resolve(root, "./package.json"))) == null ? void 0 : _a.workspaces)) {
7196
7197
  if (Dw.test(params))
7197
7198
  return params.replace(Dw, " -D");
7198
7199
  if (DW.test(params))
@@ -7202,7 +7203,7 @@ async function getParams(params) {
7202
7203
  if (w.test(params))
7203
7204
  return params.replace(w, "");
7204
7205
  }
7205
- if ((_b = await (0, import_lazy_js_utils.getPkg)()) == null ? void 0 : _b.workspaces) {
7206
+ if ((_b = await (0, import_node.getPkg)()) == null ? void 0 : _b.workspaces) {
7206
7207
  if (D.test(params))
7207
7208
  return params.replace(D, " -DW");
7208
7209
  if (d.test(params))
@@ -7244,11 +7245,15 @@ async function getStyle() {
7244
7245
  spinner
7245
7246
  };
7246
7247
  }
7247
- function getLatestVersion(pkg, isZh6 = true) {
7248
+ async function getLatestVersion(pkg, isZh6 = true) {
7248
7249
  const data = [];
7249
7250
  for (const p of pkg.replace(/\s+/, " ").split(" ")) {
7250
7251
  const [pName, v] = p.split("$");
7251
- let { status, result } = (0, import_lazy_js_utils.jsShell)(`npm view ${pName}`, "pipe");
7252
+ let { status, result } = await (0, import_node.jsShell)(`npm view ${pName}`, [
7253
+ "inherit",
7254
+ "pipe",
7255
+ "inherit"
7256
+ ]);
7252
7257
  if (status === 0) {
7253
7258
  if (result.startsWith("@"))
7254
7259
  result = result.slice(1);
@@ -7262,22 +7267,22 @@ function getLatestVersion(pkg, isZh6 = true) {
7262
7267
  }
7263
7268
 
7264
7269
  // src/help.ts
7265
- var import_lazy_js_utils2 = require("lazy-js-utils");
7270
+ var import_node2 = require("lazy-js-utils/dist/node");
7266
7271
 
7267
7272
  // package.json
7268
- var version = "0.0.93";
7273
+ var version = "0.0.94";
7269
7274
 
7270
7275
  // src/help.ts
7271
7276
  var isZh2 = process.env.PI_Lang === "zh";
7272
7277
  function help(argv) {
7273
7278
  const arg = argv[0];
7274
7279
  if (arg === "-v" || arg === "--version") {
7275
- (0, import_lazy_js_utils2.jsShell)(
7280
+ (0, import_node2.jsShell)(
7276
7281
  isZh2 ? `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi \u7248\u672C: ${version}" "\u8BF7\u4E3A\u6211\u7684\u52AA\u529B\u70B9\u4E00\u4E2A\u884C \u{1F31F}" "\u8C22\u8C22 \u{1F91F}"` : `gum style --foreground 212 --border-foreground 212 --border double --align center --width 50 --margin "1 2" --padding "2 4" "pi version: ${version}" "Please give me a \u{1F31F} for my efforts" "Thank you \u{1F91F}"`
7277
7282
  );
7278
7283
  process.exit(0);
7279
7284
  } else if (arg === "-h" || arg === "--help") {
7280
- (0, import_lazy_js_utils2.jsShell)(
7285
+ (0, import_node2.jsShell)(
7281
7286
  `gum style --foreground 212 --border-foreground 212 --border double --align left --width 50 --margin "1 2" --padding "1 1" "PI Commands:" "~ pi: install package" "~ pix: npx package" "~ pui: uninstall package" "~ prun: run package script" "~ pinit: package init" "~ pbuild: go build | cargo build" "~ pfind: find monorepo of yarn or pnpm" "~ pa: agent alias" "~ pu: package upgrade" "~ pci: package clean install" "~ pil: package latest install"
7282
7287
  `
7283
7288
  );
@@ -7286,12 +7291,16 @@ function help(argv) {
7286
7291
  }
7287
7292
 
7288
7293
  // src/installDeps.ts
7289
- var import_lazy_js_utils3 = require("lazy-js-utils");
7294
+ var import_node3 = require("lazy-js-utils/dist/node");
7290
7295
  var import_picocolors2 = __toESM(require_picocolors(), 1);
7291
7296
  async function installDeps() {
7292
- if (!(0, import_lazy_js_utils3.isInstallPkg)("gum")) {
7297
+ if (!await (0, import_node3.isInstallPkg)("gum")) {
7293
7298
  console.log(import_picocolors2.default.cyan("\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5\u5FC5\u8981\u7684\u4F9D\u8D56gum..."));
7294
- const { status } = await (0, import_lazy_js_utils3.jsShell)("brew install gum", "pipe");
7299
+ const { status } = await (0, import_node3.jsShell)("brew install gum", [
7300
+ "inherit",
7301
+ "pipe",
7302
+ "inherit"
7303
+ ]);
7295
7304
  if (status === 0) {
7296
7305
  console.log(import_picocolors2.default.cyan("gum \u5B89\u88C5\u6210\u529F!"));
7297
7306
  } else {
@@ -7303,9 +7312,13 @@ async function installDeps() {
7303
7312
  process.exit(1);
7304
7313
  }
7305
7314
  }
7306
- if (!(0, import_lazy_js_utils3.isInstallPkg)("ni")) {
7315
+ if (!await (0, import_node3.isInstallPkg)("ni")) {
7307
7316
  console.log(import_picocolors2.default.cyan("\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5\u5FC5\u8981\u7684\u4F9D\u8D56ni..."));
7308
- const { status } = await (0, import_lazy_js_utils3.jsShell)("npm i -g @antfu/ni", "pipe");
7317
+ const { status } = await (0, import_node3.jsShell)("npm i -g @antfu/ni", [
7318
+ "inherit",
7319
+ "pipe",
7320
+ "inherit"
7321
+ ]);
7309
7322
  if (status === 0) {
7310
7323
  console.log(import_picocolors2.default.cyan("ni \u5B89\u88C5\u6210\u529F!"));
7311
7324
  } else {
@@ -7322,18 +7335,18 @@ async function installDeps() {
7322
7335
  // src/pi.ts
7323
7336
  var import_process2 = __toESM(require("process"), 1);
7324
7337
  var import_console = require("console");
7325
- var import_lazy_js_utils5 = require("lazy-js-utils");
7338
+ var import_node5 = require("lazy-js-utils/dist/node");
7326
7339
  var import_picocolors4 = __toESM(require_picocolors(), 1);
7327
7340
 
7328
7341
  // src/detectNode.ts
7329
7342
  var import_process = __toESM(require("process"), 1);
7330
- var import_lazy_js_utils4 = require("lazy-js-utils");
7343
+ var import_node4 = require("lazy-js-utils/dist/node");
7331
7344
  var import_picocolors3 = __toESM(require_picocolors(), 1);
7332
7345
  async function detectNode() {
7333
7346
  var _a;
7334
7347
  let pkg;
7335
7348
  try {
7336
- pkg = await (0, import_lazy_js_utils4.getPkg)();
7349
+ pkg = await (0, import_node4.getPkg)();
7337
7350
  } catch (e) {
7338
7351
  const cwd = import_process.default.cwd();
7339
7352
  console.log(import_picocolors3.default.red(`\u5F53\u524D\u76EE\u5F55: ${cwd} \u6CA1\u6709package.json\u6587\u4EF6`));
@@ -7345,13 +7358,13 @@ async function detectNode() {
7345
7358
  pkg.engines.node
7346
7359
  );
7347
7360
  if (!isSafe) {
7348
- const { result, status } = await (0, import_lazy_js_utils4.jsShell)(
7361
+ const { result, status } = await (0, import_node4.jsShell)(
7349
7362
  `echo "yes
7350
7363
  no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3 ${pkg.engines.node}\uFF0C\u662F\u5426\u5207\u6362node\u7248\u672C"`,
7351
- "pipe"
7364
+ ["inherit", "pipe", "inherit"]
7352
7365
  );
7353
7366
  if (status === 0 && result === "yes") {
7354
- await (0, import_lazy_js_utils4.jsShell)(
7367
+ await (0, import_node4.jsShell)(
7355
7368
  `
7356
7369
  current=$(echo $(fnm current))
7357
7370
  registery=$(echo "$(fnm ls)" | sed 's/system//g' | sed 's/default//g' | sed 's/* //g' | sed "s/$current/* $current/g" | gum filter --placeholder=" \u8BF7\u9009\u62E9\u4E00\u4E2Anode\u7248\u672C")
@@ -7360,7 +7373,7 @@ no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3
7360
7373
  fnm use \${registery% -*}
7361
7374
  fi
7362
7375
  `,
7363
- "pipe"
7376
+ ["inherit", "pipe", "inherit"]
7364
7377
  );
7365
7378
  }
7366
7379
  }
@@ -7377,16 +7390,16 @@ async function pi(params, pkg, executor = "ni") {
7377
7390
  const start = Date.now();
7378
7391
  let successMsg = "";
7379
7392
  if (isLatest) {
7380
- successMsg = getLatestVersion(pkg, isZh3);
7393
+ successMsg = await getLatestVersion(pkg, isZh3);
7381
7394
  } else {
7382
7395
  successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
7383
7396
  }
7384
7397
  const failMsg = pkg ? isZh3 ? `${params} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${params} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
7385
7398
  const newParams = isLatest ? params : await getParams(params);
7386
- let stdio = "pipe";
7399
+ let stdio = ["inherit", "pipe", "inherit"];
7387
7400
  let loading_status;
7388
7401
  const { PI_DEFAULT, PI_MaxSockets: sockets } = import_process2.default.env;
7389
- const pkgTool = await (0, import_lazy_js_utils5.getPkgTool)();
7402
+ const pkgTool = await (0, import_node5.getPkgTool)();
7390
7403
  const maxSockets = sockets || 4;
7391
7404
  const install = PI_DEFAULT === "yarn" || pkgTool === "yarn" ? newParams ? "add" : "" : "install";
7392
7405
  if (pkgTool === "npm") {
@@ -7402,7 +7415,7 @@ async function pi(params, pkg, executor = "ni") {
7402
7415
  loading_status = await loading(text);
7403
7416
  }
7404
7417
  const runSockets = executor.split(" ")[0] === "npm" ? ` --max-sockets=${maxSockets}` : "";
7405
- let { status, result } = await (0, import_lazy_js_utils5.useNodeWorker)({
7418
+ let { status, result } = await (0, import_node5.useNodeWorker)({
7406
7419
  params: `${executor}${newParams ? ` ${newParams}` : runSockets}`,
7407
7420
  stdio,
7408
7421
  errorExit: false
@@ -7414,7 +7427,7 @@ async function pi(params, pkg, executor = "ni") {
7414
7427
  isZh3 ? "\u6B63\u5728\u5C1D\u8BD5\u4F7F\u7528 npm \u518D\u6B21\u6267\u884C..." : "Trying to use npm to run again..."
7415
7428
  )
7416
7429
  );
7417
- const { status: newStatus, result: newResult } = (0, import_lazy_js_utils5.jsShell)(
7430
+ const { status: newStatus, result: newResult } = await (0, import_node5.jsShell)(
7418
7431
  `npm install${newParams ? ` ${newParams}` : runSockets}`,
7419
7432
  {
7420
7433
  stdio
@@ -7444,16 +7457,16 @@ ${result}` : failMsg));
7444
7457
  const match = result.match(reg);
7445
7458
  if (match) {
7446
7459
  const dep = match[1];
7447
- (0, import_lazy_js_utils5.jsShell)(`pi ${dep}@latest`);
7460
+ (0, import_node5.jsShell)(`pi ${dep}@latest`);
7448
7461
  }
7449
7462
  }
7450
7463
  import_process2.default.exit();
7451
7464
  }
7452
7465
 
7453
7466
  // src/pa.ts
7454
- var import_lazy_js_utils6 = require("lazy-js-utils");
7467
+ var import_node6 = require("lazy-js-utils/dist/node");
7455
7468
  function pa() {
7456
- return (0, import_lazy_js_utils6.jsShell)("na");
7469
+ return (0, import_node6.jsShell)("na");
7457
7470
  }
7458
7471
 
7459
7472
  // src/pci.ts
@@ -7468,10 +7481,10 @@ function pfind(params) {
7468
7481
  }
7469
7482
 
7470
7483
  // src/pil.ts
7471
- var import_lazy_js_utils7 = require("lazy-js-utils");
7484
+ var import_node7 = require("lazy-js-utils/dist/node");
7472
7485
  var import_picocolors5 = __toESM(require_picocolors(), 1);
7473
7486
  async function pil(params) {
7474
- const { dependencies = {}, devDependencies = {} } = await (0, import_lazy_js_utils7.getPkg)();
7487
+ const { dependencies = {}, devDependencies = {} } = await (0, import_node7.getPkg)();
7475
7488
  if (!params) {
7476
7489
  const deps = [
7477
7490
  ...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
@@ -7479,11 +7492,13 @@ async function pil(params) {
7479
7492
  (key) => `${key}: ${devDependencies[key]}`
7480
7493
  )
7481
7494
  ];
7482
- const { result: choose, status } = (0, import_lazy_js_utils7.jsShell)(
7495
+ const { result: choose, status } = await (0, import_node7.jsShell)(
7483
7496
  `echo ${deps.join(
7484
7497
  ","
7485
7498
  )} | sed "s/,/\\n/g" | gum filter --no-limit --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u83B7\u53D6\u6700\u65B0\u7248\u672C\u7684\u4F9D\u8D56" : "Please select a dependency that needs to obtain the latest version."}"`,
7486
- "pipe"
7499
+ {
7500
+ stdio: ["inherit", "pipe", "inherit"]
7501
+ }
7487
7502
  );
7488
7503
  if (status === 130) {
7489
7504
  console.log(import_picocolors5.default.dim("\u5DF2\u53D6\u6D88"));
@@ -7518,32 +7533,32 @@ async function pil(params) {
7518
7533
  }
7519
7534
 
7520
7535
  // src/pinit.ts
7521
- var import_lazy_js_utils8 = require("lazy-js-utils");
7536
+ var import_node8 = require("lazy-js-utils/dist/node");
7522
7537
  async function pinit() {
7523
7538
  console.log("Initializing project...");
7524
- switch (await (0, import_lazy_js_utils8.getPkgTool)()) {
7539
+ switch (await (0, import_node8.getPkgTool)()) {
7525
7540
  case "npm":
7526
- (0, import_lazy_js_utils8.jsShell)("npm init -y");
7541
+ (0, import_node8.jsShell)("npm init -y");
7527
7542
  return;
7528
7543
  case "yarn":
7529
- (0, import_lazy_js_utils8.jsShell)("yarn init -y");
7544
+ (0, import_node8.jsShell)("yarn init -y");
7530
7545
  return;
7531
7546
  case "pnpm":
7532
- (0, import_lazy_js_utils8.jsShell)("pnpm init -y");
7547
+ (0, import_node8.jsShell)("pnpm init -y");
7533
7548
  return;
7534
7549
  default:
7535
- (0, import_lazy_js_utils8.jsShell)("npm init -y");
7550
+ (0, import_node8.jsShell)("npm init -y");
7536
7551
  }
7537
7552
  }
7538
7553
 
7539
7554
  // src/pix.ts
7540
- var import_lazy_js_utils9 = require("lazy-js-utils");
7555
+ var import_node9 = require("lazy-js-utils/dist/node");
7541
7556
  async function pix(params) {
7542
- switch (await (0, import_lazy_js_utils9.getPkgTool)()) {
7557
+ switch (await (0, import_node9.getPkgTool)()) {
7543
7558
  case "bun":
7544
- return (0, import_lazy_js_utils9.jsShell)(`bunx ${params}`);
7559
+ return (0, import_node9.jsShell)(`bunx ${params}`);
7545
7560
  default:
7546
- return (0, import_lazy_js_utils9.jsShell)(`npx ${params}`);
7561
+ return (0, import_node9.jsShell)(`npx ${params}`);
7547
7562
  }
7548
7563
  }
7549
7564
 
@@ -7554,30 +7569,30 @@ function prun(params) {
7554
7569
  }
7555
7570
 
7556
7571
  // src/pu.ts
7557
- var import_lazy_js_utils10 = require("lazy-js-utils");
7572
+ var import_node10 = require("lazy-js-utils/dist/node");
7558
7573
  function pu() {
7559
- return (0, import_lazy_js_utils10.jsShell)("nu");
7574
+ return (0, import_node10.jsShell)("nu");
7560
7575
  }
7561
7576
 
7562
7577
  // src/pui.ts
7563
- var import_lazy_js_utils11 = require("lazy-js-utils");
7578
+ var import_node11 = require("lazy-js-utils/dist/node");
7564
7579
  var import_picocolors6 = __toESM(require_picocolors(), 1);
7565
7580
  var isZh4 = process.env.PI_Lang === "zh";
7566
7581
  async function pui(params, pkg) {
7567
7582
  const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
7568
7583
  if (!params) {
7569
- const { dependencies = {}, devDependencies = {} } = await (0, import_lazy_js_utils11.getPkg)();
7584
+ const { dependencies = {}, devDependencies = {} } = await (0, import_node11.getPkg)();
7570
7585
  const deps = [
7571
7586
  ...Object.keys(dependencies).map((key) => `${key}: ${dependencies[key]}`),
7572
7587
  ...Object.keys(devDependencies).map(
7573
7588
  (key) => `${key}: ${devDependencies[key]}`
7574
7589
  )
7575
7590
  ];
7576
- const { result: choose, status: status2 } = (0, import_lazy_js_utils11.jsShell)(
7591
+ const { result: choose, status: status2 } = await (0, import_node11.jsShell)(
7577
7592
  `echo ${deps.join(
7578
7593
  ","
7579
7594
  )} | sed "s/,/\\n/g" | gum filter --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u5220\u9664\u4F9D\u8D56" : "Please select a dependency to get the latest version."}"`,
7580
- "pipe"
7595
+ ["inherit", "pipe", "inherit"]
7581
7596
  );
7582
7597
  if (status2 === 130) {
7583
7598
  console.log(import_picocolors6.default.dim("\u5DF2\u53D6\u6D88"));
@@ -7599,7 +7614,7 @@ async function pui(params, pkg) {
7599
7614
  process.exit(1);
7600
7615
  }
7601
7616
  const loading_status = await loading(text);
7602
- const { status, result } = await (0, import_lazy_js_utils11.useNodeWorker)(`nun ${params}`);
7617
+ const { status, result } = await (0, import_node11.useNodeWorker)(`nun ${params}`);
7603
7618
  const end = Date.now();
7604
7619
  const costTime = (end - start) / 1e3;
7605
7620
  successMsg += import_picocolors6.default.blue(` ---- \u23F0\uFF1A${costTime}s`);
@@ -7613,14 +7628,14 @@ ${result}` : failMsg));
7613
7628
 
7614
7629
  // src/pio.ts
7615
7630
  var import_process3 = __toESM(require("process"), 1);
7616
- var import_lazy_js_utils12 = require("lazy-js-utils");
7631
+ var import_node12 = require("lazy-js-utils/dist/node");
7617
7632
  var import_picocolors7 = __toESM(require_picocolors(), 1);
7618
7633
  async function pio(params, pkg, executor = "ni") {
7619
7634
  const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
7620
7635
  const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency! \u{1F62D}";
7621
7636
  const offline = "--prefer-offline";
7622
7637
  const newParams = await getParams(params);
7623
- const { status, result } = await (0, import_lazy_js_utils12.useNodeWorker)({
7638
+ const { status, result } = await (0, import_node12.useNodeWorker)({
7624
7639
  params: `${executor} ${newParams} ${offline}`,
7625
7640
  stdio: "inherit"
7626
7641
  });
@@ -7653,7 +7668,7 @@ var isZh5 = import_process4.default.env.PI_Lang === "zh";
7653
7668
  async function setup() {
7654
7669
  const cmd = import_process4.default.argv[1];
7655
7670
  let exec = "";
7656
- if ((0, import_lazy_js_utils13.isWin)()) {
7671
+ if ((0, import_lazy_js_utils2.isWin)()) {
7657
7672
  const last = cmd.lastIndexOf("\\") + 1;
7658
7673
  exec = cmd.slice(last, cmd.length).split(".").slice(0, -1).join(".");
7659
7674
  } else {
@@ -7662,15 +7677,15 @@ async function setup() {
7662
7677
  }
7663
7678
  const argv = import_process4.default.argv.slice(2);
7664
7679
  help(argv);
7665
- const params = (0, import_lazy_js_utils13.spaceFormat)(argv.join(" ")).trim();
7666
- if (!(0, import_lazy_js_utils13.hasPkg)(rootPath)) {
7667
- if ((0, import_lazy_js_utils13.isGo)()) {
7680
+ const params = (0, import_lazy_js_utils2.spaceFormat)(argv.join(" ")).trim();
7681
+ if (!(0, import_node13.hasPkg)(rootPath)) {
7682
+ if (await (0, import_lazy_js_utils2.isGo)()) {
7668
7683
  if (exec === "pi") {
7669
7684
  const loading_status = await loading(
7670
7685
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
7671
7686
  `
7672
7687
  );
7673
- const { status } = params ? await (0, import_lazy_js_utils13.useNodeWorker)(`go get ${params}`) : await (0, import_lazy_js_utils13.useNodeWorker)("go mod tidy");
7688
+ const { status } = params ? await (0, import_node13.useNodeWorker)(`go get ${params}`) : await (0, import_node13.useNodeWorker)("go mod tidy");
7674
7689
  if (status === 0) {
7675
7690
  loading_status.succeed(
7676
7691
  import_picocolors8.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
@@ -7685,7 +7700,7 @@ async function setup() {
7685
7700
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
7686
7701
  `
7687
7702
  );
7688
- const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`go clean ${params}`);
7703
+ const { status } = await (0, import_node13.useNodeWorker)(`go clean ${params}`);
7689
7704
  if (status === 0) {
7690
7705
  loading_status.succeed(
7691
7706
  import_picocolors8.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
@@ -7698,11 +7713,11 @@ async function setup() {
7698
7713
  } else if (exec === "prun") {
7699
7714
  const match = params ? params.endsWith(".go") ? [`**/${params}`] : [`**/${params}.go`, `**/${params}/main.go`] : "main.go";
7700
7715
  const target = (await (0, import_fast_glob.default)(match))[0];
7701
- return target ? (0, import_lazy_js_utils13.jsShell)(`go run ${target}`) : (0, import_ccommand3.ccommand)(params);
7716
+ return target ? (0, import_node13.jsShell)(`go run ${target}`) : (0, import_ccommand3.ccommand)(params);
7702
7717
  } else if (exec === "pinit") {
7703
- (0, import_lazy_js_utils13.jsShell)(`go mod init ${params}`);
7718
+ (0, import_node13.jsShell)(`go mod init ${params}`);
7704
7719
  } else if (exec === "pbuild") {
7705
- (0, import_lazy_js_utils13.jsShell)(`go build ${params}`);
7720
+ (0, import_node13.jsShell)(`go build ${params}`);
7706
7721
  } else {
7707
7722
  console.log(
7708
7723
  import_picocolors8.default.red(
@@ -7712,13 +7727,13 @@ async function setup() {
7712
7727
  }
7713
7728
  import_process4.default.exit();
7714
7729
  }
7715
- if ((0, import_lazy_js_utils13.isRust)()) {
7730
+ if (await (0, import_lazy_js_utils2.isRust)()) {
7716
7731
  if (exec === "pi") {
7717
7732
  const loading_status = await loading(
7718
7733
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
7719
7734
  `
7720
7735
  );
7721
- const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`cargo install ${params}`);
7736
+ const { status } = await (0, import_node13.useNodeWorker)(`cargo install ${params}`);
7722
7737
  if (status === 0) {
7723
7738
  loading_status.succeed(
7724
7739
  import_picocolors8.default.green(isZh5 ? "\u5B89\u88C5\u6210\u529F! \u{1F60A}" : "Installed successfully! \u{1F60A}")
@@ -7733,7 +7748,7 @@ async function setup() {
7733
7748
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${params} ...
7734
7749
  `
7735
7750
  );
7736
- const { status } = await (0, import_lazy_js_utils13.useNodeWorker)(`cargo uninstall ${params}`);
7751
+ const { status } = await (0, import_node13.useNodeWorker)(`cargo uninstall ${params}`);
7737
7752
  if (status === 0) {
7738
7753
  loading_status.succeed(
7739
7754
  import_picocolors8.default.green(isZh5 ? "\u5378\u8F7D\u6210\u529F! \u{1F60A}" : "Uninstalled successfully! \u{1F60A}")
@@ -7744,11 +7759,11 @@ async function setup() {
7744
7759
  );
7745
7760
  }
7746
7761
  } else if (exec === "prun") {
7747
- (0, import_lazy_js_utils13.jsShell)(`cargo run ${params}`);
7762
+ (0, import_node13.jsShell)(`cargo run ${params}`);
7748
7763
  } else if (exec === "pinit") {
7749
- (0, import_lazy_js_utils13.jsShell)(`cargo init ${params}`);
7764
+ (0, import_node13.jsShell)(`cargo init ${params}`);
7750
7765
  } else if (exec === "pbuild") {
7751
- (0, import_lazy_js_utils13.jsShell)(`cargo build ${params}`);
7766
+ (0, import_node13.jsShell)(`cargo build ${params}`);
7752
7767
  } else {
7753
7768
  console.log(
7754
7769
  import_picocolors8.default.red(
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as lazy_js_utils_dist_types from 'lazy-js-utils/dist/types';
1
+ import * as lazy_js_utils_dist_types_82873c18 from 'lazy-js-utils/dist/types-82873c18';
2
2
 
3
- declare function setup(): Promise<void | lazy_js_utils_dist_types.IShellMessage>;
3
+ declare function setup(): Promise<void | lazy_js_utils_dist_types_82873c18.I>;
4
4
 
5
5
  export { setup };
package/dist/index.js CHANGED
@@ -62,20 +62,19 @@ var __privateWrapper = (obj, member, setter, getter) => ({
62
62
  }
63
63
  });
64
64
 
65
- // node_modules/picocolors/picocolors.js
65
+ // node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
66
66
  var require_picocolors = __commonJS({
67
- "node_modules/picocolors/picocolors.js"(exports, module) {
68
- var argv = process.argv || [];
69
- var env3 = process.env;
70
- var isColorSupported = !("NO_COLOR" in env3 || argv.includes("--no-color")) && ("FORCE_COLOR" in env3 || argv.includes("--color") || process.platform === "win32" || __require != null && __require("tty").isatty(1) && env3.TERM !== "dumb" || "CI" in env3);
67
+ "node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
68
+ var p = process || {};
69
+ var argv = p.argv || [];
70
+ var env3 = p.env || {};
71
+ var isColorSupported = !(!!env3.NO_COLOR || argv.includes("--no-color")) && (!!env3.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env3.TERM !== "dumb" || !!env3.CI);
71
72
  var formatter = (open, close, replace = open) => (input) => {
72
- let string = "" + input;
73
- let index = string.indexOf(close, open.length);
73
+ let string = "" + input, index = string.indexOf(close, open.length);
74
74
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
75
75
  };
76
76
  var replaceClose = (string, close, replace, index) => {
77
- let result = "";
78
- let cursor = 0;
77
+ let result = "", cursor = 0;
79
78
  do {
80
79
  result += string.substring(cursor, index) + replace;
81
80
  cursor = index + close.length;
@@ -84,50 +83,50 @@ var require_picocolors = __commonJS({
84
83
  return result + string.substring(cursor);
85
84
  };
86
85
  var createColors = (enabled = isColorSupported) => {
87
- let init = enabled ? formatter : () => String;
86
+ let f = enabled ? formatter : () => String;
88
87
  return {
89
88
  isColorSupported: enabled,
90
- reset: init("\x1B[0m", "\x1B[0m"),
91
- bold: init("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
92
- dim: init("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
93
- italic: init("\x1B[3m", "\x1B[23m"),
94
- underline: init("\x1B[4m", "\x1B[24m"),
95
- inverse: init("\x1B[7m", "\x1B[27m"),
96
- hidden: init("\x1B[8m", "\x1B[28m"),
97
- strikethrough: init("\x1B[9m", "\x1B[29m"),
98
- black: init("\x1B[30m", "\x1B[39m"),
99
- red: init("\x1B[31m", "\x1B[39m"),
100
- green: init("\x1B[32m", "\x1B[39m"),
101
- yellow: init("\x1B[33m", "\x1B[39m"),
102
- blue: init("\x1B[34m", "\x1B[39m"),
103
- magenta: init("\x1B[35m", "\x1B[39m"),
104
- cyan: init("\x1B[36m", "\x1B[39m"),
105
- white: init("\x1B[37m", "\x1B[39m"),
106
- gray: init("\x1B[90m", "\x1B[39m"),
107
- bgBlack: init("\x1B[40m", "\x1B[49m"),
108
- bgRed: init("\x1B[41m", "\x1B[49m"),
109
- bgGreen: init("\x1B[42m", "\x1B[49m"),
110
- bgYellow: init("\x1B[43m", "\x1B[49m"),
111
- bgBlue: init("\x1B[44m", "\x1B[49m"),
112
- bgMagenta: init("\x1B[45m", "\x1B[49m"),
113
- bgCyan: init("\x1B[46m", "\x1B[49m"),
114
- bgWhite: init("\x1B[47m", "\x1B[49m"),
115
- blackBright: init("\x1B[90m", "\x1B[39m"),
116
- redBright: init("\x1B[91m", "\x1B[39m"),
117
- greenBright: init("\x1B[92m", "\x1B[39m"),
118
- yellowBright: init("\x1B[93m", "\x1B[39m"),
119
- blueBright: init("\x1B[94m", "\x1B[39m"),
120
- magentaBright: init("\x1B[95m", "\x1B[39m"),
121
- cyanBright: init("\x1B[96m", "\x1B[39m"),
122
- whiteBright: init("\x1B[97m", "\x1B[39m"),
123
- bgBlackBright: init("\x1B[100m", "\x1B[49m"),
124
- bgRedBright: init("\x1B[101m", "\x1B[49m"),
125
- bgGreenBright: init("\x1B[102m", "\x1B[49m"),
126
- bgYellowBright: init("\x1B[103m", "\x1B[49m"),
127
- bgBlueBright: init("\x1B[104m", "\x1B[49m"),
128
- bgMagentaBright: init("\x1B[105m", "\x1B[49m"),
129
- bgCyanBright: init("\x1B[106m", "\x1B[49m"),
130
- bgWhiteBright: init("\x1B[107m", "\x1B[49m")
89
+ reset: f("\x1B[0m", "\x1B[0m"),
90
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
91
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
92
+ italic: f("\x1B[3m", "\x1B[23m"),
93
+ underline: f("\x1B[4m", "\x1B[24m"),
94
+ inverse: f("\x1B[7m", "\x1B[27m"),
95
+ hidden: f("\x1B[8m", "\x1B[28m"),
96
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
97
+ black: f("\x1B[30m", "\x1B[39m"),
98
+ red: f("\x1B[31m", "\x1B[39m"),
99
+ green: f("\x1B[32m", "\x1B[39m"),
100
+ yellow: f("\x1B[33m", "\x1B[39m"),
101
+ blue: f("\x1B[34m", "\x1B[39m"),
102
+ magenta: f("\x1B[35m", "\x1B[39m"),
103
+ cyan: f("\x1B[36m", "\x1B[39m"),
104
+ white: f("\x1B[37m", "\x1B[39m"),
105
+ gray: f("\x1B[90m", "\x1B[39m"),
106
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
107
+ bgRed: f("\x1B[41m", "\x1B[49m"),
108
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
109
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
110
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
111
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
112
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
113
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
114
+ blackBright: f("\x1B[90m", "\x1B[39m"),
115
+ redBright: f("\x1B[91m", "\x1B[39m"),
116
+ greenBright: f("\x1B[92m", "\x1B[39m"),
117
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
118
+ blueBright: f("\x1B[94m", "\x1B[39m"),
119
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
120
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
121
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
122
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
123
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
124
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
125
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
126
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
127
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
128
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
129
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
131
130
  };
132
131
  };
133
132
  module.exports = createColors();
@@ -5678,21 +5677,15 @@ var require_bl = __commonJS({
5678
5677
  // src/index.ts
5679
5678
  var import_picocolors8 = __toESM(require_picocolors(), 1);
5680
5679
  import process12 from "process";
5681
- import {
5682
- hasPkg,
5683
- isGo,
5684
- isRust,
5685
- isWin,
5686
- jsShell as jsShell12,
5687
- spaceFormat,
5688
- useNodeWorker as useNodeWorker4
5689
- } from "lazy-js-utils";
5680
+ import { hasPkg, jsShell as jsShell12, useNodeWorker as useNodeWorker4 } from "lazy-js-utils/dist/node";
5681
+ import { isGo, isRust, isWin, spaceFormat } from "lazy-js-utils";
5690
5682
  import fg from "fast-glob";
5691
5683
  import { ccommand as ccommand3 } from "ccommand";
5692
5684
 
5693
5685
  // src/utils.ts
5694
5686
  import path from "path";
5695
- import { getPkg, getPkgTool, isFile, jsShell } from "lazy-js-utils";
5687
+ import { getPkg, getPkgTool, jsShell } from "lazy-js-utils/dist/node";
5688
+ import { isFile } from "lazy-js-utils";
5696
5689
 
5697
5690
  // node_modules/.pnpm/ora@6.3.1/node_modules/ora/index.js
5698
5691
  import process8 from "process";
@@ -7248,11 +7241,15 @@ async function getStyle() {
7248
7241
  spinner
7249
7242
  };
7250
7243
  }
7251
- function getLatestVersion(pkg, isZh6 = true) {
7244
+ async function getLatestVersion(pkg, isZh6 = true) {
7252
7245
  const data = [];
7253
7246
  for (const p of pkg.replace(/\s+/, " ").split(" ")) {
7254
7247
  const [pName, v] = p.split("$");
7255
- let { status, result } = jsShell(`npm view ${pName}`, "pipe");
7248
+ let { status, result } = await jsShell(`npm view ${pName}`, [
7249
+ "inherit",
7250
+ "pipe",
7251
+ "inherit"
7252
+ ]);
7256
7253
  if (status === 0) {
7257
7254
  if (result.startsWith("@"))
7258
7255
  result = result.slice(1);
@@ -7266,10 +7263,10 @@ function getLatestVersion(pkg, isZh6 = true) {
7266
7263
  }
7267
7264
 
7268
7265
  // src/help.ts
7269
- import { jsShell as jsShell2 } from "lazy-js-utils";
7266
+ import { jsShell as jsShell2 } from "lazy-js-utils/dist/node";
7270
7267
 
7271
7268
  // package.json
7272
- var version = "0.0.93";
7269
+ var version = "0.0.94";
7273
7270
 
7274
7271
  // src/help.ts
7275
7272
  var isZh2 = process.env.PI_Lang === "zh";
@@ -7291,11 +7288,15 @@ function help(argv) {
7291
7288
 
7292
7289
  // src/installDeps.ts
7293
7290
  var import_picocolors2 = __toESM(require_picocolors(), 1);
7294
- import { isInstallPkg, jsShell as jsShell3 } from "lazy-js-utils";
7291
+ import { isInstallPkg, jsShell as jsShell3 } from "lazy-js-utils/dist/node";
7295
7292
  async function installDeps() {
7296
- if (!isInstallPkg("gum")) {
7293
+ if (!await isInstallPkg("gum")) {
7297
7294
  console.log(import_picocolors2.default.cyan("\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5\u5FC5\u8981\u7684\u4F9D\u8D56gum..."));
7298
- const { status } = await jsShell3("brew install gum", "pipe");
7295
+ const { status } = await jsShell3("brew install gum", [
7296
+ "inherit",
7297
+ "pipe",
7298
+ "inherit"
7299
+ ]);
7299
7300
  if (status === 0) {
7300
7301
  console.log(import_picocolors2.default.cyan("gum \u5B89\u88C5\u6210\u529F!"));
7301
7302
  } else {
@@ -7307,9 +7308,13 @@ async function installDeps() {
7307
7308
  process.exit(1);
7308
7309
  }
7309
7310
  }
7310
- if (!isInstallPkg("ni")) {
7311
+ if (!await isInstallPkg("ni")) {
7311
7312
  console.log(import_picocolors2.default.cyan("\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5\u5FC5\u8981\u7684\u4F9D\u8D56ni..."));
7312
- const { status } = await jsShell3("npm i -g @antfu/ni", "pipe");
7313
+ const { status } = await jsShell3("npm i -g @antfu/ni", [
7314
+ "inherit",
7315
+ "pipe",
7316
+ "inherit"
7317
+ ]);
7313
7318
  if (status === 0) {
7314
7319
  console.log(import_picocolors2.default.cyan("ni \u5B89\u88C5\u6210\u529F!"));
7315
7320
  } else {
@@ -7327,12 +7332,12 @@ async function installDeps() {
7327
7332
  var import_picocolors4 = __toESM(require_picocolors(), 1);
7328
7333
  import process10 from "process";
7329
7334
  import { log } from "console";
7330
- import { getPkgTool as getPkgTool2, jsShell as jsShell5, useNodeWorker } from "lazy-js-utils";
7335
+ import { getPkgTool as getPkgTool2, jsShell as jsShell5, useNodeWorker } from "lazy-js-utils/dist/node";
7331
7336
 
7332
7337
  // src/detectNode.ts
7333
7338
  var import_picocolors3 = __toESM(require_picocolors(), 1);
7334
7339
  import process9 from "process";
7335
- import { getPkg as getPkg2, jsShell as jsShell4 } from "lazy-js-utils";
7340
+ import { getPkg as getPkg2, jsShell as jsShell4 } from "lazy-js-utils/dist/node";
7336
7341
  async function detectNode() {
7337
7342
  var _a;
7338
7343
  let pkg;
@@ -7352,7 +7357,7 @@ async function detectNode() {
7352
7357
  const { result, status } = await jsShell4(
7353
7358
  `echo "yes
7354
7359
  no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3 ${pkg.engines.node}\uFF0C\u662F\u5426\u5207\u6362node\u7248\u672C"`,
7355
- "pipe"
7360
+ ["inherit", "pipe", "inherit"]
7356
7361
  );
7357
7362
  if (status === 0 && result === "yes") {
7358
7363
  await jsShell4(
@@ -7364,7 +7369,7 @@ no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3
7364
7369
  fnm use \${registery% -*}
7365
7370
  fi
7366
7371
  `,
7367
- "pipe"
7372
+ ["inherit", "pipe", "inherit"]
7368
7373
  );
7369
7374
  }
7370
7375
  }
@@ -7381,13 +7386,13 @@ async function pi(params, pkg, executor = "ni") {
7381
7386
  const start = Date.now();
7382
7387
  let successMsg = "";
7383
7388
  if (isLatest) {
7384
- successMsg = getLatestVersion(pkg, isZh3);
7389
+ successMsg = await getLatestVersion(pkg, isZh3);
7385
7390
  } else {
7386
7391
  successMsg = pkg ? isZh3 ? `${pkg} \u5B89\u88C5\u6210\u529F! \u{1F60A}` : `Installed ${pkg} successfully! \u{1F60A}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u6210\u529F! \u{1F60A}" : "Updated dependency successfully! \u{1F60A}";
7387
7392
  }
7388
7393
  const failMsg = pkg ? isZh3 ? `${params} \u5B89\u88C5\u5931\u8D25 \u{1F62D}` : `Failed to install ${params} \u{1F62D}` : isZh3 ? "\u4F9D\u8D56\u66F4\u65B0\u5931\u8D25 \u{1F62D}" : "Failed to update dependency \u{1F62D}";
7389
7394
  const newParams = isLatest ? params : await getParams(params);
7390
- let stdio = "pipe";
7395
+ let stdio = ["inherit", "pipe", "inherit"];
7391
7396
  let loading_status;
7392
7397
  const { PI_DEFAULT, PI_MaxSockets: sockets } = process10.env;
7393
7398
  const pkgTool = await getPkgTool2();
@@ -7418,7 +7423,7 @@ async function pi(params, pkg, executor = "ni") {
7418
7423
  isZh3 ? "\u6B63\u5728\u5C1D\u8BD5\u4F7F\u7528 npm \u518D\u6B21\u6267\u884C..." : "Trying to use npm to run again..."
7419
7424
  )
7420
7425
  );
7421
- const { status: newStatus, result: newResult } = jsShell5(
7426
+ const { status: newStatus, result: newResult } = await jsShell5(
7422
7427
  `npm install${newParams ? ` ${newParams}` : runSockets}`,
7423
7428
  {
7424
7429
  stdio
@@ -7455,7 +7460,7 @@ ${result}` : failMsg));
7455
7460
  }
7456
7461
 
7457
7462
  // src/pa.ts
7458
- import { jsShell as jsShell6 } from "lazy-js-utils";
7463
+ import { jsShell as jsShell6 } from "lazy-js-utils/dist/node";
7459
7464
  function pa() {
7460
7465
  return jsShell6("na");
7461
7466
  }
@@ -7473,7 +7478,7 @@ function pfind(params) {
7473
7478
 
7474
7479
  // src/pil.ts
7475
7480
  var import_picocolors5 = __toESM(require_picocolors(), 1);
7476
- import { getPkg as getPkg3, jsShell as jsShell7 } from "lazy-js-utils";
7481
+ import { getPkg as getPkg3, jsShell as jsShell7 } from "lazy-js-utils/dist/node";
7477
7482
  async function pil(params) {
7478
7483
  const { dependencies = {}, devDependencies = {} } = await getPkg3();
7479
7484
  if (!params) {
@@ -7483,11 +7488,13 @@ async function pil(params) {
7483
7488
  (key) => `${key}: ${devDependencies[key]}`
7484
7489
  )
7485
7490
  ];
7486
- const { result: choose, status } = jsShell7(
7491
+ const { result: choose, status } = await jsShell7(
7487
7492
  `echo ${deps.join(
7488
7493
  ","
7489
7494
  )} | sed "s/,/\\n/g" | gum filter --no-limit --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u83B7\u53D6\u6700\u65B0\u7248\u672C\u7684\u4F9D\u8D56" : "Please select a dependency that needs to obtain the latest version."}"`,
7490
- "pipe"
7495
+ {
7496
+ stdio: ["inherit", "pipe", "inherit"]
7497
+ }
7491
7498
  );
7492
7499
  if (status === 130) {
7493
7500
  console.log(import_picocolors5.default.dim("\u5DF2\u53D6\u6D88"));
@@ -7522,7 +7529,7 @@ async function pil(params) {
7522
7529
  }
7523
7530
 
7524
7531
  // src/pinit.ts
7525
- import { getPkgTool as getPkgTool3, jsShell as jsShell8 } from "lazy-js-utils";
7532
+ import { getPkgTool as getPkgTool3, jsShell as jsShell8 } from "lazy-js-utils/dist/node";
7526
7533
  async function pinit() {
7527
7534
  console.log("Initializing project...");
7528
7535
  switch (await getPkgTool3()) {
@@ -7541,7 +7548,7 @@ async function pinit() {
7541
7548
  }
7542
7549
 
7543
7550
  // src/pix.ts
7544
- import { getPkgTool as getPkgTool4, jsShell as jsShell9 } from "lazy-js-utils";
7551
+ import { getPkgTool as getPkgTool4, jsShell as jsShell9 } from "lazy-js-utils/dist/node";
7545
7552
  async function pix(params) {
7546
7553
  switch (await getPkgTool4()) {
7547
7554
  case "bun":
@@ -7558,14 +7565,14 @@ function prun(params) {
7558
7565
  }
7559
7566
 
7560
7567
  // src/pu.ts
7561
- import { jsShell as jsShell10 } from "lazy-js-utils";
7568
+ import { jsShell as jsShell10 } from "lazy-js-utils/dist/node";
7562
7569
  function pu() {
7563
7570
  return jsShell10("nu");
7564
7571
  }
7565
7572
 
7566
7573
  // src/pui.ts
7567
7574
  var import_picocolors6 = __toESM(require_picocolors(), 1);
7568
- import { getPkg as getPkg4, jsShell as jsShell11, useNodeWorker as useNodeWorker2 } from "lazy-js-utils";
7575
+ import { getPkg as getPkg4, jsShell as jsShell11, useNodeWorker as useNodeWorker2 } from "lazy-js-utils/dist/node";
7569
7576
  var isZh4 = process.env.PI_Lang === "zh";
7570
7577
  async function pui(params, pkg) {
7571
7578
  const text = `${isZh4 ? "\u6B63\u5728\u4E3A\u60A8\u5378\u8F7D" : "Uninstalling"} ${pkg} ...`;
@@ -7577,11 +7584,11 @@ async function pui(params, pkg) {
7577
7584
  (key) => `${key}: ${devDependencies[key]}`
7578
7585
  )
7579
7586
  ];
7580
- const { result: choose, status: status2 } = jsShell11(
7587
+ const { result: choose, status: status2 } = await jsShell11(
7581
7588
  `echo ${deps.join(
7582
7589
  ","
7583
7590
  )} | sed "s/,/\\n/g" | gum filter --placeholder=" \u{1F914}${process.env.PI_Lang === "zh" ? "\u8BF7\u9009\u62E9\u4E00\u4E2A\u9700\u8981\u5220\u9664\u4F9D\u8D56" : "Please select a dependency to get the latest version."}"`,
7584
- "pipe"
7591
+ ["inherit", "pipe", "inherit"]
7585
7592
  );
7586
7593
  if (status2 === 130) {
7587
7594
  console.log(import_picocolors6.default.dim("\u5DF2\u53D6\u6D88"));
@@ -7618,7 +7625,7 @@ ${result}` : failMsg));
7618
7625
  // src/pio.ts
7619
7626
  var import_picocolors7 = __toESM(require_picocolors(), 1);
7620
7627
  import process11 from "process";
7621
- import { useNodeWorker as useNodeWorker3 } from "lazy-js-utils";
7628
+ import { useNodeWorker as useNodeWorker3 } from "lazy-js-utils/dist/node";
7622
7629
  async function pio(params, pkg, executor = "ni") {
7623
7630
  const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
7624
7631
  const failMsg = pkg ? `Failed to install ${pkg} \u{1F62D}` : "Failed to update dependency! \u{1F62D}";
@@ -7668,7 +7675,7 @@ async function setup() {
7668
7675
  help(argv);
7669
7676
  const params = spaceFormat(argv.join(" ")).trim();
7670
7677
  if (!hasPkg(rootPath)) {
7671
- if (isGo()) {
7678
+ if (await isGo()) {
7672
7679
  if (exec === "pi") {
7673
7680
  const loading_status = await loading(
7674
7681
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
@@ -7716,7 +7723,7 @@ async function setup() {
7716
7723
  }
7717
7724
  process12.exit();
7718
7725
  }
7719
- if (isRust()) {
7726
+ if (await isRust()) {
7720
7727
  if (exec === "pi") {
7721
7728
  const loading_status = await loading(
7722
7729
  `${isZh5 ? "\u6B63\u5728\u4E3A\u60A8\u5B89\u88C5" : "Installing"} ${params} ...
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@simon_he/pi",
3
3
  "type": "module",
4
- "version": "0.0.93",
4
+ "version": "0.0.94",
5
5
  "description": "",
6
6
  "author": "Simon He",
7
7
  "license": "MIT",
@@ -67,17 +67,17 @@
67
67
  "dependencies": {
68
68
  "ccommand": "^1.0.69",
69
69
  "fast-glob": "latest",
70
- "lazy-js-utils": "^0.0.94",
70
+ "lazy-js-utils": "^0.1.26",
71
71
  "semver": "^7.6.3"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@antfu/eslint-config": "^0.34.2",
75
- "@types/node": "^18.19.54",
75
+ "@types/node": "^18.19.60",
76
76
  "bumpp": "^8.2.1",
77
77
  "eslint": "^8.57.1",
78
78
  "lint-staged": "^13.3.0",
79
79
  "ora": "^6.3.1",
80
- "picocolors": "^1.1.0",
80
+ "picocolors": "^1.1.1",
81
81
  "pnpm": "^7.33.7",
82
82
  "prettier": "^2.8.8",
83
83
  "rimraf": "^3.0.2",