@workit-dev/pi 2.25.4 → 2.25.5
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/workit.js +49 -15
- package/package.json +1 -1
package/dist/workit.js
CHANGED
|
@@ -20377,6 +20377,22 @@ var powershellScript = (words, stdin) => {
|
|
|
20377
20377
|
}
|
|
20378
20378
|
return null;
|
|
20379
20379
|
};
|
|
20380
|
+
var powershellOpaque = (words) => {
|
|
20381
|
+
for (let index = 1;index < words.length; index++) {
|
|
20382
|
+
const flag = /^[-/]+(.+)/.exec(words[index])?.[1].toLowerCase();
|
|
20383
|
+
if (flag === undefined)
|
|
20384
|
+
return !/powershell/i.test(words[0]);
|
|
20385
|
+
if (flag === "e" || flag === "ec" || flag.length >= 2 && "encodedcommand".startsWith(flag))
|
|
20386
|
+
return true;
|
|
20387
|
+
if ("command".startsWith(flag) || flag === "cwa" || flag.startsWith("commandwith"))
|
|
20388
|
+
return false;
|
|
20389
|
+
if (flag === "f" || flag === "file")
|
|
20390
|
+
return true;
|
|
20391
|
+
if (POWERSHELL_VALUES.test(`-${flag}`))
|
|
20392
|
+
index++;
|
|
20393
|
+
}
|
|
20394
|
+
return false;
|
|
20395
|
+
};
|
|
20380
20396
|
var cmdScript = (words) => {
|
|
20381
20397
|
const at = words.findIndex((word, index) => index > 0 && /^\/[ck]$/i.test(word));
|
|
20382
20398
|
if (at > 0)
|
|
@@ -27641,11 +27657,17 @@ var editsOf = (input) => {
|
|
|
27641
27657
|
case "cp":
|
|
27642
27658
|
case "ln":
|
|
27643
27659
|
case "install": {
|
|
27644
|
-
const into = valueOf(args, /^(?:-t|--target-directory=?)(.*)$/s);
|
|
27660
|
+
const into = valueOf(args, /^(?:-[a-zA-Z]*t|--target-directory=?)(.*)$/s);
|
|
27645
27661
|
if (into !== undefined)
|
|
27646
27662
|
return [into];
|
|
27647
|
-
const
|
|
27648
|
-
|
|
27663
|
+
const files = operands(args);
|
|
27664
|
+
if (name === "ln" && files.length === 1)
|
|
27665
|
+
return [path42.basename(files[0])];
|
|
27666
|
+
return files.length ? [files.at(-1)] : null;
|
|
27667
|
+
}
|
|
27668
|
+
case "mklink": {
|
|
27669
|
+
const link = args.find((arg) => !/^\/[dhj]$/i.test(arg));
|
|
27670
|
+
return link ? [link] : null;
|
|
27649
27671
|
}
|
|
27650
27672
|
case "dd":
|
|
27651
27673
|
return args.filter((item) => item.startsWith("of=")).map((item) => item.slice(3));
|
|
@@ -27674,10 +27696,15 @@ var editsOf = (input) => {
|
|
|
27674
27696
|
case "del":
|
|
27675
27697
|
case "copy-item":
|
|
27676
27698
|
case "move-item": {
|
|
27677
|
-
const
|
|
27678
|
-
if (
|
|
27679
|
-
return
|
|
27680
|
-
const files =
|
|
27699
|
+
const named = valueOf(args, /^-(?:path|filepath|literalpath|destination)(?::(.+))?$/is);
|
|
27700
|
+
if (named !== undefined || args.some((item) => /^-(?:path|filepath|literalpath|destination)$/i.test(item)))
|
|
27701
|
+
return named ? [named] : null;
|
|
27702
|
+
const files = args.filter((item, at) => !item.startsWith("-") && !/^-(?:itemtype|type|value|target|encoding|name)$/i.test(args[at - 1] ?? ""));
|
|
27703
|
+
if (files.length === 0 && (name === "new-item" || name === "ni")) {
|
|
27704
|
+
const leaf = valueOf(args, /^-name(?::(.+))?$/is);
|
|
27705
|
+
if (leaf)
|
|
27706
|
+
return [leaf];
|
|
27707
|
+
}
|
|
27681
27708
|
if (name === "move-item")
|
|
27682
27709
|
return files.length ? files : null;
|
|
27683
27710
|
const file = name === "copy-item" ? files.at(-1) : files[0];
|
|
@@ -27935,7 +27962,8 @@ var shellScript3 = (words) => {
|
|
|
27935
27962
|
}
|
|
27936
27963
|
return null;
|
|
27937
27964
|
};
|
|
27938
|
-
var
|
|
27965
|
+
var CMD_VAR = /%[^%\s]+%|![^!\s]+!/;
|
|
27966
|
+
var XARGS_VALUE = /^-[InLPdsEa]$/;
|
|
27939
27967
|
var runsWriter = (words) => {
|
|
27940
27968
|
const filled = [
|
|
27941
27969
|
...words.filter((word) => word !== ";" && word !== "+").map((word) => word.includes("{}") ? "eval" : word),
|
|
@@ -27948,13 +27976,17 @@ var opaqueWrites = (input, scriptOf = (index) => input[index], fed, loads = fals
|
|
|
27948
27976
|
const words = pastLead(input);
|
|
27949
27977
|
if (words[0] === "xargs") {
|
|
27950
27978
|
let at = 1;
|
|
27951
|
-
|
|
27952
|
-
|
|
27953
|
-
|
|
27979
|
+
let token = "{}";
|
|
27980
|
+
for (;words[at]?.startsWith("-"); at += XARGS_VALUE.test(words[at]) ? 2 : 1)
|
|
27981
|
+
token = words[at] === "-I" ? words[at + 1] ?? token : /^-[Ii](.+)|^--replace=(.+)/s.exec(words[at])?.slice(1).join("") ?? token;
|
|
27982
|
+
const named = pastLead(words.slice(at))[0] ?? "";
|
|
27983
|
+
return named.includes(token) || named.includes("{}") || runsWriter(words.slice(at)) ? ["."] : null;
|
|
27954
27984
|
}
|
|
27955
27985
|
const [verb, ...args] = words;
|
|
27956
|
-
const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase();
|
|
27957
|
-
if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace)$/.test(name))
|
|
27986
|
+
const name = (verb?.split(/[\\/]/).at(-1) ?? "").toLowerCase().replace(/\.exe$/, "");
|
|
27987
|
+
if (/^(?:flock|watch|ssh|parallel|script|su|runuser|strace|iex|invoke-expression)$/.test(name) || (name === "pwsh" || name === "powershell") && powershellOpaque(words))
|
|
27988
|
+
return ["."];
|
|
27989
|
+
if (name === "mklink" && args.some((arg) => CMD_VAR.test(arg)))
|
|
27958
27990
|
return ["."];
|
|
27959
27991
|
const files = operands(args);
|
|
27960
27992
|
const has = (pattern) => args.some((arg) => pattern.test(arg));
|
|
@@ -28228,7 +28260,7 @@ var PATHS = /(?<![\w.~:/$-])(?:~\/|\/|[A-Za-z]:\/|\.\.(?:\/|$))[^\s'"`$),;:*?<>|
|
|
|
28228
28260
|
var pathsIn = (text) => [...text.matchAll(PATHS)].map((match) => match[0]);
|
|
28229
28261
|
var linkSources = (args, at) => {
|
|
28230
28262
|
const names = operands([...args]);
|
|
28231
|
-
const into = args.
|
|
28263
|
+
const into = args.findIndex((arg) => /^-[a-zA-Z]*t$/.test(arg));
|
|
28232
28264
|
const dest = into >= 0 ? args[into + 1] : names.length > 1 ? names.at(-1) : ".";
|
|
28233
28265
|
const sources = names.filter((name, index) => into >= 0 ? name !== dest : index < names.length - 1 || names.length === 1);
|
|
28234
28266
|
const target = dest === undefined ? null : at(dest);
|
|
@@ -28811,8 +28843,10 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
28811
28843
|
targets.push(...segmentTargets(runIn, inner, "posix", depth + 1, strict, runIn === dir ? vars : unPwd()));
|
|
28812
28844
|
const windows = strict && depth < 4 ? windowsScript(words, segment.stdin?.join(`
|
|
28813
28845
|
`)) : null;
|
|
28846
|
+
const cmd = /^cmd(?:\.exe)?$/.test(commandName2(pastLead(words)[0] ?? ""));
|
|
28814
28847
|
if (windows !== null && dir !== undefined)
|
|
28815
|
-
|
|
28848
|
+
for (const file of segmentTargets(dir, windows, "powershell", depth + 1, strict, vars))
|
|
28849
|
+
targets.push(cmd && CMD_VAR.test(file) ? placeholderIn(dir, `${OPAQUE_TARGET}cmd`) : file);
|
|
28816
28850
|
const bare = strict && depth < 4 ? unwrapped2(words) : null;
|
|
28817
28851
|
if (bare?.length && dir !== undefined)
|
|
28818
28852
|
targets.push(...segmentTargets(dir, bare.flatMap((word) => expansions(word, vars, loops)).map(quoteWord2).join(" "), "posix", depth + 1, strict, vars));
|