@poe-platform/safe-bash 0.1.749 → 0.1.750

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.
@@ -62907,6 +62907,40 @@ var BiffOutput = class {
62907
62907
  this.length += bytes.length;
62908
62908
  return at;
62909
62909
  }
62910
+ /** Keep tokens/elements intact; oversized UTF-16 array strings carry width flags. */
62911
+ continuedRecord(opcode, payload, boundaries, strings = []) {
62912
+ const at = this.length;
62913
+ let offset = 0, next = 0, stringIndex = 0;
62914
+ do {
62915
+ while (strings[stringIndex] && strings[stringIndex].end <= offset) stringIndex++;
62916
+ const continuedString = strings[stringIndex] && strings[stringIndex].start < offset;
62917
+ const prefix2 = continuedString ? 1 : 0;
62918
+ const maximum = Math.min(payload.length, offset + this.maximumRecord - prefix2);
62919
+ let end2 = maximum;
62920
+ if (boundaries && maximum < payload.length) {
62921
+ end2 = offset;
62922
+ while (next < boundaries.length && boundaries[next] <= maximum) end2 = boundaries[next++];
62923
+ let candidate = stringIndex;
62924
+ while (strings[candidate] && strings[candidate].end <= maximum) candidate++;
62925
+ const string = strings[candidate];
62926
+ if (string && string.end - string.start + 4 > this.maximumRecord && string.start < maximum && maximum < string.end) {
62927
+ const characterEnd = maximum - (maximum - string.start) % 2;
62928
+ if (characterEnd > string.start) end2 = Math.max(end2, characterEnd);
62929
+ }
62930
+ if (end2 <= offset) throw new SsconvertError("unsupported-feature", "Excel BIFF formula token is too large");
62931
+ }
62932
+ let part = payload.subarray(offset, end2);
62933
+ if (prefix2) {
62934
+ const continued = new Uint8Array(part.length + 1);
62935
+ continued[0] = 1;
62936
+ continued.set(part, 1);
62937
+ part = continued;
62938
+ }
62939
+ this.record(offset === 0 ? opcode : 60, part);
62940
+ offset = end2;
62941
+ } while (offset < payload.length);
62942
+ return at;
62943
+ }
62910
62944
  finish() {
62911
62945
  this.context.signal.throwIfAborted();
62912
62946
  const bytes = new Uint8Array(this.length);
@@ -75035,7 +75069,6 @@ var BiffFormulaWriter = class {
75035
75069
  macroNames = [];
75036
75070
  workbookIndices = /* @__PURE__ */ new Map();
75037
75071
  linkIndices = /* @__PURE__ */ new Map();
75038
- uniqueNameId = 0;
75039
75072
  relocations = [];
75040
75073
  externalBook(workbook) {
75041
75074
  let index2 = this.workbookIndices.get(workbook);
@@ -75156,6 +75189,11 @@ var BiffFormulaWriter = class {
75156
75189
  const relative = definition !== void 0;
75157
75190
  const root = definition ? parseNamedExpression(definition, this.book, parse3, () => this.context.signal.throwIfAborted()) : parse3(source, { sheet, row, column });
75158
75191
  const bytes = [], arrays = [], diagnostics = [];
75192
+ const tokenBoundaries = [], arrayBoundaries = [];
75193
+ const arrayStrings = [];
75194
+ const boundary = () => {
75195
+ if (bytes.length && tokenBoundaries.at(-1) !== bytes.length) tokenBoundaries.push(bytes.length);
75196
+ };
75159
75197
  let sheetLossReported = false;
75160
75198
  const relocations = [];
75161
75199
  const push = (part, target = bytes) => {
@@ -75198,12 +75236,14 @@ var BiffFormulaWriter = class {
75198
75236
  push([23]);
75199
75237
  push(biffString(text2, this.revision, this.context, 1));
75200
75238
  if (index2) push([8]);
75239
+ boundary();
75201
75240
  });
75202
75241
  if (chunks.length > 1) push([21]);
75203
75242
  }
75204
75243
  };
75205
75244
  const visit = (node3) => {
75206
75245
  this.context.signal.throwIfAborted();
75246
+ boundary();
75207
75247
  if (node3.kind === "literal") literal2(node3.value);
75208
75248
  else if (node3.kind === "omitted") push([22]);
75209
75249
  else if (node3.kind === "parentheses") {
@@ -75356,24 +75396,15 @@ var BiffFormulaWriter = class {
75356
75396
  push([28, 29]);
75357
75397
  return;
75358
75398
  }
75359
- if (node3.sheet !== void 0 && scope !== void 0) {
75360
- const data4 = new Uint8Array(this.revision === 8 ? 7 : 25), view2 = new DataView(data4.buffer);
75399
+ if (node3.sheet !== void 0 && scope !== void 0 && this.revision === 8) {
75400
+ const data4 = new Uint8Array(7), view2 = new DataView(data4.buffer);
75361
75401
  data4[0] = 89;
75362
75402
  const scopeIndex = this.book.sheets.indexOf(scope);
75363
- if (this.revision === 8) {
75364
- const externalIndex = this.sheetLink(void 0, scopeIndex, scopeIndex);
75365
- relocations.push({ offset: bytes.length + 1, index: externalIndex, kind: "sheet" });
75366
- view2.setUint16(1, externalIndex, true);
75367
- view2.setUint16(3, index2 + 1, true);
75368
- } else {
75369
- const externalIndex = current === scope ? this.book.sheets.length + 1 : scopeIndex;
75370
- view2.setInt16(1, -(externalIndex + 1), true);
75371
- view2.setUint16(9, 1, true);
75372
- view2.setUint16(11, index2 + 1, true);
75373
- view2.setUint16(19, 15, true);
75374
- view2.setUint32(21, ++this.uniqueNameId, true);
75375
- }
75376
- relocations.push({ offset: bytes.length + (this.revision === 8 ? 3 : 11), index: index2, kind: "name" });
75403
+ const externalIndex = this.sheetLink(void 0, scopeIndex, scopeIndex);
75404
+ relocations.push({ offset: bytes.length + 1, index: externalIndex, kind: "sheet" });
75405
+ view2.setUint16(1, externalIndex, true);
75406
+ view2.setUint16(3, index2 + 1, true);
75407
+ relocations.push({ offset: bytes.length + 3, index: index2, kind: "name" });
75377
75408
  push(data4);
75378
75409
  } else {
75379
75410
  const data4 = new Uint8Array(this.revision === 8 ? 5 : 15);
@@ -75431,12 +75462,15 @@ var BiffFormulaWriter = class {
75431
75462
  if (!columns || columns > 256 || node3.rows.length > 65536) throw new SsconvertError("unsupported-feature", "Excel BIFF array dimensions exceed limits");
75432
75463
  push([64, ...new Uint8Array(7)]);
75433
75464
  push([this.revision === 8 ? columns - 1 : columns & 255, ...words(node3.rows.length - (this.revision === 8 ? 1 : 0))], arrays);
75465
+ arrayBoundaries.push(arrays.length);
75434
75466
  for (const arrayRow of node3.rows) for (const item of arrayRow) {
75435
75467
  if (item.kind !== "literal") throw new SsconvertError("unsupported-feature", "Excel BIFF array requires literals");
75436
75468
  const value3 = item.value;
75437
75469
  if (value3.kind === "string") {
75470
+ const start = arrays.length + 4;
75438
75471
  push([2], arrays);
75439
75472
  push(biffString(value3.value, this.revision, this.context, this.revision === 8 ? 2 : 1), arrays);
75473
+ if (this.revision === 8 && arrays.length > start) arrayStrings.push({ start, end: arrays.length });
75440
75474
  } else {
75441
75475
  const data4 = new Uint8Array(9), view2 = new DataView(data4.buffer);
75442
75476
  data4[0] = value3.kind === "number" ? 1 : value3.kind === "boolean" ? 4 : value3.kind === "error" ? 16 : 0;
@@ -75445,15 +75479,23 @@ var BiffFormulaWriter = class {
75445
75479
  else if (value3.kind === "error") data4[1] = biffError(value3.value);
75446
75480
  push(data4, arrays);
75447
75481
  }
75482
+ arrayBoundaries.push(arrays.length);
75448
75483
  }
75449
75484
  }
75485
+ boundary();
75450
75486
  };
75451
75487
  visit(root);
75488
+ boundary();
75489
+ if (bytes.length > 65535)
75490
+ throw new SsconvertError("unsupported-feature", "Excel BIFF formula token length exceeds version limits");
75452
75491
  const tokens3 = new Uint8Array(bytes);
75453
75492
  for (const relocation of relocations) this.relocations.push({ ...relocation, tokens: tokens3 });
75454
75493
  return {
75455
75494
  tokens: tokens3,
75495
+ tokenBoundaries,
75456
75496
  arrays: new Uint8Array(arrays),
75497
+ arrayBoundaries,
75498
+ arrayStrings,
75457
75499
  diagnostics,
75458
75500
  nameDependencies: relocations.filter((relocation) => relocation.kind === "name").map((relocation) => relocation.index)
75459
75501
  };
@@ -76046,7 +76088,10 @@ async function writeBiffStream(book, revision2, dual, context2, filepass) {
76046
76088
  if (group) {
76047
76089
  formulas.set(cell, {
76048
76090
  tokens: new Uint8Array([dataTables.has(group) ? 2 : 1, ...words(group.range.startRow, group.range.startColumn)]),
76091
+ tokenBoundaries: [5],
76049
76092
  arrays: new Uint8Array(),
76093
+ arrayBoundaries: [],
76094
+ arrayStrings: [],
76050
76095
  diagnostics: [],
76051
76096
  nameDependencies: []
76052
76097
  });
@@ -76136,8 +76181,22 @@ async function writeBiffStream(book, revision2, dual, context2, filepass) {
76136
76181
  header4[3] = text2[0];
76137
76182
  view3.setUint16(4, formula3.tokens.length, true);
76138
76183
  const scope = name5.sheet === void 0 ? 0 : book.sheets.findIndex((sheet) => sheet.id === name5.sheet) + 1;
76139
- view3.setUint16(revision2 === 8 ? 8 : 6, scope, true);
76140
- output2.record(24, join(join(header4, text2.subarray(1)), join(formula3.tokens, formula3.arrays)));
76184
+ if (revision2 === 7 && scope) view3.setUint16(6, scope - 1, true);
76185
+ view3.setUint16(8, scope, true);
76186
+ const start = header4.length + text2.length - 1;
76187
+ output2.continuedRecord(
76188
+ 24,
76189
+ join(join(header4, text2.subarray(1)), join(formula3.tokens, formula3.arrays)),
76190
+ [
76191
+ start,
76192
+ ...formula3.tokenBoundaries.map((offset) => offset + start),
76193
+ ...formula3.arrayBoundaries.map((offset) => offset + start + formula3.tokens.length)
76194
+ ],
76195
+ formula3.arrayStrings.map((span2) => ({
76196
+ start: start + formula3.tokens.length + span2.start,
76197
+ end: start + formula3.tokens.length + span2.end
76198
+ }))
76199
+ );
76141
76200
  }
76142
76201
  if (revision2 === 8) {
76143
76202
  metadata3.global(output2);
@@ -76191,7 +76250,19 @@ async function writeBiffStream(book, revision2, dual, context2, filepass) {
76191
76250
  view3.setUint16(12, formula3.tokens.length, true);
76192
76251
  data4.set(formula3.tokens, 14);
76193
76252
  data4.set(formula3.arrays, 14 + formula3.tokens.length);
76194
- output2.record(545, data4);
76253
+ output2.continuedRecord(
76254
+ 545,
76255
+ data4,
76256
+ [
76257
+ 14,
76258
+ ...formula3.tokenBoundaries.map((offset) => offset + 14),
76259
+ ...formula3.arrayBoundaries.map((offset) => offset + 14 + formula3.tokens.length)
76260
+ ],
76261
+ formula3.arrayStrings.map((span2) => ({
76262
+ start: 14 + formula3.tokens.length + span2.start,
76263
+ end: 14 + formula3.tokens.length + span2.end
76264
+ }))
76265
+ );
76195
76266
  }
76196
76267
  }
76197
76268
  const cached = cell.cachedResult ?? cell.value;
@@ -76273,7 +76344,19 @@ async function writeCell(output2, cell, xf, revision2, strings, context2, formul
76273
76344
  view2.setUint16(20, formula3.tokens.length, true);
76274
76345
  data4.set(formula3.tokens, 22);
76275
76346
  data4.set(formula3.arrays, 22 + formula3.tokens.length);
76276
- output2.record(6, data4);
76347
+ output2.continuedRecord(
76348
+ 6,
76349
+ data4,
76350
+ [
76351
+ 22,
76352
+ ...formula3.tokenBoundaries.map((offset) => offset + 22),
76353
+ ...formula3.arrayBoundaries.map((offset) => offset + 22 + formula3.tokens.length)
76354
+ ],
76355
+ formula3.arrayStrings.map((span2) => ({
76356
+ start: 22 + formula3.tokens.length + span2.start,
76357
+ end: 22 + formula3.tokens.length + span2.end
76358
+ }))
76359
+ );
76277
76360
  return;
76278
76361
  }
76279
76362
  if (value3.kind === "number") {
@@ -77204,6 +77287,33 @@ async function readBiff(borrowed, context2, encoding) {
77204
77287
  while (records[index2 + 1]?.opcode === 60) parts.push(records[++index2].data);
77205
77288
  return { parts, next: index2 };
77206
77289
  };
77290
+ const formulaParts = (index2, offset, length) => {
77291
+ const first = records[index2].data;
77292
+ let tokens3;
77293
+ if (offset + length <= first.bytes.length) {
77294
+ tokens3 = first.slice(offset, length);
77295
+ offset += length;
77296
+ } else {
77297
+ accountFormulaWork(length);
77298
+ tokens3 = new Uint8Array(length);
77299
+ let written = 0;
77300
+ while (written < length) {
77301
+ context2.signal.throwIfAborted();
77302
+ const part = records[index2].data;
77303
+ const count = Math.min(length - written, part.bytes.length - offset);
77304
+ tokens3.set(part.slice(offset, count), written);
77305
+ written += count;
77306
+ offset += count;
77307
+ if (written < length) {
77308
+ if (records[index2 + 1]?.opcode !== 60) invalidBiff("truncated formula tokens/CONTINUE");
77309
+ index2++;
77310
+ offset = 0;
77311
+ }
77312
+ }
77313
+ }
77314
+ const extra = stringParts(index2, offset);
77315
+ return { tokens: tokens3, arrays: extra.parts, next: extra.next };
77316
+ };
77207
77317
  for (let index2 = 0; index2 < records.length; index2++) {
77208
77318
  context2.signal.throwIfAborted();
77209
77319
  const record7 = records[index2], data4 = record7.data, opcode = record7.opcode;
@@ -77402,13 +77512,12 @@ async function readBiff(borrowed, context2, encoding) {
77402
77512
  const name5 = accountText(ver >= 8 ? cursor.unicode(length).text : cursor.legacy(length));
77403
77513
  const end2 = 7 + cursor.consumedBytes;
77404
77514
  const tokenLength = end2 + 2 <= data4.bytes.length ? data4.u16(end2) : 0;
77405
- const tokens3 = tokenLength ? data4.slice(end2 + 2, tokenLength) : new Uint8Array();
77515
+ const formula4 = tokenLength ? formulaParts(index2, end2 + 2, tokenLength) : { tokens: new Uint8Array(), arrays: [], next: index2 };
77406
77516
  const legacyLink = (sheet?.legacyExternalLinks ?? legacyExternalLinks).get((sheet?.legacyExternalSheets ?? legacyExternalSheets).length - 1);
77407
77517
  const table10 = ver >= 8 ? supbooks.at(-1)?.names : legacyLink?.names;
77408
77518
  if (!table10) invalidBiff("EXTERNNAME without workbook link");
77409
- const arrays = tokenLength ? stringParts(index2, end2 + 2 + tokenLength) : { parts: [], next: index2 };
77410
- index2 = arrays.next;
77411
- table10.push({ name: name5, sheetIndex: data4.u16(2), tokens: tokens3, arrays: arrays.parts, revision: ver, codepage, supported: flags2 === 0, record: record7 });
77519
+ index2 = formula4.next;
77520
+ table10.push({ name: name5, sheetIndex: data4.u16(2), tokens: formula4.tokens, arrays: formula4.arrays, revision: ver, codepage, supported: flags2 === 0, record: record7 });
77412
77521
  const addin = ver >= 8 ? supbooks.at(-1)?.kind === "addin" : legacyLink?.addin;
77413
77522
  const externalIdentity = (ver >= 8 ? supbooks.at(-1)?.workbook : legacyLink?.workbook) !== void 0 && flags2 === 0;
77414
77523
  if (!addin || flags2 !== 0) await retain(record7, sheet?.unsupportedRecords ?? unsupported10, !externalIdentity);
@@ -77438,7 +77547,9 @@ async function readBiff(borrowed, context2, encoding) {
77438
77547
  }
77439
77548
  if (opcode === 24 || opcode === 536) {
77440
77549
  const flags2 = data4.u16(0), length = data4.u8(3), tokenLength = ver === 2 ? data4.u8(4) : data4.u16(4);
77441
- const start = ver >= 7 ? 14 : ver >= 3 ? 6 : 5, sheetIndex = ver >= 8 ? data4.u16(8) : ver >= 7 ? data4.u16(6) : 0;
77550
+ const start = ver >= 7 ? 14 : ver >= 3 ? 6 : 5;
77551
+ const scopeIsWorksheet = ver >= 8 || ver >= 7 && data4.u16(8) !== 0;
77552
+ const sheetIndex = scopeIsWorksheet ? data4.u16(8) : ver >= 7 ? data4.u16(6) : 0;
77442
77553
  const cursor = new BiffStrings([new Binary(data4.slice(start, data4.bytes.length - start))], context2, codepage);
77443
77554
  let name5;
77444
77555
  if (flags2 & 32 && length) {
@@ -77462,10 +77573,20 @@ async function readBiff(borrowed, context2, encoding) {
77462
77573
  ][builtin];
77463
77574
  name5 = (base ?? `_BIFF_BUILTIN_${builtin}`) + text2.slice(1);
77464
77575
  } else name5 = ver >= 8 ? cursor.unicode(length).text : cursor.legacy(length);
77465
- const tokens3 = data4.slice(start + cursor.consumedBytes, tokenLength);
77466
- const arrays = stringParts(index2, start + cursor.consumedBytes + tokenLength);
77467
- index2 = arrays.next;
77468
- names2.push({ name: accountText(name5), flags: flags2, tokens: tokens3, arrays: arrays.parts, sheetIndex, revision: ver, codepage, record: record7, ...sheet ? { owner: sheet } : {} });
77576
+ const formula4 = formulaParts(index2, start + cursor.consumedBytes, tokenLength);
77577
+ index2 = formula4.next;
77578
+ names2.push({
77579
+ name: accountText(name5),
77580
+ flags: flags2,
77581
+ tokens: formula4.tokens,
77582
+ arrays: formula4.arrays,
77583
+ sheetIndex,
77584
+ scopeIsWorksheet,
77585
+ revision: ver,
77586
+ codepage,
77587
+ record: record7,
77588
+ ...sheet ? { owner: sheet } : {}
77589
+ });
77469
77590
  continue;
77470
77591
  }
77471
77592
  if (ignoredOpcodes.has(opcode)) continue;
@@ -77539,13 +77660,15 @@ async function readBiff(borrowed, context2, encoding) {
77539
77660
  if (kind > 3) invalidBiff("invalid formula cache tag");
77540
77661
  }
77541
77662
  lastFormula = addCell(sheet, data4, value3, { cachedResult: value3, formulaDirty: !!(data4.u16(14) & 3) });
77542
- lastFormula.tokens = data4.slice(tokenStart, tokenLength);
77543
- const arrays = stringParts(index2, tokenStart + tokenLength);
77544
- index2 = arrays.next;
77545
- lastFormula.arrays = arrays.parts;
77663
+ const formula4 = formulaParts(index2, tokenStart, tokenLength);
77664
+ index2 = formula4.next;
77665
+ lastFormula.tokens = formula4.tokens;
77666
+ lastFormula.arrays = formula4.arrays;
77546
77667
  const nextOpcode = records[index2 + 1]?.opcode;
77547
77668
  const groupFollows = nextOpcode === 1212 || nextOpcode === 33 || nextOpcode === 545 || nextOpcode === 54 || nextOpcode === 55 || nextOpcode === 566;
77548
- const stringOpcode = records[index2 + (groupFollows ? 2 : 1)]?.opcode;
77669
+ let stringIndex = index2 + (groupFollows ? 2 : 1);
77670
+ if (groupFollows) while (records[stringIndex]?.opcode === 60) stringIndex++;
77671
+ const stringOpcode = records[stringIndex]?.opcode;
77549
77672
  if (stringCache2 && stringOpcode !== 7 && stringOpcode !== 519) {
77550
77673
  const error3 = { kind: "error", value: "MISSING STRING" };
77551
77674
  lastFormula.cell = { ...lastFormula.cell, value: error3, cachedResult: error3 };
@@ -77585,10 +77708,17 @@ async function readBiff(borrowed, context2, encoding) {
77585
77708
  }
77586
77709
  const kind = opcode === 1212 ? "shared" : "array";
77587
77710
  const start = kind === "shared" ? 10 : ver === 2 ? 8 : ver <= 4 ? 10 : 14;
77588
- const tokens3 = data4.slice(start, ver === 2 && kind === "array" ? data4.u8(start - 1) : data4.u16(start - 2));
77589
- const arrays = stringParts(index2, start + tokens3.length);
77590
- index2 = arrays.next;
77591
- sheet.groups.push({ id: `biff-${sheet.offset}-${record7.offset}`, kind, range: range5, tokens: tokens3, arrays: arrays.parts, keyRow: lastFormula.cell.row, keyColumn: lastFormula.cell.column });
77711
+ const formula4 = formulaParts(index2, start, ver === 2 && kind === "array" ? data4.u8(start - 1) : data4.u16(start - 2));
77712
+ index2 = formula4.next;
77713
+ sheet.groups.push({
77714
+ id: `biff-${sheet.offset}-${record7.offset}`,
77715
+ kind,
77716
+ range: range5,
77717
+ tokens: formula4.tokens,
77718
+ arrays: formula4.arrays,
77719
+ keyRow: lastFormula.cell.row,
77720
+ keyColumn: lastFormula.cell.column
77721
+ });
77592
77722
  continue;
77593
77723
  }
77594
77724
  if (opcode === 7 || opcode === 519) {
@@ -77696,7 +77826,7 @@ async function readBiff(borrowed, context2, encoding) {
77696
77826
  const localSheets = sheets.map((sheet) => sheet.name);
77697
77827
  const nameSheets = names2.map((name5) => {
77698
77828
  if (!name5.sheetIndex) return void 0;
77699
- return (name5.revision >= 8 ? sheets[name5.sheetIndex - 1]?.name : (name5.owner?.legacyExternalSheets ?? legacyExternalSheets)[name5.sheetIndex - 1]) ?? void 0;
77829
+ return (name5.scopeIsWorksheet ? sheets[name5.sheetIndex - 1]?.name : (name5.owner?.legacyExternalSheets ?? legacyExternalSheets)[name5.sheetIndex - 1]) ?? void 0;
77700
77830
  });
77701
77831
  const externalNameTables = /* @__PURE__ */ new Map();
77702
77832
  const formulaNames = names2.map((name5) => name5.name);
@@ -164478,4 +164608,4 @@ tslib/tslib.js:
164478
164608
  @noble/ciphers/utils.js:
164479
164609
  (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
164480
164610
  */
164481
- //# sourceMappingURL=chunk-BQEH4DKJ.js.map
164611
+ //# sourceMappingURL=chunk-U7DRVFRD.js.map
@@ -81,7 +81,7 @@ import {
81
81
  updateWorkbook,
82
82
  validSheetSize,
83
83
  visitFormula
84
- } from "./chunk-BQEH4DKJ.js";
84
+ } from "./chunk-U7DRVFRD.js";
85
85
  import "./chunk-CVAVQZSF.js";
86
86
  import "./chunk-RCM5PZBN.js";
87
87
  import "./chunk-LSRHLNCR.js";
@@ -171,4 +171,4 @@ export {
171
171
  validSheetSize,
172
172
  visitFormula
173
173
  };
174
- //# sourceMappingURL=src-YBSQFQZO.js.map
174
+ //# sourceMappingURL=src-YKSQQDD3.js.map
@@ -84,7 +84,7 @@ export function basicCommands() {
84
84
  return { exitCode: 0 };
85
85
  }),
86
86
  define("basename", async (context) => {
87
- const parsed = options(context.args, "as:z", { multiple: "a", suffix: "s", zero: "z" });
87
+ const parsed = options(context.args, "as:z", { multiple: "a", suffix: "s", zero: "z" }, true);
88
88
  const multiple = parsed.flags.has("a") || parsed.flags.has("s");
89
89
  requireOperands(parsed.operands, 1, multiple ? Infinity : 2);
90
90
  const suffix = value(parsed, "s") ?? (multiple ? undefined : parsed.operands[1]);
@@ -97,7 +97,7 @@ export function basicCommands() {
97
97
  return { exitCode: 0 };
98
98
  }, 1, 1),
99
99
  define("dirname", async (context) => {
100
- const parsed = options(context.args, "z", { zero: "z" });
100
+ const parsed = options(context.args, "z", { zero: "z" }, true);
101
101
  requireOperands(parsed.operands);
102
102
  for (const operand of parsed.operands) {
103
103
  const parent = dirname(operand);