@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.
Files changed (83) hide show
  1. package/dist/image-ast/index.browser.js +3 -1
  2. package/dist/image-ast/index.js +3 -1
  3. package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
  4. package/dist/safe-bash/chunks/{chunk-SZH7EJLD.js → chunk-44ALJ4QG.js} +5461 -6495
  5. package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
  6. package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
  7. package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
  8. package/dist/safe-bash/chunks/chunk-7ZBU7KYV.js +14 -0
  9. package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
  10. package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
  11. package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
  12. package/dist/safe-bash/chunks/{chunk-45PK3NWI.js → chunk-GETUOD5D.js} +1 -1
  13. package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
  14. package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
  15. package/dist/safe-bash/chunks/{chunk-ICFDYV64.js → chunk-HZAMGT5I.js} +2 -2
  16. package/dist/safe-bash/chunks/chunk-KDNSPLII.js +83 -0
  17. package/dist/safe-bash/chunks/{chunk-PQRAK7HU.js → chunk-NQCM3TYR.js} +238 -462
  18. package/dist/safe-bash/chunks/{chunk-IVRQ4BXL.js → chunk-PH63PLPZ.js} +7 -7
  19. package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
  20. package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
  21. package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
  22. package/dist/safe-bash/chunks/{chunk-FNDNHAGE.js → chunk-RSTHLAF3.js} +1 -1
  23. package/dist/safe-bash/chunks/{chunk-7VNF5BFF.js → chunk-SHEMU2Z7.js} +83 -416
  24. package/dist/safe-bash/chunks/{chunk-NR3EM4LS.js → chunk-VKNVHEX3.js} +1 -6
  25. package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
  26. package/dist/safe-bash/chunks/{chunk-VQDD3G76.js → chunk-WDLGKIHD.js} +19 -19
  27. package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
  28. package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
  29. package/dist/safe-bash/command-chunks/{chunk-PCEFOYA3.js → chunk-6GWJUQAV.js} +3 -3
  30. package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
  31. package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
  32. package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
  33. package/dist/safe-bash/command-chunks/{chunk-CZ7EN3JG.js → chunk-VT6MJBEI.js} +1 -1
  34. package/dist/safe-bash/command-chunks/{chunk-F6OYH562.js → chunk-X54L3DBL.js} +4 -9
  35. package/dist/safe-bash/command-chunks/{chunk-TNOA7FCQ.js → chunk-YVNGTIJO.js} +1 -1
  36. package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
  37. package/dist/safe-bash/commands/archive/index.browser.js +36 -0
  38. package/dist/safe-bash/commands/column/index.browser.js +12 -0
  39. package/dist/safe-bash/commands/du/index.browser.js +14 -0
  40. package/dist/safe-bash/commands/expr/index.browser.js +12 -0
  41. package/dist/safe-bash/commands/file/index.browser.js +14 -0
  42. package/dist/safe-bash/commands/filesystem.js +9 -2
  43. package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
  44. package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
  45. package/dist/safe-bash/commands/metadata/index.browser.js +21 -0
  46. package/dist/safe-bash/commands/network/index.browser.js +1 -1
  47. package/dist/safe-bash/commands/node/index.browser.js +3 -3
  48. package/dist/safe-bash/commands/python/index.browser.js +8 -8
  49. package/dist/safe-bash/commands/regex-execution/public.browser.js +5 -3
  50. package/dist/safe-bash/commands/split/index.browser.js +14 -0
  51. package/dist/safe-bash/commands/stream-format/index.browser.js +11 -0
  52. package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
  53. package/dist/safe-bash/commands/streams.js +5 -5
  54. package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
  55. package/dist/safe-bash/commands/text.js +2 -133
  56. package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
  57. package/dist/safe-bash/commands/tree/index.browser.js +14 -0
  58. package/dist/safe-bash/full-core.browser.js +227 -218
  59. package/dist/safe-bash/jobs.browser.js +2 -2
  60. package/dist/safe-bash/optional-host.browser.js +8 -8
  61. package/dist/safe-bash/plugins/index.browser.js +23 -9
  62. package/dist/safe-bash/registry-entry.browser.js +23 -9
  63. package/dist/safe-bash/search.browser.js +48 -0
  64. package/dist/safe-bash/shell/runtime.d.ts +0 -9
  65. package/dist/safe-bash/shell/runtime.js +43 -308
  66. package/dist/safe-bash/shell/shell.js +0 -23
  67. package/dist/safe-bash/shell-entry.browser.js +19 -10
  68. package/dist/safe-bash-command-nl/index.js +1 -1
  69. package/dist/safe-bash-command-nl/nl.js +1 -1
  70. package/dist/safe-bash-command-rg/index.js +1 -1
  71. package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
  72. package/dist/safe-bash-command-rg/rg-command.js +3 -5
  73. package/dist/safe-bash-command-unexpand/index.js +1 -1
  74. package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
  75. package/dist/safe-bash-mcp/index.js +3 -1
  76. package/dist/safe-bash-regex-engine/index.js +4 -4
  77. package/dist/safe-bash-regex-engine/text/budget.d.ts +0 -1
  78. package/dist/safe-bash-regex-engine/text/budget.js +1 -1
  79. package/dist/safe-bash-regex-engine/text/regex.js +4 -4
  80. package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
  81. package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
  82. package/package.json +65 -10
  83. package/dist/safe-bash/chunks/{chunk-A7XEHALN.js → chunk-BJA5XNP6.js} +3 -3
@@ -1,10 +1,26 @@
1
+ import {
2
+ createOutputOperation,
3
+ sha256
4
+ } from "./chunk-HZAMGT5I.js";
5
+ import {
6
+ PythonFailure,
7
+ PythonInvocationError,
8
+ isPythonFailureCategory,
9
+ parsePythonInvocation,
10
+ pythonDirectoryEntries,
11
+ pythonExecution,
12
+ pythonImportMetadata,
13
+ pythonRuntimeRelocation,
14
+ pythonStatProjection,
15
+ pythonTreeCleanup,
16
+ reportPythonFailure
17
+ } from "./chunk-LVOBFF4D.js";
1
18
  import {
2
19
  openCommandFile
3
20
  } from "./chunk-I5HZ4FGE.js";
4
21
  import {
5
- createOutputOperation,
6
- sha256
7
- } from "./chunk-ICFDYV64.js";
22
+ validateExitCode
23
+ } from "./chunk-7R5BDCG7.js";
8
24
  import {
9
25
  FsError
10
26
  } from "./chunk-VTH3MLDU.js";
@@ -18,22 +34,6 @@ import {
18
34
  readBytes,
19
35
  writeBytes
20
36
  } from "./chunk-74GHTNJA.js";
21
- import {
22
- validateExitCode
23
- } from "./chunk-7R5BDCG7.js";
24
- import {
25
- PythonFailure,
26
- PythonInvocationError,
27
- isPythonFailureCategory,
28
- parsePythonInvocation,
29
- pythonDirectoryEntries,
30
- pythonExecution,
31
- pythonImportMetadata,
32
- pythonRuntimeRelocation,
33
- pythonStatProjection,
34
- pythonTreeCleanup,
35
- reportPythonFailure
36
- } from "./chunk-LVOBFF4D.js";
37
37
  import {
38
38
  pathOf
39
39
  } from "./chunk-E7OYNDGL.js";
@@ -0,0 +1,14 @@
1
+ import {
2
+ init_platform
3
+ } from "./chunk-B7TAL7S5.js";
4
+
5
+ // packages/safe-bash/src/commands/apply-patch/index.ts
6
+ init_platform();
7
+ import { applyPatchCommands, createApplyPatchCommand, createApplyPatchCommands, evalSyncApplyPatch } from "../../safe-bash-command-apply-patch/index.js";
8
+
9
+ export {
10
+ applyPatchCommands,
11
+ createApplyPatchCommand,
12
+ createApplyPatchCommands,
13
+ evalSyncApplyPatch
14
+ };
@@ -0,0 +1,49 @@
1
+ import {
2
+ registerDefaultExecutors
3
+ } from "./chunk-E7OYNDGL.js";
4
+ import {
5
+ init_platform
6
+ } from "./chunk-B7TAL7S5.js";
7
+
8
+ // packages/safe-bash/src/commands/time-env/index.ts
9
+ init_platform();
10
+
11
+ // packages/safe-bash/src/commands/time-env/printenv.ts
12
+ init_platform();
13
+ import { createPrintenvWithSettings } from "../../safe-bash-command-printenv/printenv.js";
14
+ import { evalSyncPrintenv } from "../../safe-bash-command-printenv/printenv.js";
15
+
16
+ // packages/safe-bash/src/commands/time-env/date.ts
17
+ init_platform();
18
+ import { createDateWithSettings } from "../../safe-bash-command-date/date.js";
19
+ import { evalSyncDate } from "../../safe-bash-command-date/date.js";
20
+
21
+ // packages/safe-bash/src/commands/time-env/sleep.ts
22
+ init_platform();
23
+ import { createSleepWithSettings } from "../../safe-bash-command-sleep/sleep.js";
24
+
25
+ // packages/safe-bash/src/commands/time-env/shared.ts
26
+ init_platform();
27
+ import { CommandFailure, checkSize, command, defaultSleepScheduler, emit, ownEnvironment, settings, timeEnvExecutorSettings } from "../../safe-bash-calendar-engine/time-env/shared.js";
28
+
29
+ // packages/safe-bash/src/commands/time-env/index.ts
30
+ function createTimeEnvCommands(options = {}) {
31
+ const configuration = settings(options);
32
+ return registerDefaultExecutors([createDateWithSettings(configuration), createSleepWithSettings(configuration), createPrintenvWithSettings(configuration)], options);
33
+ }
34
+ function timeEnvCommands(options = {}) {
35
+ const commands = createTimeEnvCommands(options);
36
+ return { name: "time-env-commands", setup(host) {
37
+ if (!options.replace) for (const definition of commands) {
38
+ if (host.commands.has(definition.name)) throw new Error(`Command already registered: ${definition.name}`);
39
+ }
40
+ for (const definition of commands) host.commands.register(definition, { replace: options.replace ?? false });
41
+ } };
42
+ }
43
+
44
+ export {
45
+ evalSyncPrintenv,
46
+ evalSyncDate,
47
+ createTimeEnvCommands,
48
+ timeEnvCommands
49
+ };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  ReplacementBuffer
3
- } from "./chunk-CZ7EN3JG.js";
3
+ } from "./chunk-VT6MJBEI.js";
4
4
  import {
5
5
  parseRustPattern
6
- } from "./chunk-TNOA7FCQ.js";
6
+ } from "./chunk-YVNGTIJO.js";
7
7
  import {
8
8
  ProgramError
9
- } from "./chunk-F6OYH562.js";
9
+ } from "./chunk-X54L3DBL.js";
10
10
  import {
11
11
  init_buffer
12
12
  } from "./chunk-HX3SHTCE.js";
@@ -104,6 +104,7 @@ function createNlWithSettings(limits) {
104
104
  current = section === 0 ? footer : section === 1 ? body : header;
105
105
  if (!parsed.flags.has("p")) number = start;
106
106
  if (canBatch) {
107
+ session.admitOutput(1);
107
108
  if (outUsed + 1 <= outBuf.length && flushedFirst && outUsed + 1 < 8192) {
108
109
  outBuf[outUsed++] = 10;
109
110
  return;
@@ -68,12 +68,15 @@ function createUnexpandWithSettings(limits) {
68
68
  const output = new ByteOutput(session);
69
69
  let column = 0, initial = true, active = true;
70
70
  let pendingStart = 0, pendingCount = 0, pendingTab = false;
71
- const flushBlanksSlow = async (startPos, convertSingle, firstWait) => {
71
+ const flushBlanksSlow = async (startPos, convertSingle, firstWait, stepCharged = false) => {
72
72
  await firstWait;
73
73
  let position = startPos;
74
74
  while (position < column) {
75
- const s = session.step();
76
- if (s) await s;
75
+ if (!stepCharged) {
76
+ const s = session.step();
77
+ if (s) await s;
78
+ }
79
+ stepCharged = false;
77
80
  const stop = nextTab(position);
78
81
  if (stop !== void 0 && stop <= column && (stop - position > 1 || convertSingle)) {
79
82
  const b = output.byte(9);
@@ -94,7 +97,7 @@ function createUnexpandWithSettings(limits) {
94
97
  const convertSingle = initial || pendingCount > 1 || pendingTab;
95
98
  while (position < column) {
96
99
  const s = session.step();
97
- if (s) return flushBlanksSlow(position, convertSingle, s);
100
+ if (s) return flushBlanksSlow(position, convertSingle, s, true);
98
101
  const stop = nextTab(position);
99
102
  if (stop !== void 0 && stop <= column && (stop - position > 1 || convertSingle)) {
100
103
  position = stop;
@@ -5,14 +5,14 @@ import {
5
5
  // packages/safe-bash-command-rg/src/rg-command.ts
6
6
  init_buffer();
7
7
  import { utf8ByteLength, bytesFrom } from "../../safe-bash-byte-engine/index.js";
8
- import { tryGetMemoryDirectoryEntryNamesSync, tryReadMemoryFileViewSync } from "@poe-platform/safe-fs/core";
8
+ import { tryReadMemoryFileViewSync } from "@poe-platform/safe-fs/core";
9
9
  import { assertCommandRequirements, collectBytes } from "../../safe-bash-contracts/index.js";
10
10
  import { hasYieldCheckpoint } from "../../safe-bash-contracts/yield.js";
11
11
  import { chargeRuntimeFileSystemOperation, getRuntimeBackingFileSystem } from "../../safe-bash-contracts/runtime-control.js";
12
12
  import { Matcher } from "../../safe-bash-search-engine/matcher.js";
13
13
  import { parse, ParsedArguments, SearchError } from "../../safe-bash-search-engine/options.js";
14
14
  import { data, elapsed, Printer, stats } from "../../safe-bash-search-engine/output.js";
15
- import { diagnostic, Limits, lineBatches, sharedOutBufGeneration, trySyncLineBatches, OutputClosed, pathFor } from "../../safe-bash-search-engine/shared.js";
15
+ import { diagnostic, Limits, lineBatches, trySyncLineBatches, OutputClosed, pathFor } from "../../safe-bash-search-engine/shared.js";
16
16
  import { Walker } from "../../safe-bash-search-engine/walk.js";
17
17
  import { RegexExecutionError, withRegexSession } from "../../safe-bash-regex-engine/execution/portable.js";
18
18
  import { inProcessRegexProviders } from "../../safe-bash-regex-engine/execution/protocol.js";
@@ -20,69 +20,10 @@ import { assertPathRequirements, requiredFileInput, searchRequirements } from ".
20
20
  import { RESOLVED_EXIT_ONE, RESOLVED_EXIT_ZERO } from "../../safe-bash-io-engine/internal.js";
21
21
  var EMPTY_RG_LINES = Object.freeze([]);
22
22
  var EMPTY_PATTERNS = Object.freeze([]);
23
- var EMPTY_SEARCH_OPTIONS = Object.freeze({});
24
23
  var DEFAULT_CWD_PATHS = Object.freeze(["."]);
25
24
  var DEFAULT_STDIN_PATHS = Object.freeze(["-"]);
26
25
  var defaultLimitsTick = Limits.prototype.tick;
27
26
  var sharedReadState = { bytesRead: 0, bytesSearched: 0, binaryOffset: null, skipped: false };
28
- var srcRefSlotMap = /* @__PURE__ */ new WeakMap();
29
- var srcRefCountMap = /* @__PURE__ */ new WeakMap();
30
- var srcRefCacheLiteral = new Uint8Array(0);
31
- var defaultDateNowRg = Date.now;
32
- var lastRgTreePattern = "";
33
- var lastRgTreePath = "";
34
- var lastRgTreeCwd = "";
35
- var lastRgTreeOutLen = -1;
36
- var lastRgTreeFound = false;
37
- var lastRgTreeGen = -1;
38
- var lastRgTreeDirNames = new Array(8).fill("");
39
- var lastRgTreeFileNames = new Array(64).fill("");
40
- function preverifyMemoryRgTree(fastMem) {
41
- const m = fastMem;
42
- if (m && m.root?.entries?.size === 1 && m.root.entries._keys?.[0] === "src" && lastRgTreeOutLen >= 0 && lastRgTreePath === "/src") {
43
- if (tryVerifyAndPopulate64Tree(fastMem, "/src", true)) {
44
- m._rgTreeVerifiedTick = m.mutationTick ?? 0;
45
- m._rgTreeVerifiedGen = lastRgTreeGen;
46
- }
47
- }
48
- }
49
- function tryVerifyAndPopulate64Tree(fastMem, rootPath, verifyOnly) {
50
- if (verifyOnly && rootPath === "/src" && fastMem._rgTreeVerifiedTick !== void 0 && fastMem._rgTreeVerifiedTick === (fastMem.mutationTick ?? -1) && fastMem._rgTreeVerifiedGen === lastRgTreeGen) {
51
- return true;
52
- }
53
- const rootEntries = tryGetMemoryDirectoryEntryNamesSync(fastMem, rootPath);
54
- if (!rootEntries || rootEntries._next !== 8 || rootEntries.size !== 8) return false;
55
- const rKeys = rootEntries._keys;
56
- const rVals = rootEntries._vals;
57
- for (let d = 0; d < 8; d++) {
58
- const dName = rKeys[d];
59
- if (verifyOnly) {
60
- if (dName !== lastRgTreeDirNames[d]) return false;
61
- } else {
62
- lastRgTreeDirNames[d] = dName;
63
- }
64
- const dObj = rVals[d];
65
- if (!dObj || dObj.type !== "directory" || dObj.mode === void 0 || (dObj.mode >> 6 & 4) !== 4) return false;
66
- const sub = dObj.entries;
67
- if (!sub || sub._next !== 8 || sub.size !== 8) return false;
68
- const sKeys = sub._keys;
69
- const sVals = sub._vals;
70
- const base = d << 3;
71
- for (let f = 0; f < 8; f++) {
72
- const slot = base | f;
73
- const fName = sKeys[f];
74
- if (verifyOnly) {
75
- if (fName !== lastRgTreeFileNames[slot]) return false;
76
- } else {
77
- lastRgTreeFileNames[slot] = fName;
78
- }
79
- const fObj = sVals[f];
80
- if (!fObj || fObj.type !== "file" || fObj.mode === void 0 || (fObj.mode >> 6 & 4) !== 4 || fObj.revision !== 0) return false;
81
- if (fObj.sourceRef === void 0 || srcRefSlotMap.get(fObj.sourceRef) !== slot) return false;
82
- }
83
- }
84
- return true;
85
- }
86
27
  var BATCH_SIZE_1 = () => 1;
87
28
  var BATCH_SIZE_128 = () => 128;
88
29
  var RETURN_TRUE = () => true;
@@ -114,6 +55,7 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
114
55
  const maxBytes = limits.hasFiniteMaxFileBytes ? limits.maxFileBytes : void 0;
115
56
  const view = target.memoryView ?? tryReadMemoryFileViewSync(backing, target.canonicalPath, maxBytes, context.signal);
116
57
  if (view === void 0) return void 0;
58
+ context.inputBudget?.check(view.byteLength);
117
59
  if (!args.hasInfiniteMaxCount && args.maxCount === 0) {
118
60
  totals.searches++;
119
61
  return false;
@@ -122,7 +64,7 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
122
64
  const needAll = args.replacement !== void 0 || args.onlyMatching || args.mode === "matches" || args.stats === true;
123
65
  const hasExtYield = hasYieldCheckpoint(context.signal);
124
66
  const lit = matcher.literalAsciiBytes;
125
- if (lit !== void 0 && !args.invert && args.replacement === void 0 && !args.onlyMatching && args.mode !== "matches" && !args.nullData && !args.crlf && binary === "skip" && args.hasInfiniteMaxCount !== false && !hasExtYield && (view.length <= limits.maxLineBytesSmi || view.length <= limits.maxLineBytes) && (target.sourceRef !== void 0 && srcRefSlotMap.get(target.sourceRef) === (totals.searches & 63) || view.indexOf(0) === -1)) {
67
+ if (lit !== void 0 && !args.invert && args.replacement === void 0 && !args.onlyMatching && args.mode !== "matches" && !args.nullData && !args.crlf && binary === "skip" && args.hasInfiniteMaxCount !== false && !hasExtYield && (view.length <= limits.maxLineBytesSmi || view.length <= limits.maxLineBytes) && view.indexOf(0) === -1) {
126
68
  const firstByte = lit[0];
127
69
  const litLen = lit.length;
128
70
  let matchedLines2 = 0;
@@ -130,43 +72,27 @@ function trySearchFileSync(context, args, limits, matcher, printer, target, file
130
72
  let bytesSearched2 = 0;
131
73
  if (!args.stats && !limits.hasExtYield && (args.mode === "count" || args.mode === "with" || args.mode === "without" || args.quiet) && lit.indexOf(10) === -1) {
132
74
  bytesSearched2 = view.length;
133
- const slot = totals.searches & 63;
134
- const srcRef = target.sourceRef;
135
- if (srcRefCacheLiteral.length !== litLen || !srcRefCacheLiteral.every((byte, index) => byte === lit[index])) {
136
- srcRefCacheLiteral = new Uint8Array(lit);
137
- srcRefSlotMap = /* @__PURE__ */ new WeakMap();
138
- srcRefCountMap = /* @__PURE__ */ new WeakMap();
139
- }
140
- if (srcRef !== void 0 && srcRefSlotMap.get(srcRef) === slot && args.mode === "count") {
141
- matchedLines2 = srcRefCountMap.get(srcRef);
142
- matchesCount2 = matchedLines2;
143
- } else {
144
- const searchEnd = view.length - litLen;
145
- let pos = 0;
146
- while (pos <= searchEnd) {
147
- const index = view.indexOf(firstByte, pos);
148
- if (index < 0 || index > searchEnd) break;
149
- let equal = true;
150
- for (let offset = 1; offset < litLen; offset++) {
151
- if (view[index + offset] !== lit[offset]) {
152
- equal = false;
153
- break;
154
- }
155
- }
156
- if (equal) {
157
- matchedLines2++;
158
- matchesCount2++;
159
- if (args.quiet || args.mode === "with" || args.mode === "without") break;
160
- const nl = view.indexOf(10, index + litLen);
161
- if (nl < 0) break;
162
- pos = nl + 1;
163
- } else {
164
- pos = index + 1;
75
+ const searchEnd = view.length - litLen;
76
+ let pos = 0;
77
+ while (pos <= searchEnd) {
78
+ const index = view.indexOf(firstByte, pos);
79
+ if (index < 0 || index > searchEnd) break;
80
+ let equal = true;
81
+ for (let offset = 1; offset < litLen; offset++) {
82
+ if (view[index + offset] !== lit[offset]) {
83
+ equal = false;
84
+ break;
165
85
  }
166
86
  }
167
- if (srcRef !== void 0 && args.mode === "count") {
168
- srcRefSlotMap.set(srcRef, slot);
169
- srcRefCountMap.set(srcRef, matchedLines2);
87
+ if (equal) {
88
+ matchedLines2++;
89
+ matchesCount2++;
90
+ if (args.quiet || args.mode === "with" || args.mode === "without") break;
91
+ const nl = view.indexOf(10, index + litLen);
92
+ if (nl < 0) break;
93
+ pos = nl + 1;
94
+ } else {
95
+ pos = index + 1;
170
96
  }
171
97
  }
172
98
  } else {
@@ -684,14 +610,6 @@ function tryExecuteRgFastSync(context, executor, options) {
684
610
  const limits = runner.limits;
685
611
  limits.resetForRun(context, options);
686
612
  limits.speculative = true;
687
- const cArgs = context.args;
688
- if (cArgs.length === 3 && cArgs[0] === "-c" && cArgs[1] === lastRgTreePattern && cArgs[2] === lastRgTreePath && context.cwd === lastRgTreeCwd && sharedOutBufGeneration === lastRgTreeGen && lastRgTreeOutLen >= 0 && Date.now === defaultDateNowRg && options.regexExecutor === void 0 && tryVerifyAndPopulate64Tree(fastMem, lastRgTreePath, true)) {
689
- committing = true;
690
- if (lastRgTreeOutLen === 0 || limits.flushCachedSharedSync(lastRgTreeOutLen)) {
691
- return lastRgTreeFound ? RESOLVED_EXIT_ZERO : RESOLVED_EXIT_ONE;
692
- }
693
- committing = false;
694
- }
695
613
  const args = parse(context.args, runner.args);
696
614
  if (args.help || args.version || args.patternFiles.length !== 0 || args.mode === "json" || !args.quiet && args.mode === "lines" || args.before > 0 || args.after > 0 || args.stats || args.globs.length !== 0 || args.types.length !== 0 || args.ignoreFiles && args.ignorePaths.length !== 0) {
697
615
  return void 0;
@@ -731,14 +649,6 @@ function tryExecuteRgFastSync(context, executor, options) {
731
649
  }
732
650
  return void 0;
733
651
  }
734
- if (cArgs.length === 3 && cArgs[0] === "-c" && totals.searches === 64 && limits.outPos >= 0 && Date.now === defaultDateNowRg && cArgs[2].charCodeAt(0) === 47 && tryVerifyAndPopulate64Tree(fastMem, cArgs[2], false)) {
735
- lastRgTreePattern = cArgs[1];
736
- lastRgTreePath = cArgs[2];
737
- lastRgTreeCwd = context.cwd;
738
- lastRgTreeOutLen = limits.outPos;
739
- lastRgTreeFound = runner.found;
740
- lastRgTreeGen = sharedOutBufGeneration;
741
- }
742
652
  committing = true;
743
653
  const flushRes = limits.flushSyncOrAsync();
744
654
  if (flushRes === void 0) return runner.found ? RESOLVED_EXIT_ZERO : RESOLVED_EXIT_ONE;
@@ -1128,7 +1038,6 @@ function createRgCommand(executor, options = {}) {
1128
1038
  }
1129
1039
 
1130
1040
  export {
1131
- preverifyMemoryRgTree,
1132
1041
  clearRgFastRunnerPool,
1133
1042
  createRgCommand
1134
1043
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProgramError
3
- } from "./chunk-F6OYH562.js";
3
+ } from "./chunk-X54L3DBL.js";
4
4
  import {
5
5
  init_buffer
6
6
  } from "./chunk-HX3SHTCE.js";
@@ -37,8 +37,7 @@ var Budget = class _Budget {
37
37
  this.remainingNum = this.unlimited ? 0 : rem;
38
38
  this.remainingSmi = !this.unlimited && rem <= 1073741823 ? rem | 0 : 1073741823;
39
39
  this.signal = context.signal;
40
- this.hasExtYield = hasYieldCheckpoint(context.signal);
41
- this.yieldTimes[0] = performance.now !== defaultPerfNow || this.hasExtYield ? monotonicNow() : -1;
40
+ this.yieldTimes[0] = monotonicNow();
42
41
  this.maxBufferBytes = options.maxBufferBytes ?? Infinity;
43
42
  if (context.signal.aborted) context.signal.throwIfAborted();
44
43
  if (!validatedTextProgramOptions.has(options)) {
@@ -60,7 +59,6 @@ var Budget = class _Budget {
60
59
  unlimited;
61
60
  signal;
62
61
  checkpoints = 0;
63
- hasExtYield = false;
64
62
  yieldTimes = new Float64Array(1);
65
63
  static acquire(context, options) {
66
64
  if (!pooledBudgetA) {
@@ -102,8 +100,7 @@ var Budget = class _Budget {
102
100
  this.remainingSmi = !this.unlimited && rem <= 1073741823 ? rem | 0 : 1073741823;
103
101
  this.signal = context.signal;
104
102
  this.checkpoints = 0;
105
- this.hasExtYield = hasYieldCheckpoint(context.signal);
106
- this.yieldTimes[0] = performance.now !== defaultPerfNow || this.hasExtYield ? monotonicNow() : -1;
103
+ this.yieldTimes[0] = monotonicNow();
107
104
  const nextMaxBuf = options.maxBufferBytes ?? Infinity;
108
105
  if (this.maxBufferBytes !== nextMaxBuf) this.maxBufferBytes = nextMaxBuf;
109
106
  }
@@ -135,11 +132,9 @@ var Budget = class _Budget {
135
132
  if ((count & 255) === 0) {
136
133
  return this.yieldCheckpointAsync();
137
134
  }
138
- if (performance.now !== defaultPerfNow || this.hasExtYield || (count & 63) === 0) {
135
+ if (performance.now !== defaultPerfNow || hasYieldCheckpoint(this.signal) || (count & 63) === 0) {
139
136
  const now = monotonicNow();
140
- if (this.yieldTimes[0] < 0) {
141
- this.yieldTimes[0] = now;
142
- } else if (now - this.yieldTimes[0] >= 25) {
137
+ if (now - this.yieldTimes[0] >= 25) {
143
138
  return this.yieldCheckpointAsync();
144
139
  }
145
140
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ProgramError
3
- } from "./chunk-F6OYH562.js";
3
+ } from "./chunk-X54L3DBL.js";
4
4
  import {
5
5
  init_buffer
6
6
  } from "./chunk-HX3SHTCE.js";
@@ -0,0 +1,14 @@
1
+ import {
2
+ applyPatchCommands,
3
+ createApplyPatchCommand,
4
+ createApplyPatchCommands,
5
+ evalSyncApplyPatch
6
+ } from "../../chunks/chunk-XAQMU6OY.js";
7
+ import "../../chunks/chunk-IWDICZVK.js";
8
+ import "../../chunks/chunk-B7TAL7S5.js";
9
+ export {
10
+ applyPatchCommands,
11
+ createApplyPatchCommand,
12
+ createApplyPatchCommands,
13
+ evalSyncApplyPatch
14
+ };
@@ -0,0 +1,36 @@
1
+ import {
2
+ DEFAULT_ARCHIVE_LIMITS,
3
+ archiveCommands,
4
+ createArchiveCommands,
5
+ createTarCommand,
6
+ createTarCommands,
7
+ createUnzipCommand,
8
+ createUnzipCommands,
9
+ createZipCommand,
10
+ createZipCommands,
11
+ evalSyncTar,
12
+ evalSyncUnzip,
13
+ evalSyncZip,
14
+ tarCommands,
15
+ unzipCommands,
16
+ zipCommands
17
+ } from "../../chunks/chunk-QGUV42T5.js";
18
+ import "../../chunks/chunk-IWDICZVK.js";
19
+ import "../../chunks/chunk-B7TAL7S5.js";
20
+ export {
21
+ DEFAULT_ARCHIVE_LIMITS,
22
+ archiveCommands,
23
+ createArchiveCommands,
24
+ createTarCommand,
25
+ createTarCommands,
26
+ createUnzipCommand,
27
+ createUnzipCommands,
28
+ createZipCommand,
29
+ createZipCommands,
30
+ evalSyncTar,
31
+ evalSyncUnzip,
32
+ evalSyncZip,
33
+ tarCommands,
34
+ unzipCommands,
35
+ zipCommands
36
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ columnCommands,
3
+ createColumnCommand,
4
+ createColumnCommands
5
+ } from "../../chunks/chunk-3HQU4OJO.js";
6
+ import "../../chunks/chunk-IWDICZVK.js";
7
+ import "../../chunks/chunk-B7TAL7S5.js";
8
+ export {
9
+ columnCommands,
10
+ createColumnCommand,
11
+ createColumnCommands
12
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createDuCommand,
3
+ createDuCommands,
4
+ duCommands,
5
+ evalSyncDu
6
+ } from "../../chunks/chunk-GEG3BWGE.js";
7
+ import "../../chunks/chunk-IWDICZVK.js";
8
+ import "../../chunks/chunk-B7TAL7S5.js";
9
+ export {
10
+ createDuCommand,
11
+ createDuCommands,
12
+ duCommands,
13
+ evalSyncDu
14
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ createExprCommand,
3
+ createExprCommands,
4
+ exprCommands
5
+ } from "../../chunks/chunk-HZ7BWKQ3.js";
6
+ import "../../chunks/chunk-IWDICZVK.js";
7
+ import "../../chunks/chunk-B7TAL7S5.js";
8
+ export {
9
+ createExprCommand,
10
+ createExprCommands,
11
+ exprCommands
12
+ };
@@ -0,0 +1,14 @@
1
+ import {
2
+ createFileCommand,
3
+ createFileCommands,
4
+ evalSyncFile,
5
+ fileCommands
6
+ } from "../../chunks/chunk-4BSJLKNM.js";
7
+ import "../../chunks/chunk-IWDICZVK.js";
8
+ import "../../chunks/chunk-B7TAL7S5.js";
9
+ export {
10
+ createFileCommand,
11
+ createFileCommands,
12
+ evalSyncFile,
13
+ fileCommands
14
+ };
@@ -577,10 +577,17 @@ export function filesystemCommands(maxDirectoryEntries, maxRecursiveDirectoryDep
577
577
  if (admitted) {
578
578
  const effectiveMode = backingMem.capabilities.permissions !== false ? 0o777 & ~umask : undefined;
579
579
  let allCreated = true;
580
+ ended = false;
580
581
  for (let i = 0; i < rawArgs.length; i++) {
581
582
  const a = rawArgs[i];
582
- if (a === "--" || a === "-p" || a === "--parents")
583
- continue;
583
+ if (!ended) {
584
+ if (a === "--") {
585
+ ended = true;
586
+ continue;
587
+ }
588
+ if (a === "-p" || a === "--parents")
589
+ continue;
590
+ }
584
591
  if (!backingMem.tryMkdirFastSync(pathOf(context, a), recursive, effectiveMode)) {
585
592
  allCreated = false;
586
593
  break;
@@ -0,0 +1,14 @@
1
+ import {
2
+ createEgrepCommand,
3
+ createFgrepCommand,
4
+ createGrepAliasCommands,
5
+ grepAliasCommands
6
+ } from "../../chunks/chunk-RRR7AQ24.js";
7
+ import "../../chunks/chunk-E7OYNDGL.js";
8
+ import "../../chunks/chunk-B7TAL7S5.js";
9
+ export {
10
+ createGrepAliasCommands,
11
+ createEgrepCommand as egrepCommand,
12
+ createFgrepCommand as fgrepCommand,
13
+ grepAliasCommands
14
+ };
@@ -0,0 +1,16 @@
1
+ import {
2
+ createHtmlToMarkdownCommand,
3
+ createHtmlToMarkdownCommands,
4
+ evalSyncHtmlToMarkdown,
5
+ evalSyncShuf,
6
+ htmlToMarkdownCommands
7
+ } from "../../chunks/chunk-DQP3VHSB.js";
8
+ import "../../chunks/chunk-IWDICZVK.js";
9
+ import "../../chunks/chunk-B7TAL7S5.js";
10
+ export {
11
+ createHtmlToMarkdownCommand,
12
+ createHtmlToMarkdownCommands,
13
+ evalSyncHtmlToMarkdown,
14
+ evalSyncShuf,
15
+ htmlToMarkdownCommands
16
+ };
@@ -0,0 +1,21 @@
1
+ import {
2
+ createMetadataCommands,
3
+ evalSyncMktemp,
4
+ evalSyncStat,
5
+ evalSyncTruncate,
6
+ metadataCommands
7
+ } from "../../chunks/chunk-VSAJ4OTM.js";
8
+ import "../../chunks/chunk-D3ANYGMC.js";
9
+ import "../../chunks/chunk-VTH3MLDU.js";
10
+ import "../../chunks/chunk-NZQXYWA3.js";
11
+ import "../../chunks/chunk-74GHTNJA.js";
12
+ import "../../chunks/chunk-E7OYNDGL.js";
13
+ import "../../chunks/chunk-IWDICZVK.js";
14
+ import "../../chunks/chunk-B7TAL7S5.js";
15
+ export {
16
+ createMetadataCommands,
17
+ evalSyncMktemp,
18
+ evalSyncStat,
19
+ evalSyncTruncate,
20
+ metadataCommands
21
+ };
@@ -13,8 +13,8 @@ import {
13
13
  evalSyncWget,
14
14
  networkCommands
15
15
  } from "../../chunks/chunk-K6VCD7IY.js";
16
- import "../../chunks/chunk-IWDICZVK.js";
17
16
  import "../../chunks/chunk-E7OYNDGL.js";
17
+ import "../../chunks/chunk-IWDICZVK.js";
18
18
  import "../../chunks/chunk-B7TAL7S5.js";
19
19
  export {
20
20
  CurlError,
@@ -2,13 +2,13 @@ import {
2
2
  createSafeJsNodeCommand,
3
3
  createSafeJsNodeCommands,
4
4
  safeJsNodeCommands
5
- } from "../../chunks/chunk-FNDNHAGE.js";
6
- import "../../chunks/chunk-IVRQ4BXL.js";
5
+ } from "../../chunks/chunk-RSTHLAF3.js";
6
+ import "../../chunks/chunk-PH63PLPZ.js";
7
7
  import "../../chunks/chunk-D3ANYGMC.js";
8
8
  import "../../chunks/chunk-NZQXYWA3.js";
9
9
  import "../../chunks/chunk-74GHTNJA.js";
10
- import "../../chunks/chunk-IWDICZVK.js";
11
10
  import "../../chunks/chunk-E7OYNDGL.js";
11
+ import "../../chunks/chunk-IWDICZVK.js";
12
12
  import "../../chunks/chunk-B7TAL7S5.js";
13
13
  export {
14
14
  createSafeJsNodeCommand as createNodeCommand,