poe-code 17.0.32 → 17.0.34
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/{chunk-UC3KWJDL.js → chunk-EQAAKXQV.js} +8 -8
- package/dist/{chunk-54JM3XZC.js → chunk-LYH24BKM.js} +358 -46
- package/dist/chunk-LYH24BKM.js.map +7 -0
- package/dist/{chunk-GK6Z56OL.js → chunk-S2NLSD2J.js} +2 -2
- package/dist/{core-BR637SCW.js → core-CRWO3R4F.js} +2 -2
- package/dist/index.js +2 -2
- package/dist/metafile.json +1 -1
- package/dist/{program-3DNB5ZIC.js → program-3H7FXQW5.js} +3 -3
- package/dist/safe-bash.js +2 -2
- package/dist/{src-R4LATOF3.js → src-IES5F6JJ.js} +3 -3
- package/package.json +1 -1
- package/packages/package-lint/dist/bundle-policy.d.ts +3 -0
- package/packages/package-lint/dist/bundle-policy.js +4 -1
- package/packages/safe-bash/dist/chunks/{chunk-RVYQDJCC.js → chunk-AOT4SUBQ.js} +2 -2
- package/packages/safe-bash/dist/chunks/{chunk-MCBWPJRQ.js → chunk-FOMU56TU.js} +18 -2
- package/packages/safe-bash/dist/chunks/chunk-FOMU56TU.js.map +7 -0
- package/packages/safe-bash/dist/chunks/{chunk-JESM4RK2.js → chunk-KLEL3WAN.js} +41 -5
- package/packages/safe-bash/dist/chunks/chunk-KLEL3WAN.js.map +7 -0
- package/packages/safe-bash/dist/chunks/{chunk-LUQYNLH7.js → chunk-L4HKTYVE.js} +2 -2
- package/packages/safe-bash/dist/chunks/{chunk-WSCXISXW.js → chunk-RYXT5BJJ.js} +2 -2
- package/packages/safe-bash/dist/chunks/{chunk-HC4S4QZD.js → chunk-WSX5CLK2.js} +2 -2
- package/packages/safe-bash/dist/chunks/{chunk-BM3BGSH7.js → chunk-YJPA2BVP.js} +63 -20
- package/packages/safe-bash/dist/chunks/chunk-YJPA2BVP.js.map +7 -0
- package/packages/safe-bash/dist/commands/archive/index.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/index.js +27 -0
- package/packages/safe-bash/dist/commands/archive/index.js.map +1 -1
- package/packages/safe-bash/dist/commands/archive/options.d.ts +1 -1
- package/packages/safe-bash/dist/commands/archive/options.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/archive/options.js +2 -0
- package/packages/safe-bash/dist/commands/archive/options.js.map +1 -1
- package/packages/safe-bash/dist/commands/basic.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/basic.js +9 -2
- package/packages/safe-bash/dist/commands/basic.js.map +1 -1
- package/packages/safe-bash/dist/commands/csplit/index.browser.js +1 -1
- package/packages/safe-bash/dist/commands/internal.d.ts +5 -2
- package/packages/safe-bash/dist/commands/internal.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/internal.js +48 -4
- package/packages/safe-bash/dist/commands/internal.js.map +1 -1
- package/packages/safe-bash/dist/commands/llm/index.browser.js +2 -2
- package/packages/safe-bash/dist/commands/network/index.browser.js +2 -2
- package/packages/safe-bash/dist/commands/node/index.browser.js +2 -2
- package/packages/safe-bash/dist/commands/regex-execution/ascii.d.ts +2 -0
- package/packages/safe-bash/dist/commands/regex-execution/ascii.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/ascii.js +4 -0
- package/packages/safe-bash/dist/commands/regex-execution/ascii.js.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/bounded-provider.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/bounded-provider.js +51 -21
- package/packages/safe-bash/dist/commands/regex-execution/bounded-provider.js.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/ere/matcher.d.ts +2 -2
- package/packages/safe-bash/dist/commands/regex-execution/ere/matcher.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/regex-execution/ere/matcher.js +23 -9
- package/packages/safe-bash/dist/commands/regex-execution/ere/matcher.js.map +1 -1
- package/packages/safe-bash/dist/commands/search/grep.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/search/grep.js +99 -4
- package/packages/safe-bash/dist/commands/search/grep.js.map +1 -1
- package/packages/safe-bash/dist/commands/search/options.d.ts +1 -0
- package/packages/safe-bash/dist/commands/search/options.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/search/options.js +4 -1
- package/packages/safe-bash/dist/commands/search/options.js.map +1 -1
- package/packages/safe-bash/dist/commands/search/rg-command.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/search/rg-command.js +59 -0
- package/packages/safe-bash/dist/commands/search/rg-command.js.map +1 -1
- package/packages/safe-bash/dist/commands/streams.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/streams.js +32 -12
- package/packages/safe-bash/dist/commands/streams.js.map +1 -1
- package/packages/safe-bash/dist/commands/structured/jq.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/structured/jq.js +8 -4
- package/packages/safe-bash/dist/commands/structured/jq.js.map +1 -1
- package/packages/safe-bash/dist/commands/structured/values.d.ts +1 -0
- package/packages/safe-bash/dist/commands/structured/values.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/structured/values.js +18 -1
- package/packages/safe-bash/dist/commands/structured/values.js.map +1 -1
- package/packages/safe-bash/dist/commands/text-programs/sed.d.ts.map +1 -1
- package/packages/safe-bash/dist/commands/text-programs/sed.js +10 -1
- package/packages/safe-bash/dist/commands/text-programs/sed.js.map +1 -1
- package/packages/safe-bash/dist/commands/xml/index.browser.js +2 -2
- package/packages/safe-bash/dist/commands/yq/index.browser.js +2 -2
- package/packages/safe-bash/dist/core.browser.js +248 -29
- package/packages/safe-bash/dist/core.browser.js.map +3 -3
- package/dist/chunk-54JM3XZC.js.map +0 -7
- package/packages/safe-bash/dist/chunks/chunk-BM3BGSH7.js.map +0 -7
- package/packages/safe-bash/dist/chunks/chunk-JESM4RK2.js.map +0 -7
- package/packages/safe-bash/dist/chunks/chunk-MCBWPJRQ.js.map +0 -7
- /package/dist/{chunk-UC3KWJDL.js.map → chunk-EQAAKXQV.js.map} +0 -0
- /package/dist/{chunk-GK6Z56OL.js.map → chunk-S2NLSD2J.js.map} +0 -0
- /package/dist/{core-BR637SCW.js.map → core-CRWO3R4F.js.map} +0 -0
- /package/dist/{program-3DNB5ZIC.js.map → program-3H7FXQW5.js.map} +0 -0
- /package/dist/{src-R4LATOF3.js.map → src-IES5F6JJ.js.map} +0 -0
- /package/packages/safe-bash/dist/chunks/{chunk-RVYQDJCC.js.map → chunk-AOT4SUBQ.js.map} +0 -0
- /package/packages/safe-bash/dist/chunks/{chunk-LUQYNLH7.js.map → chunk-L4HKTYVE.js.map} +0 -0
- /package/packages/safe-bash/dist/chunks/{chunk-WSCXISXW.js.map → chunk-RYXT5BJJ.js.map} +0 -0
- /package/packages/safe-bash/dist/chunks/{chunk-HC4S4QZD.js.map → chunk-WSX5CLK2.js.map} +0 -0
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
createXmlCommands,
|
|
25
25
|
defaultXmlQueryLimits,
|
|
26
26
|
xmlCommands
|
|
27
|
-
} from "./chunks/chunk-
|
|
27
|
+
} from "./chunks/chunk-RYXT5BJJ.js";
|
|
28
28
|
import {
|
|
29
29
|
Interpreter,
|
|
30
30
|
createYqCommand,
|
|
@@ -33,9 +33,10 @@ import {
|
|
|
33
33
|
parse,
|
|
34
34
|
parseJson,
|
|
35
35
|
rawValues,
|
|
36
|
+
sortObjectKeys,
|
|
36
37
|
stringify,
|
|
37
38
|
yqCommands
|
|
38
|
-
} from "./chunks/chunk-
|
|
39
|
+
} from "./chunks/chunk-FOMU56TU.js";
|
|
39
40
|
import {
|
|
40
41
|
Budget,
|
|
41
42
|
JqError,
|
|
@@ -61,7 +62,7 @@ import {
|
|
|
61
62
|
curlCommands,
|
|
62
63
|
defaultNetworkLimits,
|
|
63
64
|
networkCommands
|
|
64
|
-
} from "./chunks/chunk-
|
|
65
|
+
} from "./chunks/chunk-AOT4SUBQ.js";
|
|
65
66
|
import {
|
|
66
67
|
SafeJsCommandLimitError,
|
|
67
68
|
createSafeJsNodeCommand,
|
|
@@ -72,7 +73,7 @@ import {
|
|
|
72
73
|
safeJsNodeCommands,
|
|
73
74
|
stringValue,
|
|
74
75
|
withSignal
|
|
75
|
-
} from "./chunks/chunk-
|
|
76
|
+
} from "./chunks/chunk-L4HKTYVE.js";
|
|
76
77
|
import {
|
|
77
78
|
AvailableRecords,
|
|
78
79
|
EreLedger,
|
|
@@ -92,7 +93,7 @@ import {
|
|
|
92
93
|
exprMatchCeilings,
|
|
93
94
|
matchEre,
|
|
94
95
|
withRegexSession
|
|
95
|
-
} from "./chunks/chunk-
|
|
96
|
+
} from "./chunks/chunk-YJPA2BVP.js";
|
|
96
97
|
import {
|
|
97
98
|
openFileOutput,
|
|
98
99
|
writeFileOutput
|
|
@@ -149,7 +150,7 @@ import {
|
|
|
149
150
|
import {
|
|
150
151
|
createLlmCommands,
|
|
151
152
|
llmCommands
|
|
152
|
-
} from "./chunks/chunk-
|
|
153
|
+
} from "./chunks/chunk-WSX5CLK2.js";
|
|
153
154
|
import {
|
|
154
155
|
RecordBuffer,
|
|
155
156
|
UsageError,
|
|
@@ -181,7 +182,7 @@ import {
|
|
|
181
182
|
textOutputRequirements,
|
|
182
183
|
value,
|
|
183
184
|
writeDiagnostic
|
|
184
|
-
} from "./chunks/chunk-
|
|
185
|
+
} from "./chunks/chunk-KLEL3WAN.js";
|
|
185
186
|
import {
|
|
186
187
|
PublicDiagnostic,
|
|
187
188
|
publicDiagnosticMessage
|
|
@@ -395,6 +396,11 @@ async function formatPrintf(context2) {
|
|
|
395
396
|
let argument2 = 1;
|
|
396
397
|
let exitCode = 0;
|
|
397
398
|
let stopped = false;
|
|
399
|
+
const locale = context2.env.LC_ALL || context2.env.LC_CTYPE || context2.env.LANG || "C.UTF-8";
|
|
400
|
+
const unicodeErrors = [];
|
|
401
|
+
const unicode = { utf8: locale !== "C" && locale !== "POSIX", missingDigit: (escape) => {
|
|
402
|
+
unicodeErrors.push(escape);
|
|
403
|
+
} };
|
|
398
404
|
do {
|
|
399
405
|
const before = argument2;
|
|
400
406
|
for (let offset = 0; offset < formatLength && !stopped; ) {
|
|
@@ -402,7 +408,9 @@ async function formatPrintf(context2) {
|
|
|
402
408
|
const end = rawFormat ? rawFormat.indexOf(37, offset) : format3.indexOf("%", offset);
|
|
403
409
|
const limit = end < 0 ? formatLength : end;
|
|
404
410
|
const literal = rawFormat ? rawFormat.subarray(offset, limit) : format3.slice(offset, limit);
|
|
405
|
-
const escaped3 = escapeBytes(literal);
|
|
411
|
+
const escaped3 = escapeBytes(literal, false, false, unicode);
|
|
412
|
+
for (const escape of unicodeErrors.splice(0)) await writeDiagnostic(context2.stderr, `printf: missing unicode digit for \\${escape}
|
|
413
|
+
`, context2.signal);
|
|
406
414
|
await output(context2, escaped3.bytes);
|
|
407
415
|
stopped = escaped3.stop;
|
|
408
416
|
offset += literal.length;
|
|
@@ -431,7 +439,9 @@ async function formatPrintf(context2) {
|
|
|
431
439
|
if (specifier === "b" || specifier === "s") {
|
|
432
440
|
const suppliedValue = arguments_.values[suppliedIndex] ?? "";
|
|
433
441
|
const raw = specifier === "b" && typeof suppliedValue === "string" ? suppliedValue : arguments_.bytes(suppliedIndex) ?? new Uint8Array();
|
|
434
|
-
const escaped3 = specifier === "b" ? escapeBytes(raw, true, true) : { bytes: raw, stop: false };
|
|
442
|
+
const escaped3 = specifier === "b" ? escapeBytes(raw, true, true, unicode) : { bytes: raw, stop: false };
|
|
443
|
+
for (const escape of unicodeErrors.splice(0)) await writeDiagnostic(context2.stderr, `printf: missing unicode digit for \\${escape}
|
|
444
|
+
`, context2.signal);
|
|
435
445
|
const bytes3 = escaped3.bytes.subarray(0, precision);
|
|
436
446
|
const padding = " ".repeat(Math.max(0, width - bytes3.length));
|
|
437
447
|
if (!flags3.includes("-")) await output(context2, padding);
|
|
@@ -3890,7 +3900,7 @@ async function* combinedInput(context2, names, state) {
|
|
|
3890
3900
|
}
|
|
3891
3901
|
}
|
|
3892
3902
|
}
|
|
3893
|
-
async function prefix(context2, source2, count2, bytes3, skip) {
|
|
3903
|
+
async function prefix(context2, source2, count2, bytes3, skip, delimiter) {
|
|
3894
3904
|
let remaining = count2;
|
|
3895
3905
|
if (!remaining && !skip) return;
|
|
3896
3906
|
for await (const chunk of source2) {
|
|
@@ -3901,7 +3911,7 @@ async function prefix(context2, source2, count2, bytes3, skip) {
|
|
|
3901
3911
|
offset = Math.min(chunk.length, remaining);
|
|
3902
3912
|
remaining -= offset;
|
|
3903
3913
|
} else {
|
|
3904
|
-
for (; offset < chunk.length && remaining; offset++) if (chunk[offset] ===
|
|
3914
|
+
for (; offset < chunk.length && remaining; offset++) if (chunk[offset] === delimiter) remaining--;
|
|
3905
3915
|
}
|
|
3906
3916
|
}
|
|
3907
3917
|
if (skip) {
|
|
@@ -3912,12 +3922,12 @@ async function prefix(context2, source2, count2, bytes3, skip) {
|
|
|
3912
3922
|
}
|
|
3913
3923
|
}
|
|
3914
3924
|
}
|
|
3915
|
-
async function suffix(context2, source2, count2, bytes3, omit) {
|
|
3925
|
+
async function suffix(context2, source2, count2, bytes3, omit, delimiter) {
|
|
3916
3926
|
let pending = [];
|
|
3917
3927
|
let start = 0;
|
|
3918
3928
|
let size = 0;
|
|
3919
3929
|
const records5 = bytes3 ? source2 : (async function* () {
|
|
3920
|
-
for await (const line of lines(source2)) yield line.terminated ? concatenate([line.bytes, Uint8Array.of(
|
|
3930
|
+
for await (const line of lines(source2, delimiter)) yield line.terminated ? concatenate([line.bytes, Uint8Array.of(delimiter)]) : line.bytes;
|
|
3921
3931
|
})();
|
|
3922
3932
|
for await (const chunk of records5) {
|
|
3923
3933
|
context2.signal.throwIfAborted();
|
|
@@ -3992,9 +4002,10 @@ function headTail(name2, maxTailFollowHandles = 64) {
|
|
|
3992
4002
|
return define(name2, async (context2) => {
|
|
3993
4003
|
const args = context2.args[0] && /^-[0-9]+$/u.test(context2.args[0]) ? ["-n", context2.args[0].slice(1), ...context2.args.slice(1)] : context2.args;
|
|
3994
4004
|
const follow = name2 === "tail" ? parseTailFollow(args) : void 0;
|
|
3995
|
-
const parsed = options(follow?.args ?? args, "n:c:
|
|
4005
|
+
const parsed = options(follow?.args ?? args, "n:c:qvz", { lines: "n", bytes: "c", quiet: "q", silent: "q", verbose: "v", "zero-terminated": "z" });
|
|
3996
4006
|
if (parsed.flags.has("n") && parsed.flags.has("c")) throw new UsageError("cannot combine line and byte counts");
|
|
3997
4007
|
const bytes3 = parsed.flags.has("c");
|
|
4008
|
+
const delimiter = parsed.flags.has("z") ? 0 : 10;
|
|
3998
4009
|
const amount = value(parsed, bytes3 ? "c" : "n") ?? "10";
|
|
3999
4010
|
const positive = amount.startsWith("+");
|
|
4000
4011
|
const negative = amount.startsWith("-");
|
|
@@ -4008,7 +4019,7 @@ function headTail(name2, maxTailFollowHandles = 64) {
|
|
|
4008
4019
|
bytes: bytes3,
|
|
4009
4020
|
positive,
|
|
4010
4021
|
headers: parsed.flags.has("v") || names.length > 1 && !parsed.flags.has("q")
|
|
4011
|
-
}, maxTailFollowHandles, (target, source2) => positive ? prefix(target, source2, Math.max(0, count2 - 1), bytes3, true) : suffix(target, source2, count2, bytes3, false));
|
|
4022
|
+
}, maxTailFollowHandles, (target, source2) => positive ? prefix(target, source2, Math.max(0, count2 - 1), bytes3, true, delimiter) : suffix(target, source2, count2, bytes3, false, delimiter));
|
|
4012
4023
|
await assertInputRequirements(context2, names);
|
|
4013
4024
|
assertCommandRequirements(context2, inspectedInputRequirements, [names.some((name3) => name3 !== "-") ? "file" : "stdin"]);
|
|
4014
4025
|
let exitCode = 0;
|
|
@@ -4026,9 +4037,9 @@ function headTail(name2, maxTailFollowHandles = 64) {
|
|
|
4026
4037
|
`);
|
|
4027
4038
|
headerWritten = true;
|
|
4028
4039
|
}
|
|
4029
|
-
if (name2 === "head" && !negative) await prefix(context2, input(context2, file), count2, bytes3, false);
|
|
4030
|
-
else if (name2 === "tail" && positive) await prefix(context2, input(context2, file), Math.max(0, count2 - 1), bytes3, true);
|
|
4031
|
-
else await suffix(context2, input(context2, file), count2, bytes3, name2 === "head");
|
|
4040
|
+
if (name2 === "head" && !negative) await prefix(context2, input(context2, file), count2, bytes3, false, delimiter);
|
|
4041
|
+
else if (name2 === "tail" && positive) await prefix(context2, input(context2, file), Math.max(0, count2 - 1), bytes3, true, delimiter);
|
|
4042
|
+
else await suffix(context2, input(context2, file), count2, bytes3, name2 === "head", delimiter);
|
|
4032
4043
|
} catch (error) {
|
|
4033
4044
|
await diagnostic(context2, error);
|
|
4034
4045
|
exitCode = 1;
|
|
@@ -4097,7 +4108,26 @@ function streamCommands(maxTeeTargets = 64, maxTailFollowHandles = 64) {
|
|
|
4097
4108
|
}
|
|
4098
4109
|
return [
|
|
4099
4110
|
define("cat", async (context2) => {
|
|
4100
|
-
const parsed = options(context2.args, "nbsvETAute", { number: "n", "number-nonblank": "b", "squeeze-blank": "s", "show-ends": "E", "show-tabs": "T", "show-nonprinting": "v", "show-all": "A" });
|
|
4111
|
+
const parsed = options(context2.args, "nbsvETAute", { help: false, number: "n", "number-nonblank": "b", "squeeze-blank": "s", "show-ends": "E", "show-tabs": "T", "show-nonprinting": "v", "show-all": "A" });
|
|
4112
|
+
if (parsed.flags.has("help")) {
|
|
4113
|
+
await output(context2, `Usage: cat [OPTION]... [FILE]...
|
|
4114
|
+
Concatenate FILEs to standard output. With no FILE, or FILE -, read standard input.
|
|
4115
|
+
|
|
4116
|
+
-n, --number Number all output lines
|
|
4117
|
+
-b, --number-nonblank Number nonempty output lines (overrides -n)
|
|
4118
|
+
-s, --squeeze-blank Suppress repeated empty output lines
|
|
4119
|
+
-E, --show-ends Display $ at each line end
|
|
4120
|
+
-T, --show-tabs Display TAB characters as ^I
|
|
4121
|
+
-v, --show-nonprinting Display nonprinting characters
|
|
4122
|
+
-A, --show-all Equivalent to -vET
|
|
4123
|
+
-e Equivalent to -vE
|
|
4124
|
+
-t Equivalent to -vT
|
|
4125
|
+
-u Accepted for compatibility; ignored
|
|
4126
|
+
--help Display this help and exit
|
|
4127
|
+
-- End options; remaining arguments are filenames
|
|
4128
|
+
`);
|
|
4129
|
+
return { exitCode: 0 };
|
|
4130
|
+
}
|
|
4101
4131
|
await assertInputRequirements(context2, parsed.operands);
|
|
4102
4132
|
if (parsed.flags.has("A")) for (const flag of ["v", "E", "T"]) parsed.flags.add(flag);
|
|
4103
4133
|
if (parsed.flags.has("e")) {
|
|
@@ -14534,7 +14564,7 @@ async function execute(program, context2, files, quiet, budget, separator, outpu
|
|
|
14534
14564
|
const character = pattern[offset];
|
|
14535
14565
|
const lineEnd = character === "\n" && separator === "\n";
|
|
14536
14566
|
const token = character === void 0 || lineEnd ? "$" : escapes2[character] ?? (character.charCodeAt(0) < 32 || character.charCodeAt(0) >= 127 ? `\\${character.charCodeAt(0).toString(8).padStart(3, "0")}` : character);
|
|
14537
|
-
if (line.length + token.length >=
|
|
14567
|
+
if (character !== void 0 && !lineEnd && line.length + token.length >= 70) {
|
|
14538
14568
|
await emit2(line + "\\" + separator);
|
|
14539
14569
|
line = "";
|
|
14540
14570
|
}
|
|
@@ -14695,6 +14725,14 @@ function sedCommand(options2 = {}) {
|
|
|
14695
14725
|
separator = "\0";
|
|
14696
14726
|
continue;
|
|
14697
14727
|
}
|
|
14728
|
+
if (argument2 === "--quiet") {
|
|
14729
|
+
quiet = true;
|
|
14730
|
+
continue;
|
|
14731
|
+
}
|
|
14732
|
+
if (argument2 === "--regexp-extended") {
|
|
14733
|
+
extended = true;
|
|
14734
|
+
continue;
|
|
14735
|
+
}
|
|
14698
14736
|
if (argument2.startsWith("--")) throw new ProgramError(`unsupported option '${argument2}'`);
|
|
14699
14737
|
for (let position = 1; position < argument2.length; position++) {
|
|
14700
14738
|
const flag = argument2[position];
|
|
@@ -16463,7 +16501,7 @@ function argumentsFor(args, budget) {
|
|
|
16463
16501
|
argumentBytes += import_buffer.Buffer.byteLength(argument2);
|
|
16464
16502
|
if (argumentBytes > budget.limits.maxInputBytes) throw new JqLimitError("maxInputBytes");
|
|
16465
16503
|
}
|
|
16466
|
-
const options2 = { raw: false, rawInput: false, joinOutput: false, compact: false, slurp: false, nullInput: false, exitStatus: false, source: void 0, programFile: void 0, files: [], variables: /* @__PURE__ */ new Map() };
|
|
16504
|
+
const options2 = { raw: false, rawInput: false, joinOutput: false, compact: false, sortKeys: false, slurp: false, nullInput: false, exitStatus: false, source: void 0, programFile: void 0, files: [], variables: /* @__PURE__ */ new Map() };
|
|
16467
16505
|
const named2 = object();
|
|
16468
16506
|
let ended = false;
|
|
16469
16507
|
let variableBytes = 0;
|
|
@@ -16504,10 +16542,10 @@ function argumentsFor(args, budget) {
|
|
|
16504
16542
|
options2.programFile = operand();
|
|
16505
16543
|
continue;
|
|
16506
16544
|
}
|
|
16507
|
-
const long = { "--raw-output": "r", "--raw-input": "R", "--join-output": "j", "--compact-output": "c", "--slurp": "s", "--null-input": "n", "--exit-status": "e" };
|
|
16545
|
+
const long = { "--raw-output": "r", "--raw-input": "R", "--join-output": "j", "--compact-output": "c", "--sort-keys": "S", "--slurp": "s", "--null-input": "n", "--exit-status": "e" };
|
|
16508
16546
|
if (!ended && argument2.startsWith("-") && argument2 !== "-") {
|
|
16509
16547
|
const flags3 = Object.hasOwn(long, argument2) ? long[argument2] : argument2.startsWith("--") ? "" : argument2.slice(1);
|
|
16510
|
-
if (!flags3 ||
|
|
16548
|
+
if (!flags3 || [...flags3].some((flag) => !"rRjcSsne".includes(flag))) throw new JqError(`unsupported option ${argument2}`, 2);
|
|
16511
16549
|
for (const flag of flags3) {
|
|
16512
16550
|
if (flag === "r") options2.raw = true;
|
|
16513
16551
|
else if (flag === "R") options2.rawInput = true;
|
|
@@ -16515,6 +16553,7 @@ function argumentsFor(args, budget) {
|
|
|
16515
16553
|
options2.joinOutput = true;
|
|
16516
16554
|
options2.raw = true;
|
|
16517
16555
|
} else if (flag === "c") options2.compact = true;
|
|
16556
|
+
else if (flag === "S") options2.sortKeys = true;
|
|
16518
16557
|
else if (flag === "s") options2.slurp = true;
|
|
16519
16558
|
else if (flag === "n") options2.nullInput = true;
|
|
16520
16559
|
else options2.exitStatus = true;
|
|
@@ -16640,7 +16679,8 @@ async function execute2(context2, limits) {
|
|
|
16640
16679
|
if (++budget.results > limits.maxResults) throw new JqLimitError("maxResults");
|
|
16641
16680
|
const remaining = limits.maxOutputBytes - budget.outputBytes;
|
|
16642
16681
|
const suffix2 = options2.joinOutput ? "" : "\n";
|
|
16643
|
-
const
|
|
16682
|
+
const output3 = options2.sortKeys ? await sortObjectKeys(result, budget) : result;
|
|
16683
|
+
const text3 = options2.raw && typeof output3 === "string" ? output3 : await stringify(output3, budget, !options2.compact, Math.max(0, remaining - suffix2.length), "maxOutputBytes");
|
|
16644
16684
|
const bytes3 = import_buffer.Buffer.from(`${text3}${suffix2}`);
|
|
16645
16685
|
if (bytes3.byteLength > remaining) throw new JqLimitError("maxOutputBytes");
|
|
16646
16686
|
budget.outputBytes += bytes3.byteLength;
|
|
@@ -17031,6 +17071,9 @@ function parse6(args) {
|
|
|
17031
17071
|
return output3;
|
|
17032
17072
|
};
|
|
17033
17073
|
switch (flag) {
|
|
17074
|
+
case "help":
|
|
17075
|
+
result.help = true;
|
|
17076
|
+
break;
|
|
17034
17077
|
case "e":
|
|
17035
17078
|
case "regexp":
|
|
17036
17079
|
result.explicitPatterns = true;
|
|
@@ -17276,7 +17319,7 @@ function parse6(args) {
|
|
|
17276
17319
|
}
|
|
17277
17320
|
}
|
|
17278
17321
|
if (result.before > 1e5 || result.after > 1e5) throw new SearchError("context limit exceeded");
|
|
17279
|
-
if (result.mode !== "files" && !result.explicitPatterns) {
|
|
17322
|
+
if (!result.help && result.mode !== "files" && !result.explicitPatterns) {
|
|
17280
17323
|
const pattern = operands.shift();
|
|
17281
17324
|
if (pattern === void 0) throw new SearchError("a search pattern is required");
|
|
17282
17325
|
result.patterns.push(pattern);
|
|
@@ -17878,6 +17921,65 @@ function createRgCommand(executor, options2 = {}) {
|
|
|
17878
17921
|
try {
|
|
17879
17922
|
const limits = new Limits(context2, options2);
|
|
17880
17923
|
args = parse6(context2.args);
|
|
17924
|
+
if (args.help) {
|
|
17925
|
+
await limits.output(import_buffer.Buffer.from(`Usage: rg [OPTIONS] PATTERN [PATH ...]
|
|
17926
|
+
Search files for PATTERN. PATH - reads standard input.
|
|
17927
|
+
Default input depends on shell configuration.
|
|
17928
|
+
|
|
17929
|
+
-e, --regexp=PATTERN Add a pattern (repeatable)
|
|
17930
|
+
-f, --file=FILE Read patterns from FILE
|
|
17931
|
+
-F, --fixed-strings Use fixed strings
|
|
17932
|
+
-i, --ignore-case Ignore case distinctions
|
|
17933
|
+
-s, --case-sensitive Match case sensitively
|
|
17934
|
+
-S, --smart-case Infer case sensitivity from the pattern
|
|
17935
|
+
-v, --invert-match Select nonmatching lines
|
|
17936
|
+
-w, --word-regexp Match whole words
|
|
17937
|
+
-x, --line-regexp Match whole lines
|
|
17938
|
+
-n, --line-number Print line numbers
|
|
17939
|
+
-N, --no-line-number Suppress line numbers
|
|
17940
|
+
-H, --with-filename Print filenames
|
|
17941
|
+
-I, --no-filename Suppress filenames
|
|
17942
|
+
-o, --only-matching Print matching parts
|
|
17943
|
+
-l, --files-with-matches Print filenames with matches
|
|
17944
|
+
--files-without-match Print filenames without matches
|
|
17945
|
+
--files List files without searching
|
|
17946
|
+
-c, --count Print matching line counts
|
|
17947
|
+
--count-matches Print match counts
|
|
17948
|
+
--json Emit JSON events
|
|
17949
|
+
-q, --quiet Suppress normal output
|
|
17950
|
+
-g, --glob=GLOB Include or exclude paths (repeatable)
|
|
17951
|
+
--iglob=GLOB Case-insensitive glob
|
|
17952
|
+
-t, --type=TYPE Include a file type
|
|
17953
|
+
-T, --type-not=TYPE Exclude a file type
|
|
17954
|
+
-., --hidden Search hidden files
|
|
17955
|
+
-L, --follow Follow symbolic links
|
|
17956
|
+
--no-ignore Disable ignore-file filtering
|
|
17957
|
+
-u, --unrestricted Relax ignore, hidden and binary filtering (repeatable)
|
|
17958
|
+
-a, --text Search binary files as text
|
|
17959
|
+
-A, --after-context=NUM Print NUM lines after matches
|
|
17960
|
+
-B, --before-context=NUM Print NUM lines before matches
|
|
17961
|
+
-C, --context=NUM Print NUM lines before and after matches
|
|
17962
|
+
-m, --max-count=NUM Limit matching lines per file
|
|
17963
|
+
--max-depth=NUM Limit directory traversal depth (maximum 128)
|
|
17964
|
+
--column Print columns
|
|
17965
|
+
-b, --byte-offset Print byte offsets
|
|
17966
|
+
-0, --null NUL-terminate filenames
|
|
17967
|
+
--null-data Use NUL-delimited records
|
|
17968
|
+
--crlf Handle CRLF line endings
|
|
17969
|
+
--heading Group output by filename
|
|
17970
|
+
--sort=path Sort paths
|
|
17971
|
+
--color=never Disable color
|
|
17972
|
+
--help Display this help and exit
|
|
17973
|
+
-- End options
|
|
17974
|
+
|
|
17975
|
+
Exit status: 0 when a match is found, 1 when none is found, 2 on error.
|
|
17976
|
+
Regular expression support depends on the configured regex executor.
|
|
17977
|
+
The default supports UTF-8 literals and bounded ASCII regular expressions.
|
|
17978
|
+
Regex operators: . ^ $ [...] (...) | * + ? {n,m}; -F treats patterns literally.
|
|
17979
|
+
Word/case flags and extended regex syntax require a configured executor.
|
|
17980
|
+
`));
|
|
17981
|
+
return { exitCode: 0 };
|
|
17982
|
+
}
|
|
17881
17983
|
if (args.mode !== "files" && args.patternFiles.includes("-") && args.paths.includes("-")) {
|
|
17882
17984
|
throw new SearchError("cannot search stdin while also reading patterns from stdin");
|
|
17883
17985
|
}
|
|
@@ -17936,7 +18038,51 @@ var maxPatternCount = 1024;
|
|
|
17936
18038
|
function createGrepCommands(executor) {
|
|
17937
18039
|
return [{ name: "grep", filesystemRequirements: grepRequirements, execute: (context2) => withRegexSession(context2, executor, async (session) => {
|
|
17938
18040
|
try {
|
|
17939
|
-
const
|
|
18041
|
+
const contextLengths = /* @__PURE__ */ new Map();
|
|
18042
|
+
const parsed = options(context2.args, "EFivnclLqhHowxae:f:m:szA:B:C:", { help: false, "extended-regexp": "E", "fixed-strings": "F", "ignore-case": "i", "invert-match": "v", "line-number": "n", count: "c", "files-with-matches": "l", "files-without-match": "L", quiet: "q", silent: "q", "no-filename": "h", "with-filename": "H", "only-matching": "o", "word-regexp": "w", "line-regexp": "x", regexp: "e", file: "f", "max-count": "m", "no-messages": "s", text: "a", "null-data": "z", "after-context": "A", "before-context": "B", context: "C" }, false, void 0, (key, index, offset) => {
|
|
18043
|
+
if (!["A", "B", "C"].includes(key)) return;
|
|
18044
|
+
const text3 = context2.args[index].slice(offset);
|
|
18045
|
+
try {
|
|
18046
|
+
contextLengths.set(key, integer(text3));
|
|
18047
|
+
} catch {
|
|
18048
|
+
throw new UsageError(`${text3}: invalid context length argument`);
|
|
18049
|
+
}
|
|
18050
|
+
});
|
|
18051
|
+
if (parsed.flags.has("help")) {
|
|
18052
|
+
await output(context2, `Usage: grep [OPTION]... PATTERN [FILE]...
|
|
18053
|
+
Print lines matching PATTERN. With no FILE, or FILE -, read standard input.
|
|
18054
|
+
|
|
18055
|
+
-E, --extended-regexp Use extended regular expressions
|
|
18056
|
+
-F, --fixed-strings Use fixed strings
|
|
18057
|
+
-e, --regexp=PATTERN Add a pattern (repeatable)
|
|
18058
|
+
-f, --file=FILE Read patterns from FILE
|
|
18059
|
+
-i, --ignore-case Ignore case distinctions
|
|
18060
|
+
-v, --invert-match Select nonmatching lines
|
|
18061
|
+
-w, --word-regexp Match whole words
|
|
18062
|
+
-x, --line-regexp Match whole lines
|
|
18063
|
+
-n, --line-number Print line numbers
|
|
18064
|
+
-H, --with-filename Print filenames
|
|
18065
|
+
-h, --no-filename Suppress filenames
|
|
18066
|
+
-o, --only-matching Print only matching parts
|
|
18067
|
+
-c, --count Print matching line counts
|
|
18068
|
+
-l, --files-with-matches Print filenames with matches
|
|
18069
|
+
-L, --files-without-match Print filenames without matches
|
|
18070
|
+
-q, --quiet, --silent Suppress normal output
|
|
18071
|
+
-m, --max-count=NUM Stop after NUM selected lines per file
|
|
18072
|
+
-A, --after-context=NUM Print NUM lines after selected lines
|
|
18073
|
+
-B, --before-context=NUM Print NUM lines before selected lines
|
|
18074
|
+
-C, --context=NUM Print NUM lines before and after selected lines
|
|
18075
|
+
-s, --no-messages Suppress file error messages
|
|
18076
|
+
-a, --text Process input as text
|
|
18077
|
+
-z, --null-data Use NUL-delimited records
|
|
18078
|
+
--help Display this help and exit
|
|
18079
|
+
-- End options
|
|
18080
|
+
|
|
18081
|
+
Exit status: 0 when a line is selected, 1 when none is selected, 2 on error.
|
|
18082
|
+
Regular expression support depends on the configured regex executor.
|
|
18083
|
+
`);
|
|
18084
|
+
return { exitCode: 0 };
|
|
18085
|
+
}
|
|
17940
18086
|
let positionalPattern;
|
|
17941
18087
|
if (!parsed.flags.has("e") && !parsed.flags.has("f")) {
|
|
17942
18088
|
if (!parsed.operands.length) throw new UsageError("missing pattern");
|
|
@@ -17998,13 +18144,30 @@ function createGrepCommands(executor) {
|
|
|
17998
18144
|
const batchSize = Number.isFinite(maxCount) || parsed.flags.has("q") || parsed.flags.has("l") || parsed.flags.has("L") ? 1 : 128;
|
|
17999
18145
|
const delimiter = parsed.flags.has("z") ? "\0" : "\n";
|
|
18000
18146
|
const extractMatches = parsed.flags.has("o") && !["c", "q", "l", "L", "v"].some((flag) => parsed.flags.has(flag));
|
|
18147
|
+
const displayLines = !["c", "q", "l", "L"].some((flag) => parsed.flags.has(flag));
|
|
18148
|
+
const withContext = contextLengths.size > 0 && displayLines && !(parsed.flags.has("o") && parsed.flags.has("v"));
|
|
18149
|
+
const before = withContext ? contextLengths.get("B") ?? contextLengths.get("C") ?? 0 : 0;
|
|
18150
|
+
const after = withContext ? contextLengths.get("A") ?? contextLengths.get("C") ?? 0 : 0;
|
|
18151
|
+
let emittedGroup = false;
|
|
18001
18152
|
let anySelected = false;
|
|
18002
18153
|
let failed = false;
|
|
18003
18154
|
for (const name2 of names) {
|
|
18004
18155
|
let count2 = 0;
|
|
18005
18156
|
let number6 = 0;
|
|
18157
|
+
let lastCovered = 0;
|
|
18158
|
+
let remainingAfter = 0;
|
|
18159
|
+
let pendingBytes = 0;
|
|
18160
|
+
const pending = /* @__PURE__ */ new Map();
|
|
18006
18161
|
const named2 = name2 === "-" ? "(standard input)" : name2;
|
|
18007
|
-
const prefix3 = (lineNumber = false) => `${!parsed.flags.has("h") && (parsed.flags.has("H") || names.length > 1) ? `${named2}
|
|
18162
|
+
const prefix3 = (lineNumber = false, position = number6, separator = ":") => `${!parsed.flags.has("h") && (parsed.flags.has("H") || names.length > 1) ? `${named2}${separator}` : ""}${lineNumber && parsed.flags.has("n") ? `${position}${separator}` : ""}`;
|
|
18163
|
+
const emitContext = async (line, position) => {
|
|
18164
|
+
if (!parsed.flags.has("o")) {
|
|
18165
|
+
await output(context2, prefix3(true, position, "-"));
|
|
18166
|
+
await output(context2, line.bytes);
|
|
18167
|
+
await output(context2, delimiter);
|
|
18168
|
+
}
|
|
18169
|
+
lastCovered = position;
|
|
18170
|
+
};
|
|
18008
18171
|
try {
|
|
18009
18172
|
const available2 = new AvailableRecords(parsed.flags.has("z") ? 0 : 10, bufferLimit);
|
|
18010
18173
|
const source2 = name2 === "-" ? input(context2) : requiredFileInput(context2, grepRequirements, "file", name2, bufferLimit);
|
|
@@ -18015,12 +18178,40 @@ function createGrepCommands(executor) {
|
|
|
18015
18178
|
context2.signal.throwIfAborted();
|
|
18016
18179
|
number6++;
|
|
18017
18180
|
const found = results[index];
|
|
18018
|
-
|
|
18181
|
+
const selected = count2 < maxCount && found.length > 0 !== parsed.flags.has("v");
|
|
18182
|
+
if (!selected) {
|
|
18183
|
+
if (remainingAfter > 0) {
|
|
18184
|
+
await emitContext(line, number6);
|
|
18185
|
+
remainingAfter--;
|
|
18186
|
+
if (count2 >= maxCount && remainingAfter === 0) break records;
|
|
18187
|
+
} else if (before > 0) {
|
|
18188
|
+
if (pending.size >= before) {
|
|
18189
|
+
const oldest = pending.keys().next().value;
|
|
18190
|
+
pendingBytes -= pending.get(oldest).bytes.length + 1;
|
|
18191
|
+
pending.delete(oldest);
|
|
18192
|
+
}
|
|
18193
|
+
const size = line.bytes.length + 1;
|
|
18194
|
+
if (size > bufferLimit - pendingBytes) throw new UsageError(`context byte limit exceeded (${bufferLimit} bytes)`);
|
|
18195
|
+
pending.set(number6, { bytes: Uint8Array.from(line.bytes), terminated: line.terminated });
|
|
18196
|
+
pendingBytes += size;
|
|
18197
|
+
}
|
|
18198
|
+
continue;
|
|
18199
|
+
}
|
|
18019
18200
|
count2++;
|
|
18020
18201
|
if (!parsed.flags.has("L")) anySelected = true;
|
|
18021
18202
|
if (parsed.flags.has("q")) return { exitCode: 0 };
|
|
18022
18203
|
if (parsed.flags.has("l") || parsed.flags.has("L")) break records;
|
|
18023
18204
|
if (!parsed.flags.has("c")) {
|
|
18205
|
+
if (withContext) {
|
|
18206
|
+
const first = pending.keys().next().value ?? number6;
|
|
18207
|
+
if (emittedGroup && (lastCovered === 0 || first > lastCovered + 1)) await output(context2, "--\n");
|
|
18208
|
+
for (const [position, previous] of pending) await emitContext(previous, position);
|
|
18209
|
+
pending.clear();
|
|
18210
|
+
pendingBytes = 0;
|
|
18211
|
+
remainingAfter = after;
|
|
18212
|
+
lastCovered = number6;
|
|
18213
|
+
emittedGroup = true;
|
|
18214
|
+
}
|
|
18024
18215
|
if (parsed.flags.has("o")) {
|
|
18025
18216
|
if (!parsed.flags.has("v")) {
|
|
18026
18217
|
let end = -1;
|
|
@@ -18038,7 +18229,7 @@ function createGrepCommands(executor) {
|
|
|
18038
18229
|
await output(context2, delimiter);
|
|
18039
18230
|
}
|
|
18040
18231
|
}
|
|
18041
|
-
if (count2 >= maxCount) break records;
|
|
18232
|
+
if (count2 >= maxCount && remainingAfter === 0) break records;
|
|
18042
18233
|
}
|
|
18043
18234
|
}
|
|
18044
18235
|
if (parsed.flags.has("l") && count2 > 0 || parsed.flags.has("L") && count2 === 0) {
|
|
@@ -27792,6 +27983,7 @@ async function parseOptions2(context2, limits) {
|
|
|
27792
27983
|
if (values2.has(flag) && value2 === void 0) value2 = context2.args[++index];
|
|
27793
27984
|
if (values2.has(flag) && value2 === void 0) fail(`missing argument for --${name2}`);
|
|
27794
27985
|
if (!values2.has(flag) && value2 !== void 0) fail(`option --${name2} does not take an argument`);
|
|
27986
|
+
if (flag === "help") return "help";
|
|
27795
27987
|
await apply(flag, value2);
|
|
27796
27988
|
} else if (!end && (argument2.startsWith("-") && argument2 !== "-" || index === 0 && /^[ctxzvfCT]+$/u.test(argument2))) {
|
|
27797
27989
|
const old = !argument2.startsWith("-");
|
|
@@ -33562,6 +33754,33 @@ function createTarCommand(options2 = {}) {
|
|
|
33562
33754
|
const context2 = { ...original, signal };
|
|
33563
33755
|
try {
|
|
33564
33756
|
const parsed = await parseOptions2(context2, limits);
|
|
33757
|
+
if (parsed === "help") {
|
|
33758
|
+
await writeBytes(context2.stdout, import_buffer.Buffer.from(`Usage: tar [OPTION]... [FILE]...
|
|
33759
|
+
Create, list or extract USTAR/PAX archives in the virtual filesystem.
|
|
33760
|
+
|
|
33761
|
+
-c, --create Create an archive
|
|
33762
|
+
-t, --list List archive members
|
|
33763
|
+
-x, --extract, --get Extract archive members
|
|
33764
|
+
-f, --file=ARCHIVE Use ARCHIVE (default - for standard input/output)
|
|
33765
|
+
-z, --gzip Use gzip compression
|
|
33766
|
+
-v, --verbose List processed members
|
|
33767
|
+
-C, --directory=DIR Change directory for subsequent operands
|
|
33768
|
+
-T, --files-from=FILE Read filenames from FILE (- for standard input)
|
|
33769
|
+
--null Read NUL-delimited filenames; implies verbatim names
|
|
33770
|
+
--no-null Read newline-delimited filenames
|
|
33771
|
+
--verbatim-files-from Treat file-list entries as literal filenames
|
|
33772
|
+
--no-verbatim-files-from Enable supported file-list directory options
|
|
33773
|
+
--exclude=PATTERN Exclude paths (place before source operands)
|
|
33774
|
+
--strip-components=NUM Remove leading components when reading archives
|
|
33775
|
+
--format=FORMAT Create pax (default), posix or ustar archives
|
|
33776
|
+
--help Display this help and exit
|
|
33777
|
+
-- End options; remaining arguments are filenames
|
|
33778
|
+
|
|
33779
|
+
Exactly one of -c, -t or -x is required for archive operations.
|
|
33780
|
+
Examples: tar cf archive.tar file; tar tf archive.tar; tar xf archive.tar -C directory
|
|
33781
|
+
`), signal);
|
|
33782
|
+
return { exitCode: 0 };
|
|
33783
|
+
}
|
|
33565
33784
|
const budget = new Budget14(context2, limits);
|
|
33566
33785
|
if (parsed.mode === "c") {
|
|
33567
33786
|
const prepared = await manifest(context2, parsed, budget);
|