@poe-platform/safe-bash 0.1.801 → 0.1.803
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/README.md +4 -2
- package/dist/image-ast/index.browser.js +16 -5
- package/dist/image-ast/index.js +16 -5
- package/dist/safe-bash/chunks/chunk-2LSAMQER.js +84 -0
- package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
- 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-NZQXYWA3.js → chunk-5OHX7C2V.js} +0 -1
- package/dist/safe-bash/chunks/chunk-7ZBU7KYV.js +14 -0
- package/dist/safe-bash/chunks/{chunk-7VNF5BFF.js → chunk-B7PIL77G.js} +101 -415
- package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
- package/dist/safe-bash/chunks/{chunk-VQDD3G76.js → chunk-EEEWOYEG.js} +18 -18
- package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
- package/dist/safe-bash/chunks/{chunk-45PK3NWI.js → chunk-GDYNCWRV.js} +1 -1
- package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
- 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-FNDNHAGE.js → chunk-JMMEIDPF.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-IVRQ4BXL.js → chunk-PH63PLPZ.js} +7 -7
- package/dist/safe-bash/chunks/{chunk-SZH7EJLD.js → chunk-PNBBUWSM.js} +5529 -6547
- 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-PQRAK7HU.js → chunk-RYFQ3LZG.js} +281 -476
- package/dist/safe-bash/chunks/chunk-VBTDHOWC.js +55 -0
- package/dist/safe-bash/chunks/{chunk-NR3EM4LS.js → chunk-VKNVHEX3.js} +1 -6
- 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-ORYGZYKW.js → chunk-4FEVBOL5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VXSLJH7G.js → chunk-6JSIFWYT.js} +26 -6
- package/dist/safe-bash/command-chunks/chunk-A7MU7762.js +200 -0
- package/dist/safe-bash/command-chunks/{chunk-KJIMDLBB.js → chunk-BXCXRYVU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-F4TEEZTL.js → chunk-CQHP3I66.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PEF7K3UQ.js → chunk-EARHPPPJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QKFSRZGQ.js → chunk-GFC2NTDG.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-GIRNFXP3.js +466 -0
- package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-FPVUD6TH.js → chunk-HDCNKOIX.js} +9 -7
- package/dist/safe-bash/command-chunks/{chunk-MQFIPHIQ.js → chunk-ILX2NOLF.js} +18 -15
- package/dist/safe-bash/command-chunks/{chunk-5E4WAO4O.js → chunk-JD5QNRNO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-I237SNW5.js → chunk-LFJJQQND.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-W5DNF4JH.js → chunk-LOICUCHG.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7U7EXOXX.js → chunk-NASVPT6F.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
- package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-NKIELG7Y.js} +45 -115
- package/dist/safe-bash/command-chunks/{chunk-WPYIOKE3.js → chunk-PICVQ6B5.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YOFC45RK.js → chunk-QVOS4YXL.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-VGG2DL5Q.js → chunk-TRR4MYWF.js} +4 -0
- package/dist/safe-bash/command-chunks/{chunk-2JRBIDAD.js → chunk-V4K2JDYU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-CZ7EN3JG.js → chunk-VT6MJBEI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-PCEFOYA3.js → chunk-WWIBP2ET.js} +41 -114
- 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/command-chunks/chunk-ZDN7MJE6.js +168 -0
- 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/bytes/compression/index.js +54 -51
- package/dist/safe-bash/commands/chmod/index.browser.js +14 -0
- package/dist/safe-bash/commands/chmod/index.d.ts +2 -0
- package/dist/safe-bash/commands/chmod/index.js +2 -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/chmod.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/chmod.js +1 -204
- package/dist/safe-bash/commands/metadata/index.browser.js +17 -0
- package/dist/safe-bash/commands/metadata/internal.d.ts +1 -30
- package/dist/safe-bash/commands/metadata/internal.js +1 -76
- package/dist/safe-bash/commands/metadata/mktemp.d.ts +1 -3
- package/dist/safe-bash/commands/metadata/mktemp.js +1 -202
- package/dist/safe-bash/commands/metadata/stat.d.ts +1 -7
- package/dist/safe-bash/commands/metadata/stat.js +1 -530
- package/dist/safe-bash/commands/mktemp/index.browser.js +13 -0
- package/dist/safe-bash/commands/mktemp/index.d.ts +2 -0
- package/dist/safe-bash/commands/mktemp/index.js +2 -0
- package/dist/safe-bash/commands/network/index.browser.js +1 -1
- package/dist/safe-bash/commands/node/index.browser.js +4 -4
- package/dist/safe-bash/commands/portable-random.d.ts +1 -1
- package/dist/safe-bash/commands/portable-random.js +1 -12
- 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/stat/index.browser.js +13 -0
- package/dist/safe-bash/commands/stat/index.d.ts +2 -0
- package/dist/safe-bash/commands/stat/index.js +2 -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 +48 -143
- 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 +256 -247
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +1 -0
- package/dist/safe-bash/optional-host.browser.js +12 -12
- package/dist/safe-bash/plugins/index.browser.js +25 -11
- package/dist/safe-bash/registry-entry.browser.js +28 -14
- package/dist/safe-bash/search.browser.js +48 -0
- package/dist/safe-bash/shell/runtime.d.ts +3 -9
- package/dist/safe-bash/shell/runtime.js +63 -311
- package/dist/safe-bash/shell/shell.js +0 -23
- package/dist/safe-bash/shell/types.d.ts +2 -0
- package/dist/safe-bash/shell/worker-limits.js +1 -0
- package/dist/safe-bash/shell-entry.browser.js +19 -10
- package/dist/safe-bash/worker/host.js +1 -1
- package/dist/safe-bash-command-bc/index.js +12 -5
- package/dist/safe-bash-command-bzip2/index.js +4 -3
- package/dist/safe-bash-command-chmod/LICENSE +21 -0
- package/dist/safe-bash-command-chmod/command.d.ts +7 -0
- package/dist/safe-bash-command-chmod/command.js +11 -0
- package/dist/safe-bash-command-chmod/index.d.ts +6 -0
- package/dist/safe-bash-command-chmod/index.js +27 -0
- package/dist/safe-bash-command-exiftool/index.js +5 -5
- package/dist/safe-bash-command-find/find.js +1 -1
- package/dist/safe-bash-command-find/index.js +1 -1
- package/dist/safe-bash-command-fmt/index.js +9 -2
- package/dist/safe-bash-command-gzip/index.js +45 -42
- package/dist/safe-bash-command-imagemagick/index.js +3 -1
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-less/index.js +12 -3
- package/dist/safe-bash-command-mktemp/LICENSE +21 -0
- package/dist/safe-bash-command-mktemp/command.d.ts +3 -0
- package/dist/safe-bash-command-mktemp/command.js +9 -0
- package/dist/safe-bash-command-mktemp/index.d.ts +6 -0
- package/dist/safe-bash-command-mktemp/index.js +25 -0
- 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-od/index.js +6 -2
- package/dist/safe-bash-command-op/index.js +25 -6
- 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-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- package/dist/safe-bash-command-sips/index.js +13 -5
- package/dist/safe-bash-command-sponge/index.js +10 -3
- package/dist/safe-bash-command-stat/LICENSE +21 -0
- package/dist/safe-bash-command-stat/command.d.ts +7 -0
- package/dist/safe-bash-command-stat/command.js +9 -0
- package/dist/safe-bash-command-stat/index.d.ts +6 -0
- package/dist/safe-bash-command-stat/index.js +25 -0
- package/dist/safe-bash-command-unexpand/index.js +1 -1
- package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
- package/dist/safe-bash-command-unrtf/index.js +11 -1
- package/dist/safe-bash-command-xxd/index.js +6 -2
- package/dist/safe-bash-command-xz/command.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +3 -2
- package/dist/safe-bash-command-yq/index.js +1 -0
- package/dist/safe-bash-command-yq/native-work.js +1 -0
- package/dist/safe-bash-command-yq/query.js +3 -0
- package/dist/safe-bash-compression-engine/bounded-codec.js +3 -3
- package/dist/safe-bash-compression-engine/codec-loader.js +2 -2
- package/dist/safe-bash-compression-engine/files.js +6 -6
- package/dist/safe-bash-compression-engine/index.js +5 -5
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/options.js +1 -1
- package/dist/safe-bash-compression-engine/stream.js +5 -5
- package/dist/safe-bash-compression-engine/zstd-decode.js +4 -4
- package/dist/safe-bash-contracts/escaping.js +2 -2
- package/dist/safe-bash-contracts/filesystem-output.js +2 -2
- package/dist/safe-bash-contracts/index.js +2 -2
- package/dist/safe-bash-contracts/io.d.ts +2 -0
- package/dist/safe-bash-contracts/io.js +1 -1
- package/dist/safe-bash-contracts/output.js +2 -2
- package/dist/safe-bash-io-engine/commands/search/requirements.js +1 -1
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +1 -1
- package/dist/safe-bash-mcp/index.browser.js +11 -1
- package/dist/safe-bash-mcp/index.js +38 -17
- package/dist/safe-bash-metadata-engine/LICENSE +21 -0
- package/dist/safe-bash-metadata-engine/index.d.ts +30 -0
- package/dist/safe-bash-metadata-engine/index.js +82 -0
- package/dist/safe-bash-metadata-engine/random.d.ts +1 -0
- package/dist/safe-bash-metadata-engine/random.js +21 -0
- 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/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-search-engine/glob.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +2 -2
- package/dist/safe-bash-search-engine/matcher.js +2 -2
- package/dist/safe-bash-search-engine/options.d.ts +2 -0
- package/dist/safe-bash-search-engine/options.js +1 -1
- package/dist/safe-bash-search-engine/output.js +1 -1
- package/dist/safe-bash-search-engine/shared.js +2 -2
- package/dist/safe-bash-search-engine/walk.js +3 -3
- package/dist/safe-playwright-cloudflare/browser-snapshot-json.js +2 -2
- package/dist/safe-playwright-cloudflare/browser-snapshot-references.js +1 -1
- package/package.json +91 -10
|
@@ -1,36 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createTsortCommands
|
|
3
|
+
} from "./chunk-6PAVEFT3.js";
|
|
1
4
|
import {
|
|
2
5
|
createFactorCommands
|
|
3
6
|
} from "./chunk-AM5ESLPH.js";
|
|
4
7
|
import {
|
|
5
8
|
createHexdumpCommands
|
|
6
9
|
} from "./chunk-CS4MNM6I.js";
|
|
10
|
+
import {
|
|
11
|
+
RegexExecutor
|
|
12
|
+
} from "./chunk-VKNVHEX3.js";
|
|
7
13
|
import {
|
|
8
14
|
createTimeoutCommands
|
|
9
15
|
} from "./chunk-FBUCWVTE.js";
|
|
10
16
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
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";
|
|
42
|
+
import {
|
|
43
|
+
createBoundedRegexProvider
|
|
44
|
+
} from "./chunk-FZE4HW6G.js";
|
|
13
45
|
import {
|
|
14
46
|
assertCommandRequirements,
|
|
15
47
|
basicCommands,
|
|
16
48
|
cmpCommand,
|
|
17
|
-
createArchiveCommands,
|
|
18
49
|
createCalCommands,
|
|
19
50
|
createChecksumCommands,
|
|
20
51
|
createCompressionCommands,
|
|
21
52
|
createDfCommands,
|
|
22
53
|
createDiffPatchCommands,
|
|
23
|
-
createDuCommands,
|
|
24
54
|
createFdCommands,
|
|
25
|
-
createFileCommands,
|
|
26
55
|
createFindDefinitions,
|
|
27
|
-
createHtmlToMarkdownCommands,
|
|
28
56
|
createLessCommands,
|
|
29
|
-
createMetadataCommands,
|
|
30
57
|
createPathchkCommands,
|
|
31
58
|
createRgCommand,
|
|
32
|
-
createTimeEnvCommands,
|
|
33
|
-
createTreeCommands,
|
|
34
59
|
createWhichCommands,
|
|
35
60
|
directExecutor,
|
|
36
61
|
executionCommands,
|
|
@@ -39,7 +64,13 @@ import {
|
|
|
39
64
|
openFileOutput,
|
|
40
65
|
predicateCommands,
|
|
41
66
|
wcDisplayWidth
|
|
42
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-PNBBUWSM.js";
|
|
68
|
+
import {
|
|
69
|
+
createMdqCommand
|
|
70
|
+
} from "./chunk-OV6IHKO6.js";
|
|
71
|
+
import {
|
|
72
|
+
createPrCommands
|
|
73
|
+
} from "./chunk-CHYGPFVM.js";
|
|
43
74
|
import {
|
|
44
75
|
createGetoptCommands
|
|
45
76
|
} from "./chunk-AUSNDQTJ.js";
|
|
@@ -49,9 +80,6 @@ import {
|
|
|
49
80
|
import {
|
|
50
81
|
createDos2unixCommands2 as createDos2unixCommands
|
|
51
82
|
} from "./chunk-3R3AANOR.js";
|
|
52
|
-
import {
|
|
53
|
-
createMdqCommand
|
|
54
|
-
} from "./chunk-OV6IHKO6.js";
|
|
55
83
|
import {
|
|
56
84
|
compareCopyIdentity,
|
|
57
85
|
compareObservedEntries,
|
|
@@ -64,40 +92,13 @@ import {
|
|
|
64
92
|
} from "./chunk-C5OWC2TL.js";
|
|
65
93
|
import {
|
|
66
94
|
PublicDiagnostic
|
|
67
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-PH63PLPZ.js";
|
|
68
96
|
import {
|
|
69
97
|
compareByteArrays,
|
|
70
98
|
decodeBytes,
|
|
71
99
|
encodeBytes,
|
|
72
100
|
indexOfBytes
|
|
73
101
|
} from "./chunk-D3ANYGMC.js";
|
|
74
|
-
import {
|
|
75
|
-
createPrCommands
|
|
76
|
-
} from "./chunk-CHYGPFVM.js";
|
|
77
|
-
import {
|
|
78
|
-
RegexExecutor,
|
|
79
|
-
createBoundedRegexProvider
|
|
80
|
-
} from "./chunk-NR3EM4LS.js";
|
|
81
|
-
import {
|
|
82
|
-
Chi,
|
|
83
|
-
HashMD,
|
|
84
|
-
Maj,
|
|
85
|
-
abytes,
|
|
86
|
-
aexists,
|
|
87
|
-
ahash,
|
|
88
|
-
anumber,
|
|
89
|
-
aoutput,
|
|
90
|
-
checkOpts,
|
|
91
|
-
clean,
|
|
92
|
-
createHasher,
|
|
93
|
-
createOutputOperation,
|
|
94
|
-
createView,
|
|
95
|
-
kdfInputToBytes,
|
|
96
|
-
rotl,
|
|
97
|
-
sha256,
|
|
98
|
-
sha384,
|
|
99
|
-
sha512
|
|
100
|
-
} from "./chunk-ICFDYV64.js";
|
|
101
102
|
import {
|
|
102
103
|
FsError
|
|
103
104
|
} from "./chunk-VTH3MLDU.js";
|
|
@@ -105,7 +106,7 @@ import {
|
|
|
105
106
|
hasYieldCheckpoint,
|
|
106
107
|
monotonicNow,
|
|
107
108
|
yieldTurn
|
|
108
|
-
} from "./chunk-
|
|
109
|
+
} from "./chunk-5OHX7C2V.js";
|
|
109
110
|
import {
|
|
110
111
|
collectBytes,
|
|
111
112
|
createBufferedOutput,
|
|
@@ -114,6 +115,39 @@ import {
|
|
|
114
115
|
import {
|
|
115
116
|
CommandRegistry
|
|
116
117
|
} from "./chunk-7R5BDCG7.js";
|
|
118
|
+
import {
|
|
119
|
+
createTreeCommands
|
|
120
|
+
} from "./chunk-55YJASTN.js";
|
|
121
|
+
import {
|
|
122
|
+
createFileCommands
|
|
123
|
+
} from "./chunk-4BSJLKNM.js";
|
|
124
|
+
import {
|
|
125
|
+
createHtmlToMarkdownCommands
|
|
126
|
+
} from "./chunk-DQP3VHSB.js";
|
|
127
|
+
import {
|
|
128
|
+
createDuCommands
|
|
129
|
+
} from "./chunk-GEG3BWGE.js";
|
|
130
|
+
import {
|
|
131
|
+
createMetadataCommands
|
|
132
|
+
} from "./chunk-VBTDHOWC.js";
|
|
133
|
+
import {
|
|
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
|
}
|
|
@@ -4464,6 +4371,17 @@ var SortRecordBudget = class {
|
|
|
4464
4371
|
};
|
|
4465
4372
|
|
|
4466
4373
|
// packages/safe-bash/src/commands/text.ts
|
|
4374
|
+
function sortCollator(env) {
|
|
4375
|
+
const locale = env.LC_ALL || env.LC_COLLATE || env.LANG || "C";
|
|
4376
|
+
if (["C", "POSIX", "C.UTF-8", "C.utf8"].includes(locale)) return void 0;
|
|
4377
|
+
const language = locale.split(".")[0].split("_").join("-");
|
|
4378
|
+
try {
|
|
4379
|
+
if (!Intl.Collator.supportedLocalesOf([language]).length || locale.includes("@")) throw new RangeError();
|
|
4380
|
+
return new Intl.Collator(language, { usage: "sort", sensitivity: "variant", caseFirst: "lower" });
|
|
4381
|
+
} catch {
|
|
4382
|
+
throw new UsageError(`unsupported collation locale '${locale}'`);
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4467
4385
|
var SortWork = class {
|
|
4468
4386
|
constructor(signal) {
|
|
4469
4387
|
this.signal = signal;
|
|
@@ -4485,14 +4403,14 @@ var SortWork = class {
|
|
|
4485
4403
|
}
|
|
4486
4404
|
}
|
|
4487
4405
|
};
|
|
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,
|
|
4406
|
+
async function sortRecords(records, compare, work) {
|
|
4407
|
+
if (records.length < 2) return records;
|
|
4408
|
+
let source = records;
|
|
4409
|
+
let target = new Array(records.length);
|
|
4410
|
+
for (let width = 1; width < records.length; width *= 2) {
|
|
4411
|
+
for (let begin = 0; begin < records.length; begin += width * 2) {
|
|
4412
|
+
const middle = Math.min(begin + width, records.length);
|
|
4413
|
+
const end = Math.min(begin + width * 2, records.length);
|
|
4496
4414
|
let left = begin;
|
|
4497
4415
|
let right = middle;
|
|
4498
4416
|
for (let index = begin; index < end; index++) {
|
|
@@ -4503,7 +4421,7 @@ async function sortRecords(records2, compare2, work) {
|
|
|
4503
4421
|
target[index] = source[left++];
|
|
4504
4422
|
continue;
|
|
4505
4423
|
}
|
|
4506
|
-
const compared =
|
|
4424
|
+
const compared = compare(source[left], source[right]);
|
|
4507
4425
|
const order = typeof compared === "number" ? compared : await compared;
|
|
4508
4426
|
if (order <= 0) {
|
|
4509
4427
|
target[index] = source[left++];
|
|
@@ -5019,7 +4937,7 @@ async function compareVersions(left, right, work) {
|
|
|
5019
4937
|
if (result) return result;
|
|
5020
4938
|
return await compareVersionParts(await versionPrefix(left, work), await versionPrefix(right, work), work) || await compareVersionParts(left, right, work);
|
|
5021
4939
|
}
|
|
5022
|
-
async function mergeSortRuns(runs,
|
|
4940
|
+
async function mergeSortRuns(runs, compare, work) {
|
|
5023
4941
|
while (runs.length > 1) {
|
|
5024
4942
|
const next = [];
|
|
5025
4943
|
for (let index = 0; index < runs.length; index += 2) {
|
|
@@ -5034,7 +4952,7 @@ async function mergeSortRuns(runs, compare2, work) {
|
|
|
5034
4952
|
merged.push(left[first++]);
|
|
5035
4953
|
continue;
|
|
5036
4954
|
}
|
|
5037
|
-
const compared =
|
|
4955
|
+
const compared = compare(left[first], right[second]);
|
|
5038
4956
|
const order = typeof compared === "number" ? compared : await compared;
|
|
5039
4957
|
if (order <= 0) {
|
|
5040
4958
|
merged.push(left[first++]);
|
|
@@ -5321,11 +5239,11 @@ async function keyBytes(line, key, separator, blanks, work) {
|
|
|
5321
5239
|
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
5240
|
return line.subarray(Math.min(start, line.length), Math.max(start, end));
|
|
5323
5241
|
}
|
|
5324
|
-
async function emitRecords(context,
|
|
5242
|
+
async function emitRecords(context, records, destination) {
|
|
5325
5243
|
if (destination === void 0) {
|
|
5326
5244
|
const buffered = createBufferedOutput(context.stdout, context.signal);
|
|
5327
5245
|
try {
|
|
5328
|
-
for await (const bytes of
|
|
5246
|
+
for await (const bytes of records) {
|
|
5329
5247
|
await buffered.write(bytes);
|
|
5330
5248
|
await buffered.flush();
|
|
5331
5249
|
}
|
|
@@ -5336,12 +5254,12 @@ async function emitRecords(context, records2, destination) {
|
|
|
5336
5254
|
}
|
|
5337
5255
|
await admitTextOutput(context, destination);
|
|
5338
5256
|
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),
|
|
5257
|
+
if (context.fs.writeStream && capabilities.streamingWrite !== false) await context.fs.writeStream(pathOf(context, destination), records, { signal: context.signal });
|
|
5340
5258
|
else {
|
|
5341
5259
|
if (capabilities.write === false) throw new FsError("ENOTSUP", { syscall: "writeFile", path: pathOf(context, destination) });
|
|
5342
5260
|
let size = 0;
|
|
5343
5261
|
const chunks = [];
|
|
5344
|
-
for await (const bytes of
|
|
5262
|
+
for await (const bytes of records) {
|
|
5345
5263
|
size += bytes.length;
|
|
5346
5264
|
if (size > bufferLimit) throw new FsError("EFBIG", { message: "output buffer limit exceeded" });
|
|
5347
5265
|
chunks.push(bytes);
|
|
@@ -5350,7 +5268,7 @@ async function emitRecords(context, records2, destination) {
|
|
|
5350
5268
|
}
|
|
5351
5269
|
}
|
|
5352
5270
|
async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
5353
|
-
const buffered = new
|
|
5271
|
+
const buffered = new RecordBuffer(bufferLimit);
|
|
5354
5272
|
try {
|
|
5355
5273
|
signal.throwIfAborted();
|
|
5356
5274
|
if (firstChunk) buffered.append(firstChunk);
|
|
@@ -5373,7 +5291,7 @@ async function readOwnedSortInput(source, signal, firstChunk, secondResult) {
|
|
|
5373
5291
|
}
|
|
5374
5292
|
}
|
|
5375
5293
|
async function collectSortRecords(source, delimiter, budget, signal, accept) {
|
|
5376
|
-
const pending = new
|
|
5294
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
5377
5295
|
const admit = (length) => {
|
|
5378
5296
|
signal.throwIfAborted();
|
|
5379
5297
|
budget.admit(length);
|
|
@@ -5416,7 +5334,7 @@ async function collectSortRecords(source, delimiter, budget, signal, accept) {
|
|
|
5416
5334
|
pending.clear();
|
|
5417
5335
|
}
|
|
5418
5336
|
}
|
|
5419
|
-
async function executeSortGeneral(context, preReadChunks) {
|
|
5337
|
+
async function executeSortGeneral(context, preReadChunks, collator = sortCollator(context.env)) {
|
|
5420
5338
|
let ended = false;
|
|
5421
5339
|
let hasCheckLong = false;
|
|
5422
5340
|
for (let i = 0; i < context.args.length; i++) {
|
|
@@ -5427,13 +5345,13 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5427
5345
|
break;
|
|
5428
5346
|
}
|
|
5429
5347
|
}
|
|
5430
|
-
const args = hasCheckLong ? context.args.map((
|
|
5431
|
-
if (ended) return
|
|
5432
|
-
if (
|
|
5433
|
-
if (
|
|
5434
|
-
if (
|
|
5435
|
-
if (
|
|
5436
|
-
return
|
|
5348
|
+
const args = hasCheckLong ? context.args.map((argument) => {
|
|
5349
|
+
if (ended) return argument;
|
|
5350
|
+
if (argument === "--") ended = true;
|
|
5351
|
+
if (argument === "--check" || argument === "--check=diagnose-first") return "-c";
|
|
5352
|
+
if (argument === "--check=quiet" || argument === "--check=silent") return "-C";
|
|
5353
|
+
if (argument.startsWith("--check=")) throw new UsageError(`invalid argument '${argument.slice(8)}' for '--check'`);
|
|
5354
|
+
return argument;
|
|
5437
5355
|
}) : context.args;
|
|
5438
5356
|
const parsed = options(args, "hngMVdimrfbuszt:k:o:cCS:", SORT_LONG_OPTIONS, false, void 0, (key, index) => {
|
|
5439
5357
|
if (key === "S" && !args[index].startsWith("--sort=") && args[index - 1] !== "--sort") throw new UsageError("invalid option -- 'S'");
|
|
@@ -5467,6 +5385,22 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5467
5385
|
const simple = !keys.length && !["b", "f", "h", "n", "g", "M", "V", "d", "i"].some((flag) => parsed.flags.has(flag));
|
|
5468
5386
|
const direction = parsed.flags.has("r") ? -1 : 1;
|
|
5469
5387
|
const work = new SortWork(context.signal);
|
|
5388
|
+
const decoder2 = collator ? new TextDecoder("utf-8", { fatal: true }) : void 0;
|
|
5389
|
+
const compareText = collator ? async (left, right, work2) => {
|
|
5390
|
+
await work2.charge(left.length + right.length);
|
|
5391
|
+
let first, second;
|
|
5392
|
+
try {
|
|
5393
|
+
first = decoder2.decode(left);
|
|
5394
|
+
} catch {
|
|
5395
|
+
}
|
|
5396
|
+
try {
|
|
5397
|
+
second = decoder2.decode(right);
|
|
5398
|
+
} catch {
|
|
5399
|
+
}
|
|
5400
|
+
if (first === void 0) return second === void 0 ? compareSortBytes(left, right, work2) : 1;
|
|
5401
|
+
if (second === void 0) return -1;
|
|
5402
|
+
return collator.compare(first, second);
|
|
5403
|
+
} : compareSortBytes;
|
|
5470
5404
|
const numericKey = keys.length === 1 ? keys[0] : void 0;
|
|
5471
5405
|
const numericKeyFlags = numericKey?.flags.size ? numericKey.flags : parsed.flags;
|
|
5472
5406
|
const skipTieFallback = simple || parsed.flags.has("s") || parsed.flags.has("u");
|
|
@@ -5474,7 +5408,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5474
5408
|
const exitCode = 0;
|
|
5475
5409
|
const delimiter = parsed.flags.has("z") ? 0 : 10;
|
|
5476
5410
|
const outPath = value(parsed, "o");
|
|
5477
|
-
const canFastIndexSort = !preReadChunks && !checking && !hasYieldCheckpoint(context.signal) && !parsed.flags.has("m") && !parsed.flags.has("u") && outPath === void 0 && parsed.operands.length <= 1 && SortRecordBudget.prototype.admit === defaultSortAdmit && Uint8Array === defaultUint8Array && (simple || keys.length === 1 && numericKey !== void 0 && numericKeyFlags.has("n") && !numericKeyFlags.has("h") && !["b", "f", "d", "i", "M", "V", "g"].some((flag) => numericKeyFlags.has(flag)) && !["b", "f", "d", "i", "h", "M", "V", "g"].some((flag) => parsed.flags.has(flag)) && numericKey.startCharacter === 1 && (numericKey.endCharacter === void 0 || numericKey.endCharacter === 0));
|
|
5411
|
+
const canFastIndexSort = collator === void 0 && !preReadChunks && !checking && !hasYieldCheckpoint(context.signal) && !parsed.flags.has("m") && !parsed.flags.has("u") && outPath === void 0 && parsed.operands.length <= 1 && SortRecordBudget.prototype.admit === defaultSortAdmit && Uint8Array === defaultUint8Array && (simple || keys.length === 1 && numericKey !== void 0 && numericKeyFlags.has("n") && !numericKeyFlags.has("h") && !["b", "f", "d", "i", "M", "V", "g"].some((flag) => numericKeyFlags.has(flag)) && !["b", "f", "d", "i", "h", "M", "V", "g"].some((flag) => parsed.flags.has(flag)) && numericKey.startCharacter === 1 && (numericKey.endCharacter === void 0 || numericKey.endCharacter === 0));
|
|
5478
5412
|
if (canFastIndexSort) {
|
|
5479
5413
|
let firstChunk;
|
|
5480
5414
|
try {
|
|
@@ -5673,7 +5607,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5673
5607
|
result = a.rank - b.rank || (a.value < b.value ? -1 : a.value > b.value ? 1 : 0);
|
|
5674
5608
|
} else if (flags.has("M")) result = await monthValue(first, work) - await monthValue(second, work);
|
|
5675
5609
|
else if (flags.has("V")) result = await compareVersions(first, second, work);
|
|
5676
|
-
else result = flags.has("n") || flags.has("h") ? await compareNumeric(first, second, flags.has("h")) : await
|
|
5610
|
+
else result = flags.has("n") || flags.has("h") ? await compareNumeric(first, second, flags.has("h")) : await compareText(first, second, work);
|
|
5677
5611
|
if (flags.has("r")) result = -result;
|
|
5678
5612
|
if (result) return result;
|
|
5679
5613
|
}
|
|
@@ -5681,7 +5615,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5681
5615
|
};
|
|
5682
5616
|
const keyCompareSimpleAsync = async (left, right, checkpoint) => {
|
|
5683
5617
|
await checkpoint;
|
|
5684
|
-
return await
|
|
5618
|
+
return await compareText(left, right, work) * direction;
|
|
5685
5619
|
};
|
|
5686
5620
|
const compareUnkeyedNumericAsync = async (left, right, rightPending) => {
|
|
5687
5621
|
const leftValue = await left;
|
|
@@ -5692,7 +5626,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5692
5626
|
const checkpoint = work.charge();
|
|
5693
5627
|
if (simple) {
|
|
5694
5628
|
if (checkpoint) return keyCompareSimpleAsync(left, right, checkpoint);
|
|
5695
|
-
const cmp =
|
|
5629
|
+
const cmp = compareText(left, right, work);
|
|
5696
5630
|
return typeof cmp === "number" ? cmp * direction : resolveScaledAfterPromise(cmp, direction);
|
|
5697
5631
|
}
|
|
5698
5632
|
if (isUnkeyedNumericFast && checkpoint === void 0) {
|
|
@@ -5730,7 +5664,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5730
5664
|
if (checkpoint) await checkpoint;
|
|
5731
5665
|
const first = await (firstPending ?? getKeyedLexSlice(left));
|
|
5732
5666
|
const second = await (secondPending ?? getKeyedLexSlice(right));
|
|
5733
|
-
return await
|
|
5667
|
+
return await compareText(first, second, work) * lexRev;
|
|
5734
5668
|
};
|
|
5735
5669
|
keyCompare = (left, right) => {
|
|
5736
5670
|
const checkpoint = work.charge();
|
|
@@ -5741,7 +5675,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5741
5675
|
if (!(first instanceof Promise)) {
|
|
5742
5676
|
second = getKeyedLexSlice(right);
|
|
5743
5677
|
if (!(second instanceof Promise)) {
|
|
5744
|
-
const cmp =
|
|
5678
|
+
const cmp = compareText(first, second, work);
|
|
5745
5679
|
if (typeof cmp === "number") return cmp * lexRev;
|
|
5746
5680
|
return resolveScaledAfterPromise(cmp, lexRev);
|
|
5747
5681
|
}
|
|
@@ -5894,7 +5828,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5894
5828
|
if (ls === void 0) return keyCompareGeneralAsync(left, right, void 0);
|
|
5895
5829
|
const rs = ev.evalLexSync(right);
|
|
5896
5830
|
if (rs === void 0) return keyCompareGeneralAsync(left, right, void 0);
|
|
5897
|
-
const cmp =
|
|
5831
|
+
const cmp = compareText(ls, rs, work);
|
|
5898
5832
|
if (typeof cmp !== "number") return keyCompareGeneralAsync(left, right, void 0);
|
|
5899
5833
|
if (cmp !== 0) return cmp * ev.revScale;
|
|
5900
5834
|
}
|
|
@@ -5905,31 +5839,31 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5905
5839
|
const compareSlowAsync = async (resultPromise, left, right) => {
|
|
5906
5840
|
const resolved = await resultPromise;
|
|
5907
5841
|
if (resolved !== 0 || skipTieFallback) return resolved;
|
|
5908
|
-
return await
|
|
5842
|
+
return await compareText(left, right, work) * direction;
|
|
5909
5843
|
};
|
|
5910
|
-
const
|
|
5844
|
+
const compare = (left, right) => {
|
|
5911
5845
|
const result = keyCompare(left, right);
|
|
5912
5846
|
if (typeof result === "number") {
|
|
5913
5847
|
if (result !== 0 || skipTieFallback) return result;
|
|
5914
|
-
const fallback =
|
|
5848
|
+
const fallback = compareText(left, right, work);
|
|
5915
5849
|
return typeof fallback === "number" ? fallback * direction : resolveScaledAfterPromise(fallback, direction);
|
|
5916
5850
|
}
|
|
5917
5851
|
return compareSlowAsync(result, left, right);
|
|
5918
5852
|
};
|
|
5919
|
-
const
|
|
5853
|
+
const records = [];
|
|
5920
5854
|
const runs = [];
|
|
5921
5855
|
const checkRecordAsync = async (bytes) => {
|
|
5922
|
-
if (
|
|
5923
|
-
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${
|
|
5856
|
+
if (records.length && (await compare(records.at(-1), bytes) > 0 || parsed.flags.has("u") && await keyCompare(records.at(-1), bytes) === 0)) {
|
|
5857
|
+
if (!parsed.flags.has("C")) await diagnostic(context, new PublicDiagnostic(`disorder at record ${records.length + 1}`));
|
|
5924
5858
|
return false;
|
|
5925
5859
|
}
|
|
5926
|
-
|
|
5860
|
+
records.push(bytes);
|
|
5927
5861
|
return true;
|
|
5928
5862
|
};
|
|
5929
5863
|
for (const name of parsed.operands.length ? parsed.operands : ["-"]) {
|
|
5930
5864
|
const run = [];
|
|
5931
5865
|
if (parsed.flags.has("m")) runs.push(run);
|
|
5932
|
-
const targetList = parsed.flags.has("m") ? run :
|
|
5866
|
+
const targetList = parsed.flags.has("m") ? run : records;
|
|
5933
5867
|
const acceptRecord = checking ? checkRecordAsync : (bytes) => {
|
|
5934
5868
|
targetList.push(bytes);
|
|
5935
5869
|
};
|
|
@@ -5945,121 +5879,7 @@ async function executeSortGeneral(context, preReadChunks) {
|
|
|
5945
5879
|
}
|
|
5946
5880
|
}
|
|
5947
5881
|
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
|
-
}
|
|
5882
|
+
const ordered = parsed.flags.has("m") ? await mergeSortRuns(runs, compare, work) : await sortRecords(records, compare, work);
|
|
6063
5883
|
let estBytes = 0;
|
|
6064
5884
|
let allCounted = true;
|
|
6065
5885
|
for (let i = 0; i < ordered.length; i++) {
|
|
@@ -6239,7 +6059,7 @@ async function executeCutGeneral(context) {
|
|
|
6239
6059
|
const canFastSliceCut = (byteSelection || mode === "c") && !complement && ranges.length <= 16;
|
|
6240
6060
|
const processFastSliceRange = (buf, lineStart, lineEnd) => {
|
|
6241
6061
|
const lineLen = lineEnd - lineStart;
|
|
6242
|
-
if (writer.remaining <= lineLen
|
|
6062
|
+
if (writer.remaining <= lineLen + (outputDelimiter !== void 0 ? Math.max(0, ranges.length - 1) * outDelimLen : 0) + 1) {
|
|
6243
6063
|
return null;
|
|
6244
6064
|
}
|
|
6245
6065
|
if (!byteSelection) {
|
|
@@ -6361,7 +6181,7 @@ async function executeCutGeneral(context) {
|
|
|
6361
6181
|
const wd = writer.writeByte(recordDelimiter);
|
|
6362
6182
|
if (wd) await wd;
|
|
6363
6183
|
};
|
|
6364
|
-
const pending = new
|
|
6184
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
6365
6185
|
try {
|
|
6366
6186
|
for await (const chunk of input(context, name)) {
|
|
6367
6187
|
let start = 0;
|
|
@@ -6415,12 +6235,12 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6415
6235
|
let ended = false;
|
|
6416
6236
|
let repeatedMethod = "none";
|
|
6417
6237
|
let groupMethod;
|
|
6418
|
-
const args = context.args.map((
|
|
6419
|
-
if (ended) return
|
|
6420
|
-
if (
|
|
6421
|
-
if (
|
|
6422
|
-
if (
|
|
6423
|
-
return
|
|
6238
|
+
const args = context.args.map((argument) => {
|
|
6239
|
+
if (ended) return argument;
|
|
6240
|
+
if (argument === "--") ended = true;
|
|
6241
|
+
if (argument === "--all-repeated") return "--all-repeated=none";
|
|
6242
|
+
if (argument === "--group") return "--group=separate";
|
|
6243
|
+
return argument;
|
|
6424
6244
|
});
|
|
6425
6245
|
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
6246
|
if (option === "D") repeatedMethod = "none";
|
|
@@ -6491,7 +6311,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6491
6311
|
}
|
|
6492
6312
|
return ignoreCase ? fold(result) : result;
|
|
6493
6313
|
};
|
|
6494
|
-
const
|
|
6314
|
+
const records = (async function* () {
|
|
6495
6315
|
let previous;
|
|
6496
6316
|
let previousKey;
|
|
6497
6317
|
let count = 0;
|
|
@@ -6557,7 +6377,7 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6557
6377
|
}
|
|
6558
6378
|
}
|
|
6559
6379
|
};
|
|
6560
|
-
const pending = new
|
|
6380
|
+
const pending = new RecordBuffer(bufferLimit);
|
|
6561
6381
|
try {
|
|
6562
6382
|
for await (const chunk of preReadSource ?? input(context, parsed.operands[0])) {
|
|
6563
6383
|
let start = 0;
|
|
@@ -6592,12 +6412,14 @@ async function executeUniqGeneral(context, preReadSource) {
|
|
|
6592
6412
|
while (flushChunks.length) yield flushChunks.shift();
|
|
6593
6413
|
if (outUsed > 0) yield outBuf.subarray(0, outUsed);
|
|
6594
6414
|
})();
|
|
6595
|
-
await emitRecords(context,
|
|
6415
|
+
await emitRecords(context, records, parsed.operands[1]);
|
|
6596
6416
|
return { exitCode: 0 };
|
|
6597
6417
|
}
|
|
6598
6418
|
function textCommands() {
|
|
6599
6419
|
return [
|
|
6600
6420
|
define("sort", (context) => {
|
|
6421
|
+
const collator = sortCollator(context.env);
|
|
6422
|
+
if (collator) return executeSortGeneral(context, void 0, collator);
|
|
6601
6423
|
if ((context.args.length === 0 || context.args.length === 1 && context.args[0] === "-r") && !hasYieldCheckpoint(context.signal) && SortRecordBudget.prototype.admit === defaultSortAdmit && Uint8Array === defaultUint8Array) {
|
|
6602
6424
|
const direction = context.args.length === 1 ? -1 : 1;
|
|
6603
6425
|
const req = assertInputRequirements(context, EMPTY_OPERANDS);
|
|
@@ -7039,7 +6861,7 @@ function textCommands() {
|
|
|
7039
6861
|
}
|
|
7040
6862
|
return executeCutGeneral(context);
|
|
7041
6863
|
})
|
|
7042
|
-
].map((
|
|
6864
|
+
].map((command) => ({ ...command, filesystemRequirements: command.name === "cut" ? inputRequirements : textOutputRequirements }));
|
|
7043
6865
|
}
|
|
7044
6866
|
async function executeSortFastAsync(context, direction, req) {
|
|
7045
6867
|
await req;
|
|
@@ -7269,7 +7091,7 @@ init_platform();
|
|
|
7269
7091
|
|
|
7270
7092
|
// packages/safe-bash/src/commands/shuf/index.ts
|
|
7271
7093
|
init_platform();
|
|
7272
|
-
import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as
|
|
7094
|
+
import { RandomIntegers, createShufCommand as createShufCommand2, createShufCommands as createShufCommands2, evalSyncShuf, settings as settings19, shufCommands as shufCommands2 } from "../../safe-bash-command-shuf/index.js";
|
|
7273
7095
|
|
|
7274
7096
|
// packages/safe-bash/src/commands/standard.ts
|
|
7275
7097
|
var defaultBaseStandardCommands;
|
|
@@ -7277,8 +7099,8 @@ var defaultTailStandardCommands;
|
|
|
7277
7099
|
function createStandardCommandsWithGrep(options2, grep) {
|
|
7278
7100
|
const commands = [];
|
|
7279
7101
|
const execute = directExecutor(options2.execute ?? (async (context) => {
|
|
7280
|
-
const
|
|
7281
|
-
if (
|
|
7102
|
+
const command = commands.find((definition) => definition.name === context.command);
|
|
7103
|
+
if (command) return command.execute(context);
|
|
7282
7104
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
7283
7105
|
return { exitCode: 127 };
|
|
7284
7106
|
}));
|
|
@@ -7328,8 +7150,8 @@ function createExtraAgentCommands(options2) {
|
|
|
7328
7150
|
}
|
|
7329
7151
|
function commandExecutor(lookup) {
|
|
7330
7152
|
return async (context) => {
|
|
7331
|
-
const
|
|
7332
|
-
if (
|
|
7153
|
+
const command = lookup(context.command);
|
|
7154
|
+
if (command) return command.execute(context);
|
|
7333
7155
|
await diagnostic(context, new PublicDiagnostic("command not found"));
|
|
7334
7156
|
return { exitCode: 127 };
|
|
7335
7157
|
};
|
|
@@ -7388,7 +7210,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
7388
7210
|
const defaults = getDefaultStatelessFamilies();
|
|
7389
7211
|
const aliasesGrep = executors.aliases === executors.grep ? grep[0] : createGrepCommands(executors.aliases, { ergonomicRegex: useErgonomicGrep })[0];
|
|
7390
7212
|
commands.push(
|
|
7391
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7213
|
+
...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
7214
|
...defaults.beforeAliases,
|
|
7393
7215
|
createRgCommand(executors.search, options2.search),
|
|
7394
7216
|
...createGrepAliases(aliasesGrep),
|
|
@@ -7415,7 +7237,7 @@ function composeRawAgentCommands(options2, executors, additionalCommands = []) {
|
|
|
7415
7237
|
const applyPatchLimits = options2.applyPatch?.limits;
|
|
7416
7238
|
const xmlLimits = options2.xml?.limits;
|
|
7417
7239
|
commands.push(
|
|
7418
|
-
...createStandardCommandsWithGrep({ execute: options2.execute ?? commandExecutor((name) => commands.find((
|
|
7240
|
+
...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
7241
|
...createTextProgramCommands({ ...options2.text }),
|
|
7420
7242
|
...createStructuredCommands({ ...options2.structured }),
|
|
7421
7243
|
createRgCommand(executors.search, options2.search),
|
|
@@ -7517,23 +7339,6 @@ export {
|
|
|
7517
7339
|
xxdCommands,
|
|
7518
7340
|
createByteCommands,
|
|
7519
7341
|
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
7342
|
createBcCommand,
|
|
7538
7343
|
createBcCommands,
|
|
7539
7344
|
bcCommands,
|