@poe-platform/safe-js 0.1.201 → 0.1.203

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-JWZXP3IL.js";
30
+ } from "./chunk-SYMTPL3Q.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-ARZPYB67.js.map
8252
+ //# sourceMappingURL=chunk-FUOYH35L.js.map
@@ -2146,9 +2146,14 @@ var RegexParser = class {
2146
2146
  parseQuantifiedAtom() {
2147
2147
  const quantifierStart = this.position;
2148
2148
  const current = this.peek();
2149
- if (current === "*" || current === "+" || current === "?" || current === "{") {
2149
+ if (current === "*" || current === "+" || current === "?" || current === "{" && this.unicode) {
2150
2150
  this.fail("Nothing to repeat", quantifierStart);
2151
2151
  }
2152
+ if (current === "{") {
2153
+ const quantifier2 = this.parseQuantifier();
2154
+ this.position = quantifierStart;
2155
+ if (quantifier2 !== void 0) this.fail("Nothing to repeat", quantifierStart);
2156
+ }
2152
2157
  const body = this.parseAtom();
2153
2158
  const quantifier = this.parseQuantifier();
2154
2159
  if (quantifier === void 0) {
@@ -2293,7 +2298,11 @@ var RegexParser = class {
2293
2298
  this.position += 1;
2294
2299
  const right = this.parseClassItem(start);
2295
2300
  if (left.type !== "character" || right.type !== "character") {
2296
- this.fail("Character class ranges require literal endpoints", rangePosition);
2301
+ if (this.unicode) this.fail("Character class ranges require literal endpoints", rangePosition);
2302
+ this.guard.array(items.length + 3);
2303
+ this.guard.allocate(4);
2304
+ items.push(left, { type: "character", value: "-" }, right);
2305
+ continue;
2297
2306
  }
2298
2307
  if (left.value.codePointAt(0) > right.value.codePointAt(0)) {
2299
2308
  this.fail("Character class range is out of order", rangePosition);
@@ -2455,8 +2464,7 @@ var RegexParser = class {
2455
2464
  }
2456
2465
  return { type: "literal", value: String.fromCharCode(code) };
2457
2466
  }
2458
- if (escaped === "p" || escaped === "P") {
2459
- if (!this.unicode) this.fail("Unicode property escapes are not supported", start);
2467
+ if (this.unicode && (escaped === "p" || escaped === "P")) {
2460
2468
  if (this.take() !== "{") this.fail("Invalid Unicode property escape", start);
2461
2469
  const begin = this.position;
2462
2470
  while (!this.atEnd() && this.peek() !== "}") {
@@ -2485,7 +2493,7 @@ var RegexParser = class {
2485
2493
  }
2486
2494
  if (escaped === "x") {
2487
2495
  this.guard.allocate(4);
2488
- return { type: "literal", value: this.parseHexEscape(2, "hexadecimal", start) };
2496
+ return { type: "literal", value: this.parseHexEscape(2, "hexadecimal", start, this.unicode ? void 0 : "x") };
2489
2497
  }
2490
2498
  if (escaped === "u") {
2491
2499
  this.guard.allocate(4);
@@ -2500,7 +2508,7 @@ var RegexParser = class {
2500
2508
  this.fail("Invalid Unicode escape", start);
2501
2509
  return { type: "literal", value: String.fromCodePoint(point) };
2502
2510
  }
2503
- let value = this.parseHexEscape(4, "Unicode", start);
2511
+ let value = this.parseHexEscape(4, "Unicode", start, this.unicode ? void 0 : "u");
2504
2512
  if (this.unicode && value.charCodeAt(0) >= 55296 && value.charCodeAt(0) <= 56319 && this.source.startsWith("\\u", this.position)) {
2505
2513
  const digits = this.source.slice(this.position + 2, this.position + 6);
2506
2514
  const point = Number.parseInt(digits, 16);
@@ -2542,24 +2550,29 @@ var RegexParser = class {
2542
2550
  v: "\v",
2543
2551
  "0": "\0"
2544
2552
  };
2545
- if (escaped === "c" && this.unicode) {
2546
- const letter = this.take();
2547
- if (!(letter >= "a" && letter <= "z") && !(letter >= "A" && letter <= "Z"))
2548
- this.fail("Invalid control escape", start);
2553
+ if (escaped === "c") {
2554
+ const letter = this.peek();
2549
2555
  this.guard.allocate(4);
2550
- return { type: "literal", value: String.fromCharCode(letter.charCodeAt(0) % 32) };
2556
+ if (letter >= "a" && letter <= "z" || letter >= "A" && letter <= "Z" || !this.unicode && inCharacterClass && (isDecimalDigit2(letter) || letter === "_")) {
2557
+ this.position++;
2558
+ return { type: "literal", value: String.fromCharCode(letter.charCodeAt(0) % 32) };
2559
+ }
2560
+ if (this.unicode) this.fail("Invalid control escape", start);
2561
+ this.position--;
2562
+ return { type: "literal", value: "\\" };
2551
2563
  }
2552
2564
  if (this.unicode && controls[escaped] === void 0 && !"^$\\.*+?()[]{}|/".includes(escaped) && !(inCharacterClass && (escaped === "-" || this.unicodeSets && "!#$%&+,.:;<=>?@`~".includes(escaped))))
2553
2565
  this.fail("Invalid identity escape", start);
2554
2566
  this.guard.allocate(4);
2555
2567
  return { type: "literal", value: controls[escaped] ?? escaped };
2556
2568
  }
2557
- parseHexEscape(length, name, start) {
2569
+ parseHexEscape(length, name, start, identity) {
2558
2570
  const end = this.position + length;
2559
2571
  this.guard.allocate(Math.min(length, this.source.length - this.position));
2560
2572
  this.guard.work(Math.min(length, this.source.length - this.position));
2561
2573
  const digits = this.source.slice(this.position, end);
2562
2574
  if (digits.length !== length || !allHexDigits(digits)) {
2575
+ if (identity !== void 0) return identity;
2563
2576
  this.fail(`Invalid ${name} escape`, start);
2564
2577
  }
2565
2578
  this.position = end;
@@ -2661,18 +2674,29 @@ var RegexParser = class {
2661
2674
  }
2662
2675
  if (this.peek() === "}") {
2663
2676
  this.position += 1;
2677
+ if (!Number.isSafeInteger(min)) this.fail("Quantifier is too large", start);
2664
2678
  this.guard.allocate(3);
2665
2679
  return { min, max: min };
2666
2680
  }
2667
2681
  if (this.peek() !== ",") {
2682
+ if (!this.unicode) {
2683
+ this.position = start;
2684
+ return void 0;
2685
+ }
2668
2686
  this.fail("Invalid quantifier", start);
2669
2687
  }
2670
2688
  this.position += 1;
2671
2689
  const max = this.parseDecimal();
2672
2690
  if (this.peek() !== "}") {
2691
+ if (!this.unicode) {
2692
+ this.position = start;
2693
+ return void 0;
2694
+ }
2673
2695
  this.fail("Unterminated quantifier", start);
2674
2696
  }
2675
2697
  this.position += 1;
2698
+ if (!Number.isSafeInteger(min) || max !== void 0 && !Number.isSafeInteger(max))
2699
+ this.fail("Quantifier is too large", start);
2676
2700
  if (max !== void 0 && min > max) {
2677
2701
  this.fail("Quantifier range is out of order", start);
2678
2702
  }
@@ -2689,11 +2713,7 @@ var RegexParser = class {
2689
2713
  }
2690
2714
  this.guard.allocate(this.position - start);
2691
2715
  this.guard.work(this.position - start);
2692
- const value = Number(this.source.slice(start, this.position));
2693
- if (!Number.isSafeInteger(value)) {
2694
- this.fail("Quantifier is too large", start);
2695
- }
2696
- return value;
2716
+ return Number(this.source.slice(start, this.position));
2697
2717
  }
2698
2718
  peek() {
2699
2719
  return this.source[this.position] ?? "";
@@ -9863,10 +9883,7 @@ function matchesCharacterClassItem(character, item, ignoreCase, unicode, unicode
9863
9883
  if (!ignoreCase) {
9864
9884
  return false;
9865
9885
  }
9866
- const foldedCandidate = foldCharacter(character, true).charCodeAt(0);
9867
- const foldedFrom = foldCharacter(item.from, true).charCodeAt(0);
9868
- const foldedTo = foldCharacter(item.to, true).charCodeAt(0);
9869
- return foldedCandidate >= foldedFrom && foldedCandidate <= foldedTo;
9886
+ return new RegExp(`^[\\u${from.toString(16).padStart(4, "0")}-\\u${to.toString(16).padStart(4, "0")}]$`, "i").test(character);
9870
9887
  }
9871
9888
  const matched = item.kind === "digit" ? isDigit(character) : item.kind === "word" ? isWordCharacter(character) : isSpaceCharacter(character);
9872
9889
  return item.negated ? !matched : matched;
@@ -37600,4 +37617,4 @@ export {
37600
37617
  FileSnapshotBackend,
37601
37618
  run
37602
37619
  };
37603
- //# sourceMappingURL=chunk-JWZXP3IL.js.map
37620
+ //# sourceMappingURL=chunk-SYMTPL3Q.js.map