@poe-platform/safe-bash 0.1.801 → 0.1.802
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/image-ast/index.browser.js +3 -1
- package/dist/image-ast/index.js +3 -1
- package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
- package/dist/safe-bash/chunks/{chunk-SZH7EJLD.js → chunk-44ALJ4QG.js} +5461 -6495
- package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
- package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
- package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
- package/dist/safe-bash/chunks/chunk-7ZBU7KYV.js +14 -0
- package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
- package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
- package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
- package/dist/safe-bash/chunks/{chunk-45PK3NWI.js → chunk-GETUOD5D.js} +1 -1
- package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
- package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
- package/dist/safe-bash/chunks/{chunk-ICFDYV64.js → chunk-HZAMGT5I.js} +2 -2
- package/dist/safe-bash/chunks/chunk-KDNSPLII.js +83 -0
- package/dist/safe-bash/chunks/{chunk-PQRAK7HU.js → chunk-NQCM3TYR.js} +238 -462
- package/dist/safe-bash/chunks/{chunk-IVRQ4BXL.js → chunk-PH63PLPZ.js} +7 -7
- package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
- package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
- package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
- package/dist/safe-bash/chunks/{chunk-FNDNHAGE.js → chunk-RSTHLAF3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-7VNF5BFF.js → chunk-SHEMU2Z7.js} +83 -416
- package/dist/safe-bash/chunks/{chunk-NR3EM4LS.js → chunk-VKNVHEX3.js} +1 -6
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
- package/dist/safe-bash/chunks/{chunk-VQDD3G76.js → chunk-WDLGKIHD.js} +19 -19
- package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
- package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
- package/dist/safe-bash/command-chunks/{chunk-PCEFOYA3.js → chunk-6GWJUQAV.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
- package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
- package/dist/safe-bash/command-chunks/{chunk-CZ7EN3JG.js → chunk-VT6MJBEI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-F6OYH562.js → chunk-X54L3DBL.js} +4 -9
- package/dist/safe-bash/command-chunks/{chunk-TNOA7FCQ.js → chunk-YVNGTIJO.js} +1 -1
- package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
- package/dist/safe-bash/commands/archive/index.browser.js +36 -0
- package/dist/safe-bash/commands/column/index.browser.js +12 -0
- package/dist/safe-bash/commands/du/index.browser.js +14 -0
- package/dist/safe-bash/commands/expr/index.browser.js +12 -0
- package/dist/safe-bash/commands/file/index.browser.js +14 -0
- package/dist/safe-bash/commands/filesystem.js +9 -2
- package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
- package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
- package/dist/safe-bash/commands/metadata/index.browser.js +21 -0
- package/dist/safe-bash/commands/network/index.browser.js +1 -1
- package/dist/safe-bash/commands/node/index.browser.js +3 -3
- package/dist/safe-bash/commands/python/index.browser.js +8 -8
- package/dist/safe-bash/commands/regex-execution/public.browser.js +5 -3
- package/dist/safe-bash/commands/split/index.browser.js +14 -0
- package/dist/safe-bash/commands/stream-format/index.browser.js +11 -0
- package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
- package/dist/safe-bash/commands/streams.js +5 -5
- package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
- package/dist/safe-bash/commands/text.js +2 -133
- package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
- package/dist/safe-bash/commands/tree/index.browser.js +14 -0
- package/dist/safe-bash/full-core.browser.js +227 -218
- package/dist/safe-bash/jobs.browser.js +2 -2
- package/dist/safe-bash/optional-host.browser.js +8 -8
- package/dist/safe-bash/plugins/index.browser.js +23 -9
- package/dist/safe-bash/registry-entry.browser.js +23 -9
- package/dist/safe-bash/search.browser.js +48 -0
- package/dist/safe-bash/shell/runtime.d.ts +0 -9
- package/dist/safe-bash/shell/runtime.js +43 -308
- package/dist/safe-bash/shell/shell.js +0 -23
- package/dist/safe-bash/shell-entry.browser.js +19 -10
- package/dist/safe-bash-command-nl/index.js +1 -1
- package/dist/safe-bash-command-nl/nl.js +1 -1
- package/dist/safe-bash-command-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
- package/dist/safe-bash-command-rg/rg-command.js +3 -5
- package/dist/safe-bash-command-unexpand/index.js +1 -1
- package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
- package/dist/safe-bash-mcp/index.js +3 -1
- package/dist/safe-bash-regex-engine/index.js +4 -4
- package/dist/safe-bash-regex-engine/text/budget.d.ts +0 -1
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.js +4 -4
- package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
- package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
- package/package.json +65 -10
- package/dist/safe-bash/chunks/{chunk-A7XEHALN.js → chunk-BJA5XNP6.js} +3 -3
|
@@ -10,27 +10,49 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
createTsortCommands
|
|
12
12
|
} from "./chunk-6PAVEFT3.js";
|
|
13
|
+
import {
|
|
14
|
+
RegexExecutor
|
|
15
|
+
} from "./chunk-VKNVHEX3.js";
|
|
16
|
+
import {
|
|
17
|
+
Chi,
|
|
18
|
+
HashMD,
|
|
19
|
+
Maj,
|
|
20
|
+
abytes,
|
|
21
|
+
aexists,
|
|
22
|
+
ahash,
|
|
23
|
+
anumber,
|
|
24
|
+
aoutput,
|
|
25
|
+
checkOpts,
|
|
26
|
+
clean,
|
|
27
|
+
createHasher,
|
|
28
|
+
createOutputOperation,
|
|
29
|
+
createView,
|
|
30
|
+
kdfInputToBytes,
|
|
31
|
+
rotl,
|
|
32
|
+
sha256,
|
|
33
|
+
sha384,
|
|
34
|
+
sha512
|
|
35
|
+
} from "./chunk-HZAMGT5I.js";
|
|
36
|
+
import {
|
|
37
|
+
createColumnCommands
|
|
38
|
+
} from "./chunk-3HQU4OJO.js";
|
|
39
|
+
import {
|
|
40
|
+
createApplyPatchCommands
|
|
41
|
+
} from "./chunk-XAQMU6OY.js";
|
|
13
42
|
import {
|
|
14
43
|
assertCommandRequirements,
|
|
15
44
|
basicCommands,
|
|
16
45
|
cmpCommand,
|
|
17
|
-
createArchiveCommands,
|
|
18
46
|
createCalCommands,
|
|
19
47
|
createChecksumCommands,
|
|
20
48
|
createCompressionCommands,
|
|
21
49
|
createDfCommands,
|
|
22
50
|
createDiffPatchCommands,
|
|
23
|
-
createDuCommands,
|
|
24
51
|
createFdCommands,
|
|
25
|
-
createFileCommands,
|
|
26
52
|
createFindDefinitions,
|
|
27
|
-
createHtmlToMarkdownCommands,
|
|
28
53
|
createLessCommands,
|
|
29
|
-
createMetadataCommands,
|
|
30
54
|
createPathchkCommands,
|
|
31
55
|
createRgCommand,
|
|
32
|
-
createTimeEnvCommands,
|
|
33
|
-
createTreeCommands,
|
|
34
56
|
createWhichCommands,
|
|
35
57
|
directExecutor,
|
|
36
58
|
executionCommands,
|
|
@@ -39,7 +61,7 @@ import {
|
|
|
39
61
|
openFileOutput,
|
|
40
62
|
predicateCommands,
|
|
41
63
|
wcDisplayWidth
|
|
42
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-44ALJ4QG.js";
|
|
43
65
|
import {
|
|
44
66
|
createGetoptCommands
|
|
45
67
|
} from "./chunk-AUSNDQTJ.js";
|
|
@@ -64,40 +86,37 @@ import {
|
|
|
64
86
|
} from "./chunk-C5OWC2TL.js";
|
|
65
87
|
import {
|
|
66
88
|
PublicDiagnostic
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import {
|
|
69
|
-
compareByteArrays,
|
|
70
|
-
decodeBytes,
|
|
71
|
-
encodeBytes,
|
|
72
|
-
indexOfBytes
|
|
73
|
-
} from "./chunk-D3ANYGMC.js";
|
|
89
|
+
} from "./chunk-PH63PLPZ.js";
|
|
74
90
|
import {
|
|
75
91
|
createPrCommands
|
|
76
92
|
} from "./chunk-CHYGPFVM.js";
|
|
77
93
|
import {
|
|
78
|
-
RegexExecutor,
|
|
79
94
|
createBoundedRegexProvider
|
|
80
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-FZE4HW6G.js";
|
|
81
96
|
import {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
CommandRegistry
|
|
98
|
+
} from "./chunk-7R5BDCG7.js";
|
|
99
|
+
import {
|
|
100
|
+
createTreeCommands
|
|
101
|
+
} from "./chunk-55YJASTN.js";
|
|
102
|
+
import {
|
|
103
|
+
createFileCommands
|
|
104
|
+
} from "./chunk-4BSJLKNM.js";
|
|
105
|
+
import {
|
|
106
|
+
createHtmlToMarkdownCommands
|
|
107
|
+
} from "./chunk-DQP3VHSB.js";
|
|
108
|
+
import {
|
|
109
|
+
createDuCommands
|
|
110
|
+
} from "./chunk-GEG3BWGE.js";
|
|
111
|
+
import {
|
|
112
|
+
createMetadataCommands
|
|
113
|
+
} from "./chunk-VSAJ4OTM.js";
|
|
114
|
+
import {
|
|
115
|
+
compareByteArrays,
|
|
116
|
+
decodeBytes,
|
|
117
|
+
encodeBytes,
|
|
118
|
+
indexOfBytes
|
|
119
|
+
} from "./chunk-D3ANYGMC.js";
|
|
101
120
|
import {
|
|
102
121
|
FsError
|
|
103
122
|
} from "./chunk-VTH3MLDU.js";
|
|
@@ -112,8 +131,23 @@ import {
|
|
|
112
131
|
outputFailure
|
|
113
132
|
} from "./chunk-74GHTNJA.js";
|
|
114
133
|
import {
|
|
115
|
-
|
|
116
|
-
} from "./chunk-
|
|
134
|
+
createArchiveCommands
|
|
135
|
+
} from "./chunk-QGUV42T5.js";
|
|
136
|
+
import {
|
|
137
|
+
createTableTextCommands
|
|
138
|
+
} from "./chunk-4D4N7IU2.js";
|
|
139
|
+
import {
|
|
140
|
+
createStreamInspectionCommands
|
|
141
|
+
} from "./chunk-HBCN24ZA.js";
|
|
142
|
+
import {
|
|
143
|
+
createStreamFormatCommands
|
|
144
|
+
} from "./chunk-R3NAKOED.js";
|
|
145
|
+
import {
|
|
146
|
+
createSplitCommands
|
|
147
|
+
} from "./chunk-7ZBU7KYV.js";
|
|
148
|
+
import {
|
|
149
|
+
createTimeEnvCommands
|
|
150
|
+
} from "./chunk-ZVD5IS4V.js";
|
|
117
151
|
import {
|
|
118
152
|
RESOLVED_EXIT_ZERO,
|
|
119
153
|
RETURN_EXIT_ONE,
|
|
@@ -167,11 +201,11 @@ function numfmtCommands(options2 = {}) {
|
|
|
167
201
|
name: "numfmt-commands",
|
|
168
202
|
setup(host) {
|
|
169
203
|
if (!replace) {
|
|
170
|
-
for (const
|
|
171
|
-
if (host.commands.has(
|
|
204
|
+
for (const command of commands) {
|
|
205
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
172
206
|
}
|
|
173
207
|
}
|
|
174
|
-
for (const
|
|
208
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
175
209
|
}
|
|
176
210
|
};
|
|
177
211
|
}
|
|
@@ -255,11 +289,11 @@ function odCommands(options2 = {}) {
|
|
|
255
289
|
name: "od-commands",
|
|
256
290
|
setup(host) {
|
|
257
291
|
if (!replace) {
|
|
258
|
-
for (const
|
|
259
|
-
if (host.commands.has(
|
|
292
|
+
for (const command of commands) {
|
|
293
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
260
294
|
}
|
|
261
295
|
}
|
|
262
|
-
for (const
|
|
296
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
263
297
|
}
|
|
264
298
|
};
|
|
265
299
|
}
|
|
@@ -285,11 +319,11 @@ function xxdCommands(options2 = {}) {
|
|
|
285
319
|
name: "xxd-commands",
|
|
286
320
|
setup(host) {
|
|
287
321
|
if (!replace) {
|
|
288
|
-
for (const
|
|
289
|
-
if (host.commands.has(
|
|
322
|
+
for (const command of commands) {
|
|
323
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
290
324
|
}
|
|
291
325
|
}
|
|
292
|
-
for (const
|
|
326
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
293
327
|
}
|
|
294
328
|
};
|
|
295
329
|
}
|
|
@@ -338,140 +372,13 @@ function byteCommands(options2 = {}) {
|
|
|
338
372
|
};
|
|
339
373
|
}
|
|
340
374
|
|
|
341
|
-
// packages/safe-bash/src/commands/table-text/index.ts
|
|
342
|
-
init_platform();
|
|
343
|
-
|
|
344
|
-
// packages/safe-bash/src/commands/table-text/paste.ts
|
|
345
|
-
init_platform();
|
|
346
|
-
import { createPasteCommand } from "../../safe-bash-command-paste/paste.js";
|
|
347
|
-
|
|
348
|
-
// packages/safe-bash/src/commands/table-text/comm.ts
|
|
349
|
-
init_platform();
|
|
350
|
-
import { createCommCommand } from "../../safe-bash-command-comm/comm.js";
|
|
351
|
-
|
|
352
|
-
// packages/safe-bash/src/commands/table-text/join.ts
|
|
353
|
-
init_platform();
|
|
354
|
-
import { createJoinCommand } from "../../safe-bash-command-join/join.js";
|
|
355
|
-
|
|
356
|
-
// packages/safe-bash/src/commands/table-text/internal.ts
|
|
357
|
-
init_platform();
|
|
358
|
-
import { Budget as Budget2, Inputs, OrderCheck, RecordReader, argument, command, compare, empty, encode, fail, settings as settings2 } from "../../safe-bash-table-text-engine/table-text/internal.js";
|
|
359
|
-
|
|
360
|
-
// packages/safe-bash/src/commands/table-text/index.ts
|
|
361
|
-
function createTableTextCommands(options2 = {}) {
|
|
362
|
-
settings2(options2);
|
|
363
|
-
const defs = [createPasteCommand(options2), createCommCommand(options2), createJoinCommand(options2)];
|
|
364
|
-
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
365
|
-
return defs;
|
|
366
|
-
}
|
|
367
|
-
function tableTextCommands(options2 = {}) {
|
|
368
|
-
const commands = createTableTextCommands(options2);
|
|
369
|
-
return { name: "table-text-commands", setup(host) {
|
|
370
|
-
if (!options2.replace) for (const definition of commands) {
|
|
371
|
-
if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
|
|
372
|
-
}
|
|
373
|
-
for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
|
|
374
|
-
} };
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
378
|
-
init_platform();
|
|
379
|
-
|
|
380
|
-
// packages/safe-bash/src/commands/stream-inspection/tac.ts
|
|
381
|
-
init_platform();
|
|
382
|
-
import { createTacWithSettings } from "../../safe-bash-command-tac/tac.js";
|
|
383
|
-
|
|
384
|
-
// packages/safe-bash/src/commands/stream-inspection/expand.ts
|
|
385
|
-
init_platform();
|
|
386
|
-
import { createExpandWithSettings } from "../../safe-bash-command-expand/expand.js";
|
|
387
|
-
|
|
388
|
-
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
389
|
-
import { createFoldCommand } from "../../safe-bash-command-fold/family.js";
|
|
390
|
-
|
|
391
|
-
// packages/safe-bash/src/commands/stream-inspection/strings.ts
|
|
392
|
-
init_platform();
|
|
393
|
-
import { createStringsWithSettings } from "../../safe-bash-command-strings/strings.js";
|
|
394
|
-
|
|
395
|
-
// packages/safe-bash/src/commands/stream-inspection/shared.ts
|
|
396
|
-
init_platform();
|
|
397
|
-
import { ByteOutput, RecordBuffer, Session, command as command2, settings as settings3 } from "../../safe-bash-text-stream-engine/stream-inspection/shared.js";
|
|
398
|
-
|
|
399
|
-
// packages/safe-bash/src/commands/stream-inspection/index.ts
|
|
400
|
-
function createStreamInspectionCommands(options2 = {}) {
|
|
401
|
-
const limits = settings3(options2);
|
|
402
|
-
const defs = [createTacWithSettings(limits), createExpandWithSettings(limits), createFoldCommand(limits), createStringsWithSettings(limits)];
|
|
403
|
-
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
404
|
-
return defs;
|
|
405
|
-
}
|
|
406
|
-
function streamInspectionCommands(options2 = {}) {
|
|
407
|
-
const commands = createStreamInspectionCommands(options2);
|
|
408
|
-
return { name: "stream-inspection-commands", setup(host) {
|
|
409
|
-
if (!options2.replace) for (const definition of commands) {
|
|
410
|
-
if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
|
|
411
|
-
}
|
|
412
|
-
for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
|
|
413
|
-
} };
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
// packages/safe-bash/src/commands/stream-format/index.ts
|
|
417
|
-
init_platform();
|
|
418
|
-
|
|
419
|
-
// packages/safe-bash/src/commands/stream-format/seq.ts
|
|
420
|
-
init_platform();
|
|
421
|
-
import { createSeqWithSettings } from "../../safe-bash-command-seq/seq.js";
|
|
422
|
-
|
|
423
|
-
// packages/safe-bash/src/commands/stream-format/nl.ts
|
|
424
|
-
init_platform();
|
|
425
|
-
import { createNlWithSettings } from "../../safe-bash-command-nl/nl.js";
|
|
426
|
-
|
|
427
|
-
// packages/safe-bash/src/commands/stream-format/rev.ts
|
|
428
|
-
init_platform();
|
|
429
|
-
import { createRevWithSettings } from "../../safe-bash-command-rev/rev.js";
|
|
430
|
-
|
|
431
|
-
// packages/safe-bash/src/commands/stream-format/unexpand.ts
|
|
432
|
-
init_platform();
|
|
433
|
-
import { createUnexpandWithSettings } from "../../safe-bash-command-unexpand/unexpand.js";
|
|
434
|
-
|
|
435
|
-
// packages/safe-bash/src/commands/stream-format/shared.ts
|
|
436
|
-
init_platform();
|
|
437
|
-
import { ByteOutput as ByteOutput2, Session as Session2, command as command3, forEachRecord, records, settings as settings4 } from "../../safe-bash-text-stream-engine/stream-format/shared.js";
|
|
438
|
-
|
|
439
|
-
// packages/safe-bash/src/commands/stream-format/index.ts
|
|
440
|
-
function createStreamFormatCommands(options2 = {}) {
|
|
441
|
-
const limits = settings4(options2);
|
|
442
|
-
const defs = [createSeqWithSettings(limits), createNlWithSettings(limits), createRevWithSettings(limits), createUnexpandWithSettings(limits)];
|
|
443
|
-
for (let i = 0; i < defs.length; i++) builtInDirectContextExecutors.add(defs[i].execute);
|
|
444
|
-
return defs;
|
|
445
|
-
}
|
|
446
|
-
function streamFormatCommands(options2 = {}) {
|
|
447
|
-
const commands = createStreamFormatCommands(options2);
|
|
448
|
-
return { name: "stream-format-commands", setup(host) {
|
|
449
|
-
if (!options2.replace) for (const definition of commands) {
|
|
450
|
-
if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
|
|
451
|
-
}
|
|
452
|
-
for (const definition of commands) host.commands.register(definition, { replace: options2.replace ?? false });
|
|
453
|
-
} };
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
// packages/safe-bash/src/commands/split/index.ts
|
|
457
|
-
init_platform();
|
|
458
|
-
import { createSplitCommand, createSplitCommands, evalSyncSplit, splitCommands } from "../../safe-bash-command-split/index.js";
|
|
459
|
-
|
|
460
|
-
// packages/safe-bash/src/commands/column/index.ts
|
|
461
|
-
init_platform();
|
|
462
|
-
import { columnCommands, createColumnCommand, createColumnCommands } from "../../safe-bash-command-column/index.js";
|
|
463
|
-
|
|
464
|
-
// packages/safe-bash/src/commands/apply-patch/index.ts
|
|
465
|
-
init_platform();
|
|
466
|
-
import { applyPatchCommands, createApplyPatchCommand, createApplyPatchCommands, evalSyncApplyPatch } from "../../safe-bash-command-apply-patch/index.js";
|
|
467
|
-
|
|
468
375
|
// packages/safe-bash/src/commands/bc/index.ts
|
|
469
376
|
init_platform();
|
|
470
377
|
import {
|
|
471
378
|
createBcCommand as createRawBcCommand,
|
|
472
379
|
createBcCommands as createRawBcCommands
|
|
473
380
|
} from "../../safe-bash-command-bc/index.js";
|
|
474
|
-
import { settings as
|
|
381
|
+
import { settings as settings2 } from "../../safe-bash-command-bc/index.js";
|
|
475
382
|
function createBcCommand(options2 = {}) {
|
|
476
383
|
return registerDefaultExecutor(createRawBcCommand(options2), options2);
|
|
477
384
|
}
|
|
@@ -485,11 +392,11 @@ function bcCommands(options2 = {}) {
|
|
|
485
392
|
name: "bc-commands",
|
|
486
393
|
setup(host) {
|
|
487
394
|
if (!replace) {
|
|
488
|
-
for (const
|
|
489
|
-
if (host.commands.has(
|
|
395
|
+
for (const command of commands) {
|
|
396
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
490
397
|
}
|
|
491
398
|
}
|
|
492
|
-
for (const
|
|
399
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
493
400
|
}
|
|
494
401
|
};
|
|
495
402
|
}
|
|
@@ -500,7 +407,7 @@ import {
|
|
|
500
407
|
createSpongeCommand as createRawSpongeCommand,
|
|
501
408
|
createSpongeCommands as createRawSpongeCommands,
|
|
502
409
|
spongeCommands as rawSpongeCommands,
|
|
503
|
-
settings as
|
|
410
|
+
settings as settings3
|
|
504
411
|
} from "../../safe-bash-command-sponge/index.js";
|
|
505
412
|
function evalSyncSponge(inBytes, opArgs, readFileSync, writeFileSync) {
|
|
506
413
|
let append = false;
|
|
@@ -813,7 +720,7 @@ import {
|
|
|
813
720
|
createOpensslCommand as createRawOpensslCommand,
|
|
814
721
|
createOpensslCommands as createRawOpensslCommands
|
|
815
722
|
} from "../../safe-bash-command-openssl/index.js";
|
|
816
|
-
import { settings as
|
|
723
|
+
import { settings as settings4 } from "../../safe-bash-command-openssl/index.js";
|
|
817
724
|
function isDefaultOpensslOptions(options2) {
|
|
818
725
|
if (!options2) return true;
|
|
819
726
|
return options2.limits === void 0 && options2.maxBufferedBytes === void 0;
|
|
@@ -839,11 +746,11 @@ function opensslCommands(options2 = {}) {
|
|
|
839
746
|
name: "openssl-commands",
|
|
840
747
|
setup(host) {
|
|
841
748
|
if (!replace) {
|
|
842
|
-
for (const
|
|
843
|
-
if (host.commands.has(
|
|
749
|
+
for (const command of commands) {
|
|
750
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
844
751
|
}
|
|
845
752
|
}
|
|
846
|
-
for (const
|
|
753
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
847
754
|
}
|
|
848
755
|
};
|
|
849
756
|
}
|
|
@@ -1402,7 +1309,7 @@ import {
|
|
|
1402
1309
|
createSshKeygenCommand as createRawSshKeygenCommand,
|
|
1403
1310
|
createSshCommands as createRawSshCommands
|
|
1404
1311
|
} from "../../safe-bash-command-ssh/index.js";
|
|
1405
|
-
import { settings as
|
|
1312
|
+
import { settings as settings5 } from "../../safe-bash-command-ssh/index.js";
|
|
1406
1313
|
var ED25519_P = 2n ** 255n - 19n;
|
|
1407
1314
|
var ED25519_L = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
1408
1315
|
var edMod = (a, m = ED25519_P) => (a % m + m) % m;
|
|
@@ -1542,11 +1449,11 @@ function sshCommands(options2 = {}) {
|
|
|
1542
1449
|
name: "ssh-commands",
|
|
1543
1450
|
setup(host) {
|
|
1544
1451
|
if (!replace) {
|
|
1545
|
-
for (const
|
|
1546
|
-
if (host.commands.has(
|
|
1452
|
+
for (const command of commands) {
|
|
1453
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
1547
1454
|
}
|
|
1548
1455
|
}
|
|
1549
|
-
for (const
|
|
1456
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
1550
1457
|
}
|
|
1551
1458
|
};
|
|
1552
1459
|
}
|
|
@@ -1897,7 +1804,7 @@ import {
|
|
|
1897
1804
|
createGpgCommand as createRawGpgCommand,
|
|
1898
1805
|
createGpgCommands as createRawGpgCommands
|
|
1899
1806
|
} from "../../safe-bash-command-gpg/index.js";
|
|
1900
|
-
import { settings as
|
|
1807
|
+
import { settings as settings6 } from "../../safe-bash-command-gpg/index.js";
|
|
1901
1808
|
var ED25519_P2 = 2n ** 255n - 19n;
|
|
1902
1809
|
var ED25519_L2 = 2n ** 252n + 27742317777372353535851937790883648493n;
|
|
1903
1810
|
var edMod2 = (a, m = ED25519_P2) => (a % m + m) % m;
|
|
@@ -2006,11 +1913,11 @@ function gpgCommands(options2 = {}) {
|
|
|
2006
1913
|
name: "gpg-commands",
|
|
2007
1914
|
setup(host) {
|
|
2008
1915
|
if (!replace) {
|
|
2009
|
-
for (const
|
|
2010
|
-
if (host.commands.has(
|
|
1916
|
+
for (const command of commands) {
|
|
1917
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2011
1918
|
}
|
|
2012
1919
|
}
|
|
2013
|
-
for (const
|
|
1920
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2014
1921
|
}
|
|
2015
1922
|
};
|
|
2016
1923
|
}
|
|
@@ -2199,7 +2106,7 @@ import {
|
|
|
2199
2106
|
createIdCommand as createRawIdCommand,
|
|
2200
2107
|
createIdCommands as createRawIdCommands
|
|
2201
2108
|
} from "../../safe-bash-command-id/index.js";
|
|
2202
|
-
import { settings as
|
|
2109
|
+
import { settings as settings7 } from "../../safe-bash-command-id/index.js";
|
|
2203
2110
|
function createIdCommand(options2 = {}) {
|
|
2204
2111
|
return registerDefaultExecutor(createRawIdCommand(options2), options2);
|
|
2205
2112
|
}
|
|
@@ -2213,11 +2120,11 @@ function idCommands(options2 = {}) {
|
|
|
2213
2120
|
name: "id-commands",
|
|
2214
2121
|
setup(host) {
|
|
2215
2122
|
if (!replace) {
|
|
2216
|
-
for (const
|
|
2217
|
-
if (host.commands.has(
|
|
2123
|
+
for (const command of commands) {
|
|
2124
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2218
2125
|
}
|
|
2219
2126
|
}
|
|
2220
|
-
for (const
|
|
2127
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2221
2128
|
}
|
|
2222
2129
|
};
|
|
2223
2130
|
}
|
|
@@ -2228,7 +2135,7 @@ import {
|
|
|
2228
2135
|
createWhoamiCommand as createRawWhoamiCommand,
|
|
2229
2136
|
createWhoamiCommands as createRawWhoamiCommands
|
|
2230
2137
|
} from "../../safe-bash-command-whoami/index.js";
|
|
2231
|
-
import { settings as
|
|
2138
|
+
import { settings as settings8 } from "../../safe-bash-command-whoami/index.js";
|
|
2232
2139
|
function createWhoamiCommand(options2 = {}) {
|
|
2233
2140
|
return registerDefaultExecutor(createRawWhoamiCommand(options2), options2);
|
|
2234
2141
|
}
|
|
@@ -2242,11 +2149,11 @@ function whoamiCommands(options2 = {}) {
|
|
|
2242
2149
|
name: "whoami-commands",
|
|
2243
2150
|
setup(host) {
|
|
2244
2151
|
if (!replace) {
|
|
2245
|
-
for (const
|
|
2246
|
-
if (host.commands.has(
|
|
2152
|
+
for (const command of commands) {
|
|
2153
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2247
2154
|
}
|
|
2248
2155
|
}
|
|
2249
|
-
for (const
|
|
2156
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2250
2157
|
}
|
|
2251
2158
|
};
|
|
2252
2159
|
}
|
|
@@ -2257,7 +2164,7 @@ import {
|
|
|
2257
2164
|
createUnameCommand as createRawUnameCommand,
|
|
2258
2165
|
createUnameCommands as createRawUnameCommands
|
|
2259
2166
|
} from "../../safe-bash-command-uname/index.js";
|
|
2260
|
-
import { settings as
|
|
2167
|
+
import { settings as settings9 } from "../../safe-bash-command-uname/index.js";
|
|
2261
2168
|
function createUnameCommand(options2 = {}) {
|
|
2262
2169
|
return registerDefaultExecutor(createRawUnameCommand(options2), options2);
|
|
2263
2170
|
}
|
|
@@ -2271,11 +2178,11 @@ function unameCommands(options2 = {}) {
|
|
|
2271
2178
|
name: "uname-commands",
|
|
2272
2179
|
setup(host) {
|
|
2273
2180
|
if (!replace) {
|
|
2274
|
-
for (const
|
|
2275
|
-
if (host.commands.has(
|
|
2181
|
+
for (const command of commands) {
|
|
2182
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2276
2183
|
}
|
|
2277
2184
|
}
|
|
2278
|
-
for (const
|
|
2185
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2279
2186
|
}
|
|
2280
2187
|
};
|
|
2281
2188
|
}
|
|
@@ -2286,7 +2193,7 @@ import {
|
|
|
2286
2193
|
createHostnameCommand as createRawHostnameCommand,
|
|
2287
2194
|
createHostnameCommands as createRawHostnameCommands
|
|
2288
2195
|
} from "../../safe-bash-command-hostname/index.js";
|
|
2289
|
-
import { settings as
|
|
2196
|
+
import { settings as settings10 } from "../../safe-bash-command-hostname/index.js";
|
|
2290
2197
|
function createHostnameCommand(options2 = {}) {
|
|
2291
2198
|
return registerDefaultExecutor(createRawHostnameCommand(options2), options2);
|
|
2292
2199
|
}
|
|
@@ -2300,11 +2207,11 @@ function hostnameCommands(options2 = {}) {
|
|
|
2300
2207
|
name: "hostname-commands",
|
|
2301
2208
|
setup(host) {
|
|
2302
2209
|
if (!replace) {
|
|
2303
|
-
for (const
|
|
2304
|
-
if (host.commands.has(
|
|
2210
|
+
for (const command of commands) {
|
|
2211
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2305
2212
|
}
|
|
2306
2213
|
}
|
|
2307
|
-
for (const
|
|
2214
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2308
2215
|
}
|
|
2309
2216
|
};
|
|
2310
2217
|
}
|
|
@@ -2315,7 +2222,7 @@ import {
|
|
|
2315
2222
|
createNprocCommand as createRawNprocCommand,
|
|
2316
2223
|
createNprocCommands as createRawNprocCommands
|
|
2317
2224
|
} from "../../safe-bash-command-nproc/index.js";
|
|
2318
|
-
import { settings as
|
|
2225
|
+
import { settings as settings11 } from "../../safe-bash-command-nproc/index.js";
|
|
2319
2226
|
function createNprocCommand(options2 = {}) {
|
|
2320
2227
|
return registerDefaultExecutor(createRawNprocCommand(options2), options2);
|
|
2321
2228
|
}
|
|
@@ -2329,11 +2236,11 @@ function nprocCommands(options2 = {}) {
|
|
|
2329
2236
|
name: "nproc-commands",
|
|
2330
2237
|
setup(host) {
|
|
2331
2238
|
if (!replace) {
|
|
2332
|
-
for (const
|
|
2333
|
-
if (host.commands.has(
|
|
2239
|
+
for (const command of commands) {
|
|
2240
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2334
2241
|
}
|
|
2335
2242
|
}
|
|
2336
|
-
for (const
|
|
2243
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2337
2244
|
}
|
|
2338
2245
|
};
|
|
2339
2246
|
}
|
|
@@ -2344,7 +2251,7 @@ import { createShufCommand, createShufCommands, shufCommands } from "../../safe-
|
|
|
2344
2251
|
|
|
2345
2252
|
// packages/safe-bash/src/yes.ts
|
|
2346
2253
|
init_platform();
|
|
2347
|
-
import { settings as
|
|
2254
|
+
import { settings as settings12 } from "../../safe-bash-command-yes/index.js";
|
|
2348
2255
|
import { createYesCommand, createYesCommands, yesCommands } from "../../safe-bash-command-yes/index.js";
|
|
2349
2256
|
|
|
2350
2257
|
// packages/safe-bash/src/dd.ts
|
|
@@ -2353,7 +2260,7 @@ import {
|
|
|
2353
2260
|
createDdCommand as createRawDdCommand,
|
|
2354
2261
|
createDdCommands as createRawDdCommands
|
|
2355
2262
|
} from "../../safe-bash-command-dd/index.js";
|
|
2356
|
-
import { evalSyncDd, openDdFile, settings as
|
|
2263
|
+
import { evalSyncDd, openDdFile, settings as settings13, transferReport } from "../../safe-bash-command-dd/index.js";
|
|
2357
2264
|
function createDdCommand(options2 = {}) {
|
|
2358
2265
|
return registerDefaultExecutor(createRawDdCommand(options2), options2);
|
|
2359
2266
|
}
|
|
@@ -2367,11 +2274,11 @@ function ddCommands(options2 = {}) {
|
|
|
2367
2274
|
name: "dd-commands",
|
|
2368
2275
|
setup(host) {
|
|
2369
2276
|
if (!replace) {
|
|
2370
|
-
for (const
|
|
2371
|
-
if (host.commands.has(
|
|
2277
|
+
for (const command of commands) {
|
|
2278
|
+
if (host.commands.has(command.name)) throw new Error(`Command already registered: ${command.name}`);
|
|
2372
2279
|
}
|
|
2373
2280
|
}
|
|
2374
|
-
for (const
|
|
2281
|
+
for (const command of commands) host.commands.register(command, { replace });
|
|
2375
2282
|
}
|
|
2376
2283
|
};
|
|
2377
2284
|
}
|
|
@@ -2383,7 +2290,7 @@ import {
|
|
|
2383
2290
|
createEnvsubstCommands as createRawEnvsubstCommands,
|
|
2384
2291
|
envsubstCommands as rawEnvsubstCommands
|
|
2385
2292
|
} from "../../safe-bash-command-envsubst/index.js";
|
|
2386
|
-
import { settings as
|
|
2293
|
+
import { settings as settings15 } from "../../safe-bash-command-envsubst/index.js";
|
|
2387
2294
|
function createEnvsubstCommand(options2 = {}) {
|
|
2388
2295
|
const def = createRawEnvsubstCommand(options2);
|
|
2389
2296
|
builtInDirectContextExecutors.add(def.execute);
|
|
@@ -2405,7 +2312,7 @@ import {
|
|
|
2405
2312
|
createGetconfCommand as createRawGetconfCommand,
|
|
2406
2313
|
createGetconfCommands as createRawGetconfCommands
|
|
2407
2314
|
} from "../../safe-bash-command-getconf/index.js";
|
|
2408
|
-
import { settings as
|
|
2315
|
+
import { settings as settings16 } from "../../safe-bash-command-getconf/index.js";
|
|
2409
2316
|
function isDefaultGetconfOptions(options2) {
|
|
2410
2317
|
return options2?.processors === void 0 && options2?.variables === void 0 && options2?.limits === void 0;
|
|
2411
2318
|
}
|
|
@@ -2427,14 +2334,14 @@ function getconfCommands(options2 = {}) {
|
|
|
2427
2334
|
name: "getconf-commands",
|
|
2428
2335
|
setup(host) {
|
|
2429
2336
|
if (!options2.replace) {
|
|
2430
|
-
for (const
|
|
2431
|
-
if (host.commands.has(
|
|
2432
|
-
throw new Error(`Command already registered: ${
|
|
2337
|
+
for (const command of commands) {
|
|
2338
|
+
if (host.commands.has(command.name)) {
|
|
2339
|
+
throw new Error(`Command already registered: ${command.name}`);
|
|
2433
2340
|
}
|
|
2434
2341
|
}
|
|
2435
2342
|
}
|
|
2436
|
-
for (const
|
|
2437
|
-
host.commands.register(
|
|
2343
|
+
for (const command of commands) {
|
|
2344
|
+
host.commands.register(command, { replace: options2.replace ?? false });
|
|
2438
2345
|
}
|
|
2439
2346
|
}
|
|
2440
2347
|
};
|
|
@@ -2446,7 +2353,7 @@ import {
|
|
|
2446
2353
|
createLocaleCommand as createRawLocaleCommand,
|
|
2447
2354
|
createLocaleCommands as createRawLocaleCommands
|
|
2448
2355
|
} from "../../safe-bash-command-locale/index.js";
|
|
2449
|
-
import { settings as
|
|
2356
|
+
import { settings as settings17 } from "../../safe-bash-command-locale/index.js";
|
|
2450
2357
|
function isDefaultLocaleOptions(options2) {
|
|
2451
2358
|
return options2?.locales === void 0 && options2?.charmaps === void 0 && options2?.defaultLocale === void 0 && options2?.limits === void 0;
|
|
2452
2359
|
}
|
|
@@ -2468,14 +2375,14 @@ function localeCommands(options2 = {}) {
|
|
|
2468
2375
|
name: "locale-commands",
|
|
2469
2376
|
setup(host) {
|
|
2470
2377
|
if (!options2.replace) {
|
|
2471
|
-
for (const
|
|
2472
|
-
if (host.commands.has(
|
|
2473
|
-
throw new Error(`Command already registered: ${
|
|
2378
|
+
for (const command of commands) {
|
|
2379
|
+
if (host.commands.has(command.name)) {
|
|
2380
|
+
throw new Error(`Command already registered: ${command.name}`);
|
|
2474
2381
|
}
|
|
2475
2382
|
}
|
|
2476
2383
|
}
|
|
2477
|
-
for (const
|
|
2478
|
-
host.commands.register(
|
|
2384
|
+
for (const command of commands) {
|
|
2385
|
+
host.commands.register(command, { replace: options2.replace ?? false });
|
|
2479
2386
|
}
|
|
2480
2387
|
}
|
|
2481
2388
|
};
|
|
@@ -2488,7 +2395,7 @@ import {
|
|
|
2488
2395
|
createSqlite3Commands as createRawSqlite3Commands,
|
|
2489
2396
|
evalSyncSqlite3
|
|
2490
2397
|
} from "../../safe-bash-command-sqlite3/index.js";
|
|
2491
|
-
import { evalSyncSqlite3 as evalSyncSqlite32, settings as
|
|
2398
|
+
import { evalSyncSqlite3 as evalSyncSqlite32, settings as settings18 } from "../../safe-bash-command-sqlite3/index.js";
|
|
2492
2399
|
function isDefaultSqlite3Options(options2) {
|
|
2493
2400
|
if (!options2) return true;
|
|
2494
2401
|
return options2.limits === void 0 && options2.engine === void 0;
|
|
@@ -2513,14 +2420,14 @@ function sqlite3Commands(options2 = {}) {
|
|
|
2513
2420
|
name: "sqlite3-commands",
|
|
2514
2421
|
setup(host) {
|
|
2515
2422
|
if (!options2.replace) {
|
|
2516
|
-
for (const
|
|
2517
|
-
if (host.commands.has(
|
|
2518
|
-
throw new Error(`Command already registered: ${
|
|
2423
|
+
for (const command of commands) {
|
|
2424
|
+
if (host.commands.has(command.name)) {
|
|
2425
|
+
throw new Error(`Command already registered: ${command.name}`);
|
|
2519
2426
|
}
|
|
2520
2427
|
}
|
|
2521
2428
|
}
|
|
2522
|
-
for (const
|
|
2523
|
-
host.commands.register(
|
|
2429
|
+
for (const command of commands) {
|
|
2430
|
+
host.commands.register(command, { replace: options2.replace ?? false });
|
|
2524
2431
|
}
|
|
2525
2432
|
}
|
|
2526
2433
|
};
|
|
@@ -2558,56 +2465,56 @@ function parseTailFollow(arguments_) {
|
|
|
2558
2465
|
};
|
|
2559
2466
|
let ended = false;
|
|
2560
2467
|
for (let index = 0; index < arguments_.length; index++) {
|
|
2561
|
-
const
|
|
2562
|
-
if (ended ||
|
|
2563
|
-
args.push(
|
|
2468
|
+
const argument = arguments_[index];
|
|
2469
|
+
if (ended || argument === "-" || !argument.startsWith("-")) {
|
|
2470
|
+
args.push(argument);
|
|
2564
2471
|
continue;
|
|
2565
2472
|
}
|
|
2566
|
-
if (
|
|
2473
|
+
if (argument === "--") {
|
|
2567
2474
|
ended = true;
|
|
2568
|
-
args.push(
|
|
2475
|
+
args.push(argument);
|
|
2569
2476
|
continue;
|
|
2570
2477
|
}
|
|
2571
|
-
if (
|
|
2572
|
-
const method =
|
|
2478
|
+
if (argument === "--follow" || argument.startsWith("--follow=")) {
|
|
2479
|
+
const method = argument === "--follow" ? "descriptor" : argument.slice(9);
|
|
2573
2480
|
if (method !== "descriptor" && method !== "name") throw new UsageError(`invalid argument '${method}' for 'follow'`);
|
|
2574
2481
|
mode = method === "name" ? "F" : "f";
|
|
2575
2482
|
if (method === "descriptor") retry = explicitRetry;
|
|
2576
|
-
} else if (
|
|
2483
|
+
} else if (argument === "--retry") {
|
|
2577
2484
|
retry = true;
|
|
2578
2485
|
explicitRetry = true;
|
|
2579
|
-
} else if (
|
|
2580
|
-
sleepMs = sleep(
|
|
2581
|
-
} else if (
|
|
2582
|
-
const text =
|
|
2486
|
+
} else if (argument === "--sleep-interval" || argument.startsWith("--sleep-interval=")) {
|
|
2487
|
+
sleepMs = sleep(argument === "--sleep-interval" ? arguments_[++index] : argument.slice(17));
|
|
2488
|
+
} else if (argument === "--max-unchanged-stats" || argument.startsWith("--max-unchanged-stats=")) {
|
|
2489
|
+
const text = argument === "--max-unchanged-stats" ? arguments_[++index] : argument.slice(22);
|
|
2583
2490
|
if (!text || [...text].some((digit) => digit < "0" || digit > "9") || !Number.isSafeInteger(Number(text))) throw new UsageError(`invalid maximum number of unchanged stats: '${text ?? ""}'`);
|
|
2584
2491
|
maxUnchangedStats = Number(text);
|
|
2585
|
-
} else if (
|
|
2586
|
-
const text =
|
|
2492
|
+
} else if (argument === "--max-idle" || argument.startsWith("--max-idle=")) {
|
|
2493
|
+
const text = argument === "--max-idle" ? arguments_[++index] : argument.slice(11);
|
|
2587
2494
|
if (text === void 0 || !/^(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)$/u.test(text)) throw new UsageError("max-idle must be nonnegative decimal seconds");
|
|
2588
2495
|
const [whole = "", fraction = ""] = text.split(".");
|
|
2589
2496
|
if (fraction.slice(3).split("").some((digit) => digit !== "0")) throw new UsageError("max-idle must resolve to integer milliseconds");
|
|
2590
2497
|
const milliseconds = BigInt(whole || "0") * 1000n + BigInt(fraction.slice(0, 3).padEnd(3, "0"));
|
|
2591
2498
|
if (milliseconds > BigInt(Number.MAX_SAFE_INTEGER)) throw new UsageError("max-idle exceeds safe milliseconds");
|
|
2592
2499
|
idleMs = Number(milliseconds);
|
|
2593
|
-
} else if (
|
|
2594
|
-
args.push(
|
|
2595
|
-
if ((
|
|
2500
|
+
} else if (argument.startsWith("--")) {
|
|
2501
|
+
args.push(argument);
|
|
2502
|
+
if ((argument === "--lines" || argument === "--bytes") && index + 1 < arguments_.length) args.push(arguments_[++index]);
|
|
2596
2503
|
} else {
|
|
2597
2504
|
let kept = "-";
|
|
2598
|
-
for (let offset = 1; offset <
|
|
2599
|
-
const flag =
|
|
2505
|
+
for (let offset = 1; offset < argument.length; offset++) {
|
|
2506
|
+
const flag = argument[offset];
|
|
2600
2507
|
if (flag === "f" || flag === "F") {
|
|
2601
2508
|
mode = flag;
|
|
2602
2509
|
retry = flag === "F" || explicitRetry;
|
|
2603
2510
|
} else if (flag === "s") {
|
|
2604
|
-
sleepMs = sleep(offset + 1 ===
|
|
2511
|
+
sleepMs = sleep(offset + 1 === argument.length ? arguments_[++index] : argument.slice(offset + 1));
|
|
2605
2512
|
break;
|
|
2606
2513
|
} else {
|
|
2607
2514
|
kept += flag;
|
|
2608
2515
|
if (flag === "n" || flag === "c") {
|
|
2609
|
-
kept +=
|
|
2610
|
-
if (offset + 1 ===
|
|
2516
|
+
kept += argument.slice(offset + 1);
|
|
2517
|
+
if (offset + 1 === argument.length && index + 1 < arguments_.length) {
|
|
2611
2518
|
args.push(kept, arguments_[++index]);
|
|
2612
2519
|
kept = "-";
|
|
2613
2520
|
}
|
|
@@ -3003,7 +2910,7 @@ async function followTail(caller, selection, cap, select, scheduler = tailFollow
|
|
|
3003
2910
|
|
|
3004
2911
|
// packages/safe-bash/src/commands/record-buffer.ts
|
|
3005
2912
|
init_platform();
|
|
3006
|
-
import { RecordBuffer
|
|
2913
|
+
import { RecordBuffer } from "../../safe-bash-io-engine/record-buffer.js";
|
|
3007
2914
|
|
|
3008
2915
|
// packages/safe-bash/src/commands/streams.ts
|
|
3009
2916
|
var SMALL_WC_COUNT_LINES = Array.from({ length: 129 }, (_, i) => `${i}
|
|
@@ -3351,7 +3258,7 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
3351
3258
|
let pendingLines = [];
|
|
3352
3259
|
let start2 = 0;
|
|
3353
3260
|
let size2 = 0;
|
|
3354
|
-
const pending2 = new
|
|
3261
|
+
const pending2 = new RecordBuffer(bufferLimit);
|
|
3355
3262
|
const pushLine = (lineBytes, terminated) => {
|
|
3356
3263
|
const lineLength = lineBytes.length + (terminated ? 1 : 0);
|
|
3357
3264
|
pendingLines.push({ bytes: lineBytes, terminated });
|
|
@@ -3409,14 +3316,14 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
3409
3316
|
const needed = line.bytes.length + (line.terminated ? 1 : 0);
|
|
3410
3317
|
if (needed > batch.length) {
|
|
3411
3318
|
if (batchUsed > 0) {
|
|
3412
|
-
await
|
|
3319
|
+
await outputRange(context, batch, batchUsed);
|
|
3413
3320
|
batchUsed = 0;
|
|
3414
3321
|
}
|
|
3415
3322
|
await output(context, line.terminated ? concatenate([line.bytes, delimiterByte]) : line.bytes);
|
|
3416
3323
|
continue;
|
|
3417
3324
|
}
|
|
3418
3325
|
if (batchUsed + needed > batch.length) {
|
|
3419
|
-
await
|
|
3326
|
+
await outputRange(context, batch, batchUsed);
|
|
3420
3327
|
batchUsed = 0;
|
|
3421
3328
|
}
|
|
3422
3329
|
batch.set(line.bytes, batchUsed);
|
|
@@ -3424,7 +3331,7 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
3424
3331
|
if (line.terminated) batch[batchUsed++] = delimiter;
|
|
3425
3332
|
}
|
|
3426
3333
|
if (batchUsed > 0) {
|
|
3427
|
-
await
|
|
3334
|
+
await outputRange(context, batch, batchUsed);
|
|
3428
3335
|
}
|
|
3429
3336
|
}
|
|
3430
3337
|
return;
|
|
@@ -3435,10 +3342,10 @@ async function suffix(context, source, count, bytes, omit, delimiter) {
|
|
|
3435
3342
|
let pending = [];
|
|
3436
3343
|
let start = 0;
|
|
3437
3344
|
let size = 0;
|
|
3438
|
-
const
|
|
3345
|
+
const records = bytes ? source : (async function* () {
|
|
3439
3346
|
for await (const line of lines(source, delimiter)) yield line.terminated ? concatenate([line.bytes, Uint8Array.of(delimiter)]) : line.bytes;
|
|
3440
3347
|
})();
|
|
3441
|
-
for await (const chunk of
|
|
3348
|
+
for await (const chunk of records) {
|
|
3442
3349
|
context.signal.throwIfAborted();
|
|
3443
3350
|
if (bytes && !chunk.length) continue;
|
|
3444
3351
|
pending.push(new Uint8Array(chunk));
|
|
@@ -3514,12 +3421,12 @@ function headTailArguments(name, arguments_) {
|
|
|
3514
3421
|
const args = [];
|
|
3515
3422
|
let ended = false;
|
|
3516
3423
|
for (let index = 0; index < arguments_.length; index++) {
|
|
3517
|
-
const
|
|
3518
|
-
if (
|
|
3424
|
+
const argument = arguments_[index];
|
|
3425
|
+
if (argument === "--") ended = true;
|
|
3519
3426
|
let offset = 1;
|
|
3520
|
-
while (offset <
|
|
3521
|
-
if (!ended && (
|
|
3522
|
-
const remainder =
|
|
3427
|
+
while (offset < argument.length && argument[offset] >= "0" && argument[offset] <= "9") offset++;
|
|
3428
|
+
if (!ended && (argument[0] === "-" || name === "tail" && index === 0 && argument[0] === "+") && offset > 1) {
|
|
3429
|
+
const remainder = argument.slice(offset);
|
|
3523
3430
|
let unitFlag = "-n";
|
|
3524
3431
|
let unitSuffix = "";
|
|
3525
3432
|
let rest = remainder;
|
|
@@ -3544,13 +3451,13 @@ function headTailArguments(name, arguments_) {
|
|
|
3544
3451
|
}
|
|
3545
3452
|
const allowedFlags = name === "tail" ? "qvzfF" : "qvz";
|
|
3546
3453
|
if (Array.from(rest).every((ch) => allowedFlags.includes(ch))) {
|
|
3547
|
-
args.push(unitFlag, `${
|
|
3454
|
+
args.push(unitFlag, `${argument[0] === "+" ? "+" : ""}${argument.slice(1, offset)}${unitSuffix}`);
|
|
3548
3455
|
for (const ch of rest) args.push(`-${ch}`);
|
|
3549
3456
|
continue;
|
|
3550
3457
|
}
|
|
3551
3458
|
}
|
|
3552
|
-
args.push(
|
|
3553
|
-
if (!ended && (["--lines", "--bytes", "--max-idle", "--sleep-interval", "--max-unchanged-stats"].includes(
|
|
3459
|
+
args.push(argument);
|
|
3460
|
+
if (!ended && (["--lines", "--bytes", "--max-idle", "--sleep-interval", "--max-unchanged-stats"].includes(argument) || argument.startsWith("-") && !argument.startsWith("--") && (argument.endsWith("n") || argument.endsWith("c") || argument.endsWith("s")))) {
|
|
3554
3461
|
if (arguments_[index + 1] !== void 0) args.push(arguments_[++index]);
|
|
3555
3462
|
}
|
|
3556
3463
|
}
|
|
@@ -3825,12 +3732,12 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
|
|
|
3825
3732
|
define("tee", async (context) => {
|
|
3826
3733
|
const args = [];
|
|
3827
3734
|
let ended = false;
|
|
3828
|
-
for (const
|
|
3829
|
-
if (
|
|
3830
|
-
if (!ended &&
|
|
3831
|
-
else if (!ended &&
|
|
3832
|
-
for (const flag of
|
|
3833
|
-
} else args.push(
|
|
3735
|
+
for (const argument of context.args) {
|
|
3736
|
+
if (argument === "--") ended = true;
|
|
3737
|
+
if (!ended && argument === "--output-error") args.push("--output-error=warn-nopipe");
|
|
3738
|
+
else if (!ended && argument.startsWith("-") && !argument.startsWith("--") && argument.includes("p")) {
|
|
3739
|
+
for (const flag of argument.slice(1)) args.push(flag === "p" ? "--output-error=warn-nopipe" : `-${flag}`);
|
|
3740
|
+
} else args.push(argument);
|
|
3834
3741
|
}
|
|
3835
3742
|
const parsed = options(args, "ai", { append: "a", "ignore-interrupts": "i", "output-error": "output-error:" });
|
|
3836
3743
|
const errorMode = value(parsed, "output-error");
|
|
@@ -3958,7 +3865,7 @@ function streamCommands(maxTeeTargets = Infinity, maxTailFollowHandles = Infinit
|
|
|
3958
3865
|
}
|
|
3959
3866
|
return executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezed, previous, false);
|
|
3960
3867
|
})
|
|
3961
|
-
].map((
|
|
3868
|
+
].map((command) => ({ ...command, filesystemRequirements: streamRequirements[command.name] }));
|
|
3962
3869
|
}
|
|
3963
3870
|
async function executeTrAsync(context, iter, deleting, squeezing, mapping, removed, squeezingTable, initialPrevious, alreadyOwnsShared) {
|
|
3964
3871
|
const squeezed = squeezingTable;
|
|
@@ -3982,7 +3889,7 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
|
|
|
3982
3889
|
const buf = useShared ? sharedTrOutBuffer : new Uint8Array(chunk.length);
|
|
3983
3890
|
if (!deleting && !squeezing) {
|
|
3984
3891
|
for (let index = 0; index < chunk.length; index++) buf[index] = mapping[chunk[index]];
|
|
3985
|
-
const p =
|
|
3892
|
+
const p = useShared ? outputRange(context, buf, chunk.length) : output(context, buf);
|
|
3986
3893
|
if (!isSyncResolved(p)) await p;
|
|
3987
3894
|
continue;
|
|
3988
3895
|
}
|
|
@@ -3996,7 +3903,7 @@ async function executeTrAsync(context, iter, deleting, squeezing, mapping, remov
|
|
|
3996
3903
|
previous = translated;
|
|
3997
3904
|
}
|
|
3998
3905
|
if (count) {
|
|
3999
|
-
const p =
|
|
3906
|
+
const p = outputRange(context, buf, count);
|
|
4000
3907
|
if (!isSyncResolved(p)) await p;
|
|
4001
3908
|
}
|
|
4002
3909
|
}
|
|
@@ -4485,14 +4392,14 @@ var SortWork = class {
|
|
|
4485
4392
|
}
|
|
4486
4393
|
}
|
|
4487
4394
|
};
|
|
4488
|
-
async function sortRecords(
|
|
4489
|
-
if (
|
|
4490
|
-
let source =
|
|
4491
|
-
let target = new Array(
|
|
4492
|
-
for (let width = 1; width <
|
|
4493
|
-
for (let begin = 0; begin <
|
|
4494
|
-
const middle = Math.min(begin + width,
|
|
4495
|
-
const end = Math.min(begin + width * 2,
|
|
4395
|
+
async function sortRecords(records, compare, work) {
|
|
4396
|
+
if (records.length < 2) return records;
|
|
4397
|
+
let source = records;
|
|
4398
|
+
let target = new Array(records.length);
|
|
4399
|
+
for (let width = 1; width < records.length; width *= 2) {
|
|
4400
|
+
for (let begin = 0; begin < records.length; begin += width * 2) {
|
|
4401
|
+
const middle = Math.min(begin + width, records.length);
|
|
4402
|
+
const end = Math.min(begin + width * 2, records.length);
|
|
4496
4403
|
let left = begin;
|
|
4497
4404
|
let right = middle;
|
|
4498
4405
|
for (let index = begin; index < end; index++) {
|
|
@@ -4503,7 +4410,7 @@ async function sortRecords(records2, compare2, work) {
|
|
|
4503
4410
|
target[index] = source[left++];
|
|
4504
4411
|
continue;
|
|
4505
4412
|
}
|
|
4506
|
-
const compared =
|
|
4413
|
+
const compared = compare(source[left], source[right]);
|
|
4507
4414
|
const order = typeof compared === "number" ? compared : await compared;
|
|
4508
4415
|
if (order <= 0) {
|
|
4509
4416
|
target[index] = source[left++];
|
|
@@ -5019,7 +4926,7 @@ async function compareVersions(left, right, work) {
|
|
|
5019
4926
|
if (result) return result;
|
|
5020
4927
|
return await compareVersionParts(await versionPrefix(left, work), await versionPrefix(right, work), work) || await compareVersionParts(left, right, work);
|
|
5021
4928
|
}
|
|
5022
|
-
async function mergeSortRuns(runs,
|
|
4929
|
+
async function mergeSortRuns(runs, compare, work) {
|
|
5023
4930
|
while (runs.length > 1) {
|
|
5024
4931
|
const next = [];
|
|
5025
4932
|
for (let index = 0; index < runs.length; index += 2) {
|
|
@@ -5034,7 +4941,7 @@ async function mergeSortRuns(runs, compare2, work) {
|
|
|
5034
4941
|
merged.push(left[first++]);
|
|
5035
4942
|
continue;
|
|
5036
4943
|
}
|
|
5037
|
-
const compared =
|
|
4944
|
+
const compared = compare(left[first], right[second]);
|
|
5038
4945
|
const order = typeof compared === "number" ? compared : await compared;
|
|
5039
4946
|
if (order <= 0) {
|
|
5040
4947
|
merged.push(left[first++]);
|
|
@@ -5321,11 +5228,11 @@ async function keyBytes(line, key, separator, blanks, work) {
|
|
|
5321
5228
|
const end = key.end === void 0 ? line.length : last === void 0 ? line.length : key.endCharacter === void 0 ? last.end : Math.min(line.length, await fieldStart(last, key.endBlanks || inheritBlanks) + key.endCharacter);
|
|
5322
5229
|
return line.subarray(Math.min(start, line.length), Math.max(start, end));
|
|
5323
5230
|
}
|
|
5324
|
-
async function emitRecords(context,
|
|
5231
|
+
async function emitRecords(context, records, destination) {
|
|
5325
5232
|
if (destination === void 0) {
|
|
5326
5233
|
const buffered = createBufferedOutput(context.stdout, context.signal);
|
|
5327
5234
|
try {
|
|
5328
|
-
for await (const bytes of
|
|
5235
|
+
for await (const bytes of records) {
|
|
5329
5236
|
await buffered.write(bytes);
|
|
5330
5237
|
await buffered.flush();
|
|
5331
5238
|
}
|
|
@@ -5336,12 +5243,12 @@ async function emitRecords(context, records2, destination) {
|
|
|
5336
5243
|
}
|
|
5337
5244
|
await admitTextOutput(context, destination);
|
|
5338
5245
|
const capabilities = await context.fs.capabilitiesFor?.(pathOf(context, destination), { signal: context.signal }) ?? context.fs.capabilities;
|
|
5339
|
-
if (context.fs.writeStream && capabilities.streamingWrite !== false) await context.fs.writeStream(pathOf(context, destination),
|
|
5246
|
+
if (context.fs.writeStream && capabilities.streamingWrite !== false) await context.fs.writeStream(pathOf(context, destination), records, { signal: context.signal });
|
|
5340
5247
|
else {
|
|
5341
5248
|
if (capabilities.write === false) throw new FsError("ENOTSUP", { syscall: "writeFile", path: pathOf(context, destination) });
|
|
5342
5249
|
let size = 0;
|
|
5343
5250
|
const chunks = [];
|
|
5344
|
-
for await (const bytes of
|
|
5251
|
+
for await (const bytes of records) {
|
|
5345
5252
|
size += bytes.length;
|
|
5346
5253
|
if (size > bufferLimit) throw new FsError("EFBIG", { message: "output buffer limit exceeded" });
|
|
5347
5254
|
chunks.push(bytes);
|
|
@@ -5350,7 +5257,7 @@ async function emitRecords(context, records2, destination) {
|
|
|
5350
5257
|
}
|
|
5351
5258
|
}
|
|
5352
5259
|
async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
5353
|
-
const buffered = new
|
|
5260
|
+
const buffered = new RecordBuffer(bufferLimit);
|
|
5354
5261
|
try {
|
|
5355
5262
|
signal.throwIfAborted();
|
|
5356
5263
|
if (firstChunk) buffered.append(firstChunk);
|
|
@@ -5373,7 +5280,7 @@ async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
|
5373
5280
|
}
|
|
5374
5281
|
}
|
|
5375
5282
|
async function collectSortRecords(source, delimiter, budget, signal, accept) {
|
|
5376
|
-
const pending = new
|
|
5283
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
5377
5284
|
const admit = (length) => {
|
|
5378
5285
|
signal.throwIfAborted();
|
|
5379
5286
|
budget.admit(length);
|
|
@@ -5427,13 +5334,13 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5427
5334
|
break;
|
|
5428
5335
|
}
|
|
5429
5336
|
}
|
|
5430
|
-
const args = hasCheckLong ? context.args.map((
|
|
5431
|
-
if (ended) return
|
|
5432
|
-
if (
|
|
5433
|
-
if (
|
|
5434
|
-
if (
|
|
5435
|
-
if (
|
|
5436
|
-
return
|
|
5337
|
+
const args = hasCheckLong ? context.args.map((argument) => {
|
|
5338
|
+
if (ended) return argument;
|
|
5339
|
+
if (argument === "--") ended = true;
|
|
5340
|
+
if (argument === "--check" || argument === "--check=diagnose-first") return "-c";
|
|
5341
|
+
if (argument === "--check=quiet" || argument === "--check=silent") return "-C";
|
|
5342
|
+
if (argument.startsWith("--check=")) throw new UsageError(`invalid argument '${argument.slice(8)}' for '--check'`);
|
|
5343
|
+
return argument;
|
|
5437
5344
|
}) : context.args;
|
|
5438
5345
|
const parsed = options(args, "hngMVdimrfbuszt:k:o:cCS:", SORT_LONG_OPTIONS, false, void 0, (key, index) => {
|
|
5439
5346
|
if (key === "S" && !args[index].startsWith("--sort=") && args[index - 1] !== "--sort") throw new UsageError("invalid option -- 'S'");
|
|
@@ -5907,7 +5814,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5907
5814
|
if (resolved !== 0 || skipTieFallback) return resolved;
|
|
5908
5815
|
return await compareSortBytes(left, right, work) * direction;
|
|
5909
5816
|
};
|
|
5910
|
-
const
|
|
5817
|
+
const compare = (left, right) => {
|
|
5911
5818
|
const result = keyCompare(left, right);
|
|
5912
5819
|
if (typeof result === "number") {
|
|
5913
5820
|
if (result !== 0 || skipTieFallback) return result;
|
|
@@ -5916,20 +5823,20 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5916
5823
|
}
|
|
5917
5824
|
return compareSlowAsync(result, left, right);
|
|
5918
5825
|
};
|
|
5919
|
-
const
|
|
5826
|
+
const records = [];
|
|
5920
5827
|
const runs = [];
|
|
5921
5828
|
const checkRecordAsync = async (bytes) => {
|
|
5922
|
-
if (
|
|
5923
|
-
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${
|
|
5829
|
+
if (records.length && (await compare(records.at(-1), bytes) > 0 || parsed.flags.has("u") && await keyCompare(records.at(-1), bytes) === 0)) {
|
|
5830
|
+
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${records.length + 1}`));
|
|
5924
5831
|
return false;
|
|
5925
5832
|
}
|
|
5926
|
-
|
|
5833
|
+
records.push(bytes);
|
|
5927
5834
|
return true;
|
|
5928
5835
|
};
|
|
5929
5836
|
for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
|
|
5930
5837
|
const run = [];
|
|
5931
5838
|
if (parsed.flags.has("m")) runs.push(run);
|
|
5932
|
-
const targetList = parsed.flags.has("m") ? run :
|
|
5839
|
+
const targetList = parsed.flags.has("m") ? run : records;
|
|
5933
5840
|
const acceptRecord = checking ? checkRecordAsync : (bytes) => {
|
|
5934
5841
|
targetList.push(bytes);
|
|
5935
5842
|
};
|
|
@@ -5945,121 +5852,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5945
5852
|
}
|
|
5946
5853
|
}
|
|
5947
5854
|
if (checking) return { exitCode };
|
|
5948
|
-
|
|
5949
|
-
if (!parsed.flags.has("m") && !parsed.flags.has("u") && records2.length >= 2 && records2.length <= 65536 && (canMultiKeyFast || isSingleLexKeyFast)) {
|
|
5950
|
-
const count = records2.length;
|
|
5951
|
-
const keySpecs = keys.map((k) => {
|
|
5952
|
-
const f = k.flags.size ? k.flags : parsed.flags;
|
|
5953
|
-
const numeric = f.has("n") || f.has("h");
|
|
5954
|
-
const human = f.has("h");
|
|
5955
|
-
const blanks = f.has("b");
|
|
5956
|
-
const revScale = f.has("r") ? -1 : 1;
|
|
5957
|
-
if (numeric) {
|
|
5958
|
-
const fastNums = new Float64Array(count);
|
|
5959
|
-
const numVals = new Array(count);
|
|
5960
|
-
return { numeric: true, human, blanks, revScale, key: k, fastNums, numVals };
|
|
5961
|
-
}
|
|
5962
|
-
const slices = new Array(count);
|
|
5963
|
-
return { numeric: false, blanks, revScale, key: k, slices };
|
|
5964
|
-
});
|
|
5965
|
-
for (let i = 0; i < count; i++) {
|
|
5966
|
-
const rec = records2[i];
|
|
5967
|
-
for (let ki = 0; ki < keySpecs.length; ki++) {
|
|
5968
|
-
const ks = keySpecs[ki];
|
|
5969
|
-
const sliceOrPromise = keyBytesSync(rec, ks.key, separator, ks.blanks, work);
|
|
5970
|
-
const slice = sliceOrPromise instanceof Promise ? await sliceOrPromise : sliceOrPromise;
|
|
5971
|
-
if (ks.numeric) {
|
|
5972
|
-
const parsedOrPromise = parseNumeric(slice, work, ks.human);
|
|
5973
|
-
const nv = parsedOrPromise instanceof Promise ? await parsedOrPromise : parsedOrPromise;
|
|
5974
|
-
ks.numVals[i] = nv;
|
|
5975
|
-
if (!ks.human && nv.fraction.length === 0 && nv.whole.length <= 15) {
|
|
5976
|
-
const mag = nv.whole.length === 0 ? 0 : Number(nv.whole);
|
|
5977
|
-
ks.fastNums[i] = nv.negative ? mag === 0 ? 0 : -mag : mag;
|
|
5978
|
-
} else {
|
|
5979
|
-
ks.fastNums[i] = Number.NaN;
|
|
5980
|
-
}
|
|
5981
|
-
} else {
|
|
5982
|
-
ks.slices[i] = slice;
|
|
5983
|
-
}
|
|
5984
|
-
}
|
|
5985
|
-
}
|
|
5986
|
-
let srcIdx = new Int32Array(count);
|
|
5987
|
-
let dstIdx = new Int32Array(count);
|
|
5988
|
-
for (let i = 0; i < count; i++) srcIdx[i] = i;
|
|
5989
|
-
for (let width = 1; width < count; width *= 2) {
|
|
5990
|
-
for (let begin = 0; begin < count; begin += width * 2) {
|
|
5991
|
-
const middle = Math.min(begin + width, count);
|
|
5992
|
-
const end = Math.min(begin + width * 2, count);
|
|
5993
|
-
let left = begin;
|
|
5994
|
-
let right = middle;
|
|
5995
|
-
for (let index = begin; index < end; index++) {
|
|
5996
|
-
const cp = work.charge(2);
|
|
5997
|
-
if (cp) await cp;
|
|
5998
|
-
if (left < middle) {
|
|
5999
|
-
if (right === end) {
|
|
6000
|
-
dstIdx[index] = srcIdx[left++];
|
|
6001
|
-
continue;
|
|
6002
|
-
}
|
|
6003
|
-
const a = srcIdx[left];
|
|
6004
|
-
const b = srcIdx[right];
|
|
6005
|
-
let cmp = 0;
|
|
6006
|
-
for (let ki = 0; ki < keySpecs.length; ki++) {
|
|
6007
|
-
const ks = keySpecs[ki];
|
|
6008
|
-
if (ks.numeric) {
|
|
6009
|
-
const fa = ks.fastNums[a];
|
|
6010
|
-
const fb = ks.fastNums[b];
|
|
6011
|
-
if (fa === fa && fb === fb) {
|
|
6012
|
-
cmp = fa === fb ? 0 : fa < fb ? -ks.revScale : ks.revScale;
|
|
6013
|
-
} else {
|
|
6014
|
-
const r = compareNumericValues(ks.numVals[a], ks.numVals[b], work);
|
|
6015
|
-
const resolved = typeof r === "number" ? r : await r;
|
|
6016
|
-
cmp = resolved * ks.revScale;
|
|
6017
|
-
}
|
|
6018
|
-
} else {
|
|
6019
|
-
const sa = ks.slices[a];
|
|
6020
|
-
const sb = ks.slices[b];
|
|
6021
|
-
const lenA = sa.length;
|
|
6022
|
-
const lenB = sb.length;
|
|
6023
|
-
const minL = lenA < lenB ? lenA : lenB;
|
|
6024
|
-
let d = 0;
|
|
6025
|
-
for (let p = 0; p < minL; p++) {
|
|
6026
|
-
d = sa[p] - sb[p];
|
|
6027
|
-
if (d !== 0) break;
|
|
6028
|
-
}
|
|
6029
|
-
if (d === 0) d = lenA - lenB;
|
|
6030
|
-
cmp = d * ks.revScale;
|
|
6031
|
-
}
|
|
6032
|
-
if (cmp !== 0) break;
|
|
6033
|
-
}
|
|
6034
|
-
if (cmp === 0 && !skipTieFallback) {
|
|
6035
|
-
const ra = records2[a];
|
|
6036
|
-
const rb = records2[b];
|
|
6037
|
-
const minL = ra.length < rb.length ? ra.length : rb.length;
|
|
6038
|
-
let d = 0;
|
|
6039
|
-
for (let p = 0; p < minL; p++) {
|
|
6040
|
-
d = ra[p] - rb[p];
|
|
6041
|
-
if (d !== 0) break;
|
|
6042
|
-
}
|
|
6043
|
-
if (d === 0) d = ra.length - rb.length;
|
|
6044
|
-
cmp = d * direction;
|
|
6045
|
-
}
|
|
6046
|
-
if (cmp <= 0) {
|
|
6047
|
-
dstIdx[index] = srcIdx[left++];
|
|
6048
|
-
continue;
|
|
6049
|
-
}
|
|
6050
|
-
}
|
|
6051
|
-
dstIdx[index] = srcIdx[right++];
|
|
6052
|
-
}
|
|
6053
|
-
}
|
|
6054
|
-
const tmp = srcIdx;
|
|
6055
|
-
srcIdx = dstIdx;
|
|
6056
|
-
dstIdx = tmp;
|
|
6057
|
-
}
|
|
6058
|
-
ordered = new Array(count);
|
|
6059
|
-
for (let i = 0; i < count; i++) ordered[i] = records2[srcIdx[i]];
|
|
6060
|
-
} else {
|
|
6061
|
-
ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare2, work) : await sortRecords(records2, compare2, work);
|
|
6062
|
-
}
|
|
5855
|
+
const ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare, work) : await sortRecords(records, compare, work);
|
|
6063
5856
|
let estBytes = 0;
|
|
6064
5857
|
let allCounted = true;
|
|
6065
5858
|
for (let i = 0; i < ordered.length; i++) {
|
|
@@ -6239,7 +6032,7 @@ async function executeCutGeneral(context) {
|
|
|
6239
6032
|
const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
|
|
6240
6033
|
const processFastSliceRange = (buf, lineStart, lineEnd) => {
|
|
6241
6034
|
const lineLen = lineEnd - lineStart;
|
|
6242
|
-
if (writer.remaining <= lineLen
|
|
6035
|
+
if (writer.remaining <= lineLen + (outputDelimiter !== void 0 ? Math.max(0, ranges.length - 1) * outDelimLen : 0) + 1) {
|
|
6243
6036
|
return null;
|
|
6244
6037
|
}
|
|
6245
6038
|
if (!byteSelection) {
|
|
@@ -6361,7 +6154,7 @@ async function executeCutGeneral(context) {
|
|
|
6361
6154
|
const wd = writer.writeByte(recordDelimiter);
|
|
6362
6155
|
if (wd) await wd;
|
|
6363
6156
|
};
|
|
6364
|
-
const pending = new
|
|
6157
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
6365
6158
|
try {
|
|
6366
6159
|
for await (const chunk of input(context, name)) {
|
|
6367
6160
|
let start = 0;
|
|
@@ -6415,12 +6208,12 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6415
6208
|
let ended = false;
|
|
6416
6209
|
let repeatedMethod = "none";
|
|
6417
6210
|
let groupMethod;
|
|
6418
|
-
const args = context.args.map((
|
|
6419
|
-
if (ended) return
|
|
6420
|
-
if (
|
|
6421
|
-
if (
|
|
6422
|
-
if (
|
|
6423
|
-
return
|
|
6211
|
+
const args = context.args.map((argument) => {
|
|
6212
|
+
if (ended) return argument;
|
|
6213
|
+
if (argument === "--") ended = true;
|
|
6214
|
+
if (argument === "--all-repeated") return "--all-repeated=none";
|
|
6215
|
+
if (argument === "--group") return "--group=separate";
|
|
6216
|
+
return argument;
|
|
6424
6217
|
});
|
|
6425
6218
|
const parsed = options(args, "cduiDf:s:w:z", { count: "c", repeated: "d", unique: "u", "all-repeated": "all-repeated:", group: "group:", "ignore-case": "i", "skip-fields": "f", "skip-chars": "s", "check-chars": "w", "zero-terminated": "z" }, false, void 0, void 0, (option, method) => {
|
|
6426
6219
|
if (option === "D") repeatedMethod = "none";
|
|
@@ -6491,7 +6284,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6491
6284
|
}
|
|
6492
6285
|
return ignoreCase ? fold(result) : result;
|
|
6493
6286
|
};
|
|
6494
|
-
const
|
|
6287
|
+
const records = (async function* () {
|
|
6495
6288
|
let previous;
|
|
6496
6289
|
let previousKey;
|
|
6497
6290
|
let count = 0;
|
|
@@ -6557,7 +6350,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6557
6350
|
}
|
|
6558
6351
|
}
|
|
6559
6352
|
};
|
|
6560
|
-
const pending = new
|
|
6353
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
6561
6354
|
try {
|
|
6562
6355
|
for await (const chunk of preReadSource ?? input(context, parsed.operands[0])) {
|
|
6563
6356
|
let start = 0;
|
|
@@ -6592,7 +6385,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6592
6385
|
while (flushChunks.length) yield flushChunks.shift();
|
|
6593
6386
|
if (outUsed > 0) yield outBuf.subarray(0, outUsed);
|
|
6594
6387
|
})();
|
|
6595
|
-
await emitRecords(context,
|
|
6388
|
+
await emitRecords(context, records, parsed.operands[1]);
|
|
6596
6389
|
return { exitCode: 0 };
|
|
6597
6390
|
}
|
|
6598
6391
|
function textCommands() {
|
|
@@ -7039,7 +6832,7 @@ function textCommands() {
|
|
|
7039
6832
|
}
|
|
7040
6833
|
return executeCutGeneral(context);
|
|
7041
6834
|
})
|
|
7042
|
-
].map((
|
|
6835
|
+
].map((command) => ({ ...command, filesystemRequirements: command.name === "cut" ? inputRequirements : textOutputRequirements }));
|
|
7043
6836
|
}
|
|
7044
6837
|
async function executeSortFastAsync(context, direction, req) {
|
|
7045
6838
|
await req;
|
|
@@ -7269,7 +7062,7 @@ init_platform();
|
|
|
7269
7062
|
|
|
7270
7063
|
// packages/safe-bash/src/commands/shuf/index.ts
|
|
7271
7064
|
init_platform();
|
|
7272
|
-
import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as
|
|
7065
|
+
import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as settings19, shufCommands as shufCommands2 } from "../../safe-bash-command-shuf/index.js";
|
|
7273
7066
|
|
|
7274
7067
|
// packages/safe-bash/src/commands/standard.ts
|
|
7275
7068
|
var defaultBaseStandardCommands;
|
|
@@ -7277,8 +7070,8 @@ var defaultTailStandardCommands;
|
|
|
7277
7070
|
function createStandardCommandsWithGrep(options2, grep) {
|
|
7278
7071
|
const commands = [];
|
|
7279
7072
|
const execute = directExecutor(options2.execute ?? (async (context) => {
|
|
7280
|
-
const
|
|
7281
|
-
if (
|
|
7073
|
+
const command = commands.find((definition) => definition.name === context.command);
|
|
7074
|
+
if (command) return command.execute(context);
|
|
7282
7075
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
7283
7076
|
return { exitCode: 127 };
|
|
7284
7077
|
}));
|
|
@@ -7328,8 +7121,8 @@ function createExtraAgentCommands(options2) {
|
|
|
7328
7121
|
}
|
|
7329
7122
|
function commandExecutor(lookup) {
|
|
7330
7123
|
return async (context) => {
|
|
7331
|
-
const
|
|
7332
|
-
if (
|
|
7124
|
+
const command = lookup(context.command);
|
|
7125
|
+
if (command) return command.execute(context);
|
|
7333
7126
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
7334
7127
|
return { exitCode: 127 };
|
|
7335
7128
|
};
|
|
@@ -7388,7 +7181,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
7388
7181
|
const defaults = getDefaultStatelessFamilies();
|
|
7389
7182
|
const aliasesGrep = executors.aliases === executors.grep ? grep[0] : createGrepCommands(executors.aliases, { ergonomicRegex: useErgonomicGrep })[0];
|
|
7390
7183
|
commands.push(
|
|
7391
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7184
|
+
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command) => command.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep),
|
|
7392
7185
|
...defaults.beforeAliases,
|
|
7393
7186
|
createRgCommand(executors.search, options2.search),
|
|
7394
7187
|
...createGrepAliases(aliasesGrep),
|
|
@@ -7415,7 +7208,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
7415
7208
|
const applyPatchLimits = options2.applyPatch?.limits;
|
|
7416
7209
|
const xmlLimits = options2.xml?.limits;
|
|
7417
7210
|
commands.push(
|
|
7418
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7211
|
+
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((command) => command.name === name)), ...options2.execution === void 0 ? {} : { execution: options2.execution }, ...options2.regex === void 0 ? {} : { regex: options2.regex }, ...options2.maxDirectoryEntries === void 0 ? {} : { maxDirectoryEntries: options2.maxDirectoryEntries }, ...options2.maxRecursiveDirectoryDepth === void 0 ? {} : { maxRecursiveDirectoryDepth: options2.maxRecursiveDirectoryDepth }, ...options2.maxTeeTargets === void 0 ? {} : { maxTeeTargets: options2.maxTeeTargets }, ...options2.maxTailFollowHandles === void 0 ? {} : { maxTailFollowHandles: options2.maxTailFollowHandles } }, grep).filter((command) => !options2.muscleMemory || command.name !== "shuf" && command.name !== "numfmt"),
|
|
7419
7212
|
...createTextProgramCommands({ ...options2.text }),
|
|
7420
7213
|
...createStructuredCommands({ ...options2.structured }),
|
|
7421
7214
|
createRgCommand(executors.search, options2.search),
|
|
@@ -7517,23 +7310,6 @@ export {
|
|
|
7517
7310
|
xxdCommands,
|
|
7518
7311
|
createByteCommands,
|
|
7519
7312
|
byteCommands,
|
|
7520
|
-
createTableTextCommands,
|
|
7521
|
-
tableTextCommands,
|
|
7522
|
-
createStreamInspectionCommands,
|
|
7523
|
-
streamInspectionCommands,
|
|
7524
|
-
createStreamFormatCommands,
|
|
7525
|
-
streamFormatCommands,
|
|
7526
|
-
createSplitCommand,
|
|
7527
|
-
createSplitCommands,
|
|
7528
|
-
evalSyncSplit,
|
|
7529
|
-
splitCommands,
|
|
7530
|
-
columnCommands,
|
|
7531
|
-
createColumnCommand,
|
|
7532
|
-
createColumnCommands,
|
|
7533
|
-
applyPatchCommands,
|
|
7534
|
-
createApplyPatchCommand,
|
|
7535
|
-
createApplyPatchCommands,
|
|
7536
|
-
evalSyncApplyPatch,
|
|
7537
7313
|
createBcCommand,
|
|
7538
7314
|
createBcCommands,
|
|
7539
7315
|
bcCommands,
|