@simon_he/pi 0.0.99 → 0.1.0
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 +51 -48
- package/dist/index.js +51 -48
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5200,11 +5200,11 @@ var require_signals = __commonJS({
|
|
|
5200
5200
|
var require_signal_exit = __commonJS({
|
|
5201
5201
|
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports2, module2) {
|
|
5202
5202
|
"use strict";
|
|
5203
|
-
var
|
|
5204
|
-
var processOk = function(
|
|
5205
|
-
return
|
|
5203
|
+
var process16 = global.process;
|
|
5204
|
+
var processOk = function(process17) {
|
|
5205
|
+
return process17 && typeof process17 === "object" && typeof process17.removeListener === "function" && typeof process17.emit === "function" && typeof process17.reallyExit === "function" && typeof process17.listeners === "function" && typeof process17.kill === "function" && typeof process17.pid === "number" && typeof process17.on === "function";
|
|
5206
5206
|
};
|
|
5207
|
-
if (!processOk(
|
|
5207
|
+
if (!processOk(process16)) {
|
|
5208
5208
|
module2.exports = function() {
|
|
5209
5209
|
return function() {
|
|
5210
5210
|
};
|
|
@@ -5212,15 +5212,15 @@ var require_signal_exit = __commonJS({
|
|
|
5212
5212
|
} else {
|
|
5213
5213
|
assert = require("assert");
|
|
5214
5214
|
signals = require_signals();
|
|
5215
|
-
isWin2 = /^win/i.test(
|
|
5215
|
+
isWin2 = /^win/i.test(process16.platform);
|
|
5216
5216
|
EE = require("events");
|
|
5217
5217
|
if (typeof EE !== "function") {
|
|
5218
5218
|
EE = EE.EventEmitter;
|
|
5219
5219
|
}
|
|
5220
|
-
if (
|
|
5221
|
-
emitter =
|
|
5220
|
+
if (process16.__signal_exit_emitter__) {
|
|
5221
|
+
emitter = process16.__signal_exit_emitter__;
|
|
5222
5222
|
} else {
|
|
5223
|
-
emitter =
|
|
5223
|
+
emitter = process16.__signal_exit_emitter__ = new EE();
|
|
5224
5224
|
emitter.count = 0;
|
|
5225
5225
|
emitter.emitted = {};
|
|
5226
5226
|
}
|
|
@@ -5257,12 +5257,12 @@ var require_signal_exit = __commonJS({
|
|
|
5257
5257
|
loaded = false;
|
|
5258
5258
|
signals.forEach(function(sig) {
|
|
5259
5259
|
try {
|
|
5260
|
-
|
|
5260
|
+
process16.removeListener(sig, sigListeners[sig]);
|
|
5261
5261
|
} catch (er) {
|
|
5262
5262
|
}
|
|
5263
5263
|
});
|
|
5264
|
-
|
|
5265
|
-
|
|
5264
|
+
process16.emit = originalProcessEmit;
|
|
5265
|
+
process16.reallyExit = originalProcessReallyExit;
|
|
5266
5266
|
emitter.count -= 1;
|
|
5267
5267
|
};
|
|
5268
5268
|
module2.exports.unload = unload;
|
|
@@ -5279,7 +5279,7 @@ var require_signal_exit = __commonJS({
|
|
|
5279
5279
|
if (!processOk(global.process)) {
|
|
5280
5280
|
return;
|
|
5281
5281
|
}
|
|
5282
|
-
var listeners =
|
|
5282
|
+
var listeners = process16.listeners(sig);
|
|
5283
5283
|
if (listeners.length === emitter.count) {
|
|
5284
5284
|
unload();
|
|
5285
5285
|
emit("exit", null, sig);
|
|
@@ -5287,7 +5287,7 @@ var require_signal_exit = __commonJS({
|
|
|
5287
5287
|
if (isWin2 && sig === "SIGHUP") {
|
|
5288
5288
|
sig = "SIGINT";
|
|
5289
5289
|
}
|
|
5290
|
-
|
|
5290
|
+
process16.kill(process16.pid, sig);
|
|
5291
5291
|
}
|
|
5292
5292
|
};
|
|
5293
5293
|
});
|
|
@@ -5303,36 +5303,36 @@ var require_signal_exit = __commonJS({
|
|
|
5303
5303
|
emitter.count += 1;
|
|
5304
5304
|
signals = signals.filter(function(sig) {
|
|
5305
5305
|
try {
|
|
5306
|
-
|
|
5306
|
+
process16.on(sig, sigListeners[sig]);
|
|
5307
5307
|
return true;
|
|
5308
5308
|
} catch (er) {
|
|
5309
5309
|
return false;
|
|
5310
5310
|
}
|
|
5311
5311
|
});
|
|
5312
|
-
|
|
5313
|
-
|
|
5312
|
+
process16.emit = processEmit;
|
|
5313
|
+
process16.reallyExit = processReallyExit;
|
|
5314
5314
|
};
|
|
5315
5315
|
module2.exports.load = load;
|
|
5316
|
-
originalProcessReallyExit =
|
|
5316
|
+
originalProcessReallyExit = process16.reallyExit;
|
|
5317
5317
|
processReallyExit = function processReallyExit2(code) {
|
|
5318
5318
|
if (!processOk(global.process)) {
|
|
5319
5319
|
return;
|
|
5320
5320
|
}
|
|
5321
|
-
|
|
5321
|
+
process16.exitCode = code || /* istanbul ignore next */
|
|
5322
5322
|
0;
|
|
5323
|
-
emit("exit",
|
|
5324
|
-
emit("afterexit",
|
|
5325
|
-
originalProcessReallyExit.call(
|
|
5323
|
+
emit("exit", process16.exitCode, null);
|
|
5324
|
+
emit("afterexit", process16.exitCode, null);
|
|
5325
|
+
originalProcessReallyExit.call(process16, process16.exitCode);
|
|
5326
5326
|
};
|
|
5327
|
-
originalProcessEmit =
|
|
5327
|
+
originalProcessEmit = process16.emit;
|
|
5328
5328
|
processEmit = function processEmit2(ev, arg) {
|
|
5329
5329
|
if (ev === "exit" && processOk(global.process)) {
|
|
5330
5330
|
if (arg !== void 0) {
|
|
5331
|
-
|
|
5331
|
+
process16.exitCode = arg;
|
|
5332
5332
|
}
|
|
5333
5333
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
5334
|
-
emit("exit",
|
|
5335
|
-
emit("afterexit",
|
|
5334
|
+
emit("exit", process16.exitCode, null);
|
|
5335
|
+
emit("afterexit", process16.exitCode, null);
|
|
5336
5336
|
return ret;
|
|
5337
5337
|
} else {
|
|
5338
5338
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -10461,7 +10461,7 @@ __export(index_exports, {
|
|
|
10461
10461
|
setup: () => setup
|
|
10462
10462
|
});
|
|
10463
10463
|
module.exports = __toCommonJS(index_exports);
|
|
10464
|
-
var
|
|
10464
|
+
var import_process11 = __toESM(require("process"), 1);
|
|
10465
10465
|
var import_path7 = __toESM(require("path"), 1);
|
|
10466
10466
|
|
|
10467
10467
|
// node_modules/.pnpm/lazy-js-utils@0.1.31/node_modules/lazy-js-utils/dist/chunk-4N54TZJJ.mjs
|
|
@@ -11407,6 +11407,7 @@ var import_ccommand3 = require("ccommand");
|
|
|
11407
11407
|
|
|
11408
11408
|
// src/utils.ts
|
|
11409
11409
|
var import_path6 = __toESM(require("path"), 1);
|
|
11410
|
+
var import_process7 = __toESM(require("process"), 1);
|
|
11410
11411
|
|
|
11411
11412
|
// node_modules/.pnpm/ora@6.3.1/node_modules/ora/index.js
|
|
11412
11413
|
var import_node_process6 = __toESM(require("process"), 1);
|
|
@@ -12367,9 +12368,9 @@ var Dw = /\s-Dw/g;
|
|
|
12367
12368
|
var w = /\s-w/g;
|
|
12368
12369
|
var D = /\s-D(?!w)/g;
|
|
12369
12370
|
var d = /\s-d(?!w)/g;
|
|
12370
|
-
var isZh =
|
|
12371
|
+
var isZh = import_process7.default.env.PI_Lang === "zh";
|
|
12371
12372
|
async function getParams(params) {
|
|
12372
|
-
const root =
|
|
12373
|
+
const root = import_process7.default.cwd();
|
|
12373
12374
|
try {
|
|
12374
12375
|
switch (await getPkgTool()) {
|
|
12375
12376
|
case "pnpm":
|
|
@@ -12382,6 +12383,8 @@ async function getParams(params) {
|
|
|
12382
12383
|
return params.replace(W, "");
|
|
12383
12384
|
if (w.test(params))
|
|
12384
12385
|
return params.replace(w, "");
|
|
12386
|
+
if (d.test(params))
|
|
12387
|
+
return params.replace(d, " -D");
|
|
12385
12388
|
}
|
|
12386
12389
|
if (isFile("./pnpm-workspace.yaml")) {
|
|
12387
12390
|
if (D.test(params))
|
|
@@ -12428,10 +12431,10 @@ async function getParams(params) {
|
|
|
12428
12431
|
} catch (err) {
|
|
12429
12432
|
console.log(
|
|
12430
12433
|
import_picocolors.default.red(
|
|
12431
|
-
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${
|
|
12434
|
+
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${import_process7.default.cwd()}`
|
|
12432
12435
|
)
|
|
12433
12436
|
);
|
|
12434
|
-
|
|
12437
|
+
import_process7.default.exit(1);
|
|
12435
12438
|
}
|
|
12436
12439
|
}
|
|
12437
12440
|
async function loading(text) {
|
|
@@ -12444,7 +12447,7 @@ async function loading(text) {
|
|
|
12444
12447
|
}).start();
|
|
12445
12448
|
}
|
|
12446
12449
|
async function getStyle() {
|
|
12447
|
-
const { PI_COLOR: color4 = "yellow", PI_SPINNER: spinner = "star" } =
|
|
12450
|
+
const { PI_COLOR: color4 = "yellow", PI_SPINNER: spinner = "star" } = import_process7.default.env;
|
|
12448
12451
|
return {
|
|
12449
12452
|
color: color4,
|
|
12450
12453
|
spinner
|
|
@@ -12472,7 +12475,7 @@ async function getLatestVersion(pkg, isZh6 = true) {
|
|
|
12472
12475
|
}
|
|
12473
12476
|
|
|
12474
12477
|
// package.json
|
|
12475
|
-
var version = "0.0
|
|
12478
|
+
var version = "0.1.0";
|
|
12476
12479
|
|
|
12477
12480
|
// src/help.ts
|
|
12478
12481
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -12536,25 +12539,25 @@ async function installDeps() {
|
|
|
12536
12539
|
}
|
|
12537
12540
|
|
|
12538
12541
|
// src/pi.ts
|
|
12539
|
-
var
|
|
12542
|
+
var import_process9 = __toESM(require("process"), 1);
|
|
12540
12543
|
var import_console = require("console");
|
|
12541
12544
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
12542
12545
|
|
|
12543
12546
|
// src/detectNode.ts
|
|
12544
|
-
var
|
|
12547
|
+
var import_process8 = __toESM(require("process"), 1);
|
|
12545
12548
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
12546
12549
|
async function detectNode() {
|
|
12547
12550
|
let pkg;
|
|
12548
12551
|
try {
|
|
12549
12552
|
pkg = await getPkg();
|
|
12550
12553
|
} catch (e) {
|
|
12551
|
-
const cwd =
|
|
12554
|
+
const cwd = import_process8.default.cwd();
|
|
12552
12555
|
console.log(import_picocolors3.default.red(`\u5F53\u524D\u76EE\u5F55: ${cwd} \u6CA1\u6709package.json\u6587\u4EF6`));
|
|
12553
|
-
|
|
12556
|
+
import_process8.default.exit(1);
|
|
12554
12557
|
}
|
|
12555
12558
|
if (pkg.engines?.node) {
|
|
12556
12559
|
const isSafe = require("semver").satisfies(
|
|
12557
|
-
|
|
12560
|
+
import_process8.default.version,
|
|
12558
12561
|
pkg.engines.node
|
|
12559
12562
|
);
|
|
12560
12563
|
if (!isSafe) {
|
|
@@ -12581,7 +12584,7 @@ no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3
|
|
|
12581
12584
|
}
|
|
12582
12585
|
|
|
12583
12586
|
// src/pi.ts
|
|
12584
|
-
var isZh3 =
|
|
12587
|
+
var isZh3 = import_process9.default.env.PI_Lang === "zh";
|
|
12585
12588
|
async function pi(params, pkg, executor = "ni") {
|
|
12586
12589
|
await detectNode();
|
|
12587
12590
|
const text = pkg ? `Installing ${params} ...` : "Updating dependency ...";
|
|
@@ -12597,7 +12600,7 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
12597
12600
|
const newParams = isLatest ? params : await getParams(params);
|
|
12598
12601
|
let stdio = ["inherit", "pipe", "inherit"];
|
|
12599
12602
|
let loading_status;
|
|
12600
|
-
const { PI_DEFAULT, PI_MaxSockets: sockets } =
|
|
12603
|
+
const { PI_DEFAULT, PI_MaxSockets: sockets } = import_process9.default.env;
|
|
12601
12604
|
const pkgTool = await getPkgTool();
|
|
12602
12605
|
const maxSockets = sockets || 4;
|
|
12603
12606
|
const install = PI_DEFAULT === "yarn" || pkgTool === "yarn" ? newParams ? "add" : "" : "install";
|
|
@@ -12659,7 +12662,7 @@ ${result}` : failMsg));
|
|
|
12659
12662
|
jsShell(`pi ${dep}@latest`);
|
|
12660
12663
|
}
|
|
12661
12664
|
}
|
|
12662
|
-
|
|
12665
|
+
import_process9.default.exit();
|
|
12663
12666
|
}
|
|
12664
12667
|
|
|
12665
12668
|
// src/pa.ts
|
|
@@ -12820,7 +12823,7 @@ ${result}` : failMsg));
|
|
|
12820
12823
|
}
|
|
12821
12824
|
|
|
12822
12825
|
// src/pio.ts
|
|
12823
|
-
var
|
|
12826
|
+
var import_process10 = __toESM(require("process"), 1);
|
|
12824
12827
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
12825
12828
|
async function pio(params, pkg, executor = "ni") {
|
|
12826
12829
|
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
@@ -12838,11 +12841,11 @@ async function pio(params, pkg, executor = "ni") {
|
|
|
12838
12841
|
loading_status.fail(import_picocolors7.default.red(result ? `${result}
|
|
12839
12842
|
|
|
12840
12843
|
${failMsg}` : failMsg));
|
|
12841
|
-
|
|
12844
|
+
import_process10.default.exit();
|
|
12842
12845
|
}
|
|
12843
12846
|
|
|
12844
12847
|
// src/index.ts
|
|
12845
|
-
var rootPath =
|
|
12848
|
+
var rootPath = import_process11.default.cwd();
|
|
12846
12849
|
var runMap = {
|
|
12847
12850
|
pi,
|
|
12848
12851
|
pix,
|
|
@@ -12856,9 +12859,9 @@ var runMap = {
|
|
|
12856
12859
|
pfind,
|
|
12857
12860
|
pio
|
|
12858
12861
|
};
|
|
12859
|
-
var isZh5 =
|
|
12862
|
+
var isZh5 = import_process11.default.env.PI_Lang === "zh";
|
|
12860
12863
|
async function setup() {
|
|
12861
|
-
const cmd =
|
|
12864
|
+
const cmd = import_process11.default.argv[1];
|
|
12862
12865
|
let exec = "";
|
|
12863
12866
|
if (isWin()) {
|
|
12864
12867
|
const last = cmd.lastIndexOf("\\") + 1;
|
|
@@ -12867,7 +12870,7 @@ async function setup() {
|
|
|
12867
12870
|
const last = cmd.lastIndexOf("/") + 1;
|
|
12868
12871
|
exec = cmd.slice(last, cmd.length);
|
|
12869
12872
|
}
|
|
12870
|
-
const argv =
|
|
12873
|
+
const argv = import_process11.default.argv.slice(2);
|
|
12871
12874
|
await help(argv);
|
|
12872
12875
|
let params = spaceFormat(argv.join(" ")).trim();
|
|
12873
12876
|
if (!await hasPkg(rootPath)) {
|
|
@@ -12917,7 +12920,7 @@ async function setup() {
|
|
|
12917
12920
|
)
|
|
12918
12921
|
);
|
|
12919
12922
|
}
|
|
12920
|
-
|
|
12923
|
+
import_process11.default.exit();
|
|
12921
12924
|
}
|
|
12922
12925
|
let projectPath = "";
|
|
12923
12926
|
if (params && !await isRust()) {
|
|
@@ -12982,7 +12985,7 @@ async function setup() {
|
|
|
12982
12985
|
)
|
|
12983
12986
|
);
|
|
12984
12987
|
}
|
|
12985
|
-
|
|
12988
|
+
import_process11.default.exit();
|
|
12986
12989
|
}
|
|
12987
12990
|
if (!runMap[exec]) {
|
|
12988
12991
|
console.log(
|
package/dist/index.js
CHANGED
|
@@ -5200,11 +5200,11 @@ var require_signals = __commonJS({
|
|
|
5200
5200
|
var require_signal_exit = __commonJS({
|
|
5201
5201
|
"node_modules/.pnpm/signal-exit@3.0.7/node_modules/signal-exit/index.js"(exports, module) {
|
|
5202
5202
|
"use strict";
|
|
5203
|
-
var
|
|
5204
|
-
var processOk = function(
|
|
5205
|
-
return
|
|
5203
|
+
var process16 = global.process;
|
|
5204
|
+
var processOk = function(process17) {
|
|
5205
|
+
return process17 && typeof process17 === "object" && typeof process17.removeListener === "function" && typeof process17.emit === "function" && typeof process17.reallyExit === "function" && typeof process17.listeners === "function" && typeof process17.kill === "function" && typeof process17.pid === "number" && typeof process17.on === "function";
|
|
5206
5206
|
};
|
|
5207
|
-
if (!processOk(
|
|
5207
|
+
if (!processOk(process16)) {
|
|
5208
5208
|
module.exports = function() {
|
|
5209
5209
|
return function() {
|
|
5210
5210
|
};
|
|
@@ -5212,15 +5212,15 @@ var require_signal_exit = __commonJS({
|
|
|
5212
5212
|
} else {
|
|
5213
5213
|
assert = __require("assert");
|
|
5214
5214
|
signals = require_signals();
|
|
5215
|
-
isWin2 = /^win/i.test(
|
|
5215
|
+
isWin2 = /^win/i.test(process16.platform);
|
|
5216
5216
|
EE = __require("events");
|
|
5217
5217
|
if (typeof EE !== "function") {
|
|
5218
5218
|
EE = EE.EventEmitter;
|
|
5219
5219
|
}
|
|
5220
|
-
if (
|
|
5221
|
-
emitter =
|
|
5220
|
+
if (process16.__signal_exit_emitter__) {
|
|
5221
|
+
emitter = process16.__signal_exit_emitter__;
|
|
5222
5222
|
} else {
|
|
5223
|
-
emitter =
|
|
5223
|
+
emitter = process16.__signal_exit_emitter__ = new EE();
|
|
5224
5224
|
emitter.count = 0;
|
|
5225
5225
|
emitter.emitted = {};
|
|
5226
5226
|
}
|
|
@@ -5257,12 +5257,12 @@ var require_signal_exit = __commonJS({
|
|
|
5257
5257
|
loaded = false;
|
|
5258
5258
|
signals.forEach(function(sig) {
|
|
5259
5259
|
try {
|
|
5260
|
-
|
|
5260
|
+
process16.removeListener(sig, sigListeners[sig]);
|
|
5261
5261
|
} catch (er) {
|
|
5262
5262
|
}
|
|
5263
5263
|
});
|
|
5264
|
-
|
|
5265
|
-
|
|
5264
|
+
process16.emit = originalProcessEmit;
|
|
5265
|
+
process16.reallyExit = originalProcessReallyExit;
|
|
5266
5266
|
emitter.count -= 1;
|
|
5267
5267
|
};
|
|
5268
5268
|
module.exports.unload = unload;
|
|
@@ -5279,7 +5279,7 @@ var require_signal_exit = __commonJS({
|
|
|
5279
5279
|
if (!processOk(global.process)) {
|
|
5280
5280
|
return;
|
|
5281
5281
|
}
|
|
5282
|
-
var listeners =
|
|
5282
|
+
var listeners = process16.listeners(sig);
|
|
5283
5283
|
if (listeners.length === emitter.count) {
|
|
5284
5284
|
unload();
|
|
5285
5285
|
emit("exit", null, sig);
|
|
@@ -5287,7 +5287,7 @@ var require_signal_exit = __commonJS({
|
|
|
5287
5287
|
if (isWin2 && sig === "SIGHUP") {
|
|
5288
5288
|
sig = "SIGINT";
|
|
5289
5289
|
}
|
|
5290
|
-
|
|
5290
|
+
process16.kill(process16.pid, sig);
|
|
5291
5291
|
}
|
|
5292
5292
|
};
|
|
5293
5293
|
});
|
|
@@ -5303,36 +5303,36 @@ var require_signal_exit = __commonJS({
|
|
|
5303
5303
|
emitter.count += 1;
|
|
5304
5304
|
signals = signals.filter(function(sig) {
|
|
5305
5305
|
try {
|
|
5306
|
-
|
|
5306
|
+
process16.on(sig, sigListeners[sig]);
|
|
5307
5307
|
return true;
|
|
5308
5308
|
} catch (er) {
|
|
5309
5309
|
return false;
|
|
5310
5310
|
}
|
|
5311
5311
|
});
|
|
5312
|
-
|
|
5313
|
-
|
|
5312
|
+
process16.emit = processEmit;
|
|
5313
|
+
process16.reallyExit = processReallyExit;
|
|
5314
5314
|
};
|
|
5315
5315
|
module.exports.load = load;
|
|
5316
|
-
originalProcessReallyExit =
|
|
5316
|
+
originalProcessReallyExit = process16.reallyExit;
|
|
5317
5317
|
processReallyExit = function processReallyExit2(code) {
|
|
5318
5318
|
if (!processOk(global.process)) {
|
|
5319
5319
|
return;
|
|
5320
5320
|
}
|
|
5321
|
-
|
|
5321
|
+
process16.exitCode = code || /* istanbul ignore next */
|
|
5322
5322
|
0;
|
|
5323
|
-
emit("exit",
|
|
5324
|
-
emit("afterexit",
|
|
5325
|
-
originalProcessReallyExit.call(
|
|
5323
|
+
emit("exit", process16.exitCode, null);
|
|
5324
|
+
emit("afterexit", process16.exitCode, null);
|
|
5325
|
+
originalProcessReallyExit.call(process16, process16.exitCode);
|
|
5326
5326
|
};
|
|
5327
|
-
originalProcessEmit =
|
|
5327
|
+
originalProcessEmit = process16.emit;
|
|
5328
5328
|
processEmit = function processEmit2(ev, arg) {
|
|
5329
5329
|
if (ev === "exit" && processOk(global.process)) {
|
|
5330
5330
|
if (arg !== void 0) {
|
|
5331
|
-
|
|
5331
|
+
process16.exitCode = arg;
|
|
5332
5332
|
}
|
|
5333
5333
|
var ret = originalProcessEmit.apply(this, arguments);
|
|
5334
|
-
emit("exit",
|
|
5335
|
-
emit("afterexit",
|
|
5334
|
+
emit("exit", process16.exitCode, null);
|
|
5335
|
+
emit("afterexit", process16.exitCode, null);
|
|
5336
5336
|
return ret;
|
|
5337
5337
|
} else {
|
|
5338
5338
|
return originalProcessEmit.apply(this, arguments);
|
|
@@ -10456,7 +10456,7 @@ var require_bl = __commonJS({
|
|
|
10456
10456
|
});
|
|
10457
10457
|
|
|
10458
10458
|
// src/index.ts
|
|
10459
|
-
import
|
|
10459
|
+
import process15 from "process";
|
|
10460
10460
|
import path6 from "path";
|
|
10461
10461
|
|
|
10462
10462
|
// node_modules/.pnpm/lazy-js-utils@0.1.31/node_modules/lazy-js-utils/dist/chunk-4N54TZJJ.mjs
|
|
@@ -11402,6 +11402,7 @@ import { ccommand as ccommand3 } from "ccommand";
|
|
|
11402
11402
|
|
|
11403
11403
|
// src/utils.ts
|
|
11404
11404
|
import path5 from "path";
|
|
11405
|
+
import process11 from "process";
|
|
11405
11406
|
|
|
11406
11407
|
// node_modules/.pnpm/ora@6.3.1/node_modules/ora/index.js
|
|
11407
11408
|
import process10 from "node:process";
|
|
@@ -12362,9 +12363,9 @@ var Dw = /\s-Dw/g;
|
|
|
12362
12363
|
var w = /\s-w/g;
|
|
12363
12364
|
var D = /\s-D(?!w)/g;
|
|
12364
12365
|
var d = /\s-d(?!w)/g;
|
|
12365
|
-
var isZh =
|
|
12366
|
+
var isZh = process11.env.PI_Lang === "zh";
|
|
12366
12367
|
async function getParams(params) {
|
|
12367
|
-
const root =
|
|
12368
|
+
const root = process11.cwd();
|
|
12368
12369
|
try {
|
|
12369
12370
|
switch (await getPkgTool()) {
|
|
12370
12371
|
case "pnpm":
|
|
@@ -12377,6 +12378,8 @@ async function getParams(params) {
|
|
|
12377
12378
|
return params.replace(W, "");
|
|
12378
12379
|
if (w.test(params))
|
|
12379
12380
|
return params.replace(w, "");
|
|
12381
|
+
if (d.test(params))
|
|
12382
|
+
return params.replace(d, " -D");
|
|
12380
12383
|
}
|
|
12381
12384
|
if (isFile("./pnpm-workspace.yaml")) {
|
|
12382
12385
|
if (D.test(params))
|
|
@@ -12423,10 +12426,10 @@ async function getParams(params) {
|
|
|
12423
12426
|
} catch (err) {
|
|
12424
12427
|
console.log(
|
|
12425
12428
|
import_picocolors.default.red(
|
|
12426
|
-
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${
|
|
12429
|
+
`${isZh ? "package.json\u5E76\u4E0D\u5B58\u5728,\u5728\u4EE5\u4E0B\u76EE\u5F55\u4E2D:" : "package.json has not been found in"} ${process11.cwd()}`
|
|
12427
12430
|
)
|
|
12428
12431
|
);
|
|
12429
|
-
|
|
12432
|
+
process11.exit(1);
|
|
12430
12433
|
}
|
|
12431
12434
|
}
|
|
12432
12435
|
async function loading(text) {
|
|
@@ -12439,7 +12442,7 @@ async function loading(text) {
|
|
|
12439
12442
|
}).start();
|
|
12440
12443
|
}
|
|
12441
12444
|
async function getStyle() {
|
|
12442
|
-
const { PI_COLOR: color4 = "yellow", PI_SPINNER: spinner = "star" } =
|
|
12445
|
+
const { PI_COLOR: color4 = "yellow", PI_SPINNER: spinner = "star" } = process11.env;
|
|
12443
12446
|
return {
|
|
12444
12447
|
color: color4,
|
|
12445
12448
|
spinner
|
|
@@ -12467,7 +12470,7 @@ async function getLatestVersion(pkg, isZh6 = true) {
|
|
|
12467
12470
|
}
|
|
12468
12471
|
|
|
12469
12472
|
// package.json
|
|
12470
|
-
var version = "0.0
|
|
12473
|
+
var version = "0.1.0";
|
|
12471
12474
|
|
|
12472
12475
|
// src/help.ts
|
|
12473
12476
|
var isZh2 = process.env.PI_Lang === "zh";
|
|
@@ -12531,25 +12534,25 @@ async function installDeps() {
|
|
|
12531
12534
|
}
|
|
12532
12535
|
|
|
12533
12536
|
// src/pi.ts
|
|
12534
|
-
import
|
|
12537
|
+
import process13 from "process";
|
|
12535
12538
|
import { log } from "console";
|
|
12536
12539
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
12537
12540
|
|
|
12538
12541
|
// src/detectNode.ts
|
|
12539
|
-
import
|
|
12542
|
+
import process12 from "process";
|
|
12540
12543
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
12541
12544
|
async function detectNode() {
|
|
12542
12545
|
let pkg;
|
|
12543
12546
|
try {
|
|
12544
12547
|
pkg = await getPkg();
|
|
12545
12548
|
} catch (e) {
|
|
12546
|
-
const cwd =
|
|
12549
|
+
const cwd = process12.cwd();
|
|
12547
12550
|
console.log(import_picocolors3.default.red(`\u5F53\u524D\u76EE\u5F55: ${cwd} \u6CA1\u6709package.json\u6587\u4EF6`));
|
|
12548
|
-
|
|
12551
|
+
process12.exit(1);
|
|
12549
12552
|
}
|
|
12550
12553
|
if (pkg.engines?.node) {
|
|
12551
12554
|
const isSafe = __require("semver").satisfies(
|
|
12552
|
-
|
|
12555
|
+
process12.version,
|
|
12553
12556
|
pkg.engines.node
|
|
12554
12557
|
);
|
|
12555
12558
|
if (!isSafe) {
|
|
@@ -12576,7 +12579,7 @@ no" | gum filter --placeholder=" \u5F53\u524Dnode\u7248\u672C\u4E0D\u6EE1\u8DB3
|
|
|
12576
12579
|
}
|
|
12577
12580
|
|
|
12578
12581
|
// src/pi.ts
|
|
12579
|
-
var isZh3 =
|
|
12582
|
+
var isZh3 = process13.env.PI_Lang === "zh";
|
|
12580
12583
|
async function pi(params, pkg, executor = "ni") {
|
|
12581
12584
|
await detectNode();
|
|
12582
12585
|
const text = pkg ? `Installing ${params} ...` : "Updating dependency ...";
|
|
@@ -12592,7 +12595,7 @@ async function pi(params, pkg, executor = "ni") {
|
|
|
12592
12595
|
const newParams = isLatest ? params : await getParams(params);
|
|
12593
12596
|
let stdio = ["inherit", "pipe", "inherit"];
|
|
12594
12597
|
let loading_status;
|
|
12595
|
-
const { PI_DEFAULT, PI_MaxSockets: sockets } =
|
|
12598
|
+
const { PI_DEFAULT, PI_MaxSockets: sockets } = process13.env;
|
|
12596
12599
|
const pkgTool = await getPkgTool();
|
|
12597
12600
|
const maxSockets = sockets || 4;
|
|
12598
12601
|
const install = PI_DEFAULT === "yarn" || pkgTool === "yarn" ? newParams ? "add" : "" : "install";
|
|
@@ -12654,7 +12657,7 @@ ${result}` : failMsg));
|
|
|
12654
12657
|
jsShell(`pi ${dep}@latest`);
|
|
12655
12658
|
}
|
|
12656
12659
|
}
|
|
12657
|
-
|
|
12660
|
+
process13.exit();
|
|
12658
12661
|
}
|
|
12659
12662
|
|
|
12660
12663
|
// src/pa.ts
|
|
@@ -12815,7 +12818,7 @@ ${result}` : failMsg));
|
|
|
12815
12818
|
}
|
|
12816
12819
|
|
|
12817
12820
|
// src/pio.ts
|
|
12818
|
-
import
|
|
12821
|
+
import process14 from "process";
|
|
12819
12822
|
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
12820
12823
|
async function pio(params, pkg, executor = "ni") {
|
|
12821
12824
|
const successMsg = pkg ? `Installed ${pkg} successfully! \u{1F60A}` : "Updated dependency successfully! \u{1F60A}";
|
|
@@ -12833,11 +12836,11 @@ async function pio(params, pkg, executor = "ni") {
|
|
|
12833
12836
|
loading_status.fail(import_picocolors7.default.red(result ? `${result}
|
|
12834
12837
|
|
|
12835
12838
|
${failMsg}` : failMsg));
|
|
12836
|
-
|
|
12839
|
+
process14.exit();
|
|
12837
12840
|
}
|
|
12838
12841
|
|
|
12839
12842
|
// src/index.ts
|
|
12840
|
-
var rootPath =
|
|
12843
|
+
var rootPath = process15.cwd();
|
|
12841
12844
|
var runMap = {
|
|
12842
12845
|
pi,
|
|
12843
12846
|
pix,
|
|
@@ -12851,9 +12854,9 @@ var runMap = {
|
|
|
12851
12854
|
pfind,
|
|
12852
12855
|
pio
|
|
12853
12856
|
};
|
|
12854
|
-
var isZh5 =
|
|
12857
|
+
var isZh5 = process15.env.PI_Lang === "zh";
|
|
12855
12858
|
async function setup() {
|
|
12856
|
-
const cmd =
|
|
12859
|
+
const cmd = process15.argv[1];
|
|
12857
12860
|
let exec = "";
|
|
12858
12861
|
if (isWin()) {
|
|
12859
12862
|
const last = cmd.lastIndexOf("\\") + 1;
|
|
@@ -12862,7 +12865,7 @@ async function setup() {
|
|
|
12862
12865
|
const last = cmd.lastIndexOf("/") + 1;
|
|
12863
12866
|
exec = cmd.slice(last, cmd.length);
|
|
12864
12867
|
}
|
|
12865
|
-
const argv =
|
|
12868
|
+
const argv = process15.argv.slice(2);
|
|
12866
12869
|
await help(argv);
|
|
12867
12870
|
let params = spaceFormat(argv.join(" ")).trim();
|
|
12868
12871
|
if (!await hasPkg(rootPath)) {
|
|
@@ -12912,7 +12915,7 @@ async function setup() {
|
|
|
12912
12915
|
)
|
|
12913
12916
|
);
|
|
12914
12917
|
}
|
|
12915
|
-
|
|
12918
|
+
process15.exit();
|
|
12916
12919
|
}
|
|
12917
12920
|
let projectPath = "";
|
|
12918
12921
|
if (params && !await isRust()) {
|
|
@@ -12977,7 +12980,7 @@ async function setup() {
|
|
|
12977
12980
|
)
|
|
12978
12981
|
);
|
|
12979
12982
|
}
|
|
12980
|
-
|
|
12983
|
+
process15.exit();
|
|
12981
12984
|
}
|
|
12982
12985
|
if (!runMap[exec]) {
|
|
12983
12986
|
console.log(
|