@jarkkojs/readseek-api 0.12.3 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +5 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2422,9 +2422,10 @@ function getBunSpawn() {
2422
2422
  return spawn;
2423
2423
  }
2424
2424
  async function readBoundedText(stream, streamName, maxOutputBytes, onOverflow) {
2425
- const reader = stream.getReader();
2425
+ const decoder = new TextDecoder;
2426
2426
  const chunks = [];
2427
2427
  let totalBytes = 0;
2428
+ const reader = stream.getReader();
2428
2429
  try {
2429
2430
  while (true) {
2430
2431
  const { done, value } = await reader.read();
@@ -2438,18 +2439,13 @@ async function readBoundedText(stream, streamName, maxOutputBytes, onOverflow) {
2438
2439
  });
2439
2440
  throw failureFromProcessResult({ stdout: "", stderr: "", exitCode: null, signal: null }, { overflow: streamName, maxOutputBytes });
2440
2441
  }
2441
- chunks.push(value);
2442
+ chunks.push(decoder.decode(value, { stream: true }));
2442
2443
  }
2443
2444
  } finally {
2444
2445
  reader.releaseLock();
2445
2446
  }
2446
- const bytes = new Uint8Array(totalBytes);
2447
- let offset = 0;
2448
- for (const chunk of chunks) {
2449
- bytes.set(chunk, offset);
2450
- offset += chunk.byteLength;
2451
- }
2452
- return new TextDecoder().decode(bytes);
2447
+ chunks.push(decoder.decode());
2448
+ return chunks.join("");
2453
2449
  }
2454
2450
  async function runReadSeekBun(binaryPath, args, options = {}) {
2455
2451
  const limits = resolveProcessLimits(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jarkkojs/readseek-api",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "description": "Shared ReadSeek CLI contract, validation, argv builders, and bounded process runners",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "vitest": "^4.1.0"
52
52
  },
53
53
  "dependencies": {
54
- "@jarkkojs/readseek": "^0.12.3",
54
+ "@jarkkojs/readseek": "^0.12.5",
55
55
  "@bgotink/kdl": "0.4.0",
56
56
  "@sinclair/typebox": "0.34.52"
57
57
  }