@golproductions/check 3.2.6 → 3.2.7
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/package.json +1 -1
- package/src/index.js +27 -10
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { homedir, platform, arch } from "node:os";
|
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import { Readable } from "node:stream";
|
|
8
8
|
|
|
9
|
-
const VERSION = "3.2.
|
|
9
|
+
const VERSION = "3.2.7";
|
|
10
10
|
const BINARY_VERSION = "3.0.0";
|
|
11
11
|
const API = "https://triage.golproductions.com/preflight";
|
|
12
12
|
const CDN = "https://pub-e55366a7f5994be9be04f0e205179f4a.r2.dev/releases";
|
|
@@ -744,19 +744,36 @@ const SHELL_BUILTINS = new Set([
|
|
|
744
744
|
"done", "case", "esac", "in", "function", "select", "{", "}", "!",
|
|
745
745
|
]);
|
|
746
746
|
|
|
747
|
+
// Quote-aware: "./spaced name.sh" is ONE token, and connectors inside
|
|
748
|
+
// quotes are literal text, not separators.
|
|
747
749
|
function segmentBases(command) {
|
|
750
|
+
const segs = [[]];
|
|
751
|
+
let cur = "", q = null;
|
|
752
|
+
for (let i = 0; i < command.length; i++) {
|
|
753
|
+
const ch = command[i];
|
|
754
|
+
if (q) { if (ch === q) q = null; else cur += ch; continue; }
|
|
755
|
+
if (ch === '"' || ch === "'") { q = ch; continue; }
|
|
756
|
+
if (ch === "|" || ch === "&" || ch === ";" || ch === "\n") {
|
|
757
|
+
if (cur) { segs[segs.length - 1].push(cur); cur = ""; }
|
|
758
|
+
if (segs[segs.length - 1].length) segs.push([]);
|
|
759
|
+
if ((ch === "|" || ch === "&") && command[i + 1] === ch) i++;
|
|
760
|
+
continue;
|
|
761
|
+
}
|
|
762
|
+
if (/\s/.test(ch)) { if (cur) { segs[segs.length - 1].push(cur); cur = ""; } continue; }
|
|
763
|
+
cur += ch;
|
|
764
|
+
}
|
|
765
|
+
if (cur) segs[segs.length - 1].push(cur);
|
|
766
|
+
|
|
748
767
|
const bases = [];
|
|
749
|
-
for (const
|
|
750
|
-
const words = seg.trim().split(/\s+/).filter(Boolean);
|
|
768
|
+
for (const words of segs) {
|
|
751
769
|
let base = null;
|
|
752
770
|
for (const w of words) {
|
|
753
|
-
|
|
754
|
-
if (
|
|
755
|
-
if (
|
|
756
|
-
if (
|
|
757
|
-
if (
|
|
758
|
-
|
|
759
|
-
base = bare;
|
|
771
|
+
if (!w) continue;
|
|
772
|
+
if (PREFIX_WORDS.has(w)) continue;
|
|
773
|
+
if (/^[\d.]+[smhd]?$/.test(w)) continue;
|
|
774
|
+
if (w.includes("=") && !w.startsWith("-")) continue;
|
|
775
|
+
if (w.startsWith("-")) continue;
|
|
776
|
+
base = w;
|
|
760
777
|
break;
|
|
761
778
|
}
|
|
762
779
|
if (base) bases.push(base);
|