@poe-platform/safe-bash 0.1.748 → 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.
@@ -68,8 +68,7 @@ async function patternAdmission(pattern, context) {
68
68
  else if (character === "]" && bracket && index > bracketStart + 1)
69
69
  bracket = false;
70
70
  }
71
- if (bracket)
72
- unsupported("unclosed bracket pattern");
71
+ // The pattern tokenizer treats an unclosed bracket as a literal '['.
73
72
  }
74
73
  async function unary(operator, value, context) {
75
74
  if (operator === "-n")
@@ -169,9 +168,24 @@ async function leaf(node, context) {
169
168
  return node.operator === "!=" ? !match : match;
170
169
  }
171
170
  if (node.operator === "<" || node.operator === ">") {
172
- cLocale(context);
173
171
  await charge(context, shellValueByteLength(left) + shellValueByteLength(right));
174
- const order = compareUtf8(left, right);
172
+ let order;
173
+ if (cCollation(context.locale)) {
174
+ order = compareUtf8(left, right);
175
+ }
176
+ else {
177
+ if (!utf8Locale(context.locale))
178
+ unsupported("collation locale");
179
+ const locale = context.locale.split(".")[0].split("_").join("-");
180
+ try {
181
+ if (Intl.Collator.supportedLocalesOf([locale]).length === 0)
182
+ unsupported("collation locale");
183
+ order = new Intl.Collator(locale).compare(left, right);
184
+ }
185
+ catch {
186
+ unsupported("collation locale");
187
+ }
188
+ }
175
189
  return node.operator === "<" ? order < 0 : order > 0;
176
190
  }
177
191
  await charge(context, left.length + right.length);
@@ -526,13 +526,6 @@ export declare class Runtime {
526
526
  private evalSyncRedirectSuffix;
527
527
  private encodeSyncRedirectWordsToScratch;
528
528
  private _activePrintfInductionName;
529
- private _activeLoopBodyScript;
530
- private _activeLoopCondScript;
531
- private _activeLoopVarName;
532
- private isVarUnmutatedInScript;
533
- private isVarUnmutatedInActiveLoop;
534
- private isFileReadOnlyScript;
535
- private extractLoopInvariantInput;
536
529
  private canSyncPrintfInductionBody;
537
530
  private isSyncPrintfCallOk;
538
531
  private isSimpleRedirectEchoWord;