ses 2.0.0 → 2.1.0

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.
package/dist/ses.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // ses@2.0.0
1
+ // ses@2.1.0
2
2
  (functors => options => {
3
3
  'use strict';
4
4
 
@@ -81,7 +81,6 @@
81
81
  create: cell("create"),
82
82
  defineProperties: cell("defineProperties"),
83
83
  entries: cell("entries"),
84
- freeze: cell("freeze"),
85
84
  getOwnPropertyDescriptor: cell("getOwnPropertyDescriptor"),
86
85
  getOwnPropertyDescriptors: cell("getOwnPropertyDescriptors"),
87
86
  getOwnPropertyNames: cell("getOwnPropertyNames"),
@@ -97,14 +96,20 @@
97
96
  setPrototypeOf: cell("setPrototypeOf"),
98
97
  values: cell("values"),
99
98
  fromEntries: cell("fromEntries"),
99
+ freeze: cell("freeze"),
100
100
  speciesSymbol: cell("speciesSymbol"),
101
101
  toStringTagSymbol: cell("toStringTagSymbol"),
102
102
  iteratorSymbol: cell("iteratorSymbol"),
103
103
  matchAllSymbol: cell("matchAllSymbol"),
104
104
  replaceSymbol: cell("replaceSymbol"),
105
+ searchSymbol: cell("searchSymbol"),
105
106
  unscopablesSymbol: cell("unscopablesSymbol"),
106
107
  symbolKeyFor: cell("symbolKeyFor"),
107
108
  symbolFor: cell("symbolFor"),
109
+ max: cell("max"),
110
+ min: cell("min"),
111
+ trunc: cell("trunc"),
112
+ MAX_SAFE_INTEGER: cell("MAX_SAFE_INTEGER"),
108
113
  isInteger: cell("isInteger"),
109
114
  stringifyJson: cell("stringifyJson"),
110
115
  defineProperty: cell("defineProperty"),
@@ -120,6 +125,7 @@
120
125
  isArray: cell("isArray"),
121
126
  arrayPrototype: cell("arrayPrototype"),
122
127
  arrayBufferPrototype: cell("arrayBufferPrototype"),
128
+ dataViewPrototype: cell("dataViewPrototype"),
123
129
  mapPrototype: cell("mapPrototype"),
124
130
  proxyRevocable: cell("proxyRevocable"),
125
131
  regexpPrototype: cell("regexpPrototype"),
@@ -162,8 +168,10 @@
162
168
  iterateSet: cell("iterateSet"),
163
169
  regexpExec: cell("regexpExec"),
164
170
  regexpReplace: cell("regexpReplace"),
171
+ regexpSearch: cell("regexpSearch"),
165
172
  matchAllRegExp: cell("matchAllRegExp"),
166
173
  sealRegexp: cell("sealRegexp"),
174
+ freezeRegexp: cell("freezeRegexp"),
167
175
  stringEndsWith: cell("stringEndsWith"),
168
176
  stringIncludes: cell("stringIncludes"),
169
177
  stringIndexOf: cell("stringIndexOf"),
@@ -514,7 +522,6 @@ function observeImports(map, importName, importIndex) {
514
522
  create: cells[0].create.set,
515
523
  defineProperties: cells[0].defineProperties.set,
516
524
  entries: cells[0].entries.set,
517
- freeze: cells[0].freeze.set,
518
525
  getOwnPropertyDescriptor: cells[0].getOwnPropertyDescriptor.set,
519
526
  getOwnPropertyDescriptors: cells[0].getOwnPropertyDescriptors.set,
520
527
  getOwnPropertyNames: cells[0].getOwnPropertyNames.set,
@@ -530,14 +537,20 @@ function observeImports(map, importName, importIndex) {
530
537
  setPrototypeOf: cells[0].setPrototypeOf.set,
531
538
  values: cells[0].values.set,
532
539
  fromEntries: cells[0].fromEntries.set,
540
+ freeze: cells[0].freeze.set,
533
541
  speciesSymbol: cells[0].speciesSymbol.set,
534
542
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
535
543
  iteratorSymbol: cells[0].iteratorSymbol.set,
536
544
  matchAllSymbol: cells[0].matchAllSymbol.set,
537
545
  replaceSymbol: cells[0].replaceSymbol.set,
546
+ searchSymbol: cells[0].searchSymbol.set,
538
547
  unscopablesSymbol: cells[0].unscopablesSymbol.set,
539
548
  symbolKeyFor: cells[0].symbolKeyFor.set,
540
549
  symbolFor: cells[0].symbolFor.set,
550
+ max: cells[0].max.set,
551
+ min: cells[0].min.set,
552
+ trunc: cells[0].trunc.set,
553
+ MAX_SAFE_INTEGER: cells[0].MAX_SAFE_INTEGER.set,
541
554
  isInteger: cells[0].isInteger.set,
542
555
  stringifyJson: cells[0].stringifyJson.set,
543
556
  defineProperty: cells[0].defineProperty.set,
@@ -553,6 +566,7 @@ function observeImports(map, importName, importIndex) {
553
566
  isArray: cells[0].isArray.set,
554
567
  arrayPrototype: cells[0].arrayPrototype.set,
555
568
  arrayBufferPrototype: cells[0].arrayBufferPrototype.set,
569
+ dataViewPrototype: cells[0].dataViewPrototype.set,
556
570
  mapPrototype: cells[0].mapPrototype.set,
557
571
  proxyRevocable: cells[0].proxyRevocable.set,
558
572
  regexpPrototype: cells[0].regexpPrototype.set,
@@ -595,8 +609,10 @@ function observeImports(map, importName, importIndex) {
595
609
  iterateSet: cells[0].iterateSet.set,
596
610
  regexpExec: cells[0].regexpExec.set,
597
611
  regexpReplace: cells[0].regexpReplace.set,
612
+ regexpSearch: cells[0].regexpSearch.set,
598
613
  matchAllRegExp: cells[0].matchAllRegExp.set,
599
614
  sealRegexp: cells[0].sealRegexp.set,
615
+ freezeRegexp: cells[0].freezeRegexp.set,
600
616
  stringEndsWith: cells[0].stringEndsWith.set,
601
617
  stringIncludes: cells[0].stringIncludes.set,
602
618
  stringIndexOf: cells[0].stringIndexOf.set,
@@ -1608,7 +1624,6 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
1608
1624
  create,
1609
1625
  defineProperties,
1610
1626
  entries,
1611
- freeze,
1612
1627
  getOwnPropertyDescriptor,
1613
1628
  getOwnPropertyDescriptors,
1614
1629
  getOwnPropertyNames,
@@ -1624,7 +1639,18 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
1624
1639
  setPrototypeOf,
1625
1640
  values,
1626
1641
  fromEntries,
1627
- } = Object;$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.freeze(freeze);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);
1642
+ } = Object;
1643
+
1644
+ /**
1645
+ * For use with any value except a regular expression (@see {@link sealRegexp}
1646
+ * and {@link freezeRegexp}).
1647
+ *
1648
+ * @type { &
1649
+ * ((obj: RegExp) => void) &
1650
+ * typeof Object.freeze
1651
+ * }
1652
+ */$h͏_once.assign(assign);$h͏_once.create(create);$h͏_once.defineProperties(defineProperties);$h͏_once.entries(entries);$h͏_once.getOwnPropertyDescriptor(getOwnPropertyDescriptor);$h͏_once.getOwnPropertyDescriptors(getOwnPropertyDescriptors);$h͏_once.getOwnPropertyNames(getOwnPropertyNames);$h͏_once.getPrototypeOf(getPrototypeOf);$h͏_once.is(is);$h͏_once.isFrozen(isFrozen);$h͏_once.isSealed(isSealed);$h͏_once.isExtensible(isExtensible);$h͏_once.keys(keys);$h͏_once.objectPrototype(objectPrototype);$h͏_once.seal(seal);$h͏_once.preventExtensions(preventExtensions);$h͏_once.setPrototypeOf(setPrototypeOf);$h͏_once.values(values);$h͏_once.fromEntries(fromEntries);
1653
+ const freeze = /** @type {any} */ (Object.freeze);$h͏_once.freeze(freeze);
1628
1654
 
1629
1655
  const {
1630
1656
  species: speciesSymbol,
@@ -1632,12 +1658,15 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
1632
1658
  iterator: iteratorSymbol,
1633
1659
  matchAll: matchAllSymbol,
1634
1660
  replace: replaceSymbol,
1661
+ search: searchSymbol,
1635
1662
  unscopables: unscopablesSymbol,
1636
1663
  keyFor: symbolKeyFor,
1637
1664
  for: symbolFor,
1638
- } = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.replaceSymbol(replaceSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
1665
+ } = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.replaceSymbol(replaceSymbol);$h͏_once.searchSymbol(searchSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
1666
+
1667
+ const { max, min, trunc } = Math;$h͏_once.max(max);$h͏_once.min(min);$h͏_once.trunc(trunc);
1639
1668
 
1640
- const { isInteger } = Number;$h͏_once.isInteger(isInteger);
1669
+ const { MAX_SAFE_INTEGER, isInteger } = Number;$h͏_once.MAX_SAFE_INTEGER(MAX_SAFE_INTEGER);$h͏_once.isInteger(isInteger);
1641
1670
 
1642
1671
  const { stringify: stringifyJson } = JSON;
1643
1672
 
@@ -1679,6 +1708,7 @@ $h͏_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProper
1679
1708
 
1680
1709
  const { isArray, prototype: arrayPrototype } = Array;$h͏_once.isArray(isArray);$h͏_once.arrayPrototype(arrayPrototype);
1681
1710
  const { prototype: arrayBufferPrototype } = ArrayBuffer;$h͏_once.arrayBufferPrototype(arrayBufferPrototype);
1711
+ const { prototype: dataViewPrototype } = DataView;$h͏_once.dataViewPrototype(dataViewPrototype);
1682
1712
  const { prototype: mapPrototype } = Map;$h͏_once.mapPrototype(mapPrototype);
1683
1713
  const { revocable: proxyRevocable } = Proxy;$h͏_once.proxyRevocable(proxyRevocable);
1684
1714
  const { prototype: regexpPrototype } = RegExp;$h͏_once.regexpPrototype(regexpPrototype);
@@ -1780,6 +1810,7 @@ $h͏_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h͏
1780
1810
  * vulnerable to RegExp.prototype poisoning.
1781
1811
  */$h͏_once.iterateSet(iterateSet);
1782
1812
  const regexpExec = uncurryThis(regexpPrototype.exec);
1813
+
1783
1814
  /**
1784
1815
  * @type { &
1785
1816
  * ((thisArg: RegExp, string: string, replaceValue: string) => string) &
@@ -1788,24 +1819,60 @@ $h͏_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h͏
1788
1819
  */$h͏_once.regexpExec(regexpExec);
1789
1820
  const regexpReplace = /** @type {any} */ (
1790
1821
  uncurryThis(regexpPrototype[replaceSymbol])
1791
- );$h͏_once.regexpReplace(regexpReplace);
1822
+ );
1823
+
1824
+ /**
1825
+ * `regexpSearch` can be used with a frozen non-global non-sticky RegExp.
1826
+ *
1827
+ * @type {(thisArg: RegExp, string: string) => number}
1828
+ */$h͏_once.regexpReplace(regexpReplace);
1829
+ const regexpSearch = uncurryThis(regexpPrototype[searchSymbol]);
1830
+
1831
+ /**
1832
+ * `matchAll` internally creates a new RegExp vulnerable to prototype poisoning,
1833
+ * but this function is still needed to reach %RegExpStringIteratorPrototype%.
1834
+ * @private
1835
+ */$h͏_once.regexpSearch(regexpSearch);
1792
1836
  const matchAllRegExp = uncurryThis(regexpPrototype[matchAllSymbol]);$h͏_once.matchAllRegExp(matchAllRegExp);
1793
- const { _regexpConstructor, ...regexpDescriptors } =
1794
- getOwnPropertyDescriptors(regexpPrototype);
1837
+
1838
+ const regexpDescriptors = getOwnPropertyDescriptors(regexpPrototype);
1795
1839
  arrayForEach(ownKeys(regexpDescriptors), key => {
1796
1840
  const desc = regexpDescriptors[/** @type {any} */ (key)];
1797
1841
  desc.configurable = false;
1798
1842
  if (desc.writable) desc.writable = false;
1799
1843
  });
1844
+ // Don't follow Symbol.species
1845
+ // https://tc39.es/ecma262/multipage/abstract-operations.html#sec-speciesconstructor
1846
+ defineProperty(regexpDescriptors, 'constructor', {
1847
+ value: undefined,
1848
+ enumerable: false,
1849
+ configurable: false,
1850
+ writable: false,
1851
+ });
1852
+
1800
1853
  /**
1801
1854
  * Protect a RegExp instance against RegExp.prototype poisoning ("exec",
1802
- * "flags", Symbol.replace, etc.).
1855
+ * "flags", Symbol.replace, etc.) while still maintaining mutability of its
1856
+ * "lastIndex" property (which is necessary with flags "g" and/or "y" for some
1857
+ * operations, most notably {@link regexpReplace}).
1858
+ *
1803
1859
  * @type {<T extends RegExp>(regexp: T) => T}
1804
1860
  */
1805
1861
  const sealRegexp = regexp =>
1806
1862
  seal(defineProperties(regexp, regexpDescriptors));
1863
+
1864
+ /**
1865
+ * Protect a RegExp instance against RegExp.prototype poisoning ("exec",
1866
+ * "flags", Symbol.replace, etc.) and freeze its "lastIndex" property, rendering
1867
+ * it fully inert but (absent flags "g" and/or "y") still usable by
1868
+ * {@link regexpExec} and {@link regexpSearch}.
1869
+ *
1870
+ * @type {<T extends RegExp>(regexp: T) => T}
1871
+ */$h͏_once.sealRegexp(sealRegexp);
1872
+ const freezeRegexp = regexp =>
1873
+ freeze(/** @type {any} */ (defineProperties(regexp, regexpDescriptors)));
1807
1874
  //
1808
- $h͏_once.sealRegexp(sealRegexp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
1875
+ $h͏_once.freezeRegexp(freezeRegexp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
1809
1876
  const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
1810
1877
  const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
1811
1878
  const stringMatch = uncurryThis(stringPrototype.match);
@@ -1930,7 +1997,7 @@ const makeTypeError = () => {
1930
1997
  null.null;
1931
1998
  throw TypeError('obligatory'); // To convince the type flow inferrence.
1932
1999
  } catch (error) {
1933
- return error;
2000
+ return /** @type {TypeError} */ (error);
1934
2001
  }
1935
2002
  };
1936
2003
 
@@ -2003,9 +2070,10 @@ const getAsyncGeneratorFunctionInstance = () => {
2003
2070
  'return (async function* AsyncGeneratorFunctionInstance() {})',
2004
2071
  )();
2005
2072
  } catch (error) {
2073
+ const err = /** @type {Error} */ (error);
2006
2074
  // Note: `Error.prototype.jsEngine` is only set by React Native runtime, not Hermes:
2007
2075
  // https://github.com/facebook/react-native/blob/main/packages/react-native/ReactCommon/hermes/executor/HermesExecutorFactory.cpp#L224-L230
2008
- if (error.name === 'SyntaxError') {
2076
+ if (err.name === 'SyntaxError') {
2009
2077
  // Swallows Hermes error `async generators are unsupported` at runtime.
2010
2078
  // Note: `console` is not a JS built-in, so Hermes engine throws:
2011
2079
  // Uncaught ReferenceError: Property 'console' doesn't exist
@@ -2013,11 +2081,11 @@ const getAsyncGeneratorFunctionInstance = () => {
2013
2081
  // However React Native provides a `console` implementation when setting up error handling:
2014
2082
  // https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/InitializeCore.js
2015
2083
  return undefined;
2016
- } else if (error.name === 'EvalError') {
2084
+ } else if (err.name === 'EvalError') {
2017
2085
  // eslint-disable-next-line no-empty-function
2018
2086
  return async function* AsyncGeneratorFunctionInstance() {};
2019
2087
  } else {
2020
- throw error;
2088
+ throw err;
2021
2089
  }
2022
2090
  }
2023
2091
  };
@@ -2035,7 +2103,8 @@ const getAsyncGeneratorFunctionInstance = () => {
2035
2103
  // === 1. ses ./src/assert-sloppy-mode.js ===
2036
2104
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
2037
2105
 
2038
- /** getThis returns globalThis in sloppy mode or undefined in strict mode. */
2106
+ /** @this {unknown} */
2107
+ // getThis returns globalThis in sloppy mode or undefined in strict mode.
2039
2108
  function getThis() {
2040
2109
  return this;
2041
2110
  }
@@ -3327,7 +3396,7 @@ freeze(makeNoteLogArgsArrayKit);
3327
3396
  })()
3328
3397
  ,
3329
3398
  // === 13. ses ./src/error/assert.js ===
3330
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpExec,regexpReplace,sealRegexp,stringIndexOf,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,hasOwn,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
3399
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,freezeRegexp,globalThis,is,isError,regexpSearch,stringEndsWith,stringIndexOf,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,hasOwn,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpSearch",[$h͏_a => (regexpSearch = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
3331
3400
 
3332
3401
 
3333
3402
 
@@ -3403,13 +3472,13 @@ const quote = (value, spaces = undefined) => {
3403
3472
  };$h͏_once.quote(quote);
3404
3473
  freeze(quote);
3405
3474
 
3406
- const canBeBare = freeze(/^[\w:-]( ?[\w:-])*$/);
3475
+ const canBeBare = freezeRegexp(/^[\w:-]( ?[\w:-])*$/);
3407
3476
 
3408
3477
  /**
3409
3478
  * @type {AssertionUtilities['bare']}
3410
3479
  */
3411
3480
  const bare = (text, spaces = undefined) => {
3412
- if (typeof text !== 'string' || !regexpExec(canBeBare, text)) {
3481
+ if (typeof text !== 'string' || regexpSearch(canBeBare, text) === -1) {
3413
3482
  return quote(text, spaces);
3414
3483
  }
3415
3484
  const result = freeze({
@@ -3530,9 +3599,6 @@ const unredactedDetails = (template, ...args) => {
3530
3599
  freeze(unredactedDetails);
3531
3600
 
3532
3601
 
3533
- const leadingSpacePattern = sealRegexp(/^ /);
3534
- const trailingSpacePattern = sealRegexp(/ $/);
3535
-
3536
3602
  /**
3537
3603
  * Get arguments suitable for a console logger function (e.g., `console.error`)
3538
3604
  * from `details` template literal contents, unquoting quoted substitution
@@ -3550,20 +3616,18 @@ const getLogArgs = ({ template, args }) => {
3550
3616
  }
3551
3617
  // Remove substitution-adjacent spaces from template fixed-string parts
3552
3618
  // (since console logging inserts its own argument-separating spaces).
3553
- const prevLiteralPart = regexpReplace(
3554
- trailingSpacePattern,
3555
- arrayPop(logArgs) || '',
3556
- '',
3557
- );
3558
- if (prevLiteralPart !== '') {
3559
- arrayPush(logArgs, prevLiteralPart);
3560
- }
3561
- const nextLiteralPart = regexpReplace(
3562
- leadingSpacePattern,
3563
- template[i + 1],
3564
- '',
3565
- );
3566
- arrayPush(logArgs, arg, nextLiteralPart);
3619
+ const prevLiteralPart = arrayPop(logArgs) || '';
3620
+ const trimmedPrev = stringEndsWith(prevLiteralPart, ' ')
3621
+ ? stringSlice(prevLiteralPart, 0, -1)
3622
+ : prevLiteralPart;
3623
+ if (trimmedPrev !== '') {
3624
+ arrayPush(logArgs, trimmedPrev);
3625
+ }
3626
+ const nextLiteralPart = template[i + 1];
3627
+ const trimmedNext = stringStartsWith(nextLiteralPart, ' ')
3628
+ ? stringSlice(nextLiteralPart, 1)
3629
+ : nextLiteralPart;
3630
+ arrayPush(logArgs, arg, trimmedNext);
3567
3631
  }
3568
3632
  if (logArgs[logArgs.length - 1] === '') {
3569
3633
  arrayPop(logArgs);
@@ -4262,6 +4326,7 @@ const freezeTypedArray = array => {
4262
4326
  try {
4263
4327
  delete obj[prop];
4264
4328
  } catch (err) {
4329
+ const reason = /** @type {string | object} */ (err);
4265
4330
  if (hasOwn(obj, prop)) {
4266
4331
  if (typeof obj === 'function' && prop === 'prototype') {
4267
4332
  obj.prototype = undefined;
@@ -4270,9 +4335,9 @@ const freezeTypedArray = array => {
4270
4335
  return;
4271
4336
  }
4272
4337
  }
4273
- error(`failed to delete ${subPath}`, err);
4338
+ error(`failed to delete ${subPath}`, reason);
4274
4339
  } else {
4275
- error(`deleting ${subPath} threw`, err);
4340
+ error(`deleting ${subPath} threw`, reason);
4276
4341
  }
4277
4342
  throw err;
4278
4343
  }
@@ -4620,7 +4685,7 @@ arrayForEach(['caller', 'arguments'], prop => {
4620
4685
  strict[prop];
4621
4686
  } catch (e) {
4622
4687
  // https://github.com/facebook/hermes/blob/main/test/hermes/function-non-strict.js
4623
- if (e.message === 'Restricted in strict mode') {
4688
+ if (/** @type {Error} */ (e).message === 'Restricted in strict mode') {
4624
4689
  // Fixed in Static Hermes: https://github.com/facebook/hermes/issues/1582
4625
4690
  FunctionInstance[prop] = accessor;
4626
4691
  }
@@ -5147,6 +5212,8 @@ const CommonMath = {
5147
5212
  getYear: fn,
5148
5213
  setYear: fn,
5149
5214
  toGMTString: fn,
5215
+
5216
+ toTemporalInstant: false,
5150
5217
  },
5151
5218
 
5152
5219
  // Text Processing
@@ -5535,6 +5602,8 @@ const CommonMath = {
5535
5602
  entries: fn,
5536
5603
  forEach: fn,
5537
5604
  get: fn,
5605
+ getOrInsert: fn,
5606
+ getOrInsertComputed: fn,
5538
5607
  has: fn,
5539
5608
  keys: fn,
5540
5609
  set: fn,
@@ -5606,6 +5675,8 @@ const CommonMath = {
5606
5675
  constructor: 'WeakMap',
5607
5676
  delete: fn,
5608
5677
  get: fn,
5678
+ getOrInsert: fn,
5679
+ getOrInsertComputed: fn,
5609
5680
  has: fn,
5610
5681
  set: fn,
5611
5682
  '@@toStringTag': 'string',
@@ -6864,17 +6935,25 @@ function sampleGlobals(globalObject, newPropertyNames) {
6864
6935
  })()
6865
6936
  ,
6866
6937
  // === 22. ses ./src/tame-nan-sidechannel.js ===
6867
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Object,DataView,Reflect,Number;$h͏_imports([["./commons.js", [["Object",[$h͏_a => (Object = $h͏_a)]],["DataView",[$h͏_a => (DataView = $h͏_a)]],["Reflect",[$h͏_a => (Reflect = $h͏_a)]],["Number",[$h͏_a => (Number = $h͏_a)]]]]]);
6938
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,dataViewPrototype,MAX_SAFE_INTEGER,apply,defineProperty,entries,getOwnPropertyDescriptor,hasOwn,is,max,trunc,uncurryThis;$h͏_imports([["./commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["dataViewPrototype",[$h͏_a => (dataViewPrototype = $h͏_a)]],["MAX_SAFE_INTEGER",[$h͏_a => (MAX_SAFE_INTEGER = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["max",[$h͏_a => (max = $h͏_a)]],["trunc",[$h͏_a => (trunc = $h͏_a)]],["uncurryThis",[$h͏_a => (uncurryThis = $h͏_a)]]]]]);
6939
+
6940
+
6941
+
6942
+
6943
+
6944
+
6945
+
6946
+
6947
+
6948
+
6949
+
6868
6950
 
6869
- const { is, defineProperty, entries } = Object;
6870
- const { apply } = Reflect;
6871
6951
 
6872
- const { prototype: dataViewPrototype } = DataView;
6873
6952
 
6874
6953
  /**
6875
6954
  * These `FERAL*` methods open up the NaN side-channel on some platforms,
6876
6955
  * like v8. Thus, we need to encapsulate them and replace them with wrappers
6877
- * that canonicaize NaNs.
6956
+ * that canonicalize NaNs.
6878
6957
  */
6879
6958
  const {
6880
6959
  setFloat16: FERAL_SET_FLOAT16,
@@ -6886,61 +6965,201 @@ const {
6886
6965
  setBigUint64,
6887
6966
  } = dataViewPrototype;
6888
6967
 
6889
- // See https://webidl.spec.whatwg.org/#js-unrestricted-double which implies
6890
- // that this is the canonical NaN for web standards.
6891
- // Casual googling stongly suggests that this is also the cosmWasm
6892
- // canonical NaN. But I have not yet found an authoritative page stating this.
6893
- const canonicalNaN = 0x7ff8000000000000n;
6968
+ const dataViewGetBuffer = uncurryThis(
6969
+ // @ts-expect-error we know it is there on all conforming platforms
6970
+ getOwnPropertyDescriptor(dataViewPrototype, 'buffer').get,
6971
+ );
6972
+
6973
+ /**
6974
+ * See https://webidl.spec.whatwg.org/#js-unrestricted-double which implies
6975
+ * that this is the canonical NaN for web standards.
6976
+ * Casual googling strongly suggests that this is also the cosmWasm
6977
+ * canonical NaN. But I have not yet found an authoritative page stating this.
6978
+ *
6979
+ * As noted there, WebIDL choses this value because
6980
+ * > The `NaN` value ... is chosen simply because it is the quiet NaN
6981
+ * > with the lowest value when its bit pattern is interpreted as an 64-bit
6982
+ * > unsigned integer.
6983
+ *
6984
+ * See https://github.com/endojs/endo/pull/3214#discussion_r3155852021
6985
+ */
6986
+ const canonicalNaN64Encoding = 0x7ff8000000000000n;
6987
+
6988
+ /**
6989
+ * As of this writing (April 29, 2026) all implementations agree that a
6990
+ * ***literal*** `NaN` seems to encode in 32 bits as `0x7fc00000`.
6991
+ * See https://github.com/endojs/endo/pull/3214#discussion_r3162974396
6992
+ *
6993
+ * Applying WebIDL's rationale for the 64 bit float
6994
+ * > The `NaN` value ... is chosen simply because it is the quiet NaN
6995
+ * > with the lowest value when its bit pattern is interpreted as an 64-bit
6996
+ * > unsigned integer.
6997
+ *
6998
+ * to the 32 bit case agrees with the choice the implementations make
6999
+ * for the 32 bit encoding of a ***literal*** `NaN`.
7000
+ *
7001
+ * See https://github.com/endojs/endo/pull/3214#discussion_r3155852021
7002
+ */
7003
+ const canonicalNaN32Encoding = 0x7fc00000;
7004
+
7005
+ /**
7006
+ * As of this writing (April 29, 2026) all implementations that implement
7007
+ * float16 (with the almost surely unintentional exception of QuickJS),
7008
+ * agree that a ***literal*** `NaN` seems to encode in 16 bits as `0x7e00`.
7009
+ * See https://github.com/endojs/endo/pull/3214#discussion_r3162974396
7010
+ *
7011
+ * Applying WebIDL's rationale for the 64 bit float
7012
+ * > The `NaN` value ... is chosen simply because it is the quiet NaN
7013
+ * > with the lowest value when its bit pattern is interpreted as an 64-bit
7014
+ * > unsigned integer.
7015
+ *
7016
+ * to the 16 bit case agrees with the choice those implementations make
7017
+ * for the 16 bit encoding of a ***literal*** `NaN`.
7018
+ *
7019
+ * See https://github.com/endojs/endo/pull/3214#discussion_r3155852021
7020
+ */
7021
+ const canonicalNaN16Encoding = 0x7e00;
7022
+
7023
+ /**
7024
+ * Perform `RequireInternalSlot(obj, [[DataView]])` as needed in
7025
+ * SetViewValue.
7026
+ * https://tc39.es/ecma262/multipage/structured-data.html#sec-setviewvalue
7027
+ * https://tc39.es/ecma262/#sec-get-dataview.prototype.buffer
7028
+ *
7029
+ * @param {unknown} obj
7030
+ * @returns {void}
7031
+ */
7032
+ const requireDataView = obj => {
7033
+ dataViewGetBuffer(obj);
7034
+ };
6894
7035
 
6895
- // Use method shorthand syntax to be this-sensitive but now be constructable
6896
- // nor have a `prototype` property.
7036
+ /**
7037
+ * Emulate the internal `ToIndex` from
7038
+ * https://tc39.es/ecma262/multipage/abstract-operations.html#sec-toindex
7039
+ *
7040
+ * @param {unknown} v
7041
+ * @returns {number}
7042
+ */
7043
+ const toIndex = v => {
7044
+ // @ts-expect-error Math.trunc uses the internal `ToNumber` to coerce its
7045
+ // argument, whatever it is, to an integer number.
7046
+ const n = trunc(v);
7047
+ if (n === 0 || is(n, NaN)) {
7048
+ return 0;
7049
+ }
7050
+ if (n < 0 || n > MAX_SAFE_INTEGER) {
7051
+ throw RangeError('Invalid offset');
7052
+ }
7053
+ return n;
7054
+ };
7055
+
7056
+ /**
7057
+ * Expose the internal `ToNumber` from
7058
+ * https://tc39.es/ecma262/multipage/abstract-operations.html#sec-tonumber
7059
+ * We can't just use `Number(value)` because that is backed by `ToNumeric`,
7060
+ * which coerces bigint output from `ToPrimitive` rather than throwing a
7061
+ * TypeError as required of `ToNumber` (e.g., `Number({ valueOf: () => 42n })`
7062
+ * returns 42).
7063
+ *
7064
+ * @param {unknown} v
7065
+ * @returns {number}
7066
+ */
7067
+ const toNumber = v =>
7068
+ // @ts-expect-error Math.max uses the internal `ToNumber` to coerce its
7069
+ // argument, whatever it is, to a number.
7070
+ max(v);
7071
+
7072
+ /**
7073
+ * Correctly guarding the `setFloat*` built-ins requires performing
7074
+ * `ToNumber(value)` ourselves, because a non-NaN value such as
7075
+ * `{ valueOf: () => {} }` gets coerced **to** NaN. But, according to
7076
+ * [SetViewValue](https://tc39.es/ecma262/multipage/structured-data.html#sec-setviewvalue),
7077
+ * we must first perform the observable
7078
+ * `RequireInternalSlot(view, [[DataView]])` and `ToIndex(requestIndex)` steps
7079
+ * (in that order). If those steps complete successfully, we have number-coerced
7080
+ * `byteOffset` and `value` values that will pass those same steps internal to
7081
+ * the implementation without incurring further observable interactions.
7082
+ *
7083
+ * We added these coercions to defend against an attack noticed by
7084
+ * https://github.com/deepview-autofix .
7085
+ * We were vulnerable to `value` being an
7086
+ * object with a `valueOf` method that returns a (bad) NaN, since it
7087
+ * would bypass the is NaN check. See where the
7088
+ * `tame-nan*-sidechannel.test.js test cases mention "coercion attack".
7089
+ *
7090
+ * Uses method shorthand syntax to be `this`-sensitive but not be constructable
7091
+ * nor have a `prototype` property.
7092
+ */
6897
7093
  const methods = {
6898
7094
  /**
6899
7095
  * @param {number} byteOffset
6900
7096
  * @param {number} value
6901
- * @param {boolean} [littleEndian]
7097
+ * @param {boolean} [isLittleEndian]
6902
7098
  */
6903
- setFloat16(byteOffset, value, littleEndian = undefined) {
7099
+ setFloat16(byteOffset, value, isLittleEndian = undefined) {
7100
+ requireDataView(this);
7101
+ byteOffset = toIndex(byteOffset);
7102
+ value = toNumber(value);
6904
7103
  if (is(value, NaN)) {
6905
7104
  return apply(setUint16, this, [
6906
7105
  byteOffset,
6907
- Number(canonicalNaN),
6908
- littleEndian,
7106
+ canonicalNaN16Encoding,
7107
+ isLittleEndian,
6909
7108
  ]);
6910
7109
  } else {
6911
- return apply(FERAL_SET_FLOAT16, this, [byteOffset, value, littleEndian]);
7110
+ return apply(FERAL_SET_FLOAT16, this, [
7111
+ byteOffset,
7112
+ value,
7113
+ isLittleEndian,
7114
+ ]);
6912
7115
  }
6913
7116
  },
7117
+
6914
7118
  /**
6915
7119
  * @param {number} byteOffset
6916
7120
  * @param {number} value
6917
- * @param {boolean} [littleEndian]
7121
+ * @param {boolean} [isLittleEndian]
6918
7122
  */
6919
- setFloat32(byteOffset, value, littleEndian = undefined) {
7123
+ setFloat32(byteOffset, value, isLittleEndian = undefined) {
7124
+ requireDataView(this);
7125
+ byteOffset = toIndex(byteOffset);
7126
+ value = toNumber(value);
6920
7127
  if (is(value, NaN)) {
6921
7128
  return apply(setUint32, this, [
6922
7129
  byteOffset,
6923
- Number(canonicalNaN),
6924
- littleEndian,
7130
+ canonicalNaN32Encoding,
7131
+ isLittleEndian,
6925
7132
  ]);
6926
7133
  } else {
6927
- return apply(FERAL_SET_FLOAT32, this, [byteOffset, value, littleEndian]);
7134
+ return apply(FERAL_SET_FLOAT32, this, [
7135
+ byteOffset,
7136
+ value,
7137
+ isLittleEndian,
7138
+ ]);
6928
7139
  }
6929
7140
  },
7141
+
6930
7142
  /**
6931
7143
  * @param {number} byteOffset
6932
7144
  * @param {number} value
6933
- * @param {boolean} [littleEndian]
7145
+ * @param {boolean} [isLittleEndian]
6934
7146
  */
6935
- setFloat64(byteOffset, value, littleEndian = undefined) {
7147
+ setFloat64(byteOffset, value, isLittleEndian = undefined) {
7148
+ requireDataView(this);
7149
+ byteOffset = toIndex(byteOffset);
7150
+ value = toNumber(value);
6936
7151
  if (is(value, NaN)) {
6937
7152
  return apply(setBigUint64, this, [
6938
7153
  byteOffset,
6939
- canonicalNaN,
6940
- littleEndian,
7154
+ canonicalNaN64Encoding,
7155
+ isLittleEndian,
6941
7156
  ]);
6942
7157
  } else {
6943
- return apply(FERAL_SET_FLOAT64, this, [byteOffset, value, littleEndian]);
7158
+ return apply(FERAL_SET_FLOAT64, this, [
7159
+ byteOffset,
7160
+ value,
7161
+ isLittleEndian,
7162
+ ]);
6944
7163
  }
6945
7164
  },
6946
7165
  };
@@ -6960,11 +7179,13 @@ const methods = {
6960
7179
  */
6961
7180
  const tameNaNSideChannel = () => {
6962
7181
  for (const [name, method] of entries(methods)) {
6963
- defineProperty(dataViewPrototype, name, {
6964
- // Since we're redefining properties that already exist, by omitting the
6965
- // other descriptor attributes here, they are unchanged.
6966
- value: method,
6967
- });
7182
+ if (hasOwn(dataViewPrototype, name)) {
7183
+ defineProperty(dataViewPrototype, name, {
7184
+ // Since we're redefining properties that already exist, by omitting the
7185
+ // other descriptor attributes here, they are unchanged.
7186
+ value: method,
7187
+ });
7188
+ }
6968
7189
  }
6969
7190
  };$h͏_once.tameNaNSideChannel(tameNaNSideChannel);
6970
7191
  })()
@@ -7499,7 +7720,8 @@ const methods = {
7499
7720
  })()
7500
7721
  ,
7501
7722
  // === 26. ses ./src/tame-locale-methods.js ===
7502
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,isPrimitive,regexpExec,assert;$h͏_imports([["./commons.js", [["Number",[$h͏_a => (Number = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7723
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,freezeRegexp,getOwnPropertyNames,isPrimitive,regexpExec,assert;$h͏_imports([["./commons.js", [["Number",[$h͏_a => (Number = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7724
+
7503
7725
 
7504
7726
 
7505
7727
 
@@ -7512,7 +7734,7 @@ const methods = {
7512
7734
 
7513
7735
  const { Fail, quote: q } = assert;
7514
7736
 
7515
- const localePattern = /^(\w*[a-z])Locale([A-Z]\w*)$/;
7737
+ const localePattern = freezeRegexp(/^(\w*[a-z])Locale([A-Z]\w*)$/);
7516
7738
 
7517
7739
  // Use concise methods to obtain named functions without constructor
7518
7740
  // behavior or `.prototype` property.
@@ -8129,7 +8351,12 @@ const { Fail } = assert;
8129
8351
  })()
8130
8352
  ,
8131
8353
  // === 33. ses ./src/get-source-url.js ===
8132
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,regexpExec,stringSlice;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]]]]]);
8354
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,freezeRegexp,regexpExec,stringSlice;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]]]]]);
8355
+
8356
+
8357
+
8358
+
8359
+
8133
8360
 
8134
8361
  // Captures a key and value of the form #key=value or @key=value
8135
8362
  const sourceMetaEntryRegExp =
@@ -8140,8 +8367,10 @@ const sourceMetaEntryRegExp =
8140
8367
  // On account of the mechanics of regular expressions, scanning from the end
8141
8368
  // does not allow us to capture every pair, so getSourceURL must capture and
8142
8369
  // trim until there are no matching comments.
8143
- const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
8144
- `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`,
8370
+ const sourceMetaEntriesRegExp = freezeRegexp(
8371
+ new FERAL_REG_EXP(
8372
+ `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`,
8373
+ ),
8145
8374
  );
8146
8375
 
8147
8376
  /**
@@ -8162,7 +8391,7 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
8162
8391
  if (match === null) {
8163
8392
  break;
8164
8393
  }
8165
- src = stringSlice(src, 0, src.length - match[0].length);
8394
+ src = stringSlice(src, 0, -match[0].length);
8166
8395
 
8167
8396
  // We skip $0 since it contains the entire match.
8168
8397
  // The match contains four capture groups,
@@ -8182,7 +8411,8 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
8182
8411
  })()
8183
8412
  ,
8184
8413
  // === 34. ses ./src/transforms.js ===
8185
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,regexpReplace,sealRegexp,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringSearch",[$h͏_a => (stringSearch = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
8414
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,freezeRegexp,regexpReplace,regexpSearch,sealRegexp,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["regexpSearch",[$h͏_a => (regexpSearch = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
8415
+
8186
8416
 
8187
8417
 
8188
8418
 
@@ -8205,7 +8435,7 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
8205
8435
  * @returns {number}
8206
8436
  */
8207
8437
  function getLineNumber(src, pattern) {
8208
- const index = stringSearch(src, pattern);
8438
+ const index = regexpSearch(pattern, src);
8209
8439
  if (index < 0) {
8210
8440
  return -1;
8211
8441
  }
@@ -8361,9 +8591,8 @@ const importPattern = sealRegexp(
8361
8591
 
8362
8592
  // /////////////////////////////////////////////////////////////////////////////
8363
8593
  $h͏_once.evadeImportExpressionTest(evadeImportExpressionTest);
8364
- const someDirectEvalPattern = new FERAL_REG_EXP(
8365
- '(^|[^.])\\beval(\\s*\\()',
8366
- 'g',
8594
+ const someDirectEvalPattern = freezeRegexp(
8595
+ new FERAL_REG_EXP('(^|[^.])\\beval(\\s*\\()'),
8367
8596
  );
8368
8597
 
8369
8598
  /**
@@ -8454,7 +8683,8 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
8454
8683
  })()
8455
8684
  ,
8456
8685
  // === 35. ses ./src/scope-constants.js ===
8457
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpExec,Set,setHas;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]]]);
8686
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,freezeRegexp,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpSearch,Set,setHas;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["regexpSearch",[$h͏_a => (regexpSearch = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]]]);
8687
+
8458
8688
 
8459
8689
 
8460
8690
 
@@ -8547,7 +8777,7 @@ const reservedNames = new Set([
8547
8777
  * Note: \w is equivalent [a-zA-Z_0-9]
8548
8778
  * See 11.6.1 Identifier Names
8549
8779
  */
8550
- const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
8780
+ const identifierPattern = freezeRegexp(/^[a-zA-Z_$][\w$]*$/);
8551
8781
 
8552
8782
  /**
8553
8783
  * isValidIdentifierName()
@@ -8556,7 +8786,7 @@ const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
8556
8786
  * @param {string} name
8557
8787
  */
8558
8788
  const isValidIdentifierName = name =>
8559
- !setHas(reservedNames, name) && !!regexpExec(identifierPattern, name);
8789
+ !setHas(reservedNames, name) && regexpSearch(identifierPattern, name) !== -1;
8560
8790
 
8561
8791
  /*
8562
8792
  * isImmutableDataProperty
@@ -9879,7 +10109,9 @@ const wrapLogger = (logger, thisArg) =>
9879
10109
  })()
9880
10110
  ,
9881
10111
  // === 44. ses ./src/error/tame-v8-error-constructor.js ===
9882
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
10112
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,freezeRegexp,fromEntries,reflectSet,regexpExec,regexpSearch,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["freezeRegexp",[$h͏_a => (freezeRegexp = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpSearch",[$h͏_a => (regexpSearch = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
10113
+
10114
+
9883
10115
 
9884
10116
 
9885
10117
 
@@ -9944,27 +10176,33 @@ const safeV8SST = sst => arrayMap(sst, safeV8CallSiteFacet);
9944
10176
  // If it has `/node_modules/` anywhere in it, on Node it is likely
9945
10177
  // to be a dependent package of the current package, and so to
9946
10178
  // be an infrastructure frame to be dropped from concise stack traces.
9947
- const FILENAME_NODE_DEPENDENTS_CENSOR = /\/node_modules\//;
10179
+ const FILENAME_NODE_DEPENDENTS_CENSOR = freezeRegexp(/\/node_modules\//);
9948
10180
 
9949
10181
  // If it begins with `internal/` or `node:internal` then it is likely
9950
10182
  // part of the node infrustructre itself, to be dropped from concise
9951
10183
  // stack traces.
9952
- const FILENAME_NODE_INTERNALS_CENSOR = /^(?:node:)?internal\//;
10184
+ const FILENAME_NODE_INTERNALS_CENSOR = freezeRegexp(/^(?:node:)?internal\//);
9953
10185
 
9954
10186
  // Frames within SES `assert.js` should be dropped from concise stack traces, as
9955
10187
  // these are just steps towards creating the error object in question.
9956
- const FILENAME_ASSERT_CENSOR = /\/packages\/ses\/src\/error\/assert\.js$/;
10188
+ const FILENAME_ASSERT_CENSOR = freezeRegexp(
10189
+ /\/packages\/ses\/src\/error\/assert\.js$/,
10190
+ );
9957
10191
 
9958
10192
  // Frames within the `eventual-send` shim should be dropped so that concise
9959
10193
  // deep stacks omit the internals of the eventual-sending mechanism causing
9960
10194
  // asynchronous messages to be sent.
9961
10195
  // Note that the eventual-send package will move from agoric-sdk to
9962
10196
  // Endo, so this rule will be of general interest.
9963
- const FILENAME_EVENTUAL_SEND_CENSOR = /\/packages\/eventual-send\/src\//;
10197
+ const FILENAME_EVENTUAL_SEND_CENSOR = freezeRegexp(
10198
+ /\/packages\/eventual-send\/src\//,
10199
+ );
9964
10200
 
9965
10201
  // Frames within the `ses-ava` package should be dropped from concise stack
9966
10202
  // traces, as they just support exposing error details to AVA.
9967
- const FILENAME_SES_AVA_CENSOR = /\/packages\/ses-ava\/src\/ses-ava-test\.js$/;
10203
+ const FILENAME_SES_AVA_CENSOR = freezeRegexp(
10204
+ /\/packages\/ses-ava\/src\/ses-ava-test\.js$/,
10205
+ );
9968
10206
 
9969
10207
  // Any stack frame whose `fileName` matches any of these censor patterns
9970
10208
  // will be omitted from concise stacks.
@@ -9987,7 +10225,7 @@ const FILENAME_CENSORS = [
9987
10225
  return false;
9988
10226
  }
9989
10227
  for (const filter of FILENAME_CENSORS) {
9990
- if (regexpExec(filter, fileName)) {
10228
+ if (regexpSearch(filter, fileName) !== -1) {
9991
10229
  return false;
9992
10230
  }
9993
10231
  }
@@ -10004,7 +10242,9 @@ const FILENAME_CENSORS = [
10004
10242
  //
10005
10243
  // See thread starting at
10006
10244
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
10007
- $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/;
10245
+ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=freezeRegexp(
10246
+ /^((?:.*[( ])?)[:/\w_-]*\/\.\.\.\/(.+)$/,
10247
+ );
10008
10248
 
10009
10249
  // The ad-hoc rule of the current pattern is that any likely-file-path or
10010
10250
  // likely url-path prefix consisting of `.../` should get dropped.
@@ -10016,7 +10256,7 @@ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:
10016
10256
  //
10017
10257
  // See thread starting at
10018
10258
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
10019
- const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
10259
+ const CALLSITE_ELLIPSIS_PATTERN2 = freezeRegexp(/^((?:.*[( ])?)\.\.\.\/(.+)$/);
10020
10260
 
10021
10261
  // The ad-hoc rule of the current pattern is that any likely-file-path or
10022
10262
  // likely url-path prefix, ending in a `/` and prior to `package/` should get
@@ -10028,7 +10268,9 @@ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
10028
10268
  // `'Object.bar (packages/errors/test/deep-send.test.js:13:21)'`.
10029
10269
  // Note that `/packages/` is a convention for monorepos encouraged by
10030
10270
  // lerna.
10031
- const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
10271
+ const CALLSITE_PACKAGES_PATTERN = freezeRegexp(
10272
+ /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/,
10273
+ );
10032
10274
 
10033
10275
  // The ad-hoc rule of the current pattern is that any likely-file-path or
10034
10276
  // likely url-path prefix of the form `file://` but not `file:///` gets
@@ -10044,7 +10286,9 @@ const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
10044
10286
  // clickable without removing the `file:///`, whereas `file://` usually precedes
10045
10287
  // a relative path which, for whatever vscode reason, is not clickable until the
10046
10288
  // `file://` is removed.
10047
- const CALLSITE_FILE_2SLASH_PATTERN = /^((?:.*[( ])?)file:\/\/([^/].*)$/;
10289
+ const CALLSITE_FILE_2SLASH_PATTERN = freezeRegexp(
10290
+ /^((?:.*[( ])?)file:\/\/([^/].*)$/,
10291
+ );
10048
10292
 
10049
10293
  // The use of these callSite patterns below assumes that any match will bind
10050
10294
  // capture groups containing the parts of the original string we want
@@ -10315,10 +10559,16 @@ let initialGetStackString = tamedMethods.getStackString;
10315
10559
  typeof originalCaptureStackTrace === 'function' ? 'v8' : 'unknown';
10316
10560
 
10317
10561
  const makeErrorConstructor = (_ = {}) => {
10562
+ /**
10563
+ * @this {ErrorConstructor}
10564
+ * @param {...any} rest
10565
+ */
10318
10566
  // eslint-disable-next-line no-shadow
10319
10567
  const ResultError = function Error(...rest) {
10320
10568
  let error;
10321
10569
  if (new.target === undefined) {
10570
+ // Forward caller's `this` to FERAL_ERROR to keep the shim transparent.
10571
+ // Error() as a function ignores `this` per spec, but do not narrow it.
10322
10572
  error = apply(FERAL_ERROR, this, rest);
10323
10573
  } else {
10324
10574
  error = construct(FERAL_ERROR, rest, new.target);
@@ -12582,9 +12832,9 @@ defineProperties(InertCompartment, {
12582
12832
  { parentCompartment = undefined, enforceNew = false } = {},
12583
12833
  ) => {
12584
12834
  /**
12585
- *
12586
- * @param {CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12835
+ * @param {...CompartmentOptionsArgs|LegacyCompartmentOptionsArgs} args
12587
12836
  */
12837
+ /** @this {Compartment} */
12588
12838
  function Compartment(...args) {
12589
12839
  if (enforceNew && new.target === undefined) {
12590
12840
  throw TypeError(
@@ -12606,7 +12856,9 @@ defineProperties(InertCompartment, {
12606
12856
  importMetaHook,
12607
12857
  __noNamespaceBox__: noNamespaceBox = false,
12608
12858
  noAggregateLoadErrors = false,
12609
- } = compartmentOptions(...args);
12859
+ } = compartmentOptions(
12860
+ .../** @type {Parameters<typeof compartmentOptions>} */ (args),
12861
+ );
12610
12862
  const globalTransforms = arrayFlatMap(
12611
12863
  [transforms, __shimTransforms__],
12612
12864
  identity,
@@ -12623,7 +12875,7 @@ defineProperties(InertCompartment, {
12623
12875
 
12624
12876
  const globalObject = {};
12625
12877
 
12626
- const compartment = this;
12878
+ const compartment = /** @type {Compartment} */ (this);
12627
12879
 
12628
12880
  setGlobalObjectSymbolUnscopables(globalObject);
12629
12881
 
@@ -12644,7 +12896,7 @@ defineProperties(InertCompartment, {
12644
12896
  intrinsics,
12645
12897
  newGlobalPropertyNames: sharedGlobalPropertyNames,
12646
12898
  makeCompartmentConstructor: targetMakeCompartmentConstructor,
12647
- parentCompartment: this,
12899
+ parentCompartment: compartment,
12648
12900
  markVirtualizedNativeFunction,
12649
12901
  });
12650
12902
 
@@ -12696,7 +12948,7 @@ defineProperties(InertCompartment, {
12696
12948
  return exportsProxy;
12697
12949
  };
12698
12950
 
12699
- weakmapSet(privateFields, this, {
12951
+ weakmapSet(privateFields, compartment, {
12700
12952
  name: `${name}`,
12701
12953
  globalTransforms,
12702
12954
  globalObject,
@@ -12787,7 +13039,7 @@ function makeArguments() {
12787
13039
 
12788
13040
  // 21.2.7.1 The %RegExpStringIteratorPrototype% Object
12789
13041
  const RegExpStringIterator =
12790
- regexpPrototype[matchAllSymbol] && matchAllRegExp(/./);
13042
+ regexpPrototype[matchAllSymbol] && matchAllRegExp(/./, '');
12791
13043
  const RegExpStringIteratorPrototype =
12792
13044
  RegExpStringIterator && getPrototypeOf(RegExpStringIterator);
12793
13045