@poe-platform/safe-bash 0.1.777 → 0.1.779

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.
@@ -18,15 +18,15 @@ init_buffer();
18
18
  var precedence = Object.freeze({
19
19
  "|": 1,
20
20
  ",": 2,
21
- "=": 3,
22
- "|=": 3,
23
- "+=": 3,
24
- "-=": 3,
25
- "*=": 3,
26
- "/=": 3,
27
- "%=": 3,
28
- "//=": 3,
29
- "//": 4,
21
+ "//": 3,
22
+ "=": 4,
23
+ "|=": 4,
24
+ "+=": 4,
25
+ "-=": 4,
26
+ "*=": 4,
27
+ "/=": 4,
28
+ "%=": 4,
29
+ "//=": 4,
30
30
  or: 5,
31
31
  and: 6,
32
32
  "==": 7,
@@ -461,7 +461,7 @@ jq: 1 compile error`, 3);
461
461
  if (priority < minimum || stopComma && operator === ",")
462
462
  break;
463
463
  take();
464
- const assignment = priority === 3;
464
+ const assignment = priority === 4;
465
465
  if (assignment && !isPath(left))
466
466
  fail("unsupported assignment path");
467
467
  const right = expression(priority + (assignment ? 0 : 1), stopComma);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-DC52GWRK.js";
4
4
  import {
5
5
  parse
6
- } from "./chunk-ACRMXIQC.js";
6
+ } from "./chunk-JUMF6JDJ.js";
7
7
  import {
8
8
  Budget,
9
9
  JqLimitError,
@@ -82626,7 +82626,7 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
82626
82626
  if (genSelM) {
82627
82627
  const condVals = this.evalSyncJqPathOps(item, genSelM[1]);
82628
82628
  if (!condVals) return void 0;
82629
- return condVals.some((v) => v !== null && v !== void 0 && v !== false) ? [item] : [];
82629
+ return condVals.filter((v) => v !== null && v !== void 0 && v !== false).map(() => item);
82630
82630
  }
82631
82631
  const delGenM = /^del\(\s*(.+)\s*\)$/.exec(st);
82632
82632
  if (delGenM && item && typeof item === "object") {
@@ -82649,6 +82649,8 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
82649
82649
  const subClone = { ...clone[k1] };
82650
82650
  delete subClone[k2];
82651
82651
  clone[k1] = subClone;
82652
+ } else if (clone[k1] !== null && clone[k1] !== void 0) {
82653
+ return void 0;
82652
82654
  }
82653
82655
  }
82654
82656
  if (okDel) return [clone];
@@ -83890,7 +83892,23 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
83890
83892
  if (patSpec.length === 0 || patSpec.includes("[.") || patSpec.includes("[=") || /\\[1-9]/.test(patSpec)) return void 0;
83891
83893
  const normPat = syncPosixRegexSource(patSpec);
83892
83894
  if (normPat === void 0) return void 0;
83893
- const jsPat = isExtended ? normPat : normPat.replace(/\\([+?()|])/g, "$1");
83895
+ let jsPat = normPat;
83896
+ if (!isExtended) {
83897
+ jsPat = "";
83898
+ let inBracket = false;
83899
+ for (let i = 0; i < normPat.length; i++) {
83900
+ const ch = normPat[i];
83901
+ if (ch === "\\") {
83902
+ const next = normPat[++i];
83903
+ if (next === void 0) return void 0;
83904
+ jsPat += !inBracket && "+?(){}|".includes(next) ? next : "\\" + next;
83905
+ } else {
83906
+ if (ch === "[") inBracket = true;
83907
+ else if (ch === "]") inBracket = false;
83908
+ jsPat += !inBracket && "+?(){}|".includes(ch) ? "\\" + ch : ch;
83909
+ }
83910
+ }
83911
+ }
83894
83912
  try {
83895
83913
  return new RegExp(jsPat);
83896
83914
  } catch {
@@ -85211,23 +85229,6 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
85211
85229
  let l = rawLines[li];
85212
85230
  let fields2 = awkSep === void 0 || awkSep === " " ? l.split(/[ \t]+/).filter(Boolean) : l.length === 0 ? [] : l.split(awkSep);
85213
85231
  if (rowPred && !rowPred(l, fields2, li + 1)) continue;
85214
- if (subRe) {
85215
- if (subTarget === "0") {
85216
- l = l.replace(subRe, (matched) => subRep.split("&").join(matched));
85217
- fields2 = awkSep === void 0 || awkSep === " " ? l.split(/[ \t]+/).filter(Boolean) : l.length === 0 ? [] : l.split(awkSep);
85218
- } else {
85219
- const tIdx = subTarget === "NF" ? fields2.length : Number(subTarget);
85220
- if (tIdx >= 1 && tIdx <= fields2.length) {
85221
- fields2 = [...fields2];
85222
- let replaced = false;
85223
- fields2[tIdx - 1] = fields2[tIdx - 1].replace(subRe, (matched) => {
85224
- replaced = true;
85225
- return subRep.split("&").join(matched);
85226
- });
85227
- if (replaced) l = fields2.join(ofs);
85228
- }
85229
- }
85230
- }
85231
85232
  if (preAssigns.length > 0) {
85232
85233
  for (let ai = 0; ai < preAssigns.length; ai++) {
85233
85234
  const pa = preAssigns[ai];
@@ -85295,6 +85296,23 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
85295
85296
  }
85296
85297
  }
85297
85298
  }
85299
+ if (subRe) {
85300
+ if (subTarget === "0") {
85301
+ l = l.replace(subRe, (matched) => subRep.split("&").join(matched));
85302
+ fields2 = awkSep === void 0 || awkSep === " " ? l.split(/[ \t]+/).filter(Boolean) : l.length === 0 ? [] : l.split(awkSep);
85303
+ } else {
85304
+ const tIdx = subTarget === "NF" ? fields2.length : Number(subTarget);
85305
+ if (tIdx >= 1 && tIdx <= fields2.length) {
85306
+ fields2 = [...fields2];
85307
+ let replaced = false;
85308
+ fields2[tIdx - 1] = fields2[tIdx - 1].replace(subRe, (matched) => {
85309
+ replaced = true;
85310
+ return subRep.split("&").join(matched);
85311
+ });
85312
+ if (replaced) l = fields2.join(ofs);
85313
+ }
85314
+ }
85315
+ }
85298
85316
  if (parts.length === 1 && parts[0].kind === "field" && parts[0].token === "0") {
85299
85317
  outLines.push(l);
85300
85318
  continue;
@@ -86041,7 +86059,7 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
86041
86059
  const formatJoin = (key, r1, r2) => {
86042
86060
  if (outSpec) {
86043
86061
  return outSpec.map((s) => {
86044
- if (s.file === 0) return key;
86062
+ if (s.file === 0) return key === "" ? emptyRep : key;
86045
86063
  const src = s.file === 1 ? r1 : r2;
86046
86064
  const val = src ? src[s.idx] : void 0;
86047
86065
  return val !== void 0 && val !== "" ? val : emptyRep;
@@ -86271,7 +86289,7 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
86271
86289
  }
86272
86290
  }
86273
86291
  if (sepChars || l.length > start) row.push(l.slice(start));
86274
- if (row.length === 0 && !emptyLines) continue;
86292
+ if (row.length === 0) continue;
86275
86293
  if (row.length > maxCols) maxCols = row.length;
86276
86294
  rows.push(row);
86277
86295
  }
@@ -28156,7 +28156,7 @@ export class Runtime {
28156
28156
  const condVals = this.evalSyncJqPathOps(item, genSelM[1]);
28157
28157
  if (!condVals)
28158
28158
  return undefined;
28159
- return condVals.some(v => v !== null && v !== undefined && v !== false) ? [item] : [];
28159
+ return condVals.filter(v => v !== null && v !== undefined && v !== false).map(() => item);
28160
28160
  }
28161
28161
  const delGenM = /^del\(\s*(.+)\s*\)$/.exec(st);
28162
28162
  if (delGenM && item && typeof item === "object") {
@@ -28181,6 +28181,9 @@ export class Runtime {
28181
28181
  delete subClone[k2];
28182
28182
  clone[k1] = subClone;
28183
28183
  }
28184
+ else if (clone[k1] !== null && clone[k1] !== undefined) {
28185
+ return undefined;
28186
+ }
28184
28187
  }
28185
28188
  if (okDel)
28186
28189
  return [clone];
@@ -29675,9 +29678,27 @@ export class Runtime {
29675
29678
  const normPat = syncPosixRegexSource(patSpec);
29676
29679
  if (normPat === undefined)
29677
29680
  return undefined;
29678
- const jsPat = isExtended
29679
- ? normPat
29680
- : normPat.replace(/\\([+?()|])/g, "$1");
29681
+ let jsPat = normPat;
29682
+ if (!isExtended) {
29683
+ jsPat = "";
29684
+ let inBracket = false;
29685
+ for (let i = 0; i < normPat.length; i++) {
29686
+ const ch = normPat[i];
29687
+ if (ch === "\\") {
29688
+ const next = normPat[++i];
29689
+ if (next === undefined)
29690
+ return undefined;
29691
+ jsPat += !inBracket && "+?(){}|".includes(next) ? next : "\\" + next;
29692
+ }
29693
+ else {
29694
+ if (ch === "[")
29695
+ inBracket = true;
29696
+ else if (ch === "]")
29697
+ inBracket = false;
29698
+ jsPat += !inBracket && "+?(){}|".includes(ch) ? "\\" + ch : ch;
29699
+ }
29700
+ }
29701
+ }
29681
29702
  try {
29682
29703
  return new RegExp(jsPat);
29683
29704
  }
@@ -31318,27 +31339,6 @@ export class Runtime {
31318
31339
  : (l.length === 0 ? [] : l.split(awkSep));
31319
31340
  if (rowPred && !rowPred(l, fields, li + 1))
31320
31341
  continue;
31321
- if (subRe) {
31322
- if (subTarget === "0") {
31323
- l = l.replace(subRe, matched => subRep.split("&").join(matched));
31324
- fields = awkSep === undefined || awkSep === " "
31325
- ? l.split(/[ \t]+/).filter(Boolean)
31326
- : (l.length === 0 ? [] : l.split(awkSep));
31327
- }
31328
- else {
31329
- const tIdx = subTarget === "NF" ? fields.length : Number(subTarget);
31330
- if (tIdx >= 1 && tIdx <= fields.length) {
31331
- fields = [...fields];
31332
- let replaced = false;
31333
- fields[tIdx - 1] = fields[tIdx - 1].replace(subRe, matched => {
31334
- replaced = true;
31335
- return subRep.split("&").join(matched);
31336
- });
31337
- if (replaced)
31338
- l = fields.join(ofs);
31339
- }
31340
- }
31341
- }
31342
31342
  if (preAssigns.length > 0) {
31343
31343
  for (let ai = 0; ai < preAssigns.length; ai++) {
31344
31344
  const pa = preAssigns[ai];
@@ -31419,6 +31419,27 @@ export class Runtime {
31419
31419
  }
31420
31420
  }
31421
31421
  }
31422
+ if (subRe) {
31423
+ if (subTarget === "0") {
31424
+ l = l.replace(subRe, matched => subRep.split("&").join(matched));
31425
+ fields = awkSep === undefined || awkSep === " "
31426
+ ? l.split(/[ \t]+/).filter(Boolean)
31427
+ : (l.length === 0 ? [] : l.split(awkSep));
31428
+ }
31429
+ else {
31430
+ const tIdx = subTarget === "NF" ? fields.length : Number(subTarget);
31431
+ if (tIdx >= 1 && tIdx <= fields.length) {
31432
+ fields = [...fields];
31433
+ let replaced = false;
31434
+ fields[tIdx - 1] = fields[tIdx - 1].replace(subRe, matched => {
31435
+ replaced = true;
31436
+ return subRep.split("&").join(matched);
31437
+ });
31438
+ if (replaced)
31439
+ l = fields.join(ofs);
31440
+ }
31441
+ }
31442
+ }
31422
31443
  if (parts.length === 1 && parts[0].kind === "field" && parts[0].token === "0") {
31423
31444
  outLines.push(l);
31424
31445
  continue;
@@ -32340,7 +32361,7 @@ export class Runtime {
32340
32361
  if (outSpec) {
32341
32362
  return outSpec.map(s => {
32342
32363
  if (s.file === 0)
32343
- return key;
32364
+ return key === "" ? emptyRep : key;
32344
32365
  const src = s.file === 1 ? r1 : r2;
32345
32366
  const val = src ? src[s.idx] : undefined;
32346
32367
  return val !== undefined && val !== "" ? val : emptyRep;
@@ -32648,7 +32669,7 @@ export class Runtime {
32648
32669
  }
32649
32670
  if (sepChars || l.length > start)
32650
32671
  row.push(l.slice(start));
32651
- if (row.length === 0 && !emptyLines)
32672
+ if (row.length === 0)
32652
32673
  continue;
32653
32674
  if (row.length > maxCols)
32654
32675
  maxCols = row.length;
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  YqValueFailure,
3
3
  createYqQuerySession
4
- } from "../safe-bash/command-chunks/chunk-CUFCNL6G.js";
4
+ } from "../safe-bash/command-chunks/chunk-MTKXVRXL.js";
5
5
  import "../safe-bash/command-chunks/chunk-DC52GWRK.js";
6
6
  import "../safe-bash/command-chunks/chunk-NSEUBSOD.js";
7
7
  import "../safe-bash/command-chunks/chunk-WVWWRMFD.js";
8
8
  import "../safe-bash/command-chunks/chunk-Z47EO74H.js";
9
- import "../safe-bash/command-chunks/chunk-ACRMXIQC.js";
9
+ import "../safe-bash/command-chunks/chunk-JUMF6JDJ.js";
10
10
  import "../safe-bash/command-chunks/chunk-5PM5TEPM.js";
11
11
  import "../safe-bash/command-chunks/chunk-GZOUGVVV.js";
12
12
  import "../safe-bash/command-chunks/chunk-SNXWY3KV.js";
@@ -2,7 +2,7 @@ import {
2
2
  functions,
3
3
  moduleProgram,
4
4
  parse
5
- } from "../safe-bash/command-chunks/chunk-ACRMXIQC.js";
5
+ } from "../safe-bash/command-chunks/chunk-JUMF6JDJ.js";
6
6
  import "../safe-bash/command-chunks/chunk-UPOI7O7Y.js";
7
7
  import "../safe-bash/command-chunks/chunk-744EDSWN.js";
8
8
  import "../safe-bash/command-chunks/chunk-W3UCANZ3.js";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  YqValueFailure,
3
3
  createYqQuerySession
4
- } from "../safe-bash/command-chunks/chunk-CUFCNL6G.js";
4
+ } from "../safe-bash/command-chunks/chunk-MTKXVRXL.js";
5
5
  import "../safe-bash/command-chunks/chunk-DC52GWRK.js";
6
6
  import "../safe-bash/command-chunks/chunk-NSEUBSOD.js";
7
7
  import "../safe-bash/command-chunks/chunk-WVWWRMFD.js";
8
8
  import "../safe-bash/command-chunks/chunk-Z47EO74H.js";
9
- import "../safe-bash/command-chunks/chunk-ACRMXIQC.js";
9
+ import "../safe-bash/command-chunks/chunk-JUMF6JDJ.js";
10
10
  import "../safe-bash/command-chunks/chunk-5PM5TEPM.js";
11
11
  import "../safe-bash/command-chunks/chunk-GZOUGVVV.js";
12
12
  import "../safe-bash/command-chunks/chunk-SNXWY3KV.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.777",
3
+ "version": "0.1.779",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -841,7 +841,7 @@
841
841
  "access": "public"
842
842
  },
843
843
  "dependencies": {
844
- "@poe-platform/safe-fs": "0.1.777",
844
+ "@poe-platform/safe-fs": "0.1.779",
845
845
  "pdf-lib": "1.17.1",
846
846
  "@noble/hashes": "2.4.0",
847
847
  "pako": "3.0.1",