@simon_he/pi 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +21 -6
- package/dist/index.mjs +21 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ let node_module = require("node:module");
|
|
|
44
44
|
let node_url = require("node:url");
|
|
45
45
|
|
|
46
46
|
//#region package.json
|
|
47
|
-
var version = "0.2.
|
|
47
|
+
var version = "0.2.1";
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region src/installDeps.ts
|
|
@@ -653,6 +653,12 @@ const isZh$2 = node_process.default.env.PI_Lang === "zh";
|
|
|
653
653
|
const safeShellValue = /^[\w./:@%+=,-]+$/;
|
|
654
654
|
const ansiEscape = String.fromCharCode(27);
|
|
655
655
|
const ansiRegex = new RegExp(`${ansiEscape}\\[[0-9;]*m`, "g");
|
|
656
|
+
const statusSuffixes = [
|
|
657
|
+
"run successfully",
|
|
658
|
+
"运行成功",
|
|
659
|
+
"run error",
|
|
660
|
+
"运行失败"
|
|
661
|
+
];
|
|
656
662
|
function stripAnsi(value) {
|
|
657
663
|
return value.replace(ansiRegex, "");
|
|
658
664
|
}
|
|
@@ -709,6 +715,15 @@ function stripTrailingNonAscii(value) {
|
|
|
709
715
|
}
|
|
710
716
|
return end === value.length ? value : value.slice(0, end);
|
|
711
717
|
}
|
|
718
|
+
function stripStatusSuffix(value) {
|
|
719
|
+
const trimmed = value.trim();
|
|
720
|
+
const lower = trimmed.toLowerCase();
|
|
721
|
+
for (const suffix of statusSuffixes) {
|
|
722
|
+
const suffixLower = suffix.toLowerCase();
|
|
723
|
+
if (lower.endsWith(suffixLower)) return trimmed.slice(0, trimmed.length - suffix.length).trimEnd();
|
|
724
|
+
}
|
|
725
|
+
return trimmed;
|
|
726
|
+
}
|
|
712
727
|
function extractShortcutCommand(logs) {
|
|
713
728
|
for (let i = logs.length - 1; i >= 0; i--) {
|
|
714
729
|
const line = stripAnsi(logs[i]).trim();
|
|
@@ -720,11 +735,11 @@ function extractShortcutCommand(logs) {
|
|
|
720
735
|
const command = runningMatch[1].trim();
|
|
721
736
|
if (command) return command.startsWith("prun ") ? command : `prun ${command}`;
|
|
722
737
|
}
|
|
723
|
-
const
|
|
724
|
-
if (
|
|
725
|
-
if (
|
|
726
|
-
const idx =
|
|
727
|
-
if (idx !== -1) return
|
|
738
|
+
const sanitized = stripStatusSuffix(stripTrailingNonAscii(line).trim().replace(/^['"]|['"]$/g, ""));
|
|
739
|
+
if (sanitized.startsWith("prun ")) return sanitized;
|
|
740
|
+
if (sanitized === "prun") return sanitized;
|
|
741
|
+
const idx = sanitized.lastIndexOf("prun ");
|
|
742
|
+
if (idx !== -1) return sanitized.slice(idx).trim();
|
|
728
743
|
}
|
|
729
744
|
return "";
|
|
730
745
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import os from "node:os";
|
|
|
11
11
|
import { fileURLToPath } from "node:url";
|
|
12
12
|
|
|
13
13
|
//#region package.json
|
|
14
|
-
var version = "0.2.
|
|
14
|
+
var version = "0.2.1";
|
|
15
15
|
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/installDeps.ts
|
|
@@ -620,6 +620,12 @@ const isZh$2 = process.env.PI_Lang === "zh";
|
|
|
620
620
|
const safeShellValue = /^[\w./:@%+=,-]+$/;
|
|
621
621
|
const ansiEscape = String.fromCharCode(27);
|
|
622
622
|
const ansiRegex = new RegExp(`${ansiEscape}\\[[0-9;]*m`, "g");
|
|
623
|
+
const statusSuffixes = [
|
|
624
|
+
"run successfully",
|
|
625
|
+
"运行成功",
|
|
626
|
+
"run error",
|
|
627
|
+
"运行失败"
|
|
628
|
+
];
|
|
623
629
|
function stripAnsi(value) {
|
|
624
630
|
return value.replace(ansiRegex, "");
|
|
625
631
|
}
|
|
@@ -676,6 +682,15 @@ function stripTrailingNonAscii(value) {
|
|
|
676
682
|
}
|
|
677
683
|
return end === value.length ? value : value.slice(0, end);
|
|
678
684
|
}
|
|
685
|
+
function stripStatusSuffix(value) {
|
|
686
|
+
const trimmed = value.trim();
|
|
687
|
+
const lower = trimmed.toLowerCase();
|
|
688
|
+
for (const suffix of statusSuffixes) {
|
|
689
|
+
const suffixLower = suffix.toLowerCase();
|
|
690
|
+
if (lower.endsWith(suffixLower)) return trimmed.slice(0, trimmed.length - suffix.length).trimEnd();
|
|
691
|
+
}
|
|
692
|
+
return trimmed;
|
|
693
|
+
}
|
|
679
694
|
function extractShortcutCommand(logs) {
|
|
680
695
|
for (let i = logs.length - 1; i >= 0; i--) {
|
|
681
696
|
const line = stripAnsi(logs[i]).trim();
|
|
@@ -687,11 +702,11 @@ function extractShortcutCommand(logs) {
|
|
|
687
702
|
const command = runningMatch[1].trim();
|
|
688
703
|
if (command) return command.startsWith("prun ") ? command : `prun ${command}`;
|
|
689
704
|
}
|
|
690
|
-
const
|
|
691
|
-
if (
|
|
692
|
-
if (
|
|
693
|
-
const idx =
|
|
694
|
-
if (idx !== -1) return
|
|
705
|
+
const sanitized = stripStatusSuffix(stripTrailingNonAscii(line).trim().replace(/^['"]|['"]$/g, ""));
|
|
706
|
+
if (sanitized.startsWith("prun ")) return sanitized;
|
|
707
|
+
if (sanitized === "prun") return sanitized;
|
|
708
|
+
const idx = sanitized.lastIndexOf("prun ");
|
|
709
|
+
if (idx !== -1) return sanitized.slice(idx).trim();
|
|
695
710
|
}
|
|
696
711
|
return "";
|
|
697
712
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simon_he/pi",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"packageManager": "pnpm@10.28.2",
|
|
6
6
|
"description": "An intelligent cross-platform package manager and CLI tool that autodetects project environments (Node.mjs, Go, Rust, Python) with beautiful loading animations and smart command execution.",
|
|
7
7
|
"author": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"test": "vitest"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"ccommand": "^1.1.
|
|
93
|
+
"ccommand": "^1.1.2",
|
|
94
94
|
"fast-glob": "^3.3.3",
|
|
95
95
|
"lazy-js-utils": "^0.1.49",
|
|
96
96
|
"ora": "^8.2.0",
|