@inixiative/archive 0.5.0 → 0.5.1

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/package.json +2 -2
  2. package/src/agents.ts +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inixiative/archive",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "@biomejs/biome": "2.5.2",
39
- "@inixiative/config": "^0.5.38",
39
+ "@inixiative/config": "^0.5.39",
40
40
  "@types/bun": "1.4.2",
41
41
  "lefthook": "2.1.9",
42
42
  "typescript": "6.0.3"
package/src/agents.ts CHANGED
@@ -357,7 +357,9 @@ function lastEntry(file: string) {
357
357
  const buffer = Buffer.alloc(Math.min(size, 65_536));
358
358
  readSync(fd, buffer, 0, buffer.length, size - buffer.length);
359
359
  const lines = buffer.toString('utf8').trimEnd().split('\n');
360
- const start = lines.findLastIndex((line) => line === '{' || line === '[');
360
+ // Source ships to consumers compiled against older libs, so no findLastIndex.
361
+ let start = lines.length - 1;
362
+ while (start >= 0 && lines[start] !== '{' && lines[start] !== '[') start--;
361
363
  if (start >= 0)
362
364
  try {
363
365
  return JSON.stringify(JSON.parse(lines.slice(start).join('\n'))).slice(0, 500);