ses 0.15.23 → 0.16.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.cjs CHANGED
@@ -69,8 +69,9 @@ const {
69
69
  seal,
70
70
  preventExtensions,
71
71
  setPrototypeOf,
72
- values}=
73
- 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.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);
72
+ values,
73
+ fromEntries}=
74
+ 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.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);
74
75
 
75
76
  const {
76
77
  species: speciesSymbol,
@@ -85,24 +86,8 @@ const { isInteger}= Number;$h‍_once.isInteger(isInteger);
85
86
 
86
87
  const { stringify: stringifyJson}= JSON;
87
88
 
88
- // At time of this writing, we still support Node 10 which doesn't have
89
- // `Object.fromEntries`. If it is absent, this should be an adequate
90
- // replacement.
91
- // By the terminology of https://ponyfoo.com/articles/polyfills-or-ponyfills
92
- // it is a ponyfill rather than a polyfill or shim because we do not
93
- // install it on `Object`.
94
- $h‍_once.stringifyJson(stringifyJson);const objectFromEntries=(entryPairs)=>{
95
- const result= {};
96
- for( const [prop, val]of entryPairs) {
97
- result[prop]= val;
98
- }
99
- return result;
100
- };
101
-
102
- const fromEntries= Object.fromEntries|| objectFromEntries;
103
-
104
89
  // Needed only for the Safari bug workaround below
105
- $h‍_once.fromEntries(fromEntries);const{defineProperty:originalDefineProperty}=Object;
90
+ $h‍_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object;
106
91
 
107
92
  const defineProperty= (object, prop, descriptor)=> {
108
93
  // We used to do the following, until we had to reopen Safari bug
@@ -5845,22 +5830,27 @@ const severeEnablements= {
5845
5830
  ...moderateEnablements,
5846
5831
 
5847
5832
  /**
5848
- * Rollup(as used at least by vega) and webpack
5833
+ * Rollup (as used at least by vega) and webpack
5849
5834
  * (as used at least by regenerator) both turn exports into assignments
5850
5835
  * to a big `exports` object that inherits directly from
5851
- * `Object.prototype`.Some of the exported names we've seen include
5836
+ * `Object.prototype`. Some of the exported names we've seen include
5852
5837
  * `hasOwnProperty`, `constructor`, and `toString`. But the strategy used
5853
- * by rollup and webpack means potentionally turns any exported name
5854
- * into an assignment rejected by the override mistake.That's why
5855
- * we take the extreme step of enabling everything on`Object.prototype`.
5838
+ * by rollup and webpack potentionally turns any exported name
5839
+ * into an assignment rejected by the override mistake. That's why
5840
+ * the `severe` enablements takes the extreme step of enabling
5841
+ * everything on `Object.prototype`.
5856
5842
  *
5857
5843
  * In addition, code doing inheritance manually will often override
5858
5844
  * the `constructor` property on the new prototype by assignment. We've
5859
5845
  * seen this several times.
5860
5846
  *
5861
5847
  * The cost of enabling all these is that they create a miserable debugging
5862
- * experience. https://github.com/Agoric/agoric-sdk/issues/2324 explains
5863
- * how it confused the Node console.
5848
+ * experience specifically on Node.
5849
+ * https://github.com/Agoric/agoric-sdk/issues/2324
5850
+ * explains how it confused the Node console.
5851
+ *
5852
+ * (TODO Reexamine the vscode situation. I think it may have improved
5853
+ * since the following paragraph was written.)
5864
5854
  *
5865
5855
  * The vscode debugger's object inspector shows the own data properties of
5866
5856
  * an object, which is typically what you want, but also shows both getter
@@ -5877,8 +5867,8 @@ const severeEnablements= {
5877
5867
  * The widely used Buffer defined at https://github.com/feross/buffer
5878
5868
  * on initialization, manually creates the equivalent of a subclass of
5879
5869
  * `TypedArray`, which it then initializes by assignment. These assignments
5880
- * include enough of the `TypeArray` methods that here, we just enable
5881
- * them all.
5870
+ * include enough of the `TypeArray` methods that here, the `severe`
5871
+ * enablements just enable them all.
5882
5872
  */
5883
5873
  '%TypedArrayPrototype%': '*'};$h‍_once.severeEnablements(severeEnablements);
5884
5874
  })
@@ -7680,40 +7670,52 @@ const getTypedArrayToStringTag= typedArrayToStringTag.get;
7680
7670
  assert(getTypedArrayToStringTag);
7681
7671
 
7682
7672
  // Exported for tests.
7683
- /** @param {unknown} object */
7673
+ /**
7674
+ * Duplicates packages/marshal/src/helpers/passStyle-helpers.js to avoid a dependency.
7675
+ *
7676
+ * @param {unknown} object
7677
+ */
7684
7678
  const isTypedArray= (object)=>{
7685
7679
  // The object must pass a brand check or toStringTag will return undefined.
7686
7680
  const tag= apply(getTypedArrayToStringTag, object, []);
7687
7681
  return tag!== undefined;
7688
7682
  };
7689
7683
 
7684
+ /**
7685
+ * Tests if a property key is an integer-valued canonical numeric index.
7686
+ * https://tc39.es/ecma262/#sec-canonicalnumericindexstring
7687
+ *
7688
+ * @param {string | symbol} propertyKey
7689
+ */$h‍_once.isTypedArray(isTypedArray);
7690
+ const isCanonicalIntegerIndexString= (propertyKey)=>{
7691
+ const n= +String(propertyKey);
7692
+ return isInteger(n)&& String(n)=== propertyKey;
7693
+ };
7694
+
7690
7695
  /**
7691
7696
  * @template T
7692
7697
  * @param {ArrayLike<T>} array
7693
- */$h‍_once.isTypedArray(isTypedArray);
7698
+ */
7694
7699
  const freezeTypedArray= (array)=>{
7695
- const descs= getOwnPropertyDescriptors(array);
7696
-
7697
7700
  preventExtensions(array);
7698
7701
 
7699
7702
  // Downgrade writable expandos to readonly, even if non-configurable.
7700
- arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name)=> {
7701
- const desc= descs[/** @type {string} */ name];
7702
- // The numbered properties are writable and non-configurable,
7703
- // and cannot be made non-writable by defineProperty.
7704
- // This is a strange behavior intrinsic to TypedArrays, but no more harmful
7705
- // than the mutability of properties of a hardened Map or Set,
7706
- // so we carve out this exceptional behavior.
7707
- //
7708
- // TypedArrays are integer-indexed exotic objects, so indexed properties
7709
- // outside the range of 0 to the typed array's length are disallowed.
7710
- // Assignment to these indexes silently fails and defining an indexed
7711
- // property throws an error.
7712
- // So, we only need to make non-index properties non-writable and
7713
- // non-configurable.
7703
+ // We get each descriptor individually rather than using
7704
+ // getOwnPropertyDescriptors in order to fail safe when encountering
7705
+ // an obscure GraalJS issue where getOwnPropertyDescriptor returns
7706
+ // undefined for a property that does exist.
7707
+ arrayForEach(ownKeys(array), (/** @type {string | symbol} */ name)=> {
7708
+ const desc= getOwnPropertyDescriptor(array, name);
7709
+ assert(desc);
7710
+ // TypedArrays are integer-indexed exotic objects, which define special
7711
+ // treatment for property names in canonical numeric form:
7712
+ // integers in range are permanently writable and non-configurable.
7714
7713
  // https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects
7715
- const number= +String(name);
7716
- if( !isInteger(number)) {
7714
+ //
7715
+ // This is analogous to the data of a hardened Map or Set,
7716
+ // so we carve out this exceptional behavior but make all other
7717
+ // properties non-configurable.
7718
+ if( !isCanonicalIntegerIndexString(name)) {
7717
7719
  defineProperty(array, name, {
7718
7720
  ...desc,
7719
7721
  writable: false,
@@ -9209,6 +9211,7 @@ assign(globalThis, {
9209
9211
  preventExtensions: cell("preventExtensions"),
9210
9212
  setPrototypeOf: cell("setPrototypeOf"),
9211
9213
  values: cell("values"),
9214
+ fromEntries: cell("fromEntries"),
9212
9215
  speciesSymbol: cell("speciesSymbol"),
9213
9216
  toStringTagSymbol: cell("toStringTagSymbol"),
9214
9217
  iteratorSymbol: cell("iteratorSymbol"),
@@ -9217,7 +9220,6 @@ assign(globalThis, {
9217
9220
  symbolFor: cell("symbolFor"),
9218
9221
  isInteger: cell("isInteger"),
9219
9222
  stringifyJson: cell("stringifyJson"),
9220
- fromEntries: cell("fromEntries"),
9221
9223
  defineProperty: cell("defineProperty"),
9222
9224
  apply: cell("apply"),
9223
9225
  construct: cell("construct"),
@@ -9525,6 +9527,7 @@ assign(globalThis, {
9525
9527
  preventExtensions: cells[0].preventExtensions.set,
9526
9528
  setPrototypeOf: cells[0].setPrototypeOf.set,
9527
9529
  values: cells[0].values.set,
9530
+ fromEntries: cells[0].fromEntries.set,
9528
9531
  speciesSymbol: cells[0].speciesSymbol.set,
9529
9532
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
9530
9533
  iteratorSymbol: cells[0].iteratorSymbol.set,
@@ -9533,7 +9536,6 @@ assign(globalThis, {
9533
9536
  symbolFor: cells[0].symbolFor.set,
9534
9537
  isInteger: cells[0].isInteger.set,
9535
9538
  stringifyJson: cells[0].stringifyJson.set,
9536
- fromEntries: cells[0].fromEntries.set,
9537
9539
  defineProperty: cells[0].defineProperty.set,
9538
9540
  apply: cells[0].apply.set,
9539
9541
  construct: cells[0].construct.set,
package/dist/ses.mjs CHANGED
@@ -69,8 +69,9 @@ const {
69
69
  seal,
70
70
  preventExtensions,
71
71
  setPrototypeOf,
72
- values}=
73
- 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.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);
72
+ values,
73
+ fromEntries}=
74
+ 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.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);
74
75
 
75
76
  const {
76
77
  species: speciesSymbol,
@@ -85,24 +86,8 @@ const { isInteger}= Number;$h‍_once.isInteger(isInteger);
85
86
 
86
87
  const { stringify: stringifyJson}= JSON;
87
88
 
88
- // At time of this writing, we still support Node 10 which doesn't have
89
- // `Object.fromEntries`. If it is absent, this should be an adequate
90
- // replacement.
91
- // By the terminology of https://ponyfoo.com/articles/polyfills-or-ponyfills
92
- // it is a ponyfill rather than a polyfill or shim because we do not
93
- // install it on `Object`.
94
- $h‍_once.stringifyJson(stringifyJson);const objectFromEntries=(entryPairs)=>{
95
- const result= {};
96
- for( const [prop, val]of entryPairs) {
97
- result[prop]= val;
98
- }
99
- return result;
100
- };
101
-
102
- const fromEntries= Object.fromEntries|| objectFromEntries;
103
-
104
89
  // Needed only for the Safari bug workaround below
105
- $h‍_once.fromEntries(fromEntries);const{defineProperty:originalDefineProperty}=Object;
90
+ $h‍_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object;
106
91
 
107
92
  const defineProperty= (object, prop, descriptor)=> {
108
93
  // We used to do the following, until we had to reopen Safari bug
@@ -5845,22 +5830,27 @@ const severeEnablements= {
5845
5830
  ...moderateEnablements,
5846
5831
 
5847
5832
  /**
5848
- * Rollup(as used at least by vega) and webpack
5833
+ * Rollup (as used at least by vega) and webpack
5849
5834
  * (as used at least by regenerator) both turn exports into assignments
5850
5835
  * to a big `exports` object that inherits directly from
5851
- * `Object.prototype`.Some of the exported names we've seen include
5836
+ * `Object.prototype`. Some of the exported names we've seen include
5852
5837
  * `hasOwnProperty`, `constructor`, and `toString`. But the strategy used
5853
- * by rollup and webpack means potentionally turns any exported name
5854
- * into an assignment rejected by the override mistake.That's why
5855
- * we take the extreme step of enabling everything on`Object.prototype`.
5838
+ * by rollup and webpack potentionally turns any exported name
5839
+ * into an assignment rejected by the override mistake. That's why
5840
+ * the `severe` enablements takes the extreme step of enabling
5841
+ * everything on `Object.prototype`.
5856
5842
  *
5857
5843
  * In addition, code doing inheritance manually will often override
5858
5844
  * the `constructor` property on the new prototype by assignment. We've
5859
5845
  * seen this several times.
5860
5846
  *
5861
5847
  * The cost of enabling all these is that they create a miserable debugging
5862
- * experience. https://github.com/Agoric/agoric-sdk/issues/2324 explains
5863
- * how it confused the Node console.
5848
+ * experience specifically on Node.
5849
+ * https://github.com/Agoric/agoric-sdk/issues/2324
5850
+ * explains how it confused the Node console.
5851
+ *
5852
+ * (TODO Reexamine the vscode situation. I think it may have improved
5853
+ * since the following paragraph was written.)
5864
5854
  *
5865
5855
  * The vscode debugger's object inspector shows the own data properties of
5866
5856
  * an object, which is typically what you want, but also shows both getter
@@ -5877,8 +5867,8 @@ const severeEnablements= {
5877
5867
  * The widely used Buffer defined at https://github.com/feross/buffer
5878
5868
  * on initialization, manually creates the equivalent of a subclass of
5879
5869
  * `TypedArray`, which it then initializes by assignment. These assignments
5880
- * include enough of the `TypeArray` methods that here, we just enable
5881
- * them all.
5870
+ * include enough of the `TypeArray` methods that here, the `severe`
5871
+ * enablements just enable them all.
5882
5872
  */
5883
5873
  '%TypedArrayPrototype%': '*'};$h‍_once.severeEnablements(severeEnablements);
5884
5874
  })
@@ -7680,40 +7670,52 @@ const getTypedArrayToStringTag= typedArrayToStringTag.get;
7680
7670
  assert(getTypedArrayToStringTag);
7681
7671
 
7682
7672
  // Exported for tests.
7683
- /** @param {unknown} object */
7673
+ /**
7674
+ * Duplicates packages/marshal/src/helpers/passStyle-helpers.js to avoid a dependency.
7675
+ *
7676
+ * @param {unknown} object
7677
+ */
7684
7678
  const isTypedArray= (object)=>{
7685
7679
  // The object must pass a brand check or toStringTag will return undefined.
7686
7680
  const tag= apply(getTypedArrayToStringTag, object, []);
7687
7681
  return tag!== undefined;
7688
7682
  };
7689
7683
 
7684
+ /**
7685
+ * Tests if a property key is an integer-valued canonical numeric index.
7686
+ * https://tc39.es/ecma262/#sec-canonicalnumericindexstring
7687
+ *
7688
+ * @param {string | symbol} propertyKey
7689
+ */$h‍_once.isTypedArray(isTypedArray);
7690
+ const isCanonicalIntegerIndexString= (propertyKey)=>{
7691
+ const n= +String(propertyKey);
7692
+ return isInteger(n)&& String(n)=== propertyKey;
7693
+ };
7694
+
7690
7695
  /**
7691
7696
  * @template T
7692
7697
  * @param {ArrayLike<T>} array
7693
- */$h‍_once.isTypedArray(isTypedArray);
7698
+ */
7694
7699
  const freezeTypedArray= (array)=>{
7695
- const descs= getOwnPropertyDescriptors(array);
7696
-
7697
7700
  preventExtensions(array);
7698
7701
 
7699
7702
  // Downgrade writable expandos to readonly, even if non-configurable.
7700
- arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name)=> {
7701
- const desc= descs[/** @type {string} */ name];
7702
- // The numbered properties are writable and non-configurable,
7703
- // and cannot be made non-writable by defineProperty.
7704
- // This is a strange behavior intrinsic to TypedArrays, but no more harmful
7705
- // than the mutability of properties of a hardened Map or Set,
7706
- // so we carve out this exceptional behavior.
7707
- //
7708
- // TypedArrays are integer-indexed exotic objects, so indexed properties
7709
- // outside the range of 0 to the typed array's length are disallowed.
7710
- // Assignment to these indexes silently fails and defining an indexed
7711
- // property throws an error.
7712
- // So, we only need to make non-index properties non-writable and
7713
- // non-configurable.
7703
+ // We get each descriptor individually rather than using
7704
+ // getOwnPropertyDescriptors in order to fail safe when encountering
7705
+ // an obscure GraalJS issue where getOwnPropertyDescriptor returns
7706
+ // undefined for a property that does exist.
7707
+ arrayForEach(ownKeys(array), (/** @type {string | symbol} */ name)=> {
7708
+ const desc= getOwnPropertyDescriptor(array, name);
7709
+ assert(desc);
7710
+ // TypedArrays are integer-indexed exotic objects, which define special
7711
+ // treatment for property names in canonical numeric form:
7712
+ // integers in range are permanently writable and non-configurable.
7714
7713
  // https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects
7715
- const number= +String(name);
7716
- if( !isInteger(number)) {
7714
+ //
7715
+ // This is analogous to the data of a hardened Map or Set,
7716
+ // so we carve out this exceptional behavior but make all other
7717
+ // properties non-configurable.
7718
+ if( !isCanonicalIntegerIndexString(name)) {
7717
7719
  defineProperty(array, name, {
7718
7720
  ...desc,
7719
7721
  writable: false,
@@ -9209,6 +9211,7 @@ assign(globalThis, {
9209
9211
  preventExtensions: cell("preventExtensions"),
9210
9212
  setPrototypeOf: cell("setPrototypeOf"),
9211
9213
  values: cell("values"),
9214
+ fromEntries: cell("fromEntries"),
9212
9215
  speciesSymbol: cell("speciesSymbol"),
9213
9216
  toStringTagSymbol: cell("toStringTagSymbol"),
9214
9217
  iteratorSymbol: cell("iteratorSymbol"),
@@ -9217,7 +9220,6 @@ assign(globalThis, {
9217
9220
  symbolFor: cell("symbolFor"),
9218
9221
  isInteger: cell("isInteger"),
9219
9222
  stringifyJson: cell("stringifyJson"),
9220
- fromEntries: cell("fromEntries"),
9221
9223
  defineProperty: cell("defineProperty"),
9222
9224
  apply: cell("apply"),
9223
9225
  construct: cell("construct"),
@@ -9525,6 +9527,7 @@ assign(globalThis, {
9525
9527
  preventExtensions: cells[0].preventExtensions.set,
9526
9528
  setPrototypeOf: cells[0].setPrototypeOf.set,
9527
9529
  values: cells[0].values.set,
9530
+ fromEntries: cells[0].fromEntries.set,
9528
9531
  speciesSymbol: cells[0].speciesSymbol.set,
9529
9532
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
9530
9533
  iteratorSymbol: cells[0].iteratorSymbol.set,
@@ -9533,7 +9536,6 @@ assign(globalThis, {
9533
9536
  symbolFor: cells[0].symbolFor.set,
9534
9537
  isInteger: cells[0].isInteger.set,
9535
9538
  stringifyJson: cells[0].stringifyJson.set,
9536
- fromEntries: cells[0].fromEntries.set,
9537
9539
  defineProperty: cells[0].defineProperty.set,
9538
9540
  apply: cells[0].apply.set,
9539
9541
  construct: cells[0].construct.set,
package/dist/ses.umd.js CHANGED
@@ -69,8 +69,9 @@ const {
69
69
  seal,
70
70
  preventExtensions,
71
71
  setPrototypeOf,
72
- values}=
73
- 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.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);
72
+ values,
73
+ fromEntries}=
74
+ 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.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);
74
75
 
75
76
  const {
76
77
  species: speciesSymbol,
@@ -85,24 +86,8 @@ const { isInteger}= Number;$h‍_once.isInteger(isInteger);
85
86
 
86
87
  const { stringify: stringifyJson}= JSON;
87
88
 
88
- // At time of this writing, we still support Node 10 which doesn't have
89
- // `Object.fromEntries`. If it is absent, this should be an adequate
90
- // replacement.
91
- // By the terminology of https://ponyfoo.com/articles/polyfills-or-ponyfills
92
- // it is a ponyfill rather than a polyfill or shim because we do not
93
- // install it on `Object`.
94
- $h‍_once.stringifyJson(stringifyJson);const objectFromEntries=(entryPairs)=>{
95
- const result= {};
96
- for( const [prop, val]of entryPairs) {
97
- result[prop]= val;
98
- }
99
- return result;
100
- };
101
-
102
- const fromEntries= Object.fromEntries|| objectFromEntries;
103
-
104
89
  // Needed only for the Safari bug workaround below
105
- $h‍_once.fromEntries(fromEntries);const{defineProperty:originalDefineProperty}=Object;
90
+ $h‍_once.stringifyJson(stringifyJson);const{defineProperty:originalDefineProperty}=Object;
106
91
 
107
92
  const defineProperty= (object, prop, descriptor)=> {
108
93
  // We used to do the following, until we had to reopen Safari bug
@@ -5845,22 +5830,27 @@ const severeEnablements= {
5845
5830
  ...moderateEnablements,
5846
5831
 
5847
5832
  /**
5848
- * Rollup(as used at least by vega) and webpack
5833
+ * Rollup (as used at least by vega) and webpack
5849
5834
  * (as used at least by regenerator) both turn exports into assignments
5850
5835
  * to a big `exports` object that inherits directly from
5851
- * `Object.prototype`.Some of the exported names we've seen include
5836
+ * `Object.prototype`. Some of the exported names we've seen include
5852
5837
  * `hasOwnProperty`, `constructor`, and `toString`. But the strategy used
5853
- * by rollup and webpack means potentionally turns any exported name
5854
- * into an assignment rejected by the override mistake.That's why
5855
- * we take the extreme step of enabling everything on`Object.prototype`.
5838
+ * by rollup and webpack potentionally turns any exported name
5839
+ * into an assignment rejected by the override mistake. That's why
5840
+ * the `severe` enablements takes the extreme step of enabling
5841
+ * everything on `Object.prototype`.
5856
5842
  *
5857
5843
  * In addition, code doing inheritance manually will often override
5858
5844
  * the `constructor` property on the new prototype by assignment. We've
5859
5845
  * seen this several times.
5860
5846
  *
5861
5847
  * The cost of enabling all these is that they create a miserable debugging
5862
- * experience. https://github.com/Agoric/agoric-sdk/issues/2324 explains
5863
- * how it confused the Node console.
5848
+ * experience specifically on Node.
5849
+ * https://github.com/Agoric/agoric-sdk/issues/2324
5850
+ * explains how it confused the Node console.
5851
+ *
5852
+ * (TODO Reexamine the vscode situation. I think it may have improved
5853
+ * since the following paragraph was written.)
5864
5854
  *
5865
5855
  * The vscode debugger's object inspector shows the own data properties of
5866
5856
  * an object, which is typically what you want, but also shows both getter
@@ -5877,8 +5867,8 @@ const severeEnablements= {
5877
5867
  * The widely used Buffer defined at https://github.com/feross/buffer
5878
5868
  * on initialization, manually creates the equivalent of a subclass of
5879
5869
  * `TypedArray`, which it then initializes by assignment. These assignments
5880
- * include enough of the `TypeArray` methods that here, we just enable
5881
- * them all.
5870
+ * include enough of the `TypeArray` methods that here, the `severe`
5871
+ * enablements just enable them all.
5882
5872
  */
5883
5873
  '%TypedArrayPrototype%': '*'};$h‍_once.severeEnablements(severeEnablements);
5884
5874
  })
@@ -7680,40 +7670,52 @@ const getTypedArrayToStringTag= typedArrayToStringTag.get;
7680
7670
  assert(getTypedArrayToStringTag);
7681
7671
 
7682
7672
  // Exported for tests.
7683
- /** @param {unknown} object */
7673
+ /**
7674
+ * Duplicates packages/marshal/src/helpers/passStyle-helpers.js to avoid a dependency.
7675
+ *
7676
+ * @param {unknown} object
7677
+ */
7684
7678
  const isTypedArray= (object)=>{
7685
7679
  // The object must pass a brand check or toStringTag will return undefined.
7686
7680
  const tag= apply(getTypedArrayToStringTag, object, []);
7687
7681
  return tag!== undefined;
7688
7682
  };
7689
7683
 
7684
+ /**
7685
+ * Tests if a property key is an integer-valued canonical numeric index.
7686
+ * https://tc39.es/ecma262/#sec-canonicalnumericindexstring
7687
+ *
7688
+ * @param {string | symbol} propertyKey
7689
+ */$h‍_once.isTypedArray(isTypedArray);
7690
+ const isCanonicalIntegerIndexString= (propertyKey)=>{
7691
+ const n= +String(propertyKey);
7692
+ return isInteger(n)&& String(n)=== propertyKey;
7693
+ };
7694
+
7690
7695
  /**
7691
7696
  * @template T
7692
7697
  * @param {ArrayLike<T>} array
7693
- */$h‍_once.isTypedArray(isTypedArray);
7698
+ */
7694
7699
  const freezeTypedArray= (array)=>{
7695
- const descs= getOwnPropertyDescriptors(array);
7696
-
7697
7700
  preventExtensions(array);
7698
7701
 
7699
7702
  // Downgrade writable expandos to readonly, even if non-configurable.
7700
- arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name)=> {
7701
- const desc= descs[/** @type {string} */ name];
7702
- // The numbered properties are writable and non-configurable,
7703
- // and cannot be made non-writable by defineProperty.
7704
- // This is a strange behavior intrinsic to TypedArrays, but no more harmful
7705
- // than the mutability of properties of a hardened Map or Set,
7706
- // so we carve out this exceptional behavior.
7707
- //
7708
- // TypedArrays are integer-indexed exotic objects, so indexed properties
7709
- // outside the range of 0 to the typed array's length are disallowed.
7710
- // Assignment to these indexes silently fails and defining an indexed
7711
- // property throws an error.
7712
- // So, we only need to make non-index properties non-writable and
7713
- // non-configurable.
7703
+ // We get each descriptor individually rather than using
7704
+ // getOwnPropertyDescriptors in order to fail safe when encountering
7705
+ // an obscure GraalJS issue where getOwnPropertyDescriptor returns
7706
+ // undefined for a property that does exist.
7707
+ arrayForEach(ownKeys(array), (/** @type {string | symbol} */ name)=> {
7708
+ const desc= getOwnPropertyDescriptor(array, name);
7709
+ assert(desc);
7710
+ // TypedArrays are integer-indexed exotic objects, which define special
7711
+ // treatment for property names in canonical numeric form:
7712
+ // integers in range are permanently writable and non-configurable.
7714
7713
  // https://tc39.es/ecma262/#sec-integer-indexed-exotic-objects
7715
- const number= +String(name);
7716
- if( !isInteger(number)) {
7714
+ //
7715
+ // This is analogous to the data of a hardened Map or Set,
7716
+ // so we carve out this exceptional behavior but make all other
7717
+ // properties non-configurable.
7718
+ if( !isCanonicalIntegerIndexString(name)) {
7717
7719
  defineProperty(array, name, {
7718
7720
  ...desc,
7719
7721
  writable: false,
@@ -9209,6 +9211,7 @@ assign(globalThis, {
9209
9211
  preventExtensions: cell("preventExtensions"),
9210
9212
  setPrototypeOf: cell("setPrototypeOf"),
9211
9213
  values: cell("values"),
9214
+ fromEntries: cell("fromEntries"),
9212
9215
  speciesSymbol: cell("speciesSymbol"),
9213
9216
  toStringTagSymbol: cell("toStringTagSymbol"),
9214
9217
  iteratorSymbol: cell("iteratorSymbol"),
@@ -9217,7 +9220,6 @@ assign(globalThis, {
9217
9220
  symbolFor: cell("symbolFor"),
9218
9221
  isInteger: cell("isInteger"),
9219
9222
  stringifyJson: cell("stringifyJson"),
9220
- fromEntries: cell("fromEntries"),
9221
9223
  defineProperty: cell("defineProperty"),
9222
9224
  apply: cell("apply"),
9223
9225
  construct: cell("construct"),
@@ -9525,6 +9527,7 @@ assign(globalThis, {
9525
9527
  preventExtensions: cells[0].preventExtensions.set,
9526
9528
  setPrototypeOf: cells[0].setPrototypeOf.set,
9527
9529
  values: cells[0].values.set,
9530
+ fromEntries: cells[0].fromEntries.set,
9528
9531
  speciesSymbol: cells[0].speciesSymbol.set,
9529
9532
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
9530
9533
  iteratorSymbol: cells[0].iteratorSymbol.set,
@@ -9533,7 +9536,6 @@ assign(globalThis, {
9533
9536
  symbolFor: cells[0].symbolFor.set,
9534
9537
  isInteger: cells[0].isInteger.set,
9535
9538
  stringifyJson: cells[0].stringifyJson.set,
9536
- fromEntries: cells[0].fromEntries.set,
9537
9539
  defineProperty: cells[0].defineProperty.set,
9538
9540
  apply: cells[0].apply.set,
9539
9541
  construct: cells[0].construct.set,