ses 0.15.2 → 0.15.3

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/lockdown.mjs CHANGED
@@ -36,8 +36,8 @@ const {
36
36
  Set,
37
37
  String,
38
38
  WeakMap,
39
- WeakSet,
40
- } = globalThis;$h‍_once.Array(Array);$h‍_once.Date(Date);$h‍_once.Float32Array(Float32Array);$h‍_once.JSON(JSON);$h‍_once.Map(Map);$h‍_once.Math(Math);$h‍_once.Object(Object);$h‍_once.Promise(Promise);$h‍_once.Proxy(Proxy);$h‍_once.Reflect(Reflect);$h‍_once.FERAL_REG_EXP(FERAL_REG_EXP);$h‍_once.Set(Set);$h‍_once.String(String);$h‍_once.WeakMap(WeakMap);$h‍_once.WeakSet(WeakSet);
39
+ WeakSet } =
40
+ globalThis;$h‍_once.Array(Array);$h‍_once.Date(Date);$h‍_once.Float32Array(Float32Array);$h‍_once.JSON(JSON);$h‍_once.Map(Map);$h‍_once.Math(Math);$h‍_once.Object(Object);$h‍_once.Promise(Promise);$h‍_once.Proxy(Proxy);$h‍_once.Reflect(Reflect);$h‍_once.FERAL_REG_EXP(FERAL_REG_EXP);$h‍_once.Set(Set);$h‍_once.String(String);$h‍_once.WeakMap(WeakMap);$h‍_once.WeakSet(WeakSet);
41
41
 
42
42
  const {
43
43
  // The feral Error constructor is safe for internal use, but must not be
@@ -47,8 +47,8 @@ const {
47
47
  RangeError,
48
48
  ReferenceError,
49
49
  SyntaxError,
50
- TypeError,
51
- } = globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError);
50
+ TypeError } =
51
+ globalThis;$h‍_once.FERAL_ERROR(FERAL_ERROR);$h‍_once.RangeError(RangeError);$h‍_once.ReferenceError(ReferenceError);$h‍_once.SyntaxError(SyntaxError);$h‍_once.TypeError(TypeError);
52
52
 
53
53
  const {
54
54
  assign,
@@ -66,15 +66,15 @@ const {
66
66
  prototype: objectPrototype,
67
67
  seal,
68
68
  setPrototypeOf,
69
- values,
70
- } = 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.setPrototypeOf(setPrototypeOf);$h‍_once.values(values);
69
+ values } =
70
+ 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.setPrototypeOf(setPrototypeOf);$h‍_once.values(values);
71
71
 
72
72
  const {
73
73
  species: speciesSymbol,
74
74
  toStringTag: toStringTagSymbol,
75
75
  iterator: iteratorSymbol,
76
- matchAll: matchAllSymbol,
77
- } = Symbol;$h‍_once.speciesSymbol(speciesSymbol);$h‍_once.toStringTagSymbol(toStringTagSymbol);$h‍_once.iteratorSymbol(iteratorSymbol);$h‍_once.matchAllSymbol(matchAllSymbol);
76
+ matchAll: matchAllSymbol } =
77
+ Symbol;$h‍_once.speciesSymbol(speciesSymbol);$h‍_once.toStringTagSymbol(toStringTagSymbol);$h‍_once.iteratorSymbol(iteratorSymbol);$h‍_once.matchAllSymbol(matchAllSymbol);
78
78
 
79
79
  const { stringify: stringifyJson } = JSON;$h‍_once.stringifyJson(stringifyJson);
80
80
 
@@ -84,7 +84,7 @@ const { stringify: stringifyJson } = JSON;$h‍_once.stringifyJson(stringifyJson
84
84
  // By the terminology of https://ponyfoo.com/articles/polyfills-or-ponyfills
85
85
  // it is a ponyfill rather than a polyfill or shim because we do not
86
86
  // install it on `Object`.
87
- const objectFromEntries = entryPairs => {
87
+ const objectFromEntries = (entryPairs) => {
88
88
  const result = {};
89
89
  for (const [prop, val] of entryPairs) {
90
90
  result[prop] = val;
@@ -109,10 +109,10 @@ const defineProperty = (object, prop, descriptor) => {
109
109
  const result = originalDefineProperty(object, prop, descriptor);
110
110
  if (result !== object) {
111
111
  throw TypeError(
112
- `Please report that the original defineProperty silently failed to set ${stringifyJson(
113
- String(prop),
114
- )}. (SES_DEFINE_PROPERTY_FAILED_SILENTLY)`,
115
- );
112
+ `Please report that the original defineProperty silently failed to set ${stringifyJson(
113
+ String(prop))
114
+ }. (SES_DEFINE_PROPERTY_FAILED_SILENTLY)`);
115
+
116
116
  }
117
117
  return result;
118
118
  };$h‍_once.defineProperty(defineProperty);
@@ -126,8 +126,8 @@ const {
126
126
  isExtensible: reflectIsExtensible,
127
127
  ownKeys,
128
128
  preventExtensions: reflectPreventExtensions,
129
- set: reflectSet,
130
- } = Reflect;$h‍_once.apply(apply);$h‍_once.construct(construct);$h‍_once.reflectGet(reflectGet);$h‍_once.reflectGetOwnPropertyDescriptor(reflectGetOwnPropertyDescriptor);$h‍_once.reflectHas(reflectHas);$h‍_once.reflectIsExtensible(reflectIsExtensible);$h‍_once.ownKeys(ownKeys);$h‍_once.reflectPreventExtensions(reflectPreventExtensions);$h‍_once.reflectSet(reflectSet);
129
+ set: reflectSet } =
130
+ Reflect;$h‍_once.apply(apply);$h‍_once.construct(construct);$h‍_once.reflectGet(reflectGet);$h‍_once.reflectGetOwnPropertyDescriptor(reflectGetOwnPropertyDescriptor);$h‍_once.reflectHas(reflectHas);$h‍_once.reflectIsExtensible(reflectIsExtensible);$h‍_once.ownKeys(ownKeys);$h‍_once.reflectPreventExtensions(reflectPreventExtensions);$h‍_once.reflectSet(reflectSet);
131
131
 
132
132
  const { isArray, prototype: arrayPrototype } = Array;$h‍_once.isArray(isArray);$h‍_once.arrayPrototype(arrayPrototype);
133
133
  const { prototype: mapPrototype } = Map;$h‍_once.mapPrototype(mapPrototype);
@@ -155,7 +155,7 @@ const { prototype: promisePrototype } = Promise;$h‍_once.promisePrototype(prom
155
155
  *
156
156
  * @param {(thisArg: Object, ...args: any[]) => any} fn
157
157
  */
158
- const uncurryThis = fn => (thisArg, ...args) => apply(fn, thisArg, args);$h‍_once.uncurryThis(uncurryThis);
158
+ const uncurryThis = (fn) => (thisArg, ...args) => apply(fn, thisArg, args);$h‍_once.uncurryThis(uncurryThis);
159
159
 
160
160
  const objectHasOwnProperty = uncurryThis(objectPrototype.hasOwnProperty);$h‍_once.objectHasOwnProperty(objectHasOwnProperty);
161
161
  //
@@ -208,7 +208,7 @@ const weaksetHas = uncurryThis(weaksetPrototype.has);$h‍_once.weaksetHas(weaks
208
208
  const functionToString = uncurryThis(functionPrototype.toString);$h‍_once.functionToString(functionToString);
209
209
  //
210
210
  const { all } = Promise;
211
- const promiseAll = promises => apply(all, Promise, [promises]);$h‍_once.promiseAll(promiseAll);
211
+ const promiseAll = (promises) => apply(all, Promise, [promises]);$h‍_once.promiseAll(promiseAll);
212
212
  const promiseCatch = uncurryThis(promisePrototype.catch);$h‍_once.promiseCatch(promiseCatch);
213
213
  const promiseThen = uncurryThis(promisePrototype.then);$h‍_once.promiseThen(promiseThen);
214
214
 
@@ -218,8 +218,8 @@ const promiseThen = uncurryThis(promisePrototype.then);$h‍_once.promiseThen(pr
218
218
  *
219
219
  * @param {Function} fn
220
220
  */
221
- const getConstructorOf = fn =>
222
- reflectGet(getPrototypeOf(fn), 'constructor');$h‍_once.getConstructorOf(getConstructorOf);
221
+ const getConstructorOf = (fn) =>
222
+ reflectGet(getPrototypeOf(fn), 'constructor');$h‍_once.getConstructorOf(getConstructorOf);
223
223
 
224
224
  /**
225
225
  * immutableObject
@@ -244,7 +244,7 @@ const immutableObject = freeze(create(null));$h‍_once.immutableObject(immutabl
244
244
  *
245
245
  * @param {any} value
246
246
  */
247
- const isObject = value => Object(value) === value;$h‍_once.isObject(isObject);
247
+ const isObject = (value) => Object(value) === value;$h‍_once.isObject(isObject);
248
248
 
249
249
  /**
250
250
  * isError tests whether an object inherits from the intrinsic
@@ -257,7 +257,7 @@ const isObject = value => Object(value) === value;$h‍_once.isObject(isObject);
257
257
  *
258
258
  * @param {any} value
259
259
  */
260
- const isError = value => value instanceof FERAL_ERROR;$h‍_once.isError(isError);
260
+ const isError = (value) => value instanceof FERAL_ERROR;$h‍_once.isError(isError);
261
261
 
262
262
  // The original unsafe untamed eval function, which must not escape.
263
263
  // Sample at module initialization time, which is before lockdown can
@@ -269,7 +269,6 @@ const FERAL_EVAL = eval;$h‍_once.FERAL_EVAL(FERAL_EVAL);
269
269
  // Sample at module initialization time, which is before lockdown can
270
270
  // repair it. Use it only to build powerless abstractions.
271
271
  const FERAL_FUNCTION = Function;$h‍_once.FERAL_FUNCTION(FERAL_FUNCTION);
272
-
273
272
  })
274
273
  ,
275
274
  // === functors[1] ===
@@ -362,7 +361,6 @@ const FERAL_FUNCTION = Function;$h‍_once.FERAL_FUNCTION(FERAL_FUNCTION);
362
361
  * @param {LoggedErrorHandler} loggedErrorHandler
363
362
  * @returns {VirtualConsole}
364
363
  */
365
-
366
364
  })
367
365
  ,
368
366
  // === functors[2] ===
@@ -400,7 +398,7 @@ const enJoin = (terms, conjunction) => {
400
398
  return `${first} ${conjunction} ${second}`;
401
399
  } else {
402
400
  return `${arrayJoin(arraySlice(terms, 0, -1), ', ')}, ${conjunction} ${
403
- terms[terms.length - 1]
401
+ terms[terms.length - 1]
404
402
  }`;
405
403
  }
406
404
  };$h‍_once.enJoin(enJoin);
@@ -412,7 +410,7 @@ const enJoin = (terms, conjunction) => {
412
410
  * @param {string} str The noun to prepend
413
411
  * @returns {string} The noun prepended with a/an
414
412
  */
415
- const an = str => {
413
+ const an = (str) => {
416
414
  str = `${str}`;
417
415
  if (str.length >= 1 && stringIncludes('aeiouAEIOU', str[0])) {
418
416
  return `an ${str}`;
@@ -453,73 +451,73 @@ const bestEffortStringify = (payload, spaces = undefined) => {
453
451
  const seenSet = new Set();
454
452
  const replacer = (_, val) => {
455
453
  switch (typeof val) {
456
- case 'object': {
457
- if (val === null) {
458
- return null;
454
+ case 'object':{
455
+ if (val === null) {
456
+ return null;
457
+ }
458
+ if (setHas(seenSet, val)) {
459
+ return '[Seen]';
460
+ }
461
+ setAdd(seenSet, val);
462
+ if (isError(val)) {
463
+ return `[${val.name}: ${val.message}]`;
464
+ }
465
+ if (toStringTagSymbol in val) {
466
+ // For the built-ins that have or inherit a `Symbol.toStringTag`-named
467
+ // property, most of them inherit the default `toString` method,
468
+ // which will print in a similar manner: `"[object Foo]"` vs
469
+ // `"[Foo]"`. The exceptions are
470
+ // * `Symbol.prototype`, `BigInt.prototype`, `String.prototype`
471
+ // which don't matter to us since we handle primitives
472
+ // separately and we don't care about primitive wrapper objects.
473
+ // * TODO
474
+ // `Date.prototype`, `TypedArray.prototype`.
475
+ // Hmmm, we probably should make special cases for these. We're
476
+ // not using these yet, so it's not urgent. But others will run
477
+ // into these.
478
+ //
479
+ // Once #2018 is closed, the only objects in our code that have or
480
+ // inherit a `Symbol.toStringTag`-named property are remotables
481
+ // or their remote presences.
482
+ // This printing will do a good job for these without
483
+ // violating abstraction layering. This behavior makes sense
484
+ // purely in terms of JavaScript concepts. That's some of the
485
+ // motivation for choosing that representation of remotables
486
+ // and their remote presences in the first place.
487
+ return `[${val[toStringTagSymbol]}]`;
488
+ }
489
+ return val;
459
490
  }
460
- if (setHas(seenSet, val)) {
461
- return '[Seen]';
491
+ case 'function':{
492
+ return `[Function ${val.name || '<anon>'}]`;
462
493
  }
463
- setAdd(seenSet, val);
464
- if (isError(val)) {
465
- return `[${val.name}: ${val.message}]`;
494
+ case 'string':{
495
+ if (stringStartsWith(val, '[')) {
496
+ return `[${val}]`;
497
+ }
498
+ return val;
466
499
  }
467
- if (toStringTagSymbol in val) {
468
- // For the built-ins that have or inherit a `Symbol.toStringTag`-named
469
- // property, most of them inherit the default `toString` method,
470
- // which will print in a similar manner: `"[object Foo]"` vs
471
- // `"[Foo]"`. The exceptions are
472
- // * `Symbol.prototype`, `BigInt.prototype`, `String.prototype`
473
- // which don't matter to us since we handle primitives
474
- // separately and we don't care about primitive wrapper objects.
475
- // * TODO
476
- // `Date.prototype`, `TypedArray.prototype`.
477
- // Hmmm, we probably should make special cases for these. We're
478
- // not using these yet, so it's not urgent. But others will run
479
- // into these.
480
- //
481
- // Once #2018 is closed, the only objects in our code that have or
482
- // inherit a `Symbol.toStringTag`-named property are remotables
483
- // or their remote presences.
484
- // This printing will do a good job for these without
485
- // violating abstraction layering. This behavior makes sense
486
- // purely in terms of JavaScript concepts. That's some of the
487
- // motivation for choosing that representation of remotables
488
- // and their remote presences in the first place.
489
- return `[${val[toStringTagSymbol]}]`;
500
+ case 'undefined':
501
+ case 'symbol':{
502
+ return `[${String(val)}]`;
490
503
  }
491
- return val;
492
- }
493
- case 'function': {
494
- return `[Function ${val.name || '<anon>'}]`;
495
- }
496
- case 'string': {
497
- if (stringStartsWith(val, '[')) {
498
- return `[${val}]`;
504
+ case 'bigint':{
505
+ return `[${val}n]`;
499
506
  }
500
- return val;
501
- }
502
- case 'undefined':
503
- case 'symbol': {
504
- return `[${String(val)}]`;
505
- }
506
- case 'bigint': {
507
- return `[${val}n]`;
508
- }
509
- case 'number': {
510
- if (is(val, NaN)) {
511
- return '[NaN]';
512
- } else if (val === Infinity) {
513
- return '[Infinity]';
514
- } else if (val === -Infinity) {
515
- return '[-Infinity]';
507
+ case 'number':{
508
+ if (is(val, NaN)) {
509
+ return '[NaN]';
510
+ } else if (val === Infinity) {
511
+ return '[Infinity]';
512
+ } else if (val === -Infinity) {
513
+ return '[-Infinity]';
514
+ }
515
+ return val;
516
516
  }
517
- return val;
518
- }
519
- default: {
520
- return val;
521
- }
522
- }
517
+ default:{
518
+ return val;
519
+ }}
520
+
523
521
  };
524
522
  try {
525
523
  return stringifyJson(payload, replacer, spaces);
@@ -534,7 +532,6 @@ const bestEffortStringify = (payload, spaces = undefined) => {
534
532
  }
535
533
  };$h‍_once.bestEffortStringify(bestEffortStringify);
536
534
  freeze(bestEffortStringify);
537
-
538
535
  })
539
536
  ,
540
537
  // === functors[3] ===
@@ -888,7 +885,6 @@ freeze(bestEffortStringify);
888
885
  * @param {string=} topic
889
886
  * @returns {VirtualConsole}
890
887
  */
891
-
892
888
  })
893
889
  ,
894
890
  // === functors[4] ===
@@ -942,8 +938,8 @@ const declassifiers = new WeakMap();
942
938
  /** @type {AssertQuote} */
943
939
  const quote = (payload, spaces = undefined) => {
944
940
  const result = freeze({
945
- toString: freeze(() => bestEffortStringify(payload, spaces)),
946
- });
941
+ toString: freeze(() => bestEffortStringify(payload, spaces)) });
942
+
947
943
  weakmapSet(declassifiers, result, payload);
948
944
  return result;
949
945
  };
@@ -1008,8 +1004,8 @@ const DetailsTokenProto = freeze({
1008
1004
  return '[Not a DetailsToken]';
1009
1005
  }
1010
1006
  return getMessageString(hiddenDetails);
1011
- },
1012
- });
1007
+ } });
1008
+
1013
1009
  freeze(DetailsTokenProto.toString);
1014
1010
 
1015
1011
  /**
@@ -1048,9 +1044,9 @@ freeze(redactedDetails);
1048
1044
  * @type {DetailsTag}
1049
1045
  */
1050
1046
  const unredactedDetails = (template, ...args) => {
1051
- args = arrayMap(args, arg =>
1052
- weakmapHas(declassifiers, arg) ? arg : quote(arg),
1053
- );
1047
+ args = arrayMap(args, (arg) =>
1048
+ weakmapHas(declassifiers, arg) ? arg : quote(arg));
1049
+
1054
1050
  return redactedDetails(template, ...args);
1055
1051
  };$h‍_once.unredactedDetails(unredactedDetails);
1056
1052
  freeze(unredactedDetails);
@@ -1119,10 +1115,10 @@ const tagError = (err, optErrorName = err.name) => {
1119
1115
  * @type {AssertMakeError}
1120
1116
  */
1121
1117
  const makeError = (
1122
- optDetails = redactedDetails`Assert failed`,
1123
- ErrorConstructor = globalThis.Error,
1124
- { errorName = undefined } = {},
1125
- ) => {
1118
+ optDetails = redactedDetails`Assert failed`,
1119
+ ErrorConstructor = globalThis.Error,
1120
+ { errorName = undefined } = {}) =>
1121
+ {
1126
1122
  if (typeof optDetails === 'string') {
1127
1123
  // If it is a string, use it as the literal part of the template so
1128
1124
  // it doesn't get quoted.
@@ -1207,7 +1203,7 @@ freeze(note);
1207
1203
  * @param {Error} error
1208
1204
  * @returns {string}
1209
1205
  */
1210
- const defaultGetStackString = error => {
1206
+ const defaultGetStackString = (error) => {
1211
1207
  if (!('stack' in error)) {
1212
1208
  return '';
1213
1209
  }
@@ -1222,12 +1218,12 @@ const defaultGetStackString = error => {
1222
1218
  /** @type {LoggedErrorHandler} */
1223
1219
  const loggedErrorHandler = {
1224
1220
  getStackString: globalThis.getStackString || defaultGetStackString,
1225
- tagError: error => tagError(error),
1221
+ tagError: (error) => tagError(error),
1226
1222
  resetErrorTagNum: () => {
1227
1223
  errorTagNum = 0;
1228
1224
  },
1229
- getMessageLogArgs: error => weakmapGet(hiddenMessageLogArgs, error),
1230
- takeMessageLogArgs: error => {
1225
+ getMessageLogArgs: (error) => weakmapGet(hiddenMessageLogArgs, error),
1226
+ takeMessageLogArgs: (error) => {
1231
1227
  const result = weakmapGet(hiddenMessageLogArgs, error);
1232
1228
  weakmapDelete(hiddenMessageLogArgs, error);
1233
1229
  return result;
@@ -1244,8 +1240,8 @@ const loggedErrorHandler = {
1244
1240
  }
1245
1241
  }
1246
1242
  return result || [];
1247
- },
1248
- };$h‍_once.loggedErrorHandler(loggedErrorHandler);
1243
+ } };$h‍_once.loggedErrorHandler(loggedErrorHandler);
1244
+
1249
1245
  freeze(loggedErrorHandler);
1250
1246
 
1251
1247
 
@@ -1258,9 +1254,9 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1258
1254
  const details = unredacted ? unredactedDetails : redactedDetails;
1259
1255
  /** @type {AssertFail} */
1260
1256
  const fail = (
1261
- optDetails = details`Assert failed`,
1262
- ErrorConstructor = globalThis.Error,
1263
- ) => {
1257
+ optDetails = details`Assert failed`,
1258
+ ErrorConstructor = globalThis.Error) =>
1259
+ {
1264
1260
  const reason = makeError(optDetails, ErrorConstructor);
1265
1261
  if (optRaise !== undefined) {
1266
1262
  optRaise(reason);
@@ -1274,10 +1270,10 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1274
1270
  // function, I seem to get type errors from TypeScript. Why?
1275
1271
  /** @type {BaseAssert} */
1276
1272
  function baseAssert(
1277
- flag,
1278
- optDetails = details`Check failed`,
1279
- ErrorConstructor = globalThis.Error,
1280
- ) {
1273
+ flag,
1274
+ optDetails = details`Check failed`,
1275
+ ErrorConstructor = globalThis.Error)
1276
+ {
1281
1277
  if (!flag) {
1282
1278
  throw fail(optDetails, ErrorConstructor);
1283
1279
  }
@@ -1285,11 +1281,11 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1285
1281
 
1286
1282
  /** @type {AssertEqual} */
1287
1283
  const equal = (
1288
- actual,
1289
- expected,
1290
- optDetails = details`Expected ${actual} is same as ${expected}`,
1291
- ErrorConstructor = RangeError,
1292
- ) => {
1284
+ actual,
1285
+ expected,
1286
+ optDetails = details`Expected ${actual} is same as ${expected}`,
1287
+ ErrorConstructor = RangeError) =>
1288
+ {
1293
1289
  baseAssert(is(actual, expected), optDetails, ErrorConstructor);
1294
1290
  };
1295
1291
  freeze(equal);
@@ -1297,9 +1293,9 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1297
1293
  /** @type {AssertTypeof} */
1298
1294
  const assertTypeof = (specimen, typename, optDetails) => {
1299
1295
  baseAssert(
1300
- typeof typename === 'string',
1301
- details`${quote(typename)} must be a string`,
1302
- );
1296
+ typeof typename === 'string',
1297
+ details`${quote(typename)} must be a string`);
1298
+
1303
1299
  if (optDetails === undefined) {
1304
1300
  // Like
1305
1301
  // ```js
@@ -1315,7 +1311,7 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1315
1311
 
1316
1312
  /** @type {AssertString} */
1317
1313
  const assertString = (specimen, optDetails) =>
1318
- assertTypeof(specimen, 'string', optDetails);
1314
+ assertTypeof(specimen, 'string', optDetails);
1319
1315
 
1320
1316
  // Note that "assert === baseAssert"
1321
1317
  /** @type {Assert} */
@@ -1328,8 +1324,8 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
1328
1324
  note,
1329
1325
  details,
1330
1326
  quote,
1331
- makeAssert,
1332
- });
1327
+ makeAssert });
1328
+
1333
1329
  return freeze(assert);
1334
1330
  };$h‍_once.makeAssert(makeAssert);
1335
1331
  freeze(makeAssert);
@@ -1337,7 +1333,6 @@ freeze(makeAssert);
1337
1333
 
1338
1334
  /** @type {Assert} */
1339
1335
  const assert = makeAssert();$h‍_once.assert(assert);
1340
-
1341
1336
  })
1342
1337
  ,
1343
1338
  // === functors[5] ===
@@ -1412,7 +1407,6 @@ const makeEvaluateFactory = (constants = []) => {
1412
1407
  }
1413
1408
  `);
1414
1409
  };$h‍_once.makeEvaluateFactory(makeEvaluateFactory);
1415
-
1416
1410
  })
1417
1411
  ,
1418
1412
  // === functors[6] ===
@@ -1431,67 +1425,67 @@ const makeEvaluateFactory = (constants = []) => {
1431
1425
  * See 11.6.1 Identifier Names
1432
1426
  */
1433
1427
  const keywords = [
1434
- // 11.6.2.1 Keywords
1435
- 'await',
1436
- 'break',
1437
- 'case',
1438
- 'catch',
1439
- 'class',
1440
- 'const',
1441
- 'continue',
1442
- 'debugger',
1443
- 'default',
1444
- 'delete',
1445
- 'do',
1446
- 'else',
1447
- 'export',
1448
- 'extends',
1449
- 'finally',
1450
- 'for',
1451
- 'function',
1452
- 'if',
1453
- 'import',
1454
- 'in',
1455
- 'instanceof',
1456
- 'new',
1457
- 'return',
1458
- 'super',
1459
- 'switch',
1460
- 'this',
1461
- 'throw',
1462
- 'try',
1463
- 'typeof',
1464
- 'var',
1465
- 'void',
1466
- 'while',
1467
- 'with',
1468
- 'yield',
1469
-
1470
- // Also reserved when parsing strict mode code
1471
- 'let',
1472
- 'static',
1473
-
1474
- // 11.6.2.2 Future Reserved Words
1475
- 'enum',
1476
-
1477
- // Also reserved when parsing strict mode code
1478
- 'implements',
1479
- 'package',
1480
- 'protected',
1481
- 'interface',
1482
- 'private',
1483
- 'public',
1484
-
1485
- // Reserved but not mentioned in specs
1486
- 'await',
1487
-
1488
- 'null',
1489
- 'true',
1490
- 'false',
1491
-
1492
- 'this',
1493
- 'arguments',
1494
- ];
1428
+ // 11.6.2.1 Keywords
1429
+ 'await',
1430
+ 'break',
1431
+ 'case',
1432
+ 'catch',
1433
+ 'class',
1434
+ 'const',
1435
+ 'continue',
1436
+ 'debugger',
1437
+ 'default',
1438
+ 'delete',
1439
+ 'do',
1440
+ 'else',
1441
+ 'export',
1442
+ 'extends',
1443
+ 'finally',
1444
+ 'for',
1445
+ 'function',
1446
+ 'if',
1447
+ 'import',
1448
+ 'in',
1449
+ 'instanceof',
1450
+ 'new',
1451
+ 'return',
1452
+ 'super',
1453
+ 'switch',
1454
+ 'this',
1455
+ 'throw',
1456
+ 'try',
1457
+ 'typeof',
1458
+ 'var',
1459
+ 'void',
1460
+ 'while',
1461
+ 'with',
1462
+ 'yield',
1463
+
1464
+ // Also reserved when parsing strict mode code
1465
+ 'let',
1466
+ 'static',
1467
+
1468
+ // 11.6.2.2 Future Reserved Words
1469
+ 'enum',
1470
+
1471
+ // Also reserved when parsing strict mode code
1472
+ 'implements',
1473
+ 'package',
1474
+ 'protected',
1475
+ 'interface',
1476
+ 'private',
1477
+ 'public',
1478
+
1479
+ // Reserved but not mentioned in specs
1480
+ 'await',
1481
+
1482
+ 'null',
1483
+ 'true',
1484
+ 'false',
1485
+
1486
+ 'this',
1487
+ 'arguments'];
1488
+
1495
1489
 
1496
1490
  /**
1497
1491
  * identifierPattern
@@ -1516,14 +1510,14 @@ const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
1516
1510
  *
1517
1511
  * @param {string} name
1518
1512
  */
1519
- const isValidIdentifierName = name => {
1513
+ const isValidIdentifierName = (name) => {
1520
1514
  // Ensure we have a valid identifier. We use regexpTest rather than
1521
1515
  // /../.test() to guard against the case where RegExp has been poisoned.
1522
1516
  return (
1523
1517
  name !== 'eval' &&
1524
1518
  !arrayIncludes(keywords, name) &&
1525
- regexpTest(identifierPattern, name)
1526
- );
1519
+ regexpTest(identifierPattern, name));
1520
+
1527
1521
  };$h‍_once.isValidIdentifierName(isValidIdentifierName);
1528
1522
 
1529
1523
  /*
@@ -1540,17 +1534,17 @@ function isImmutableDataProperty(obj, name) {
1540
1534
  // extra properties which weren't really there. Accessor properties have
1541
1535
  // 'get/set/enumerable/configurable', while data properties have
1542
1536
  // 'value/writable/enumerable/configurable'.
1543
- (desc.configurable === false &&
1544
- desc.writable === false && //
1537
+ desc.configurable === false &&
1538
+ desc.writable === false &&
1539
+ //
1545
1540
  // Checks for data properties because they're the only ones we can
1546
1541
  // optimize (accessors are most likely non-constant). Descriptors can't
1547
1542
  // can't have accessors and value properties at the same time, therefore
1548
1543
  // this check is sufficient. Using explicit own property deal with the
1549
1544
  // case where Object.prototype has been poisoned.
1550
- objectHasOwnProperty(desc, 'value'))
1551
- );
1552
- }
1545
+ objectHasOwnProperty(desc, 'value'));
1553
1546
 
1547
+ }
1554
1548
 
1555
1549
  /**
1556
1550
  * getScopeConstants()
@@ -1572,26 +1566,25 @@ const getScopeConstants = (globalObject, localObject = {}) => {
1572
1566
 
1573
1567
  // Collect all valid & immutable identifiers from the endowments.
1574
1568
  const localConstants = arrayFilter(
1575
- localNames,
1576
- name =>
1577
- isValidIdentifierName(name) && isImmutableDataProperty(localObject, name),
1578
- );
1569
+ localNames,
1570
+ (name) =>
1571
+ isValidIdentifierName(name) && isImmutableDataProperty(localObject, name));
1572
+
1579
1573
 
1580
1574
  // Collect all valid & immutable identifiers from the global that
1581
1575
  // are also not present in the endwoments (immutable or not).
1582
1576
  const globalConstants = arrayFilter(
1583
- globalNames,
1584
- name =>
1585
- // Can't define a constant: it would prevent a
1586
- // lookup on the endowments.
1587
- !arrayIncludes(localNames, name) &&
1588
- isValidIdentifierName(name) &&
1589
- isImmutableDataProperty(globalObject, name),
1590
- );
1577
+ globalNames,
1578
+ (name) =>
1579
+ // Can't define a constant: it would prevent a
1580
+ // lookup on the endowments.
1581
+ !arrayIncludes(localNames, name) &&
1582
+ isValidIdentifierName(name) &&
1583
+ isImmutableDataProperty(globalObject, name));
1584
+
1591
1585
 
1592
1586
  return [...globalConstants, ...localConstants];
1593
1587
  };$h‍_once.getScopeConstants(getScopeConstants);
1594
-
1595
1588
  })
1596
1589
  ,
1597
1590
  // === functors[7] ===
@@ -1622,16 +1615,16 @@ const { details: d, quote: q } = assert;
1622
1615
  * create one and share it between all scopeHandlers.
1623
1616
  */
1624
1617
  const alwaysThrowHandler = new Proxy(
1625
- immutableObject,
1626
- freeze({
1627
- get(_shadow, prop) {
1628
- // eslint-disable-next-line @endo/no-polymorphic-call
1629
- assert.fail(
1630
- d`Please report unexpected scope handler trap: ${q(String(prop))}`,
1631
- );
1632
- },
1633
- }),
1634
- );
1618
+ immutableObject,
1619
+ freeze({
1620
+ get(_shadow, prop) {
1621
+ // eslint-disable-next-line @endo/no-polymorphic-call
1622
+ assert.fail(
1623
+ d`Please report unexpected scope handler trap: ${q(String(prop))}`);
1624
+
1625
+ } }));
1626
+
1627
+
1635
1628
 
1636
1629
  /*
1637
1630
  * createScopeHandler()
@@ -1649,10 +1642,10 @@ const alwaysThrowHandler = new Proxy(
1649
1642
  * - ensure the Proxy invariants despite some global properties being frozen.
1650
1643
  */
1651
1644
  const createScopeHandler = (
1652
- globalObject,
1653
- localObject = {},
1654
- { sloppyGlobalsMode = false } = {},
1655
- ) => {
1645
+ globalObject,
1646
+ localObject = {},
1647
+ { sloppyGlobalsMode = false } = {}) =>
1648
+ {
1656
1649
  // This flag allow us to determine if the eval() call is an done by the
1657
1650
  // compartment's code or if it is user-land invocation, so we can react
1658
1651
  // differently.
@@ -1762,11 +1755,11 @@ const createScopeHandler = (
1762
1755
  // !!!!! WARNING: DANGER ZONE !!!!!!
1763
1756
  return (
1764
1757
  sloppyGlobalsMode ||
1765
- (allowNextEvalToBeUnsafe && prop === 'eval') ||
1758
+ allowNextEvalToBeUnsafe && prop === 'eval' ||
1766
1759
  prop in localObject ||
1767
1760
  prop in globalObject ||
1768
- prop in globalThis
1769
- );
1761
+ prop in globalThis);
1762
+
1770
1763
  },
1771
1764
 
1772
1765
  // note: this is likely a bug of safari
@@ -1785,30 +1778,29 @@ const createScopeHandler = (
1785
1778
  const quotedProp = q(String(prop));
1786
1779
  // eslint-disable-next-line @endo/no-polymorphic-call
1787
1780
  console.warn(
1788
- `getOwnPropertyDescriptor trap on scopeHandler for ${quotedProp}`,
1789
- new TypeError().stack,
1790
- );
1781
+ `getOwnPropertyDescriptor trap on scopeHandler for ${quotedProp}`,
1782
+ new TypeError().stack);
1783
+
1791
1784
  return undefined;
1792
- },
1793
- };
1785
+ } };
1786
+
1794
1787
 
1795
1788
  // The scope handler's prototype is a proxy that throws if any trap other
1796
1789
  // than get/set/has are run (like getOwnPropertyDescriptors, apply,
1797
1790
  // getPrototypeOf).
1798
1791
  const scopeHandler = freeze(
1799
- create(
1800
- alwaysThrowHandler,
1801
- getOwnPropertyDescriptors(scopeProxyHandlerProperties),
1802
- ),
1803
- );
1792
+ create(
1793
+ alwaysThrowHandler,
1794
+ getOwnPropertyDescriptors(scopeProxyHandlerProperties)));
1795
+
1796
+
1804
1797
 
1805
1798
  return {
1806
1799
  admitOneUnsafeEvalNext,
1807
1800
  resetOneUnsafeEvalNext,
1808
- scopeHandler,
1809
- };
1810
- };$h‍_once.createScopeHandler(createScopeHandler);
1801
+ scopeHandler };
1811
1802
 
1803
+ };$h‍_once.createScopeHandler(createScopeHandler);
1812
1804
  })
1813
1805
  ,
1814
1806
  // === functors[8] ===
@@ -1816,7 +1808,7 @@ const createScopeHandler = (
1816
1808
 
1817
1809
  // Captures a key and value of the form #key=value or @key=value
1818
1810
  const sourceMetaEntryRegExp =
1819
- '\\s*[@#]\\s*([a-zA-Z][a-zA-Z0-9]*)\\s*=\\s*([^\\s\\*]*)';
1811
+ '\\s*[@#]\\s*([a-zA-Z][a-zA-Z0-9]*)\\s*=\\s*([^\\s\\*]*)';
1820
1812
  // Captures either a one-line or multi-line comment containing
1821
1813
  // one #key=value or @key=value.
1822
1814
  // Produces two pairs of capture groups, but the initial two may be undefined.
@@ -1824,10 +1816,10 @@ const sourceMetaEntryRegExp =
1824
1816
  // does not allow us to capture every pair, so getSourceURL must capture and
1825
1817
  // trim until there are no matching comments.
1826
1818
  const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
1827
- `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`,
1828
- );
1819
+ `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`);
1820
+
1829
1821
 
1830
- const getSourceURL = src => {
1822
+ const getSourceURL = (src) => {
1831
1823
  let sourceURL = '<unknown>';
1832
1824
 
1833
1825
  // Our regular expression matches the last one or two comments with key value
@@ -1859,7 +1851,6 @@ const getSourceURL = src => {
1859
1851
 
1860
1852
  return sourceURL;
1861
1853
  };$h‍_once.getSourceURL(getSourceURL);
1862
-
1863
1854
  })
1864
1855
  ,
1865
1856
  // === functors[9] ===
@@ -1928,15 +1919,15 @@ const htmlCommentPattern = new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g');
1928
1919
  * @param {string} src
1929
1920
  * @returns {string}
1930
1921
  */
1931
- const rejectHtmlComments = src => {
1922
+ const rejectHtmlComments = (src) => {
1932
1923
  const lineNumber = getLineNumber(src, htmlCommentPattern);
1933
1924
  if (lineNumber < 0) {
1934
1925
  return src;
1935
1926
  }
1936
1927
  const name = getSourceURL(src);
1937
1928
  throw new SyntaxError(
1938
- `Possible HTML comment rejected at ${name}:${lineNumber}. (SES_HTML_COMMENT_REJECTED)`,
1939
- );
1929
+ `Possible HTML comment rejected at ${name}:${lineNumber}. (SES_HTML_COMMENT_REJECTED)`);
1930
+
1940
1931
  };$h‍_once.rejectHtmlComments(rejectHtmlComments);
1941
1932
 
1942
1933
  /**
@@ -1961,17 +1952,17 @@ const rejectHtmlComments = src => {
1961
1952
  * @param { string } src
1962
1953
  * @returns { string }
1963
1954
  */
1964
- const evadeHtmlCommentTest = src => {
1965
- const replaceFn = match => (match[0] === '<' ? '< ! --' : '-- >');
1955
+ const evadeHtmlCommentTest = (src) => {
1956
+ const replaceFn = (match) => match[0] === '<' ? '< ! --' : '-- >';
1966
1957
  return stringReplace(src, htmlCommentPattern, replaceFn);
1967
1958
  };$h‍_once.evadeHtmlCommentTest(evadeHtmlCommentTest);
1968
1959
 
1969
1960
  // /////////////////////////////////////////////////////////////////////////////
1970
1961
 
1971
1962
  const importPattern = new FERAL_REG_EXP(
1972
- '(^|[^.])\\bimport(\\s*(?:\\(|/[/*]))',
1973
- 'g',
1974
- );
1963
+ '(^|[^.])\\bimport(\\s*(?:\\(|/[/*]))',
1964
+ 'g');
1965
+
1975
1966
 
1976
1967
  /**
1977
1968
  * Conservatively reject the source text if it may contain a dynamic
@@ -2003,15 +1994,15 @@ const importPattern = new FERAL_REG_EXP(
2003
1994
  * @param { string } src
2004
1995
  * @returns { string }
2005
1996
  */
2006
- const rejectImportExpressions = src => {
1997
+ const rejectImportExpressions = (src) => {
2007
1998
  const lineNumber = getLineNumber(src, importPattern);
2008
1999
  if (lineNumber < 0) {
2009
2000
  return src;
2010
2001
  }
2011
2002
  const name = getSourceURL(src);
2012
2003
  throw new SyntaxError(
2013
- `Possible import expression rejected at ${name}:${lineNumber}. (SES_IMPORT_REJECTED)`,
2014
- );
2004
+ `Possible import expression rejected at ${name}:${lineNumber}. (SES_IMPORT_REJECTED)`);
2005
+
2015
2006
  };$h‍_once.rejectImportExpressions(rejectImportExpressions);
2016
2007
 
2017
2008
  /**
@@ -2030,7 +2021,7 @@ const rejectImportExpressions = src => {
2030
2021
  * @param { string } src
2031
2022
  * @returns { string }
2032
2023
  */
2033
- const evadeImportExpressionTest = src => {
2024
+ const evadeImportExpressionTest = (src) => {
2034
2025
  const replaceFn = (_, p1, p2) => `${p1}__import__${p2}`;
2035
2026
  return stringReplace(src, importPattern, replaceFn);
2036
2027
  };$h‍_once.evadeImportExpressionTest(evadeImportExpressionTest);
@@ -2038,9 +2029,9 @@ const evadeImportExpressionTest = src => {
2038
2029
  // /////////////////////////////////////////////////////////////////////////////
2039
2030
 
2040
2031
  const someDirectEvalPattern = new FERAL_REG_EXP(
2041
- '(^|[^.])\\beval(\\s*\\()',
2042
- 'g',
2043
- );
2032
+ '(^|[^.])\\beval(\\s*\\()',
2033
+ 'g');
2034
+
2044
2035
 
2045
2036
  /**
2046
2037
  * Heuristically reject some text that seems to contain a direct eval
@@ -2074,15 +2065,15 @@ const someDirectEvalPattern = new FERAL_REG_EXP(
2074
2065
  * @param { string } src
2075
2066
  * @returns { string }
2076
2067
  */
2077
- const rejectSomeDirectEvalExpressions = src => {
2068
+ const rejectSomeDirectEvalExpressions = (src) => {
2078
2069
  const lineNumber = getLineNumber(src, someDirectEvalPattern);
2079
2070
  if (lineNumber < 0) {
2080
2071
  return src;
2081
2072
  }
2082
2073
  const name = getSourceURL(src);
2083
2074
  throw new SyntaxError(
2084
- `Possible direct eval expression rejected at ${name}:${lineNumber}. (SES_EVAL_REJECTED)`,
2085
- );
2075
+ `Possible direct eval expression rejected at ${name}:${lineNumber}. (SES_EVAL_REJECTED)`);
2076
+
2086
2077
  };$h‍_once.rejectSomeDirectEvalExpressions(rejectSomeDirectEvalExpressions);
2087
2078
 
2088
2079
  // /////////////////////////////////////////////////////////////////////////////
@@ -2094,7 +2085,7 @@ const rejectSomeDirectEvalExpressions = src => {
2094
2085
  * @param {string} source
2095
2086
  * @returns {string}
2096
2087
  */
2097
- const mandatoryTransforms = source => {
2088
+ const mandatoryTransforms = (source) => {
2098
2089
  source = rejectHtmlComments(source);
2099
2090
  source = rejectImportExpressions(source);
2100
2091
  return source;
@@ -2114,7 +2105,6 @@ const applyTransforms = (source, transforms) => {
2114
2105
  }
2115
2106
  return source;
2116
2107
  };$h‍_once.applyTransforms(applyTransforms);
2117
-
2118
2108
  })
2119
2109
  ,
2120
2110
  // === functors[10] ===
@@ -2155,19 +2145,19 @@ const makeSafeEvaluator = ({
2155
2145
  localObject = {},
2156
2146
  globalTransforms = [],
2157
2147
  sloppyGlobalsMode = false,
2158
- knownScopeProxies = new WeakSet(),
2159
- } = {}) => {
2148
+ knownScopeProxies = new WeakSet() } =
2149
+ {}) => {
2160
2150
  const {
2161
2151
  scopeHandler,
2162
2152
  admitOneUnsafeEvalNext,
2163
- resetOneUnsafeEvalNext,
2164
- } = createScopeHandler(globalObject, localObject, {
2165
- sloppyGlobalsMode,
2166
- });
2153
+ resetOneUnsafeEvalNext } =
2154
+ createScopeHandler(globalObject, localObject, {
2155
+ sloppyGlobalsMode });
2156
+
2167
2157
  const { proxy: scopeProxy, revoke: revokeScopeProxy } = proxyRevocable(
2168
- immutableObject,
2169
- scopeHandler,
2170
- );
2158
+ immutableObject,
2159
+ scopeHandler);
2160
+
2171
2161
  weaksetAdd(knownScopeProxies, scopeProxy);
2172
2162
 
2173
2163
  // Defer creating the actual evaluator to first use.
@@ -2193,10 +2183,10 @@ const makeSafeEvaluator = ({
2193
2183
  // Execute the mandatory transforms last to ensure that any rewritten code
2194
2184
  // meets those mandatory requirements.
2195
2185
  source = applyTransforms(source, [
2196
- ...localTransforms,
2197
- ...globalTransforms,
2198
- mandatoryTransforms,
2199
- ]);
2186
+ ...localTransforms,
2187
+ ...globalTransforms,
2188
+ mandatoryTransforms]);
2189
+
2200
2190
 
2201
2191
  admitOneUnsafeEvalNext();
2202
2192
  let err;
@@ -2235,7 +2225,6 @@ const makeSafeEvaluator = ({
2235
2225
 
2236
2226
  return { safeEvaluate };
2237
2227
  };$h‍_once.makeSafeEvaluator(makeSafeEvaluator);
2238
-
2239
2228
  })
2240
2229
  ,
2241
2230
  // === functors[11] ===
@@ -2257,8 +2246,8 @@ const makeSafeEvaluator = ({
2257
2246
  const provideCompartmentEvaluator = (compartmentFields, options) => {
2258
2247
  const {
2259
2248
  sloppyGlobalsMode = false,
2260
- __moduleShimLexicals__ = undefined,
2261
- } = options;
2249
+ __moduleShimLexicals__ = undefined } =
2250
+ options;
2262
2251
 
2263
2252
  let safeEvaluate;
2264
2253
 
@@ -2272,8 +2261,8 @@ const provideCompartmentEvaluator = (compartmentFields, options) => {
2272
2261
  const {
2273
2262
  globalObject,
2274
2263
  globalLexicals,
2275
- knownScopeProxies,
2276
- } = compartmentFields;
2264
+ knownScopeProxies } =
2265
+ compartmentFields;
2277
2266
 
2278
2267
  let localObject = globalLexicals;
2279
2268
  if (__moduleShimLexicals__ !== undefined) {
@@ -2289,9 +2278,9 @@ const provideCompartmentEvaluator = (compartmentFields, options) => {
2289
2278
 
2290
2279
  localObject = create(null, getOwnPropertyDescriptors(globalLexicals));
2291
2280
  defineProperties(
2292
- localObject,
2293
- getOwnPropertyDescriptors(__moduleShimLexicals__),
2294
- );
2281
+ localObject,
2282
+ getOwnPropertyDescriptors(__moduleShimLexicals__));
2283
+
2295
2284
  }
2296
2285
 
2297
2286
  ({ safeEvaluate } = makeSafeEvaluator({
@@ -2299,8 +2288,8 @@ const provideCompartmentEvaluator = (compartmentFields, options) => {
2299
2288
  localObject,
2300
2289
  globalTransforms,
2301
2290
  sloppyGlobalsMode,
2302
- knownScopeProxies,
2303
- }));
2291
+ knownScopeProxies }));
2292
+
2304
2293
  }
2305
2294
 
2306
2295
  return { safeEvaluate };
@@ -2319,7 +2308,7 @@ const compartmentEvaluate = (compartmentFields, source, options) => {
2319
2308
  transforms = [],
2320
2309
  __evadeHtmlCommentTest__ = false,
2321
2310
  __evadeImportExpressionTest__ = false,
2322
- __rejectSomeDirectEvalExpressions__ = true, // Note default on
2311
+ __rejectSomeDirectEvalExpressions__ = true // Note default on
2323
2312
  } = options;
2324
2313
  const localTransforms = [...transforms];
2325
2314
  if (__evadeHtmlCommentTest__ === true) {
@@ -2333,15 +2322,14 @@ const compartmentEvaluate = (compartmentFields, source, options) => {
2333
2322
  }
2334
2323
 
2335
2324
  const { safeEvaluate } = provideCompartmentEvaluator(
2336
- compartmentFields,
2337
- options,
2338
- );
2325
+ compartmentFields,
2326
+ options);
2327
+
2339
2328
 
2340
2329
  return safeEvaluate(source, {
2341
- localTransforms,
2342
- });
2343
- };$h‍_once.compartmentEvaluate(compartmentEvaluate);
2330
+ localTransforms });
2344
2331
 
2332
+ };$h‍_once.compartmentEvaluate(compartmentEvaluate);
2345
2333
  })
2346
2334
  ,
2347
2335
  // === functors[12] ===
@@ -2350,7 +2338,7 @@ const compartmentEvaluate = (compartmentFields, source, options) => {
2350
2338
  * A safe version of the native eval function which relies on
2351
2339
  * the safety of safeEvaluate for confinement.
2352
2340
  */
2353
- const makeEvalFunction = safeEvaluate => {
2341
+ const makeEvalFunction = (safeEvaluate) => {
2354
2342
  // We use the the concise method syntax to create an eval without a
2355
2343
  // [[Construct]] behavior (such that the invocation "new eval()" throws
2356
2344
  // TypeError: eval is not a constructor"), but which still accepts a
@@ -2365,12 +2353,11 @@ const makeEvalFunction = safeEvaluate => {
2365
2353
  return source;
2366
2354
  }
2367
2355
  return safeEvaluate(source);
2368
- },
2369
- }.eval;
2356
+ } }.
2357
+ eval;
2370
2358
 
2371
2359
  return newEval;
2372
2360
  };$h‍_once.makeEvalFunction(makeEvalFunction);
2373
-
2374
2361
  })
2375
2362
  ,
2376
2363
  // === functors[13] ===
@@ -2388,7 +2375,7 @@ const makeEvalFunction = safeEvaluate => {
2388
2375
  * A safe version of the native Function which relies on
2389
2376
  * the safety of safeEvaluate for confinement.
2390
2377
  */
2391
- const makeFunctionConstructor = safeEvaluate => {
2378
+ const makeFunctionConstructor = (safeEvaluate) => {
2392
2379
  // Define an unused parameter to ensure Function.length === 1
2393
2380
  const newFunction = function Function(_body) {
2394
2381
  // Sanitize all parameters at the entry point.
@@ -2438,23 +2425,22 @@ const makeFunctionConstructor = safeEvaluate => {
2438
2425
  value: FERAL_FUNCTION.prototype,
2439
2426
  writable: false,
2440
2427
  enumerable: false,
2441
- configurable: false,
2442
- },
2443
- });
2428
+ configurable: false } });
2429
+
2430
+
2444
2431
 
2445
2432
  // Assert identity of Function.__proto__ accross all compartments
2446
2433
  assert(
2447
- getPrototypeOf(FERAL_FUNCTION) === FERAL_FUNCTION.prototype,
2448
- 'Function prototype is the same accross compartments',
2449
- );
2434
+ getPrototypeOf(FERAL_FUNCTION) === FERAL_FUNCTION.prototype,
2435
+ 'Function prototype is the same accross compartments');
2436
+
2450
2437
  assert(
2451
- getPrototypeOf(newFunction) === FERAL_FUNCTION.prototype,
2452
- 'Function constructor prototype is the same accross compartments',
2453
- );
2438
+ getPrototypeOf(newFunction) === FERAL_FUNCTION.prototype,
2439
+ 'Function constructor prototype is the same accross compartments');
2440
+
2454
2441
 
2455
2442
  return newFunction;
2456
2443
  };$h‍_once.makeFunctionConstructor(makeFunctionConstructor);
2457
-
2458
2444
  })
2459
2445
  ,
2460
2446
  // === functors[14] ===
@@ -2481,8 +2467,8 @@ const constantProperties = {
2481
2467
 
2482
2468
  Infinity,
2483
2469
  NaN,
2484
- undefined,
2485
- };$h‍_once.constantProperties(constantProperties);
2470
+ undefined };$h‍_once.constantProperties(constantProperties);
2471
+
2486
2472
 
2487
2473
  /**
2488
2474
  * universalPropertyNames
@@ -2552,7 +2538,7 @@ const universalPropertyNames = {
2552
2538
 
2553
2539
  lockdown: 'lockdown',
2554
2540
  harden: 'harden',
2555
- HandledPromise: 'HandledPromise', // TODO: Until Promise.delegate (see below).
2541
+ HandledPromise: 'HandledPromise' // TODO: Until Promise.delegate (see below).
2556
2542
  };$h‍_once.universalPropertyNames(universalPropertyNames);
2557
2543
 
2558
2544
  /**
@@ -2578,7 +2564,7 @@ const initialGlobalPropertyNames = {
2578
2564
  // From Error-stack proposal
2579
2565
  // Only on initial global. No corresponding
2580
2566
  // powerless form for other globals.
2581
- getStackString: '%InitialGetStackString%',
2567
+ getStackString: '%InitialGetStackString%'
2582
2568
 
2583
2569
  // TODO https://github.com/Agoric/SES-shim/issues/551
2584
2570
  // Need initial WeakRef and FinalizationGroup in
@@ -2600,8 +2586,8 @@ const sharedGlobalPropertyNames = {
2600
2586
 
2601
2587
  // *** Other Properties of the Global Object
2602
2588
 
2603
- Math: '%SharedMath%',
2604
- };$h‍_once.sharedGlobalPropertyNames(sharedGlobalPropertyNames);
2589
+ Math: '%SharedMath%' };$h‍_once.sharedGlobalPropertyNames(sharedGlobalPropertyNames);
2590
+
2605
2591
 
2606
2592
  /**
2607
2593
  * uniqueGlobalPropertyNames
@@ -2627,7 +2613,7 @@ const uniqueGlobalPropertyNames = {
2627
2613
 
2628
2614
  // ESNext
2629
2615
 
2630
- Compartment: '%UniqueCompartment%',
2616
+ Compartment: '%UniqueCompartment%'
2631
2617
  // According to current agreements, eventually the Realm constructor too.
2632
2618
  // 'Realm',
2633
2619
  };$h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);
@@ -2636,13 +2622,13 @@ const uniqueGlobalPropertyNames = {
2636
2622
  // ECMAScript spec by the meta variable NativeError.
2637
2623
  // TODO Add AggregateError https://github.com/Agoric/SES-shim/issues/550
2638
2624
  const NativeErrors = [
2639
- EvalError,
2640
- RangeError,
2641
- ReferenceError,
2642
- SyntaxError,
2643
- TypeError,
2644
- URIError,
2645
- ];$h‍_once.NativeErrors(NativeErrors);
2625
+ EvalError,
2626
+ RangeError,
2627
+ ReferenceError,
2628
+ SyntaxError,
2629
+ TypeError,
2630
+ URIError];$h‍_once.NativeErrors(NativeErrors);
2631
+
2646
2632
 
2647
2633
  /**
2648
2634
  * <p>Each JSON record enumerates the disposition of the properties on
@@ -2691,7 +2677,7 @@ const NativeErrors = [
2691
2677
  const FunctionInstance = {
2692
2678
  '[[Proto]]': '%FunctionPrototype%',
2693
2679
  length: 'number',
2694
- name: 'string',
2680
+ name: 'string'
2695
2681
  // Do not specify "prototype" here, since only Function instances that can
2696
2682
  // be used as a constructor have a prototype property. For constructors,
2697
2683
  // since prototype properties are instance-specific, we define it there.
@@ -2701,8 +2687,8 @@ const FunctionInstance = {
2701
2687
  const AsyncFunctionInstance = {
2702
2688
  // This property is not mentioned in ECMA 262, but is present in V8 and
2703
2689
  // necessary for lockdown to succeed.
2704
- '[[Proto]]': '%AsyncFunctionPrototype%',
2705
- };
2690
+ '[[Proto]]': '%AsyncFunctionPrototype%' };
2691
+
2706
2692
 
2707
2693
  // Aliases
2708
2694
  const fn = FunctionInstance;
@@ -2710,8 +2696,8 @@ const asyncFn = AsyncFunctionInstance;
2710
2696
 
2711
2697
  const getter = {
2712
2698
  get: fn,
2713
- set: 'undefined',
2714
- };
2699
+ set: 'undefined' };
2700
+
2715
2701
 
2716
2702
  // Possible but not encountered in the specs
2717
2703
  // export const setter = {
@@ -2721,10 +2707,10 @@ const getter = {
2721
2707
 
2722
2708
  const accessor = {
2723
2709
  get: fn,
2724
- set: fn,
2725
- };
2710
+ set: fn };
2711
+
2726
2712
 
2727
- const isAccessorPermit = permit => {
2713
+ const isAccessorPermit = (permit) => {
2728
2714
  return permit === getter || permit === accessor;
2729
2715
  };$h‍_once.isAccessorPermit(isAccessorPermit);
2730
2716
 
@@ -2735,8 +2721,8 @@ function NativeError(prototype) {
2735
2721
  '[[Proto]]': '%SharedError%',
2736
2722
 
2737
2723
  // NativeError.prototype
2738
- prototype,
2739
- };
2724
+ prototype };
2725
+
2740
2726
  }
2741
2727
 
2742
2728
  function NativeErrorPrototype(constructor) {
@@ -2747,8 +2733,8 @@ function NativeErrorPrototype(constructor) {
2747
2733
  message: 'string',
2748
2734
  name: 'string',
2749
2735
  // Redundantly present only on v8. Safe to remove.
2750
- toString: false,
2751
- };
2736
+ toString: false };
2737
+
2752
2738
  }
2753
2739
 
2754
2740
  // The TypedArray Constructors
@@ -2757,8 +2743,8 @@ function TypedArray(prototype) {
2757
2743
  // Properties of the TypedArray Constructors
2758
2744
  '[[Proto]]': '%TypedArray%',
2759
2745
  BYTES_PER_ELEMENT: 'number',
2760
- prototype,
2761
- };
2746
+ prototype };
2747
+
2762
2748
  }
2763
2749
 
2764
2750
  function TypedArrayPrototype(constructor) {
@@ -2766,8 +2752,8 @@ function TypedArrayPrototype(constructor) {
2766
2752
  // Properties of the TypedArray Prototype Objects
2767
2753
  '[[Proto]]': '%TypedArrayPrototype%',
2768
2754
  BYTES_PER_ELEMENT: 'number',
2769
- constructor,
2770
- };
2755
+ constructor };
2756
+
2771
2757
  }
2772
2758
 
2773
2759
  // Without Math.random
@@ -2826,8 +2812,8 @@ const SharedMath = {
2826
2812
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
2827
2813
  irem: false,
2828
2814
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
2829
- mod: false,
2830
- };
2815
+ mod: false };
2816
+
2831
2817
 
2832
2818
  const whitelist = {
2833
2819
  // ECMA https://tc39.es/ecma262
@@ -2886,8 +2872,8 @@ const whitelist = {
2886
2872
  setPrototypeOf: fn,
2887
2873
  values: fn,
2888
2874
  // See https://github.com/tc39/proposal-accessible-object-hasownproperty
2889
- hasOwn: fn,
2890
- },
2875
+ hasOwn: fn },
2876
+
2891
2877
 
2892
2878
  '%ObjectPrototype%': {
2893
2879
  // Properties of the Object Prototype Object
@@ -2908,19 +2894,19 @@ const whitelist = {
2908
2894
  __defineGetter__: fn,
2909
2895
  __defineSetter__: fn,
2910
2896
  __lookupGetter__: fn,
2911
- __lookupSetter__: fn,
2912
- },
2897
+ __lookupSetter__: fn },
2898
+
2913
2899
 
2914
2900
  '%UniqueFunction%': {
2915
2901
  // Properties of the Function Constructor
2916
2902
  '[[Proto]]': '%FunctionPrototype%',
2917
- prototype: '%FunctionPrototype%',
2918
- },
2903
+ prototype: '%FunctionPrototype%' },
2904
+
2919
2905
 
2920
2906
  '%InertFunction%': {
2921
2907
  '[[Proto]]': '%FunctionPrototype%',
2922
- prototype: '%FunctionPrototype%',
2923
- },
2908
+ prototype: '%FunctionPrototype%' },
2909
+
2924
2910
 
2925
2911
  '%FunctionPrototype%': {
2926
2912
  apply: fn,
@@ -2932,20 +2918,20 @@ const whitelist = {
2932
2918
  // proposed but not yet std yet. To be removed if there
2933
2919
  caller: false,
2934
2920
  // proposed but not yet std yet. To be removed if there
2935
- arguments: false,
2936
- },
2921
+ arguments: false },
2922
+
2937
2923
 
2938
2924
  Boolean: {
2939
2925
  // Properties of the Boolean Constructor
2940
2926
  '[[Proto]]': '%FunctionPrototype%',
2941
- prototype: '%BooleanPrototype%',
2942
- },
2927
+ prototype: '%BooleanPrototype%' },
2928
+
2943
2929
 
2944
2930
  '%BooleanPrototype%': {
2945
2931
  constructor: 'Boolean',
2946
2932
  toString: fn,
2947
- valueOf: fn,
2948
- },
2933
+ valueOf: fn },
2934
+
2949
2935
 
2950
2936
  Symbol: {
2951
2937
  // Properties of the Symbol Constructor
@@ -2965,8 +2951,8 @@ const whitelist = {
2965
2951
  split: 'symbol',
2966
2952
  toPrimitive: 'symbol',
2967
2953
  toStringTag: 'symbol',
2968
- unscopables: 'symbol',
2969
- },
2954
+ unscopables: 'symbol' },
2955
+
2970
2956
 
2971
2957
  '%SymbolPrototype%': {
2972
2958
  // Properties of the Symbol Prototype Object
@@ -2975,8 +2961,8 @@ const whitelist = {
2975
2961
  toString: fn,
2976
2962
  valueOf: fn,
2977
2963
  '@@toPrimitive': fn,
2978
- '@@toStringTag': 'string',
2979
- },
2964
+ '@@toStringTag': 'string' },
2965
+
2980
2966
 
2981
2967
  '%InitialError%': {
2982
2968
  // Properties of the Error Constructor
@@ -2987,8 +2973,8 @@ const whitelist = {
2987
2973
  // Non standard, v8 only, used by tap, tamed to accessor
2988
2974
  stackTraceLimit: accessor,
2989
2975
  // Non standard, v8 only, used by several, tamed to accessor
2990
- prepareStackTrace: accessor,
2991
- },
2976
+ prepareStackTrace: accessor },
2977
+
2992
2978
 
2993
2979
  '%SharedError%': {
2994
2980
  // Properties of the Error Constructor
@@ -2999,8 +2985,8 @@ const whitelist = {
2999
2985
  // Non standard, v8 only, used by tap, tamed to accessor
3000
2986
  stackTraceLimit: accessor,
3001
2987
  // Non standard, v8 only, used by several, tamed to accessor
3002
- prepareStackTrace: accessor,
3003
- },
2988
+ prepareStackTrace: accessor },
2989
+
3004
2990
 
3005
2991
  '%ErrorPrototype%': {
3006
2992
  constructor: '%SharedError%',
@@ -3011,8 +2997,8 @@ const whitelist = {
3011
2997
  // Seen on FF Nightly 88.0a1
3012
2998
  at: false,
3013
2999
  // Seen on FF and XS
3014
- stack: false,
3015
- },
3000
+ stack: false },
3001
+
3016
3002
 
3017
3003
  // NativeError
3018
3004
 
@@ -3049,8 +3035,8 @@ const whitelist = {
3049
3035
  parseFloat: fn,
3050
3036
  parseInt: fn,
3051
3037
  POSITIVE_INFINITY: 'number',
3052
- prototype: '%NumberPrototype%',
3053
- },
3038
+ prototype: '%NumberPrototype%' },
3039
+
3054
3040
 
3055
3041
  '%NumberPrototype%': {
3056
3042
  // Properties of the Number Prototype Object
@@ -3060,8 +3046,8 @@ const whitelist = {
3060
3046
  toLocaleString: fn,
3061
3047
  toPrecision: fn,
3062
3048
  toString: fn,
3063
- valueOf: fn,
3064
- },
3049
+ valueOf: fn },
3050
+
3065
3051
 
3066
3052
  BigInt: {
3067
3053
  // Properties of the BigInt Constructor
@@ -3072,22 +3058,22 @@ const whitelist = {
3072
3058
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3073
3059
  bitLength: false,
3074
3060
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3075
- fromArrayBuffer: false,
3076
- },
3061
+ fromArrayBuffer: false },
3062
+
3077
3063
 
3078
3064
  '%BigIntPrototype%': {
3079
3065
  constructor: 'BigInt',
3080
3066
  toLocaleString: fn,
3081
3067
  toString: fn,
3082
3068
  valueOf: fn,
3083
- '@@toStringTag': 'string',
3084
- },
3069
+ '@@toStringTag': 'string' },
3070
+
3085
3071
 
3086
3072
  '%InitialMath%': {
3087
3073
  ...SharedMath,
3088
3074
  // random is standard but omitted from SharedMath
3089
- random: fn,
3090
- },
3075
+ random: fn },
3076
+
3091
3077
 
3092
3078
  '%SharedMath%': SharedMath,
3093
3079
 
@@ -3097,8 +3083,8 @@ const whitelist = {
3097
3083
  now: fn,
3098
3084
  parse: fn,
3099
3085
  prototype: '%DatePrototype%',
3100
- UTC: fn,
3101
- },
3086
+ UTC: fn },
3087
+
3102
3088
 
3103
3089
  '%SharedDate%': {
3104
3090
  // Properties of the Date Constructor
@@ -3106,8 +3092,8 @@ const whitelist = {
3106
3092
  now: fn,
3107
3093
  parse: fn,
3108
3094
  prototype: '%DatePrototype%',
3109
- UTC: fn,
3110
- },
3095
+ UTC: fn },
3096
+
3111
3097
 
3112
3098
  '%DatePrototype%': {
3113
3099
  constructor: '%SharedDate%',
@@ -3159,8 +3145,8 @@ const whitelist = {
3159
3145
  // Annex B: Additional Properties of the Date.prototype Object
3160
3146
  getYear: fn,
3161
3147
  setYear: fn,
3162
- toGMTString: fn,
3163
- },
3148
+ toGMTString: fn },
3149
+
3164
3150
 
3165
3151
  // Text Processing
3166
3152
 
@@ -3172,8 +3158,8 @@ const whitelist = {
3172
3158
  prototype: '%StringPrototype%',
3173
3159
  raw: fn,
3174
3160
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3175
- fromArrayBuffer: false,
3176
- },
3161
+ fromArrayBuffer: false },
3162
+
3177
3163
 
3178
3164
  '%StringPrototype%': {
3179
3165
  // Properties of the String Prototype Object
@@ -3234,14 +3220,14 @@ const whitelist = {
3234
3220
 
3235
3221
  // Stage 3:
3236
3222
  // https://tc39.es/proposal-relative-indexing-method/
3237
- at: fn,
3238
- },
3223
+ at: fn },
3224
+
3239
3225
 
3240
3226
  '%StringIteratorPrototype%': {
3241
3227
  '[[Proto]]': '%IteratorPrototype%',
3242
3228
  next: fn,
3243
- '@@toStringTag': 'string',
3244
- },
3229
+ '@@toStringTag': 'string' },
3230
+
3245
3231
 
3246
3232
  '%InitialRegExp%': {
3247
3233
  // Properties of the RegExp Constructor
@@ -3269,15 +3255,15 @@ const whitelist = {
3269
3255
  $6: false,
3270
3256
  $7: false,
3271
3257
  $8: false,
3272
- $9: false,
3273
- },
3258
+ $9: false },
3259
+
3274
3260
 
3275
3261
  '%SharedRegExp%': {
3276
3262
  // Properties of the RegExp Constructor
3277
3263
  '[[Proto]]': '%FunctionPrototype%',
3278
3264
  prototype: '%RegExpPrototype%',
3279
- '@@species': getter,
3280
- },
3265
+ '@@species': getter },
3266
+
3281
3267
 
3282
3268
  '%RegExpPrototype%': {
3283
3269
  // Properties of the RegExp Prototype Object
@@ -3303,15 +3289,15 @@ const whitelist = {
3303
3289
  compile: false, // UNSAFE and suppressed.
3304
3290
  // Seen on FF Nightly 88.0a1, Chrome Canary 91.0.4446.0,
3305
3291
  // Safari Tech Preview Release 122 (Safari 14.2, WebKit 16612.1.6.2)
3306
- hasIndices: false,
3307
- },
3292
+ hasIndices: false },
3293
+
3308
3294
 
3309
3295
  '%RegExpStringIteratorPrototype%': {
3310
3296
  // The %RegExpStringIteratorPrototype% Object
3311
3297
  '[[Proto]]': '%IteratorPrototype%',
3312
3298
  next: fn,
3313
- '@@toStringTag': 'string',
3314
- },
3299
+ '@@toStringTag': 'string' },
3300
+
3315
3301
 
3316
3302
  // Indexed Collections
3317
3303
 
@@ -3326,8 +3312,8 @@ const whitelist = {
3326
3312
 
3327
3313
  // Stage 3:
3328
3314
  // https://tc39.es/proposal-relative-indexing-method/
3329
- at: fn,
3330
- },
3315
+ at: fn },
3316
+
3331
3317
 
3332
3318
  '%ArrayPrototype%': {
3333
3319
  // Properties of the Array Prototype Object
@@ -3379,22 +3365,22 @@ const whitelist = {
3379
3365
  values: 'boolean',
3380
3366
  // Failed tc39 proposal
3381
3367
  // Seen on FF Nightly 88.0a1
3382
- at: false,
3383
- },
3368
+ at: false },
3369
+
3384
3370
  // Failed tc39 proposal
3385
3371
  // Seen on FF Nightly 88.0a1
3386
3372
  at: false,
3387
3373
  // See https://github.com/tc39/proposal-array-find-from-last
3388
3374
  findLast: fn,
3389
- findLastIndex: fn,
3390
- },
3375
+ findLastIndex: fn },
3376
+
3391
3377
 
3392
3378
  '%ArrayIteratorPrototype%': {
3393
3379
  // The %ArrayIteratorPrototype% Object
3394
3380
  '[[Proto]]': '%IteratorPrototype%',
3395
3381
  next: fn,
3396
- '@@toStringTag': 'string',
3397
- },
3382
+ '@@toStringTag': 'string' },
3383
+
3398
3384
 
3399
3385
  // *** TypedArray Objects
3400
3386
 
@@ -3404,8 +3390,8 @@ const whitelist = {
3404
3390
  from: fn,
3405
3391
  of: fn,
3406
3392
  prototype: '%TypedArrayPrototype%',
3407
- '@@species': getter,
3408
- },
3393
+ '@@species': getter },
3394
+
3409
3395
 
3410
3396
  '%TypedArrayPrototype%': {
3411
3397
  buffer: getter,
@@ -3445,8 +3431,8 @@ const whitelist = {
3445
3431
  at: false,
3446
3432
  // See https://github.com/tc39/proposal-array-find-from-last
3447
3433
  findLast: fn,
3448
- findLastIndex: fn,
3449
- },
3434
+ findLastIndex: fn },
3435
+
3450
3436
 
3451
3437
  // The TypedArray Constructors
3452
3438
 
@@ -3480,8 +3466,8 @@ const whitelist = {
3480
3466
  // Properties of the Map Constructor
3481
3467
  '[[Proto]]': '%FunctionPrototype%',
3482
3468
  '@@species': getter,
3483
- prototype: '%MapPrototype%',
3484
- },
3469
+ prototype: '%MapPrototype%' },
3470
+
3485
3471
 
3486
3472
  '%MapPrototype%': {
3487
3473
  clear: fn,
@@ -3496,22 +3482,22 @@ const whitelist = {
3496
3482
  size: getter,
3497
3483
  values: fn,
3498
3484
  '@@iterator': fn,
3499
- '@@toStringTag': 'string',
3500
- },
3485
+ '@@toStringTag': 'string' },
3486
+
3501
3487
 
3502
3488
  '%MapIteratorPrototype%': {
3503
3489
  // The %MapIteratorPrototype% Object
3504
3490
  '[[Proto]]': '%IteratorPrototype%',
3505
3491
  next: fn,
3506
- '@@toStringTag': 'string',
3507
- },
3492
+ '@@toStringTag': 'string' },
3493
+
3508
3494
 
3509
3495
  Set: {
3510
3496
  // Properties of the Set Constructor
3511
3497
  '[[Proto]]': '%FunctionPrototype%',
3512
3498
  prototype: '%SetPrototype%',
3513
- '@@species': getter,
3514
- },
3499
+ '@@species': getter },
3500
+
3515
3501
 
3516
3502
  '%SetPrototype%': {
3517
3503
  add: fn,
@@ -3525,21 +3511,21 @@ const whitelist = {
3525
3511
  size: getter,
3526
3512
  values: fn,
3527
3513
  '@@iterator': fn,
3528
- '@@toStringTag': 'string',
3529
- },
3514
+ '@@toStringTag': 'string' },
3515
+
3530
3516
 
3531
3517
  '%SetIteratorPrototype%': {
3532
3518
  // The %SetIteratorPrototype% Object
3533
3519
  '[[Proto]]': '%IteratorPrototype%',
3534
3520
  next: fn,
3535
- '@@toStringTag': 'string',
3536
- },
3521
+ '@@toStringTag': 'string' },
3522
+
3537
3523
 
3538
3524
  WeakMap: {
3539
3525
  // Properties of the WeakMap Constructor
3540
3526
  '[[Proto]]': '%FunctionPrototype%',
3541
- prototype: '%WeakMapPrototype%',
3542
- },
3527
+ prototype: '%WeakMapPrototype%' },
3528
+
3543
3529
 
3544
3530
  '%WeakMapPrototype%': {
3545
3531
  constructor: 'WeakMap',
@@ -3547,22 +3533,22 @@ const whitelist = {
3547
3533
  get: fn,
3548
3534
  has: fn,
3549
3535
  set: fn,
3550
- '@@toStringTag': 'string',
3551
- },
3536
+ '@@toStringTag': 'string' },
3537
+
3552
3538
 
3553
3539
  WeakSet: {
3554
3540
  // Properties of the WeakSet Constructor
3555
3541
  '[[Proto]]': '%FunctionPrototype%',
3556
- prototype: '%WeakSetPrototype%',
3557
- },
3542
+ prototype: '%WeakSetPrototype%' },
3543
+
3558
3544
 
3559
3545
  '%WeakSetPrototype%': {
3560
3546
  add: fn,
3561
3547
  constructor: 'WeakSet',
3562
3548
  delete: fn,
3563
3549
  has: fn,
3564
- '@@toStringTag': 'string',
3565
- },
3550
+ '@@toStringTag': 'string' },
3551
+
3566
3552
 
3567
3553
  // *** Structured Data
3568
3554
 
@@ -3575,8 +3561,8 @@ const whitelist = {
3575
3561
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3576
3562
  fromString: false,
3577
3563
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3578
- fromBigInt: false,
3579
- },
3564
+ fromBigInt: false },
3565
+
3580
3566
 
3581
3567
  '%ArrayBufferPrototype%': {
3582
3568
  byteLength: getter,
@@ -3589,8 +3575,8 @@ const whitelist = {
3589
3575
  transfer: fn,
3590
3576
  resize: fn,
3591
3577
  resizable: getter,
3592
- maxByteLength: getter,
3593
- },
3578
+ maxByteLength: getter },
3579
+
3594
3580
 
3595
3581
  // SharedArrayBuffer Objects
3596
3582
  SharedArrayBuffer: false, // UNSAFE and purposely suppressed.
@@ -3600,8 +3586,8 @@ const whitelist = {
3600
3586
  // Properties of the DataView Constructor
3601
3587
  '[[Proto]]': '%FunctionPrototype%',
3602
3588
  BYTES_PER_ELEMENT: 'number', // Non std but undeletable on Safari.
3603
- prototype: '%DataViewPrototype%',
3604
- },
3589
+ prototype: '%DataViewPrototype%' },
3590
+
3605
3591
 
3606
3592
  '%DataViewPrototype%': {
3607
3593
  buffer: getter,
@@ -3628,8 +3614,8 @@ const whitelist = {
3628
3614
  setUint8: fn,
3629
3615
  setUint16: fn,
3630
3616
  setUint32: fn,
3631
- '@@toStringTag': 'string',
3632
- },
3617
+ '@@toStringTag': 'string' },
3618
+
3633
3619
 
3634
3620
  // Atomics
3635
3621
  Atomics: false, // UNSAFE and suppressed.
@@ -3637,48 +3623,48 @@ const whitelist = {
3637
3623
  JSON: {
3638
3624
  parse: fn,
3639
3625
  stringify: fn,
3640
- '@@toStringTag': 'string',
3641
- },
3626
+ '@@toStringTag': 'string' },
3627
+
3642
3628
 
3643
3629
  // *** Control Abstraction Objects
3644
3630
 
3645
3631
  '%IteratorPrototype%': {
3646
3632
  // The %IteratorPrototype% Object
3647
- '@@iterator': fn,
3648
- },
3633
+ '@@iterator': fn },
3634
+
3649
3635
 
3650
3636
  '%AsyncIteratorPrototype%': {
3651
3637
  // The %AsyncIteratorPrototype% Object
3652
- '@@asyncIterator': fn,
3653
- },
3638
+ '@@asyncIterator': fn },
3639
+
3654
3640
 
3655
3641
  '%InertGeneratorFunction%': {
3656
3642
  // Properties of the GeneratorFunction Constructor
3657
3643
  '[[Proto]]': '%InertFunction%',
3658
- prototype: '%Generator%',
3659
- },
3644
+ prototype: '%Generator%' },
3645
+
3660
3646
 
3661
3647
  '%Generator%': {
3662
3648
  // Properties of the GeneratorFunction Prototype Object
3663
3649
  '[[Proto]]': '%FunctionPrototype%',
3664
3650
  constructor: '%InertGeneratorFunction%',
3665
3651
  prototype: '%GeneratorPrototype%',
3666
- '@@toStringTag': 'string',
3667
- },
3652
+ '@@toStringTag': 'string' },
3653
+
3668
3654
 
3669
3655
  '%InertAsyncGeneratorFunction%': {
3670
3656
  // Properties of the AsyncGeneratorFunction Constructor
3671
3657
  '[[Proto]]': '%InertFunction%',
3672
- prototype: '%AsyncGenerator%',
3673
- },
3658
+ prototype: '%AsyncGenerator%' },
3659
+
3674
3660
 
3675
3661
  '%AsyncGenerator%': {
3676
3662
  // Properties of the AsyncGeneratorFunction Prototype Object
3677
3663
  '[[Proto]]': '%FunctionPrototype%',
3678
3664
  constructor: '%InertAsyncGeneratorFunction%',
3679
3665
  prototype: '%AsyncGeneratorPrototype%',
3680
- '@@toStringTag': 'string',
3681
- },
3666
+ '@@toStringTag': 'string' },
3667
+
3682
3668
 
3683
3669
  '%GeneratorPrototype%': {
3684
3670
  // Properties of the Generator Prototype Object
@@ -3687,8 +3673,8 @@ const whitelist = {
3687
3673
  next: fn,
3688
3674
  return: fn,
3689
3675
  throw: fn,
3690
- '@@toStringTag': 'string',
3691
- },
3676
+ '@@toStringTag': 'string' },
3677
+
3692
3678
 
3693
3679
  '%AsyncGeneratorPrototype%': {
3694
3680
  // Properties of the AsyncGenerator Prototype Object
@@ -3697,8 +3683,8 @@ const whitelist = {
3697
3683
  next: fn,
3698
3684
  return: fn,
3699
3685
  throw: fn,
3700
- '@@toStringTag': 'string',
3701
- },
3686
+ '@@toStringTag': 'string' },
3687
+
3702
3688
 
3703
3689
  // TODO: To be replaced with Promise.delegate
3704
3690
  //
@@ -3718,8 +3704,8 @@ const whitelist = {
3718
3704
  get: fn,
3719
3705
  getSendOnly: fn,
3720
3706
  prototype: '%PromisePrototype%',
3721
- resolve: fn,
3722
- },
3707
+ resolve: fn },
3708
+
3723
3709
 
3724
3710
  Promise: {
3725
3711
  // Properties of the Promise Constructor
@@ -3733,8 +3719,8 @@ const whitelist = {
3733
3719
  race: fn,
3734
3720
  reject: fn,
3735
3721
  resolve: fn,
3736
- '@@species': getter,
3737
- },
3722
+ '@@species': getter },
3723
+
3738
3724
 
3739
3725
  '%PromisePrototype%': {
3740
3726
  // Properties of the Promise Prototype Object
@@ -3742,21 +3728,21 @@ const whitelist = {
3742
3728
  constructor: 'Promise',
3743
3729
  finally: fn,
3744
3730
  then: fn,
3745
- '@@toStringTag': 'string',
3746
- },
3731
+ '@@toStringTag': 'string' },
3732
+
3747
3733
 
3748
3734
  '%InertAsyncFunction%': {
3749
3735
  // Properties of the AsyncFunction Constructor
3750
3736
  '[[Proto]]': '%InertFunction%',
3751
- prototype: '%AsyncFunctionPrototype%',
3752
- },
3737
+ prototype: '%AsyncFunctionPrototype%' },
3738
+
3753
3739
 
3754
3740
  '%AsyncFunctionPrototype%': {
3755
3741
  // Properties of the AsyncFunction Prototype Object
3756
3742
  '[[Proto]]': '%FunctionPrototype%',
3757
3743
  constructor: '%InertAsyncFunction%',
3758
- '@@toStringTag': 'string',
3759
- },
3744
+ '@@toStringTag': 'string' },
3745
+
3760
3746
 
3761
3747
  // Reflection
3762
3748
 
@@ -3776,14 +3762,14 @@ const whitelist = {
3776
3762
  preventExtensions: fn,
3777
3763
  set: fn,
3778
3764
  setPrototypeOf: fn,
3779
- '@@toStringTag': 'string',
3780
- },
3765
+ '@@toStringTag': 'string' },
3766
+
3781
3767
 
3782
3768
  Proxy: {
3783
3769
  // Properties of the Proxy Constructor
3784
3770
  '[[Proto]]': '%FunctionPrototype%',
3785
- revocable: fn,
3786
- },
3771
+ revocable: fn },
3772
+
3787
3773
 
3788
3774
  // Appendix B
3789
3775
 
@@ -3797,14 +3783,14 @@ const whitelist = {
3797
3783
  '%UniqueCompartment%': {
3798
3784
  '[[Proto]]': '%FunctionPrototype%',
3799
3785
  prototype: '%CompartmentPrototype%',
3800
- toString: fn,
3801
- },
3786
+ toString: fn },
3787
+
3802
3788
 
3803
3789
  '%InertCompartment%': {
3804
3790
  '[[Proto]]': '%FunctionPrototype%',
3805
3791
  prototype: '%CompartmentPrototype%',
3806
- toString: fn,
3807
- },
3792
+ toString: fn },
3793
+
3808
3794
 
3809
3795
  '%CompartmentPrototype%': {
3810
3796
  constructor: '%InertCompartment%',
@@ -3817,15 +3803,13 @@ const whitelist = {
3817
3803
  import: asyncFn,
3818
3804
  load: asyncFn,
3819
3805
  importNow: fn,
3820
- module: fn,
3821
- },
3806
+ module: fn },
3807
+
3822
3808
 
3823
3809
  lockdown: fn,
3824
3810
  harden: fn,
3825
3811
 
3826
- '%InitialGetStackString%': fn,
3827
- };$h‍_once.whitelist(whitelist);
3828
-
3812
+ '%InitialGetStackString%': fn };$h‍_once.whitelist(whitelist);
3829
3813
  })
3830
3814
  ,
3831
3815
  // === functors[15] ===
@@ -3842,14 +3826,14 @@ const whitelist = {
3842
3826
  *
3843
3827
  * @param {Object} globalObject
3844
3828
  */
3845
- const setGlobalObjectConstantProperties = globalObject => {
3829
+ const setGlobalObjectConstantProperties = (globalObject) => {
3846
3830
  for (const [name, constant] of entries(constantProperties)) {
3847
3831
  defineProperty(globalObject, name, {
3848
3832
  value: constant,
3849
3833
  writable: false,
3850
3834
  enumerable: false,
3851
- configurable: false,
3852
- });
3835
+ configurable: false });
3836
+
3853
3837
  }
3854
3838
  };$h‍_once.setGlobalObjectConstantProperties(setGlobalObjectConstantProperties);
3855
3839
 
@@ -3869,23 +3853,23 @@ const setGlobalObjectConstantProperties = globalObject => {
3869
3853
  * @param {(Object) => void} param1.markVirtualizedNativeFunction
3870
3854
  */
3871
3855
  const setGlobalObjectMutableProperties = (
3872
- globalObject,
3873
- {
3874
- intrinsics,
3875
- newGlobalPropertyNames,
3876
- makeCompartmentConstructor,
3877
- safeEvaluate,
3878
- markVirtualizedNativeFunction,
3879
- },
3880
- ) => {
3856
+ globalObject,
3857
+ {
3858
+ intrinsics,
3859
+ newGlobalPropertyNames,
3860
+ makeCompartmentConstructor,
3861
+ safeEvaluate,
3862
+ markVirtualizedNativeFunction }) =>
3863
+
3864
+ {
3881
3865
  for (const [name, intrinsicName] of entries(universalPropertyNames)) {
3882
3866
  if (objectHasOwnProperty(intrinsics, intrinsicName)) {
3883
3867
  defineProperty(globalObject, name, {
3884
3868
  value: intrinsics[intrinsicName],
3885
3869
  writable: true,
3886
3870
  enumerable: false,
3887
- configurable: true,
3888
- });
3871
+ configurable: true });
3872
+
3889
3873
  }
3890
3874
  }
3891
3875
 
@@ -3895,22 +3879,22 @@ const setGlobalObjectMutableProperties = (
3895
3879
  value: intrinsics[intrinsicName],
3896
3880
  writable: true,
3897
3881
  enumerable: false,
3898
- configurable: true,
3899
- });
3882
+ configurable: true });
3883
+
3900
3884
  }
3901
3885
  }
3902
3886
 
3903
3887
  const perCompartmentGlobals = {
3904
3888
  globalThis: globalObject,
3905
3889
  eval: makeEvalFunction(safeEvaluate),
3906
- Function: makeFunctionConstructor(safeEvaluate),
3907
- };
3890
+ Function: makeFunctionConstructor(safeEvaluate) };
3891
+
3908
3892
 
3909
3893
  perCompartmentGlobals.Compartment = makeCompartmentConstructor(
3910
- makeCompartmentConstructor,
3911
- intrinsics,
3912
- markVirtualizedNativeFunction,
3913
- );
3894
+ makeCompartmentConstructor,
3895
+ intrinsics,
3896
+ markVirtualizedNativeFunction);
3897
+
3914
3898
 
3915
3899
  // TODO These should still be tamed according to the whitelist before
3916
3900
  // being made available.
@@ -3919,14 +3903,13 @@ const setGlobalObjectMutableProperties = (
3919
3903
  value,
3920
3904
  writable: true,
3921
3905
  enumerable: false,
3922
- configurable: true,
3923
- });
3906
+ configurable: true });
3907
+
3924
3908
  if (typeof value === 'function') {
3925
3909
  markVirtualizedNativeFunction(value);
3926
3910
  }
3927
3911
  }
3928
3912
  };$h‍_once.setGlobalObjectMutableProperties(setGlobalObjectMutableProperties);
3929
-
3930
3913
  })
3931
3914
  ,
3932
3915
  // === functors[16] ===
@@ -3970,10 +3953,10 @@ const noop = () => {};
3970
3953
  // aliases.
3971
3954
  // Both are facilitated by the moduleMap Compartment constructor option.
3972
3955
  const makeAlias = (compartment, specifier) =>
3973
- freeze({
3974
- compartment,
3975
- specifier,
3976
- });$h‍_once.makeAlias(makeAlias);
3956
+ freeze({
3957
+ compartment,
3958
+ specifier });$h‍_once.makeAlias(makeAlias);
3959
+
3977
3960
 
3978
3961
  // `resolveAll` pre-computes resolutions of all imports within the compartment
3979
3962
  // in which a module was loaded.
@@ -3987,52 +3970,52 @@ const resolveAll = (imports, resolveHook, fullReferrerSpecifier) => {
3987
3970
  };
3988
3971
 
3989
3972
  const loadRecord = async (
3990
- compartmentPrivateFields,
3991
- moduleAliases,
3992
- compartment,
3993
- moduleSpecifier,
3994
- staticModuleRecord,
3995
- pendingJobs,
3996
- moduleLoads,
3997
- errors,
3998
- ) => {
3973
+ compartmentPrivateFields,
3974
+ moduleAliases,
3975
+ compartment,
3976
+ moduleSpecifier,
3977
+ staticModuleRecord,
3978
+ pendingJobs,
3979
+ moduleLoads,
3980
+ errors) =>
3981
+ {
3999
3982
  const { resolveHook, moduleRecords } = weakmapGet(
4000
- compartmentPrivateFields,
4001
- compartment,
4002
- );
3983
+ compartmentPrivateFields,
3984
+ compartment);
3985
+
4003
3986
 
4004
3987
  // resolve all imports relative to this referrer module.
4005
3988
  const resolvedImports = resolveAll(
4006
- staticModuleRecord.imports,
4007
- resolveHook,
4008
- moduleSpecifier,
4009
- );
3989
+ staticModuleRecord.imports,
3990
+ resolveHook,
3991
+ moduleSpecifier);
3992
+
4010
3993
  const moduleRecord = freeze({
4011
3994
  compartment,
4012
3995
  staticModuleRecord,
4013
3996
  moduleSpecifier,
4014
- resolvedImports,
4015
- });
3997
+ resolvedImports });
3998
+
4016
3999
 
4017
4000
  // Enqueue jobs to load this module's shallow dependencies.
4018
4001
  for (const fullSpecifier of values(resolvedImports)) {
4019
4002
  // Behold: recursion.
4020
4003
  // eslint-disable-next-line no-use-before-define
4021
4004
  const dependencyLoaded = memoizedLoadWithErrorAnnotation(
4022
- compartmentPrivateFields,
4023
- moduleAliases,
4024
- compartment,
4025
- fullSpecifier,
4026
- pendingJobs,
4027
- moduleLoads,
4028
- errors,
4029
- );
4005
+ compartmentPrivateFields,
4006
+ moduleAliases,
4007
+ compartment,
4008
+ fullSpecifier,
4009
+ pendingJobs,
4010
+ moduleLoads,
4011
+ errors);
4012
+
4030
4013
  setAdd(
4031
- pendingJobs,
4032
- promiseThen(dependencyLoaded, noop, error => {
4033
- arrayPush(errors, error);
4034
- }),
4035
- );
4014
+ pendingJobs,
4015
+ promiseThen(dependencyLoaded, noop, (error) => {
4016
+ arrayPush(errors, error);
4017
+ }));
4018
+
4036
4019
  }
4037
4020
 
4038
4021
  // Memoize.
@@ -4041,18 +4024,18 @@ const loadRecord = async (
4041
4024
  };
4042
4025
 
4043
4026
  const loadWithoutErrorAnnotation = async (
4044
- compartmentPrivateFields,
4045
- moduleAliases,
4046
- compartment,
4047
- moduleSpecifier,
4048
- pendingJobs,
4049
- moduleLoads,
4050
- errors,
4051
- ) => {
4027
+ compartmentPrivateFields,
4028
+ moduleAliases,
4029
+ compartment,
4030
+ moduleSpecifier,
4031
+ pendingJobs,
4032
+ moduleLoads,
4033
+ errors) =>
4034
+ {
4052
4035
  const { importHook, moduleMap, moduleMapHook, moduleRecords } = weakmapGet(
4053
- compartmentPrivateFields,
4054
- compartment,
4055
- );
4036
+ compartmentPrivateFields,
4037
+ compartment);
4038
+
4056
4039
 
4057
4040
  // Follow moduleMap, or moduleMapHook if present.
4058
4041
  let aliasNamespace = moduleMap[moduleSpecifier];
@@ -4062,33 +4045,33 @@ const loadWithoutErrorAnnotation = async (
4062
4045
  if (typeof aliasNamespace === 'string') {
4063
4046
  // eslint-disable-next-line @endo/no-polymorphic-call
4064
4047
  assert.fail(
4065
- d`Cannot map module ${q(moduleSpecifier)} to ${q(
4066
- aliasNamespace,
4067
- )} in parent compartment, not yet implemented`,
4068
- TypeError,
4069
- );
4048
+ d`Cannot map module ${q(moduleSpecifier)} to ${q(
4049
+ aliasNamespace)
4050
+ } in parent compartment, not yet implemented`,
4051
+ TypeError);
4052
+
4070
4053
  } else if (aliasNamespace !== undefined) {
4071
4054
  const alias = weakmapGet(moduleAliases, aliasNamespace);
4072
4055
  if (alias === undefined) {
4073
4056
  // eslint-disable-next-line @endo/no-polymorphic-call
4074
4057
  assert.fail(
4075
- d`Cannot map module ${q(
4076
- moduleSpecifier,
4077
- )} because the value is not a module exports namespace, or is from another realm`,
4078
- ReferenceError,
4079
- );
4058
+ d`Cannot map module ${q(
4059
+ moduleSpecifier)
4060
+ } because the value is not a module exports namespace, or is from another realm`,
4061
+ ReferenceError);
4062
+
4080
4063
  }
4081
4064
  // Behold: recursion.
4082
4065
  // eslint-disable-next-line no-use-before-define
4083
4066
  const aliasRecord = await memoizedLoadWithErrorAnnotation(
4084
- compartmentPrivateFields,
4085
- moduleAliases,
4086
- alias.compartment,
4087
- alias.specifier,
4088
- pendingJobs,
4089
- moduleLoads,
4090
- errors,
4091
- );
4067
+ compartmentPrivateFields,
4068
+ moduleAliases,
4069
+ alias.compartment,
4070
+ alias.specifier,
4071
+ pendingJobs,
4072
+ moduleLoads,
4073
+ errors);
4074
+
4092
4075
  mapSet(moduleRecords, moduleSpecifier, aliasRecord);
4093
4076
  return aliasRecord;
4094
4077
  }
@@ -4102,58 +4085,58 @@ const loadWithoutErrorAnnotation = async (
4102
4085
  if (staticModuleRecord === null || typeof staticModuleRecord !== 'object') {
4103
4086
  // eslint-disable-next-line @endo/no-polymorphic-call
4104
4087
  assert.fail(
4105
- d`importHook must return a promise for an object, for module ${q(
4106
- moduleSpecifier,
4107
- )} in compartment ${q(compartment.name)}`,
4108
- );
4088
+ d`importHook must return a promise for an object, for module ${q(
4089
+ moduleSpecifier)
4090
+ } in compartment ${q(compartment.name)}`);
4091
+
4109
4092
  }
4110
4093
 
4111
4094
  if (staticModuleRecord.record !== undefined) {
4112
4095
  const {
4113
4096
  compartment: aliasCompartment = compartment,
4114
4097
  specifier: aliasSpecifier = moduleSpecifier,
4115
- record: aliasModuleRecord,
4116
- } = staticModuleRecord;
4098
+ record: aliasModuleRecord } =
4099
+ staticModuleRecord;
4117
4100
 
4118
4101
  const aliasRecord = await loadRecord(
4119
- compartmentPrivateFields,
4120
- moduleAliases,
4121
- aliasCompartment,
4122
- aliasSpecifier,
4123
- aliasModuleRecord,
4124
- pendingJobs,
4125
- moduleLoads,
4126
- errors,
4127
- );
4128
- mapSet(moduleRecords, moduleSpecifier, aliasRecord);
4129
- return aliasRecord;
4130
- }
4131
-
4132
- return loadRecord(
4133
4102
  compartmentPrivateFields,
4134
4103
  moduleAliases,
4135
- compartment,
4136
- moduleSpecifier,
4137
- staticModuleRecord,
4104
+ aliasCompartment,
4105
+ aliasSpecifier,
4106
+ aliasModuleRecord,
4138
4107
  pendingJobs,
4139
4108
  moduleLoads,
4140
- errors,
4141
- );
4142
- };
4109
+ errors);
4143
4110
 
4144
- const memoizedLoadWithErrorAnnotation = async (
4111
+ mapSet(moduleRecords, moduleSpecifier, aliasRecord);
4112
+ return aliasRecord;
4113
+ }
4114
+
4115
+ return loadRecord(
4145
4116
  compartmentPrivateFields,
4146
4117
  moduleAliases,
4147
4118
  compartment,
4148
4119
  moduleSpecifier,
4120
+ staticModuleRecord,
4149
4121
  pendingJobs,
4150
4122
  moduleLoads,
4151
- errors,
4152
- ) => {
4123
+ errors);
4124
+
4125
+ };
4126
+
4127
+ const memoizedLoadWithErrorAnnotation = async (
4128
+ compartmentPrivateFields,
4129
+ moduleAliases,
4130
+ compartment,
4131
+ moduleSpecifier,
4132
+ pendingJobs,
4133
+ moduleLoads,
4134
+ errors) =>
4135
+ {
4153
4136
  const { name: compartmentName } = weakmapGet(
4154
- compartmentPrivateFields,
4155
- compartment,
4156
- );
4137
+ compartmentPrivateFields,
4138
+ compartment);
4139
+
4157
4140
 
4158
4141
  // Prevent data-lock from recursion into branches visited in dependent loads.
4159
4142
  let compartmentLoading = mapGet(moduleLoads, compartment);
@@ -4167,26 +4150,26 @@ const memoizedLoadWithErrorAnnotation = async (
4167
4150
  }
4168
4151
 
4169
4152
  moduleLoading = promiseCatch(
4170
- loadWithoutErrorAnnotation(
4171
- compartmentPrivateFields,
4172
- moduleAliases,
4173
- compartment,
4174
- moduleSpecifier,
4175
- pendingJobs,
4176
- moduleLoads,
4177
- errors,
4178
- ),
4179
- error => {
4180
- // eslint-disable-next-line @endo/no-polymorphic-call
4181
- assert.note(
4182
- error,
4183
- d`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
4184
- compartmentName,
4185
- )}`,
4186
- );
4187
- throw error;
4188
- },
4189
- );
4153
+ loadWithoutErrorAnnotation(
4154
+ compartmentPrivateFields,
4155
+ moduleAliases,
4156
+ compartment,
4157
+ moduleSpecifier,
4158
+ pendingJobs,
4159
+ moduleLoads,
4160
+ errors),
4161
+
4162
+ (error) => {
4163
+ // eslint-disable-next-line @endo/no-polymorphic-call
4164
+ assert.note(
4165
+ error,
4166
+ d`${error.message}, loading ${q(moduleSpecifier)} in compartment ${q(
4167
+ compartmentName)
4168
+ }`);
4169
+
4170
+ throw error;
4171
+ });
4172
+
4190
4173
 
4191
4174
  mapSet(compartmentLoading, moduleSpecifier, moduleLoading);
4192
4175
 
@@ -4201,15 +4184,15 @@ const memoizedLoadWithErrorAnnotation = async (
4201
4184
  * This graph is then ready to be synchronously linked and executed.
4202
4185
  */
4203
4186
  const load = async (
4204
- compartmentPrivateFields,
4205
- moduleAliases,
4206
- compartment,
4207
- moduleSpecifier,
4208
- ) => {
4187
+ compartmentPrivateFields,
4188
+ moduleAliases,
4189
+ compartment,
4190
+ moduleSpecifier) =>
4191
+ {
4209
4192
  const { name: compartmentName } = weakmapGet(
4210
- compartmentPrivateFields,
4211
- compartment,
4212
- );
4193
+ compartmentPrivateFields,
4194
+ compartment);
4195
+
4213
4196
 
4214
4197
  /** @type {Set<Promise<undefined>>} */
4215
4198
  const pendingJobs = new Set();
@@ -4219,20 +4202,20 @@ const load = async (
4219
4202
  const errors = [];
4220
4203
 
4221
4204
  const dependencyLoaded = memoizedLoadWithErrorAnnotation(
4222
- compartmentPrivateFields,
4223
- moduleAliases,
4224
- compartment,
4225
- moduleSpecifier,
4226
- pendingJobs,
4227
- moduleLoads,
4228
- errors,
4229
- );
4205
+ compartmentPrivateFields,
4206
+ moduleAliases,
4207
+ compartment,
4208
+ moduleSpecifier,
4209
+ pendingJobs,
4210
+ moduleLoads,
4211
+ errors);
4212
+
4230
4213
  setAdd(
4231
- pendingJobs,
4232
- promiseThen(dependencyLoaded, noop, error => {
4233
- arrayPush(errors, error);
4234
- }),
4235
- );
4214
+ pendingJobs,
4215
+ promiseThen(dependencyLoaded, noop, (error) => {
4216
+ arrayPush(errors, error);
4217
+ }));
4218
+
4236
4219
 
4237
4220
  // Drain pending jobs queue.
4238
4221
  // Each job is a promise for undefined, regardless of success or failure.
@@ -4246,16 +4229,15 @@ const load = async (
4246
4229
  // Throw an aggregate error if there were any errors.
4247
4230
  if (errors.length > 0) {
4248
4231
  throw new TypeError(
4249
- `Failed to load module ${q(moduleSpecifier)} in package ${q(
4250
- compartmentName,
4251
- )} (${errors.length} underlying failures: ${arrayJoin(
4252
- arrayMap(errors, error => error.message),
4253
- ', ',
4254
- )}`,
4255
- );
4232
+ `Failed to load module ${q(moduleSpecifier)} in package ${q(
4233
+ compartmentName)
4234
+ } (${errors.length} underlying failures: ${arrayJoin(
4235
+ arrayMap(errors, (error) => error.message),
4236
+ ', ')
4237
+ }`);
4238
+
4256
4239
  }
4257
4240
  };$h‍_once.load(load);
4258
-
4259
4241
  })
4260
4242
  ,
4261
4243
  // === functors[17] ===
@@ -4322,64 +4304,64 @@ const deferExports = () => {
4322
4304
  get(_target, name, receiver) {
4323
4305
  if (!active) {
4324
4306
  throw new TypeError(
4325
- `Cannot get property ${q(
4326
- name,
4327
- )} of module exports namespace, the module has not yet begun to execute`,
4328
- );
4307
+ `Cannot get property ${q(
4308
+ name)
4309
+ } of module exports namespace, the module has not yet begun to execute`);
4310
+
4329
4311
  }
4330
4312
  return reflectGet(proxiedExports, name, receiver);
4331
4313
  },
4332
4314
  set(_target, name, _value) {
4333
4315
  throw new TypeError(
4334
- `Cannot set property ${q(name)} of module exports namespace`,
4335
- );
4316
+ `Cannot set property ${q(name)} of module exports namespace`);
4317
+
4336
4318
  },
4337
4319
  has(_target, name) {
4338
4320
  if (!active) {
4339
4321
  throw new TypeError(
4340
- `Cannot check property ${q(
4341
- name,
4342
- )}, the module has not yet begun to execute`,
4343
- );
4322
+ `Cannot check property ${q(
4323
+ name)
4324
+ }, the module has not yet begun to execute`);
4325
+
4344
4326
  }
4345
4327
  return reflectHas(proxiedExports, name);
4346
4328
  },
4347
4329
  deleteProperty(_target, name) {
4348
4330
  throw new TypeError(
4349
- `Cannot delete property ${q(name)}s of module exports namespace`,
4350
- );
4331
+ `Cannot delete property ${q(name)}s of module exports namespace`);
4332
+
4351
4333
  },
4352
4334
  ownKeys(_target) {
4353
4335
  if (!active) {
4354
4336
  throw new TypeError(
4355
- 'Cannot enumerate keys, the module has not yet begun to execute',
4356
- );
4337
+ 'Cannot enumerate keys, the module has not yet begun to execute');
4338
+
4357
4339
  }
4358
4340
  return ownKeys(proxiedExports);
4359
4341
  },
4360
4342
  getOwnPropertyDescriptor(_target, name) {
4361
4343
  if (!active) {
4362
4344
  throw new TypeError(
4363
- `Cannot get own property descriptor ${q(
4364
- name,
4365
- )}, the module has not yet begun to execute`,
4366
- );
4345
+ `Cannot get own property descriptor ${q(
4346
+ name)
4347
+ }, the module has not yet begun to execute`);
4348
+
4367
4349
  }
4368
4350
  return reflectGetOwnPropertyDescriptor(proxiedExports, name);
4369
4351
  },
4370
4352
  preventExtensions(_target) {
4371
4353
  if (!active) {
4372
4354
  throw new TypeError(
4373
- 'Cannot prevent extensions of module exports namespace, the module has not yet begun to execute',
4374
- );
4355
+ 'Cannot prevent extensions of module exports namespace, the module has not yet begun to execute');
4356
+
4375
4357
  }
4376
4358
  return reflectPreventExtensions(proxiedExports);
4377
4359
  },
4378
4360
  isExtensible() {
4379
4361
  if (!active) {
4380
4362
  throw new TypeError(
4381
- 'Cannot check extensibility of module exports namespace, the module has not yet begun to execute',
4382
- );
4363
+ 'Cannot check extensibility of module exports namespace, the module has not yet begun to execute');
4364
+
4383
4365
  }
4384
4366
  return reflectIsExtensible(proxiedExports);
4385
4367
  },
@@ -4391,21 +4373,21 @@ const deferExports = () => {
4391
4373
  },
4392
4374
  defineProperty(_target, name, _descriptor) {
4393
4375
  throw new TypeError(
4394
- `Cannot define property ${q(name)} of module exports namespace`,
4395
- );
4376
+ `Cannot define property ${q(name)} of module exports namespace`);
4377
+
4396
4378
  },
4397
4379
  apply(_target, _thisArg, _args) {
4398
4380
  throw new TypeError(
4399
- 'Cannot call module exports namespace, it is not a function',
4400
- );
4381
+ 'Cannot call module exports namespace, it is not a function');
4382
+
4401
4383
  },
4402
4384
  construct(_target, _args) {
4403
4385
  throw new TypeError(
4404
- 'Cannot construct module exports namespace, it is not a constructor',
4405
- );
4406
- },
4407
- }),
4408
- });
4386
+ 'Cannot construct module exports namespace, it is not a constructor');
4387
+
4388
+ } }) });
4389
+
4390
+
4409
4391
  };$h‍_once.deferExports(deferExports);
4410
4392
 
4411
4393
  // `getDeferredExports` memoizes the creation of a deferred module exports
@@ -4414,24 +4396,23 @@ const deferExports = () => {
4414
4396
  // exports namespace proxy so it can be used as an alias into another
4415
4397
  // compartment when threaded through a compartment's `moduleMap` argument.
4416
4398
  const getDeferredExports = (
4417
- compartment,
4418
- compartmentPrivateFields,
4419
- moduleAliases,
4420
- specifier,
4421
- ) => {
4399
+ compartment,
4400
+ compartmentPrivateFields,
4401
+ moduleAliases,
4402
+ specifier) =>
4403
+ {
4422
4404
  const { deferredExports } = compartmentPrivateFields;
4423
4405
  if (!mapHas(deferredExports, specifier)) {
4424
4406
  const deferred = deferExports();
4425
4407
  weakmapSet(
4426
- moduleAliases,
4427
- deferred.exportsProxy,
4428
- makeAlias(compartment, specifier),
4429
- );
4408
+ moduleAliases,
4409
+ deferred.exportsProxy,
4410
+ makeAlias(compartment, specifier));
4411
+
4430
4412
  mapSet(deferredExports, specifier, deferred);
4431
4413
  }
4432
4414
  return mapGet(deferredExports, specifier);
4433
4415
  };$h‍_once.getDeferredExports(getDeferredExports);
4434
-
4435
4416
  })
4436
4417
  ,
4437
4418
  // === functors[18] ===
@@ -4460,38 +4441,38 @@ const getDeferredExports = (
4460
4441
  const { quote: q } = assert;
4461
4442
 
4462
4443
  const makeThirdPartyModuleInstance = (
4463
- compartmentPrivateFields,
4464
- staticModuleRecord,
4444
+ compartmentPrivateFields,
4445
+ staticModuleRecord,
4446
+ compartment,
4447
+ moduleAliases,
4448
+ moduleSpecifier,
4449
+ resolvedImports) =>
4450
+ {
4451
+ const { exportsProxy, proxiedExports, activate } = getDeferredExports(
4465
4452
  compartment,
4453
+ weakmapGet(compartmentPrivateFields, compartment),
4466
4454
  moduleAliases,
4467
- moduleSpecifier,
4468
- resolvedImports,
4469
- ) => {
4470
- const { exportsProxy, proxiedExports, activate } = getDeferredExports(
4471
- compartment,
4472
- weakmapGet(compartmentPrivateFields, compartment),
4473
- moduleAliases,
4474
- moduleSpecifier,
4475
- );
4455
+ moduleSpecifier);
4456
+
4476
4457
 
4477
4458
  const notifiers = create(null);
4478
4459
 
4479
4460
  if (staticModuleRecord.exports) {
4480
4461
  if (
4481
- !isArray(staticModuleRecord.exports) ||
4482
- arraySome(staticModuleRecord.exports, name => typeof name !== 'string')
4483
- ) {
4462
+ !isArray(staticModuleRecord.exports) ||
4463
+ arraySome(staticModuleRecord.exports, (name) => typeof name !== 'string'))
4464
+ {
4484
4465
  throw new TypeError(
4485
- `SES third-party static module record "exports" property must be an array of strings for module ${moduleSpecifier}`,
4486
- );
4466
+ `SES third-party static module record "exports" property must be an array of strings for module ${moduleSpecifier}`);
4467
+
4487
4468
  }
4488
- arrayForEach(staticModuleRecord.exports, name => {
4469
+ arrayForEach(staticModuleRecord.exports, (name) => {
4489
4470
  let value = proxiedExports[name];
4490
4471
  const updaters = [];
4491
4472
 
4492
4473
  const get = () => value;
4493
4474
 
4494
- const set = newValue => {
4475
+ const set = (newValue) => {
4495
4476
  value = newValue;
4496
4477
  for (const updater of updaters) {
4497
4478
  updater(newValue);
@@ -4502,10 +4483,10 @@ const makeThirdPartyModuleInstance = (
4502
4483
  get,
4503
4484
  set,
4504
4485
  enumerable: true,
4505
- configurable: false,
4506
- });
4486
+ configurable: false });
4487
+
4507
4488
 
4508
- notifiers[name] = update => {
4489
+ notifiers[name] = (update) => {
4509
4490
  arrayPush(updaters, update);
4510
4491
  update(value);
4511
4492
  };
@@ -4522,13 +4503,13 @@ const makeThirdPartyModuleInstance = (
4522
4503
  activated = true;
4523
4504
  // eslint-disable-next-line @endo/no-polymorphic-call
4524
4505
  staticModuleRecord.execute(
4525
- proxiedExports,
4526
- compartment,
4527
- resolvedImports,
4528
- );
4506
+ proxiedExports,
4507
+ compartment,
4508
+ resolvedImports);
4509
+
4529
4510
  }
4530
- },
4531
- });
4511
+ } });
4512
+
4532
4513
  };$h‍_once.makeThirdPartyModuleInstance(makeThirdPartyModuleInstance);
4533
4514
 
4534
4515
  // `makeModuleInstance` takes a module's compartment record, the live import
@@ -4539,29 +4520,29 @@ const makeThirdPartyModuleInstance = (
4539
4520
  // The module exports namespace is a proxy to the proxied exports namespace
4540
4521
  // that the execution of the module instance populates.
4541
4522
  const makeModuleInstance = (
4542
- privateFields,
4543
- moduleAliases,
4544
- moduleRecord,
4545
- importedInstances,
4546
- ) => {
4523
+ privateFields,
4524
+ moduleAliases,
4525
+ moduleRecord,
4526
+ importedInstances) =>
4527
+ {
4547
4528
  const { compartment, moduleSpecifier, staticModuleRecord } = moduleRecord;
4548
4529
  const {
4549
4530
  reexports: exportAlls = [],
4550
4531
  __syncModuleProgram__: functorSource,
4551
4532
  __fixedExportMap__: fixedExportMap = {},
4552
- __liveExportMap__: liveExportMap = {},
4553
- } = staticModuleRecord;
4533
+ __liveExportMap__: liveExportMap = {} } =
4534
+ staticModuleRecord;
4554
4535
 
4555
4536
  const compartmentFields = weakmapGet(privateFields, compartment);
4556
4537
 
4557
4538
  const { __shimTransforms__ } = compartmentFields;
4558
4539
 
4559
4540
  const { exportsProxy, proxiedExports, activate } = getDeferredExports(
4560
- compartment,
4561
- compartmentFields,
4562
- moduleAliases,
4563
- moduleSpecifier,
4564
- );
4541
+ compartment,
4542
+ compartmentFields,
4543
+ moduleAliases,
4544
+ moduleSpecifier);
4545
+
4565
4546
 
4566
4547
  // {_exportName_: getter} module exports namespace
4567
4548
  // object (eventually proxied).
@@ -4600,20 +4581,20 @@ const makeModuleInstance = (
4600
4581
  const get = () => {
4601
4582
  if (tdz) {
4602
4583
  throw new ReferenceError(
4603
- `binding ${q(localName)} not yet initialized`,
4604
- );
4584
+ `binding ${q(localName)} not yet initialized`);
4585
+
4605
4586
  }
4606
4587
  return value;
4607
4588
  };
4608
4589
 
4609
4590
  // leave tdz once
4610
- const init = freeze(initValue => {
4591
+ const init = freeze((initValue) => {
4611
4592
  // init with initValue of a declared const binding, and return
4612
4593
  // it.
4613
4594
  if (!tdz) {
4614
4595
  throw new TypeError(
4615
- `Internal: binding ${q(localName)} already initialized`,
4616
- );
4596
+ `Internal: binding ${q(localName)} already initialized`);
4597
+
4617
4598
  }
4618
4599
  value = initValue;
4619
4600
  const updaters = optUpdaters;
@@ -4627,7 +4608,7 @@ const makeModuleInstance = (
4627
4608
 
4628
4609
  // If still tdz, register update for notification later.
4629
4610
  // Otherwise, update now.
4630
- const notify = updater => {
4611
+ const notify = (updater) => {
4631
4612
  if (updater === init) {
4632
4613
  // Prevent recursion.
4633
4614
  return;
@@ -4642,8 +4623,8 @@ const makeModuleInstance = (
4642
4623
  // Need these for additional exports of the local variable.
4643
4624
  fixedGetNotify = {
4644
4625
  get,
4645
- notify,
4646
- };
4626
+ notify };
4627
+
4647
4628
  localGetNotify[localName] = fixedGetNotify;
4648
4629
  onceVar[localName] = init;
4649
4630
  }
@@ -4652,104 +4633,104 @@ const makeModuleInstance = (
4652
4633
  get: fixedGetNotify.get,
4653
4634
  set: undefined,
4654
4635
  enumerable: true,
4655
- configurable: false,
4656
- };
4636
+ configurable: false };
4637
+
4657
4638
 
4658
4639
  notifiers[fixedExportName] = fixedGetNotify.notify;
4659
4640
  });
4660
4641
 
4661
4642
  arrayForEach(
4662
- entries(liveExportMap),
4663
- ([liveExportName, [localName, setProxyTrap]]) => {
4664
- let liveGetNotify = localGetNotify[localName];
4665
- if (!liveGetNotify) {
4666
- // live binding state
4667
- let value;
4668
- let tdz = true;
4669
- const updaters = [];
4670
-
4671
- // tdz sensitive getter
4672
- const get = () => {
4673
- if (tdz) {
4674
- throw new ReferenceError(
4675
- `binding ${q(liveExportName)} not yet initialized`,
4676
- );
4677
- }
4678
- return value;
4679
- };
4680
-
4681
- // This must be usable locally for the translation of initializing
4682
- // a declared local live binding variable.
4683
- //
4684
- // For reexported variable, this is also an update function to
4685
- // register for notification with the downstream import, which we
4686
- // must assume to be live. Thus, it can be called independent of
4687
- // tdz but always leaves tdz. Such reexporting creates a tree of
4688
- // bindings. This lets the tree be hooked up even if the imported
4689
- // module instance isn't initialized yet, as may happen in cycles.
4690
- const update = freeze(newValue => {
4691
- value = newValue;
4692
- tdz = false;
4693
- for (const updater of updaters) {
4694
- updater(newValue);
4695
- }
4696
- });
4643
+ entries(liveExportMap),
4644
+ ([liveExportName, [localName, setProxyTrap]]) => {
4645
+ let liveGetNotify = localGetNotify[localName];
4646
+ if (!liveGetNotify) {
4647
+ // live binding state
4648
+ let value;
4649
+ let tdz = true;
4650
+ const updaters = [];
4697
4651
 
4698
- // tdz sensitive setter
4699
- const set = newValue => {
4700
- if (tdz) {
4701
- throw new ReferenceError(
4702
- `binding ${q(localName)} not yet initialized`,
4703
- );
4704
- }
4705
- value = newValue;
4706
- for (const updater of updaters) {
4707
- updater(newValue);
4708
- }
4709
- };
4710
-
4711
- // Always register the updater function.
4712
- // If not in tdz, also update now.
4713
- const notify = updater => {
4714
- if (updater === update) {
4715
- // Prevent recursion.
4716
- return;
4717
- }
4718
- arrayPush(updaters, updater);
4719
- if (!tdz) {
4720
- updater(value);
4721
- }
4722
- };
4652
+ // tdz sensitive getter
4653
+ const get = () => {
4654
+ if (tdz) {
4655
+ throw new ReferenceError(
4656
+ `binding ${q(liveExportName)} not yet initialized`);
4723
4657
 
4724
- liveGetNotify = {
4725
- get,
4726
- notify,
4727
- };
4728
-
4729
- localGetNotify[localName] = liveGetNotify;
4730
- if (setProxyTrap) {
4731
- defineProperty(localLexicals, localName, {
4732
- get,
4733
- set,
4734
- enumerable: true,
4735
- configurable: false,
4736
- });
4737
4658
  }
4738
- liveVar[localName] = update;
4739
- }
4659
+ return value;
4660
+ };
4740
4661
 
4741
- exportsProps[liveExportName] = {
4742
- get: liveGetNotify.get,
4743
- set: undefined,
4744
- enumerable: true,
4745
- configurable: false,
4662
+ // This must be usable locally for the translation of initializing
4663
+ // a declared local live binding variable.
4664
+ //
4665
+ // For reexported variable, this is also an update function to
4666
+ // register for notification with the downstream import, which we
4667
+ // must assume to be live. Thus, it can be called independent of
4668
+ // tdz but always leaves tdz. Such reexporting creates a tree of
4669
+ // bindings. This lets the tree be hooked up even if the imported
4670
+ // module instance isn't initialized yet, as may happen in cycles.
4671
+ const update = freeze((newValue) => {
4672
+ value = newValue;
4673
+ tdz = false;
4674
+ for (const updater of updaters) {
4675
+ updater(newValue);
4676
+ }
4677
+ });
4678
+
4679
+ // tdz sensitive setter
4680
+ const set = (newValue) => {
4681
+ if (tdz) {
4682
+ throw new ReferenceError(
4683
+ `binding ${q(localName)} not yet initialized`);
4684
+
4685
+ }
4686
+ value = newValue;
4687
+ for (const updater of updaters) {
4688
+ updater(newValue);
4689
+ }
4746
4690
  };
4747
4691
 
4748
- notifiers[liveExportName] = liveGetNotify.notify;
4749
- },
4750
- );
4692
+ // Always register the updater function.
4693
+ // If not in tdz, also update now.
4694
+ const notify = (updater) => {
4695
+ if (updater === update) {
4696
+ // Prevent recursion.
4697
+ return;
4698
+ }
4699
+ arrayPush(updaters, updater);
4700
+ if (!tdz) {
4701
+ updater(value);
4702
+ }
4703
+ };
4704
+
4705
+ liveGetNotify = {
4706
+ get,
4707
+ notify };
4708
+
4751
4709
 
4752
- const notifyStar = update => {
4710
+ localGetNotify[localName] = liveGetNotify;
4711
+ if (setProxyTrap) {
4712
+ defineProperty(localLexicals, localName, {
4713
+ get,
4714
+ set,
4715
+ enumerable: true,
4716
+ configurable: false });
4717
+
4718
+ }
4719
+ liveVar[localName] = update;
4720
+ }
4721
+
4722
+ exportsProps[liveExportName] = {
4723
+ get: liveGetNotify.get,
4724
+ set: undefined,
4725
+ enumerable: true,
4726
+ configurable: false };
4727
+
4728
+
4729
+ notifiers[liveExportName] = liveGetNotify.notify;
4730
+ });
4731
+
4732
+
4733
+ const notifyStar = (update) => {
4753
4734
  update(proxiedExports);
4754
4735
  };
4755
4736
  notifiers['*'] = notifyStar;
@@ -4785,8 +4766,8 @@ const makeModuleInstance = (
4785
4766
  const importNotify = importNotifiers[importName];
4786
4767
  if (!importNotify) {
4787
4768
  throw SyntaxError(
4788
- `The requested module '${specifier}' does not provide an export named '${importName}'`,
4789
- );
4769
+ `The requested module '${specifier}' does not provide an export named '${importName}'`);
4770
+
4790
4771
  }
4791
4772
  for (const updater of updaters) {
4792
4773
  importNotify(updater);
@@ -4811,7 +4792,7 @@ const makeModuleInstance = (
4811
4792
 
4812
4793
  // exported live binding state
4813
4794
  let value;
4814
- const update = newValue => (value = newValue);
4795
+ const update = (newValue) => value = newValue;
4815
4796
  notify(update);
4816
4797
  exportsProps[importName] = {
4817
4798
  get() {
@@ -4819,8 +4800,8 @@ const makeModuleInstance = (
4819
4800
  },
4820
4801
  set: undefined,
4821
4802
  enumerable: true,
4822
- configurable: false,
4823
- };
4803
+ configurable: false };
4804
+
4824
4805
  }
4825
4806
  }
4826
4807
 
@@ -4833,9 +4814,9 @@ const makeModuleInstance = (
4833
4814
  // since all properties of the exports namespace must be keyed by a string
4834
4815
  // and the string must correspond to a valid identifier, sorting these
4835
4816
  // properties works for this specific case.
4836
- arrayForEach(arraySort(keys(exportsProps)), k =>
4837
- defineProperty(proxiedExports, k, exportsProps[k]),
4838
- );
4817
+ arrayForEach(arraySort(keys(exportsProps)), (k) =>
4818
+ defineProperty(proxiedExports, k, exportsProps[k]));
4819
+
4839
4820
 
4840
4821
  freeze(proxiedExports);
4841
4822
  activate();
@@ -4844,8 +4825,8 @@ const makeModuleInstance = (
4844
4825
  let optFunctor = compartmentEvaluate(compartmentFields, functorSource, {
4845
4826
  globalObject: compartment.globalThis,
4846
4827
  transforms: __shimTransforms__,
4847
- __moduleShimLexicals__: localLexicals,
4848
- });
4828
+ __moduleShimLexicals__: localLexicals });
4829
+
4849
4830
  let didThrow = false;
4850
4831
  let thrownError;
4851
4832
  function execute() {
@@ -4856,12 +4837,12 @@ const makeModuleInstance = (
4856
4837
  // initializing - call with `this` of `undefined`.
4857
4838
  try {
4858
4839
  functor(
4859
- freeze({
4860
- imports: freeze(imports),
4861
- onceVar: freeze(onceVar),
4862
- liveVar: freeze(liveVar),
4863
- }),
4864
- );
4840
+ freeze({
4841
+ imports: freeze(imports),
4842
+ onceVar: freeze(onceVar),
4843
+ liveVar: freeze(liveVar) }));
4844
+
4845
+
4865
4846
  } catch (e) {
4866
4847
  didThrow = true;
4867
4848
  thrownError = e;
@@ -4876,10 +4857,9 @@ const makeModuleInstance = (
4876
4857
  return freeze({
4877
4858
  notifiers,
4878
4859
  exportsProxy,
4879
- execute,
4880
- });
4881
- };$h‍_once.makeModuleInstance(makeModuleInstance);
4860
+ execute });
4882
4861
 
4862
+ };$h‍_once.makeModuleInstance(makeModuleInstance);
4883
4863
  })
4884
4864
  ,
4885
4865
  // === functors[19] ===
@@ -4920,23 +4900,23 @@ const { quote: q } = assert;
4920
4900
  // property descriptors for their exports, which the Compartment proxies with
4921
4901
  // the actual `ModuleNamespace`.
4922
4902
  const link = (
4923
- compartmentPrivateFields,
4924
- moduleAliases,
4925
- compartment,
4926
- moduleSpecifier,
4927
- ) => {
4903
+ compartmentPrivateFields,
4904
+ moduleAliases,
4905
+ compartment,
4906
+ moduleSpecifier) =>
4907
+ {
4928
4908
  const { name: compartmentName, moduleRecords } = weakmapGet(
4929
- compartmentPrivateFields,
4930
- compartment,
4931
- );
4909
+ compartmentPrivateFields,
4910
+ compartment);
4911
+
4932
4912
 
4933
4913
  const moduleRecord = mapGet(moduleRecords, moduleSpecifier);
4934
4914
  if (moduleRecord === undefined) {
4935
4915
  throw new ReferenceError(
4936
- `Missing link to module ${q(moduleSpecifier)} from compartment ${q(
4937
- compartmentName,
4938
- )}`,
4939
- );
4916
+ `Missing link to module ${q(moduleSpecifier)} from compartment ${q(
4917
+ compartmentName)
4918
+ }`);
4919
+
4940
4920
  }
4941
4921
 
4942
4922
  // Mutual recursion so there's no confusion about which
@@ -4951,80 +4931,80 @@ function isPrecompiled(staticModuleRecord) {
4951
4931
  }
4952
4932
 
4953
4933
  function validatePrecompiledStaticModuleRecord(
4954
- staticModuleRecord,
4955
- moduleSpecifier,
4956
- ) {
4934
+ staticModuleRecord,
4935
+ moduleSpecifier)
4936
+ {
4957
4937
  const { __fixedExportMap__, __liveExportMap__ } = staticModuleRecord;
4958
4938
  assert(
4959
- isObject(__fixedExportMap__),
4960
- `Property '__fixedExportMap__' of a precompiled module record must be an object, got ${q(
4961
- __fixedExportMap__,
4962
- )}, for module ${q(moduleSpecifier)}`,
4963
- );
4939
+ isObject(__fixedExportMap__),
4940
+ `Property '__fixedExportMap__' of a precompiled module record must be an object, got ${q(
4941
+ __fixedExportMap__)
4942
+ }, for module ${q(moduleSpecifier)}`);
4943
+
4964
4944
  assert(
4965
- isObject(__liveExportMap__),
4966
- `Property '__liveExportMap__' of a precompiled module record must be an object, got ${q(
4967
- __liveExportMap__,
4968
- )}, for module ${q(moduleSpecifier)}`,
4969
- );
4945
+ isObject(__liveExportMap__),
4946
+ `Property '__liveExportMap__' of a precompiled module record must be an object, got ${q(
4947
+ __liveExportMap__)
4948
+ }, for module ${q(moduleSpecifier)}`);
4949
+
4970
4950
  }
4971
4951
 
4972
4952
  function isThirdParty(staticModuleRecord) {
4973
4953
  return typeof staticModuleRecord.execute === 'function';
4974
4954
  }
4975
4955
 
4976
- function validateThirdPartyStaticModuleRecord(
4977
- staticModuleRecord,
4978
- moduleSpecifier,
4979
- ) {
4956
+ function validateThirdPartyStaticModuleRecord(
4957
+ staticModuleRecord,
4958
+ moduleSpecifier)
4959
+ {
4980
4960
  const { exports } = staticModuleRecord;
4981
4961
  assert(
4982
- isArray(exports),
4983
- `Property 'exports' of a third-party static module record must be an array, got ${q(
4984
- exports,
4985
- )}, for module ${q(moduleSpecifier)}`,
4986
- );
4962
+ isArray(exports),
4963
+ `Property 'exports' of a third-party static module record must be an array, got ${q(
4964
+ exports)
4965
+ }, for module ${q(moduleSpecifier)}`);
4966
+
4987
4967
  }
4988
4968
 
4989
4969
  function validateStaticModuleRecord(staticModuleRecord, moduleSpecifier) {
4990
4970
  assert(
4991
- isObject(staticModuleRecord),
4992
- `Static module records must be of type object, got ${q(
4993
- staticModuleRecord,
4994
- )}, for module ${q(moduleSpecifier)}`,
4995
- );
4971
+ isObject(staticModuleRecord),
4972
+ `Static module records must be of type object, got ${q(
4973
+ staticModuleRecord)
4974
+ }, for module ${q(moduleSpecifier)}`);
4975
+
4996
4976
  const { imports, exports, reexports = [] } = staticModuleRecord;
4997
4977
  assert(
4998
- isArray(imports),
4999
- `Property 'imports' of a static module record must be an array, got ${q(
5000
- imports,
5001
- )}, for module ${q(moduleSpecifier)}`,
5002
- );
4978
+ isArray(imports),
4979
+ `Property 'imports' of a static module record must be an array, got ${q(
4980
+ imports)
4981
+ }, for module ${q(moduleSpecifier)}`);
4982
+
5003
4983
  assert(
5004
- isArray(exports),
5005
- `Property 'exports' of a precompiled module record must be an array, got ${q(
5006
- exports,
5007
- )}, for module ${q(moduleSpecifier)}`,
5008
- );
4984
+ isArray(exports),
4985
+ `Property 'exports' of a precompiled module record must be an array, got ${q(
4986
+ exports)
4987
+ }, for module ${q(moduleSpecifier)}`);
4988
+
5009
4989
  assert(
5010
- isArray(reexports),
5011
- `Property 'reexports' of a precompiled module record must be an array if present, got ${q(
5012
- reexports,
5013
- )}, for module ${q(moduleSpecifier)}`,
5014
- );
4990
+ isArray(reexports),
4991
+ `Property 'reexports' of a precompiled module record must be an array if present, got ${q(
4992
+ reexports)
4993
+ }, for module ${q(moduleSpecifier)}`);
4994
+
5015
4995
  }
5016
4996
 
5017
4997
  const instantiate = (
5018
- compartmentPrivateFields,
5019
- moduleAliases,
5020
- moduleRecord,
5021
- ) => {
4998
+ compartmentPrivateFields,
4999
+ moduleAliases,
5000
+ moduleRecord) =>
5001
+ {
5022
5002
  const {
5023
5003
  compartment,
5024
5004
  moduleSpecifier,
5025
5005
  resolvedImports,
5026
- staticModuleRecord,
5027
- } = moduleRecord;
5006
+ staticModuleRecord } =
5007
+ moduleRecord;
5028
5008
  const { instances } = weakmapGet(compartmentPrivateFields, compartment);
5029
5009
 
5030
5010
  // Memoize.
@@ -5039,27 +5019,27 @@ const instantiate = (
5039
5019
  if (isPrecompiled(staticModuleRecord)) {
5040
5020
  validatePrecompiledStaticModuleRecord(staticModuleRecord, moduleSpecifier);
5041
5021
  moduleInstance = makeModuleInstance(
5042
- compartmentPrivateFields,
5043
- moduleAliases,
5044
- moduleRecord,
5045
- importedInstances,
5046
- );
5022
+ compartmentPrivateFields,
5023
+ moduleAliases,
5024
+ moduleRecord,
5025
+ importedInstances);
5026
+
5047
5027
  } else if (isThirdParty(staticModuleRecord)) {
5048
5028
  validateThirdPartyStaticModuleRecord(staticModuleRecord, moduleSpecifier);
5049
5029
  moduleInstance = makeThirdPartyModuleInstance(
5050
- compartmentPrivateFields,
5051
- staticModuleRecord,
5052
- compartment,
5053
- moduleAliases,
5054
- moduleSpecifier,
5055
- resolvedImports,
5056
- );
5030
+ compartmentPrivateFields,
5031
+ staticModuleRecord,
5032
+ compartment,
5033
+ moduleAliases,
5034
+ moduleSpecifier,
5035
+ resolvedImports);
5036
+
5057
5037
  } else {
5058
5038
  throw new TypeError(
5059
- `importHook must return a static module record, got ${q(
5060
- staticModuleRecord,
5061
- )}`,
5062
- );
5039
+ `importHook must return a static module record, got ${q(
5040
+ staticModuleRecord)
5041
+ }`);
5042
+
5063
5043
  }
5064
5044
 
5065
5045
  // Memoize.
@@ -5068,17 +5048,16 @@ const instantiate = (
5068
5048
  // Link dependency modules.
5069
5049
  for (const [importSpecifier, resolvedSpecifier] of entries(resolvedImports)) {
5070
5050
  const importedInstance = link(
5071
- compartmentPrivateFields,
5072
- moduleAliases,
5073
- compartment,
5074
- resolvedSpecifier,
5075
- );
5051
+ compartmentPrivateFields,
5052
+ moduleAliases,
5053
+ compartment,
5054
+ resolvedSpecifier);
5055
+
5076
5056
  mapSet(importedInstances, importSpecifier, importedInstance);
5077
5057
  }
5078
5058
 
5079
5059
  return moduleInstance;
5080
5060
  };$h‍_once.instantiate(instantiate);
5081
-
5082
5061
  })
5083
5062
  ,
5084
5063
  // === functors[20] ===
@@ -5138,23 +5117,23 @@ const privateFields = new WeakMap();
5138
5117
  // as a vessel for evaluating programs.
5139
5118
  // However, any method that operates the module system will throw an exception
5140
5119
  // if these hooks are not available.
5141
- const assertModuleHooks = compartment => {
5120
+ const assertModuleHooks = (compartment) => {
5142
5121
  const { importHook, resolveHook } = weakmapGet(privateFields, compartment);
5143
5122
  if (typeof importHook !== 'function' || typeof resolveHook !== 'function') {
5144
5123
  throw new TypeError(
5145
- 'Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules',
5146
- );
5124
+ 'Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules');
5125
+
5147
5126
  }
5148
5127
  };
5149
5128
 
5150
5129
  const InertCompartment = function Compartment(
5151
- _endowments = {},
5152
- _modules = {},
5153
- _options = {},
5154
- ) {
5130
+ _endowments = {},
5131
+ _modules = {},
5132
+ _options = {})
5133
+ {
5155
5134
  throw new TypeError(
5156
- 'Compartment.prototype.constructor is not a valid constructor.',
5157
- );
5135
+ 'Compartment.prototype.constructor is not a valid constructor.');
5136
+
5158
5137
  };$h‍_once.InertCompartment(InertCompartment);
5159
5138
 
5160
5139
  /**
@@ -5163,11 +5142,11 @@ const InertCompartment = function Compartment(
5163
5142
  */
5164
5143
  const compartmentImportNow = (compartment, specifier) => {
5165
5144
  const { execute, exportsProxy } = link(
5166
- privateFields,
5167
- moduleAliases,
5168
- compartment,
5169
- specifier,
5170
- );
5145
+ privateFields,
5146
+ moduleAliases,
5147
+ compartment,
5148
+ specifier);
5149
+
5171
5150
  execute();
5172
5151
  return exportsProxy;
5173
5152
  };
@@ -5216,11 +5195,11 @@ const CompartmentPrototype = {
5216
5195
  assertModuleHooks(this);
5217
5196
 
5218
5197
  const { exportsProxy } = getDeferredExports(
5219
- this,
5220
- weakmapGet(privateFields, this),
5221
- moduleAliases,
5222
- specifier,
5223
- );
5198
+ this,
5199
+ weakmapGet(privateFields, this),
5200
+ moduleAliases,
5201
+ specifier);
5202
+
5224
5203
 
5225
5204
  return exportsProxy;
5226
5205
  },
@@ -5233,14 +5212,14 @@ const CompartmentPrototype = {
5233
5212
  assertModuleHooks(this);
5234
5213
 
5235
5214
  return promiseThen(
5236
- load(privateFields, moduleAliases, this, specifier),
5237
- () => {
5238
- // The namespace box is a contentious design and likely to be a breaking
5239
- // change in an appropriately numbered future version.
5240
- const namespace = compartmentImportNow(this, specifier);
5241
- return { namespace };
5242
- },
5243
- );
5215
+ load(privateFields, moduleAliases, this, specifier),
5216
+ () => {
5217
+ // The namespace box is a contentious design and likely to be a breaking
5218
+ // change in an appropriately numbered future version.
5219
+ const namespace = compartmentImportNow(this, specifier);
5220
+ return { namespace };
5221
+ });
5222
+
5244
5223
  },
5245
5224
 
5246
5225
  async load(specifier) {
@@ -5261,12 +5240,12 @@ const CompartmentPrototype = {
5261
5240
  assertModuleHooks(this);
5262
5241
 
5263
5242
  return compartmentImportNow(this, specifier);
5264
- },
5265
- };$h‍_once.CompartmentPrototype(CompartmentPrototype);
5243
+ } };$h‍_once.CompartmentPrototype(CompartmentPrototype);
5244
+
5266
5245
 
5267
5246
  defineProperties(InertCompartment, {
5268
- prototype: { value: CompartmentPrototype },
5269
- });
5247
+ prototype: { value: CompartmentPrototype } });
5248
+
5270
5249
 
5271
5250
  /**
5272
5251
  * @callback MakeCompartmentConstructor
@@ -5278,15 +5257,15 @@ defineProperties(InertCompartment, {
5278
5257
 
5279
5258
  /** @type {MakeCompartmentConstructor} */
5280
5259
  const makeCompartmentConstructor = (
5281
- targetMakeCompartmentConstructor,
5282
- intrinsics,
5283
- markVirtualizedNativeFunction,
5284
- ) => {
5260
+ targetMakeCompartmentConstructor,
5261
+ intrinsics,
5262
+ markVirtualizedNativeFunction) =>
5263
+ {
5285
5264
  function Compartment(endowments = {}, moduleMap = {}, options = {}) {
5286
5265
  if (new.target === undefined) {
5287
5266
  throw new TypeError(
5288
- "Class constructor Compartment cannot be invoked without 'new'",
5289
- );
5267
+ "Class constructor Compartment cannot be invoked without 'new'");
5268
+
5290
5269
  }
5291
5270
 
5292
5271
  // Extract options, and shallow-clone transforms.
@@ -5297,8 +5276,8 @@ const makeCompartmentConstructor = (
5297
5276
  globalLexicals: globalLexicalsOption = {},
5298
5277
  resolveHook,
5299
5278
  importHook,
5300
- moduleMapHook,
5301
- } = options;
5279
+ moduleMapHook } =
5280
+ options;
5302
5281
  const globalTransforms = [...transforms, ...__shimTransforms__];
5303
5282
 
5304
5283
  // Map<FullSpecifier, ModuleCompartmentRecord>
@@ -5317,32 +5296,32 @@ const makeCompartmentConstructor = (
5317
5296
  if (typeof aliasNamespace === 'string') {
5318
5297
  // TODO implement parent module record retrieval.
5319
5298
  throw new TypeError(
5320
- `Cannot map module ${q(specifier)} to ${q(
5321
- aliasNamespace,
5322
- )} in parent compartment`,
5323
- );
5299
+ `Cannot map module ${q(specifier)} to ${q(
5300
+ aliasNamespace)
5301
+ } in parent compartment`);
5302
+
5324
5303
  } else if (weakmapGet(moduleAliases, aliasNamespace) === undefined) {
5325
5304
  // TODO create and link a synthetic module instance from the given
5326
5305
  // namespace object.
5327
5306
  throw ReferenceError(
5328
- `Cannot map module ${q(
5329
- specifier,
5330
- )} because it has no known compartment in this realm`,
5331
- );
5307
+ `Cannot map module ${q(
5308
+ specifier)
5309
+ } because it has no known compartment in this realm`);
5310
+
5332
5311
  }
5333
5312
  }
5334
5313
 
5335
5314
  const invalidNames = arrayFilter(
5336
- getOwnPropertyNames(globalLexicalsOption),
5337
- identifier => !isValidIdentifierName(identifier),
5338
- );
5315
+ getOwnPropertyNames(globalLexicalsOption),
5316
+ (identifier) => !isValidIdentifierName(identifier));
5317
+
5339
5318
  if (invalidNames.length) {
5340
5319
  throw new TypeError(
5341
- `Cannot create compartment with invalid names for global lexicals: ${arrayJoin(
5342
- invalidNames,
5343
- ', ',
5344
- )}; these names would not be lexically mentionable`,
5345
- );
5320
+ `Cannot create compartment with invalid names for global lexicals: ${arrayJoin(
5321
+ invalidNames,
5322
+ ', ')
5323
+ }; these names would not be lexically mentionable`);
5324
+
5346
5325
  }
5347
5326
  // The caller continues to own the globalLexicals object they passed to
5348
5327
  // the compartment constructor, but the compartment only respects the
@@ -5369,16 +5348,16 @@ const makeCompartmentConstructor = (
5369
5348
  localObject: globalLexicals,
5370
5349
  globalTransforms,
5371
5350
  sloppyGlobalsMode: false,
5372
- knownScopeProxies,
5373
- });
5351
+ knownScopeProxies });
5352
+
5374
5353
 
5375
5354
  setGlobalObjectMutableProperties(globalObject, {
5376
5355
  intrinsics,
5377
5356
  newGlobalPropertyNames: sharedGlobalPropertyNames,
5378
5357
  makeCompartmentConstructor: targetMakeCompartmentConstructor,
5379
5358
  safeEvaluate,
5380
- markVirtualizedNativeFunction,
5381
- });
5359
+ markVirtualizedNativeFunction });
5360
+
5382
5361
 
5383
5362
  assign(globalObject, endowments);
5384
5363
 
@@ -5396,15 +5375,14 @@ const makeCompartmentConstructor = (
5396
5375
  moduleRecords,
5397
5376
  __shimTransforms__,
5398
5377
  deferredExports,
5399
- instances,
5400
- });
5378
+ instances });
5379
+
5401
5380
  }
5402
5381
 
5403
5382
  Compartment.prototype = CompartmentPrototype;
5404
5383
 
5405
5384
  return Compartment;
5406
5385
  };$h‍_once.makeCompartmentConstructor(makeCompartmentConstructor);
5407
-
5408
5386
  })
5409
5387
  ,
5410
5388
  // === functors[21] ===
@@ -5432,7 +5410,7 @@ const makeCompartmentConstructor = (
5432
5410
 
5433
5411
 
5434
5412
 
5435
- const isFunction = obj => typeof obj === 'function';
5413
+ const isFunction = (obj) => typeof obj === 'function';
5436
5414
 
5437
5415
  // Like defineProperty, but throws if it would modify an existing property.
5438
5416
  // We use this to ensure that two conflicting attempts to define the same
@@ -5444,13 +5422,13 @@ function initProperty(obj, name, desc) {
5444
5422
  if (objectHasOwnProperty(obj, name)) {
5445
5423
  const preDesc = getOwnPropertyDescriptor(obj, name);
5446
5424
  if (
5447
- !is(preDesc.value, desc.value) ||
5448
- preDesc.get !== desc.get ||
5449
- preDesc.set !== desc.set ||
5450
- preDesc.writable !== desc.writable ||
5451
- preDesc.enumerable !== desc.enumerable ||
5452
- preDesc.configurable !== desc.configurable
5453
- ) {
5425
+ !is(preDesc.value, desc.value) ||
5426
+ preDesc.get !== desc.get ||
5427
+ preDesc.set !== desc.set ||
5428
+ preDesc.writable !== desc.writable ||
5429
+ preDesc.enumerable !== desc.enumerable ||
5430
+ preDesc.configurable !== desc.configurable)
5431
+ {
5454
5432
  throw new TypeError(`Conflicting definitions of ${name}`);
5455
5433
  }
5456
5434
  }
@@ -5483,7 +5461,7 @@ const makeIntrinsicsCollector = () => {
5483
5461
  const intrinsics = { __proto__: null };
5484
5462
  let pseudoNatives;
5485
5463
 
5486
- const addIntrinsics = newIntrinsics => {
5464
+ const addIntrinsics = (newIntrinsics) => {
5487
5465
  initProperties(intrinsics, getOwnPropertyDescriptors(newIntrinsics));
5488
5466
  };
5489
5467
  freeze(addIntrinsics);
@@ -5510,9 +5488,9 @@ const makeIntrinsicsCollector = () => {
5510
5488
  throw new TypeError(`${name}.prototype property not whitelisted`);
5511
5489
  }
5512
5490
  if (
5513
- typeof namePrototype !== 'string' ||
5514
- !objectHasOwnProperty(whitelist, namePrototype)
5515
- ) {
5491
+ typeof namePrototype !== 'string' ||
5492
+ !objectHasOwnProperty(whitelist, namePrototype))
5493
+ {
5516
5494
  throw new TypeError(`Unrecognized ${name}.prototype whitelist entry`);
5517
5495
  }
5518
5496
  const intrinsicPrototype = intrinsic.prototype;
@@ -5535,11 +5513,11 @@ const makeIntrinsicsCollector = () => {
5535
5513
  };
5536
5514
  freeze(finalIntrinsics);
5537
5515
 
5538
- const isPseudoNative = obj => {
5516
+ const isPseudoNative = (obj) => {
5539
5517
  if (!pseudoNatives) {
5540
5518
  throw new TypeError(
5541
- 'isPseudoNative can only be called after finalIntrinsics',
5542
- );
5519
+ 'isPseudoNative can only be called after finalIntrinsics');
5520
+
5543
5521
  }
5544
5522
  return weaksetHas(pseudoNatives, obj);
5545
5523
  };
@@ -5549,8 +5527,8 @@ const makeIntrinsicsCollector = () => {
5549
5527
  addIntrinsics,
5550
5528
  completePrototypes,
5551
5529
  finalIntrinsics,
5552
- isPseudoNative,
5553
- };
5530
+ isPseudoNative };
5531
+
5554
5532
  freeze(intrinsicsCollector);
5555
5533
 
5556
5534
  addIntrinsics(constantProperties);
@@ -5572,14 +5550,13 @@ const makeIntrinsicsCollector = () => {
5572
5550
  *
5573
5551
  * @param {Object} globalObject
5574
5552
  */
5575
- const getGlobalIntrinsics = globalObject => {
5553
+ const getGlobalIntrinsics = (globalObject) => {
5576
5554
  const { addIntrinsics, finalIntrinsics } = makeIntrinsicsCollector();
5577
5555
 
5578
5556
  addIntrinsics(sampleGlobals(globalObject, sharedGlobalPropertyNames));
5579
5557
 
5580
5558
  return finalIntrinsics();
5581
5559
  };$h‍_once.getGlobalIntrinsics(getGlobalIntrinsics);
5582
-
5583
5560
  })
5584
5561
  ,
5585
5562
  // === functors[22] ===
@@ -5649,17 +5626,17 @@ const getGlobalIntrinsics = globalObject => {
5649
5626
  */
5650
5627
  const minEnablements = {
5651
5628
  '%ObjectPrototype%': {
5652
- toString: true,
5653
- },
5629
+ toString: true },
5630
+
5654
5631
 
5655
5632
  '%FunctionPrototype%': {
5656
- toString: true, // set by "rollup"
5633
+ toString: true // set by "rollup"
5657
5634
  },
5658
5635
 
5659
5636
  '%ErrorPrototype%': {
5660
- name: true, // set by "precond", "ava", "node-fetch"
5661
- },
5662
- };$h‍_once.minEnablements(minEnablements);
5637
+ name: true // set by "precond", "ava", "node-fetch"
5638
+ } };$h‍_once.minEnablements(minEnablements);
5639
+
5663
5640
 
5664
5641
  /**
5665
5642
  * Moderate enablements are usually good enough for legacy compat.
@@ -5667,12 +5644,12 @@ const minEnablements = {
5667
5644
  const moderateEnablements = {
5668
5645
  '%ObjectPrototype%': {
5669
5646
  toString: true,
5670
- valueOf: true,
5671
- },
5647
+ valueOf: true },
5648
+
5672
5649
 
5673
5650
  '%ArrayPrototype%': {
5674
5651
  toString: true,
5675
- push: true, // set by "Google Analytics"
5652
+ push: true // set by "Google Analytics"
5676
5653
  },
5677
5654
 
5678
5655
  // Function.prototype has no 'prototype' property to enable.
@@ -5682,49 +5659,49 @@ const moderateEnablements = {
5682
5659
  '%FunctionPrototype%': {
5683
5660
  constructor: true, // set by "regenerator-runtime"
5684
5661
  bind: true, // set by "underscore", "express"
5685
- toString: true, // set by "rollup"
5662
+ toString: true // set by "rollup"
5686
5663
  },
5687
5664
 
5688
5665
  '%ErrorPrototype%': {
5689
5666
  constructor: true, // set by "fast-json-patch", "node-fetch"
5690
5667
  message: true,
5691
5668
  name: true, // set by "precond", "ava", "node-fetch", "node 14"
5692
- toString: true, // set by "bluebird"
5669
+ toString: true // set by "bluebird"
5693
5670
  },
5694
5671
 
5695
5672
  '%TypeErrorPrototype%': {
5696
5673
  constructor: true, // set by "readable-stream"
5697
5674
  message: true, // set by "tape"
5698
- name: true, // set by "readable-stream", "node 14"
5675
+ name: true // set by "readable-stream", "node 14"
5699
5676
  },
5700
5677
 
5701
5678
  '%SyntaxErrorPrototype%': {
5702
5679
  message: true, // to match TypeErrorPrototype.message
5703
- name: true, // set by "node 14"
5680
+ name: true // set by "node 14"
5704
5681
  },
5705
5682
 
5706
5683
  '%RangeErrorPrototype%': {
5707
5684
  message: true, // to match TypeErrorPrototype.message
5708
- name: true, // set by "node 14"
5685
+ name: true // set by "node 14"
5709
5686
  },
5710
5687
 
5711
5688
  '%URIErrorPrototype%': {
5712
5689
  message: true, // to match TypeErrorPrototype.message
5713
- name: true, // set by "node 14"
5690
+ name: true // set by "node 14"
5714
5691
  },
5715
5692
 
5716
5693
  '%EvalErrorPrototype%': {
5717
5694
  message: true, // to match TypeErrorPrototype.message
5718
- name: true, // set by "node 14"
5695
+ name: true // set by "node 14"
5719
5696
  },
5720
5697
 
5721
5698
  '%ReferenceErrorPrototype%': {
5722
5699
  message: true, // to match TypeErrorPrototype.message
5723
- name: true, // set by "node 14"
5700
+ name: true // set by "node 14"
5724
5701
  },
5725
5702
 
5726
5703
  '%PromisePrototype%': {
5727
- constructor: true, // set by "core-js"
5704
+ constructor: true // set by "core-js"
5728
5705
  },
5729
5706
 
5730
5707
  '%TypedArrayPrototype%': '*', // set by https://github.com/feross/buffer
@@ -5732,13 +5709,13 @@ const moderateEnablements = {
5732
5709
  '%Generator%': {
5733
5710
  constructor: true,
5734
5711
  name: true,
5735
- toString: true,
5736
- },
5712
+ toString: true },
5713
+
5737
5714
 
5738
5715
  '%IteratorPrototype%': {
5739
- toString: true,
5740
- },
5741
- };$h‍_once.moderateEnablements(moderateEnablements);
5716
+ toString: true } };$h‍_once.moderateEnablements(moderateEnablements);
5717
+
5718
+
5742
5719
 
5743
5720
  /**
5744
5721
  * The 'severe' enablement are needed because of issues tracked at
@@ -5785,9 +5762,7 @@ const severeEnablements = {
5785
5762
  * include enough of the `TypeArray` methods that here, we just enable
5786
5763
  * them all.
5787
5764
  */
5788
- '%TypedArrayPrototype%': '*',
5789
- };$h‍_once.severeEnablements(severeEnablements);
5790
-
5765
+ '%TypedArrayPrototype%': '*' };$h‍_once.severeEnablements(severeEnablements);
5791
5766
  })
5792
5767
  ,
5793
5768
  // === functors[23] ===
@@ -5871,7 +5846,11 @@ const severeEnablements = {
5871
5846
  * @param {'min' | 'moderate' | 'severe'} overrideTaming
5872
5847
  * @param {Iterable<string | symbol>} [overrideDebug]
5873
5848
  */
5874
- function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = []) {
5849
+ function enablePropertyOverrides(
5850
+ intrinsics,
5851
+ overrideTaming,
5852
+ overrideDebug = [])
5853
+ {
5875
5854
  const debugProperties = new Set(overrideDebug);
5876
5855
  function enable(path, obj, prop, desc) {
5877
5856
  if ('value' in desc && desc.configurable) {
@@ -5884,18 +5863,18 @@ function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = [])
5884
5863
  value,
5885
5864
  writable: false,
5886
5865
  enumerable: false,
5887
- configurable: false,
5888
- });
5866
+ configurable: false });
5867
+
5889
5868
 
5890
5869
  const isDebug = setHas(debugProperties, prop);
5891
5870
 
5892
5871
  function setter(newValue) {
5893
5872
  if (obj === this) {
5894
5873
  throw new TypeError(
5895
- `Cannot assign to read only property '${String(
5896
- prop,
5897
- )}' of '${path}'`,
5898
- );
5874
+ `Cannot assign to read only property '${String(
5875
+ prop)
5876
+ }' of '${path}'`);
5877
+
5899
5878
  }
5900
5879
  if (objectHasOwnProperty(this, prop)) {
5901
5880
  this[prop] = newValue;
@@ -5908,8 +5887,8 @@ function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = [])
5908
5887
  value: newValue,
5909
5888
  writable: true,
5910
5889
  enumerable: true,
5911
- configurable: true,
5912
- });
5890
+ configurable: true });
5891
+
5913
5892
  }
5914
5893
  }
5915
5894
 
@@ -5917,8 +5896,8 @@ function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = [])
5917
5896
  get: getter,
5918
5897
  set: setter,
5919
5898
  enumerable: desc.enumerable,
5920
- configurable: desc.configurable,
5921
- });
5899
+ configurable: desc.configurable });
5900
+
5922
5901
  }
5923
5902
  }
5924
5903
 
@@ -5938,7 +5917,7 @@ function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = [])
5938
5917
  // TypeScript does not allow symbols to be used as indexes because it
5939
5918
  // cannot recokon types of symbolized properties.
5940
5919
  // @ts-ignore
5941
- arrayForEach(ownKeys(descs), prop => enable(path, obj, prop, descs[prop]));
5920
+ arrayForEach(ownKeys(descs), (prop) => enable(path, obj, prop, descs[prop]));
5942
5921
  }
5943
5922
 
5944
5923
  function enableProperties(path, obj, plan) {
@@ -5971,27 +5950,26 @@ function enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug = [])
5971
5950
 
5972
5951
  let plan;
5973
5952
  switch (overrideTaming) {
5974
- case 'min': {
5975
- plan = minEnablements;
5976
- break;
5977
- }
5978
- case 'moderate': {
5979
- plan = moderateEnablements;
5980
- break;
5981
- }
5982
- case 'severe': {
5983
- plan = severeEnablements;
5984
- break;
5985
- }
5986
- default: {
5987
- throw new TypeError(`unrecognized overrideTaming ${overrideTaming}`);
5988
- }
5989
- }
5953
+ case 'min':{
5954
+ plan = minEnablements;
5955
+ break;
5956
+ }
5957
+ case 'moderate':{
5958
+ plan = moderateEnablements;
5959
+ break;
5960
+ }
5961
+ case 'severe':{
5962
+ plan = severeEnablements;
5963
+ break;
5964
+ }
5965
+ default:{
5966
+ throw new TypeError(`unrecognized overrideTaming ${overrideTaming}`);
5967
+ }}
5968
+
5990
5969
 
5991
5970
  // Do the repair.
5992
5971
  enableProperties('root', intrinsics, plan);
5993
5972
  }$h‍_once.default(enablePropertyOverrides);
5994
-
5995
5973
  })
5996
5974
  ,
5997
5975
  // === functors[24] ===
@@ -6054,7 +6032,7 @@ const { details: X, quote: q } = assert;
6054
6032
  *
6055
6033
  * @param {Object} aGlobal
6056
6034
  */
6057
- const makeEnvironmentCaptor = aGlobal => {
6035
+ const makeEnvironmentCaptor = (aGlobal) => {
6058
6036
  const capturedEnvironmentOptionNames = [];
6059
6037
 
6060
6038
  /**
@@ -6068,18 +6046,18 @@ const makeEnvironmentCaptor = aGlobal => {
6068
6046
  const getEnvironmentOption = (optionName, defaultSetting) => {
6069
6047
  // eslint-disable-next-line @endo/no-polymorphic-call
6070
6048
  assert.typeof(
6071
- optionName,
6072
- 'string',
6073
- X`Environment option name ${q(optionName)} must be a string.`,
6074
- );
6049
+ optionName,
6050
+ 'string',
6051
+ X`Environment option name ${q(optionName)} must be a string.`);
6052
+
6075
6053
  // eslint-disable-next-line @endo/no-polymorphic-call
6076
6054
  assert.typeof(
6077
- defaultSetting,
6078
- 'string',
6079
- X`Environment option default setting ${q(
6080
- defaultSetting,
6081
- )} must be a string.`,
6082
- );
6055
+ defaultSetting,
6056
+ 'string',
6057
+ X`Environment option default setting ${q(
6058
+ defaultSetting)
6059
+ } must be a string.`);
6060
+
6083
6061
 
6084
6062
  /** @type {string} */
6085
6063
  let setting = defaultSetting;
@@ -6092,22 +6070,22 @@ const makeEnvironmentCaptor = aGlobal => {
6092
6070
  const optionValue = globalEnv[optionName];
6093
6071
  // eslint-disable-next-line @endo/no-polymorphic-call
6094
6072
  assert.typeof(
6095
- optionValue,
6096
- 'string',
6097
- X`Environment option named ${q(
6098
- optionName,
6099
- )}, if present, must have a corresponding string value, got ${q(
6100
- optionValue,
6101
- )}`,
6102
- );
6073
+ optionValue,
6074
+ 'string',
6075
+ X`Environment option named ${q(
6076
+ optionName)
6077
+ }, if present, must have a corresponding string value, got ${q(
6078
+ optionValue)
6079
+ }`);
6080
+
6103
6081
  setting = optionValue;
6104
6082
  }
6105
6083
  }
6106
6084
  }
6107
6085
  assert(
6108
- setting === undefined || typeof setting === 'string',
6109
- X`Environment option value ${q(setting)}, if present, must be a string.`,
6110
- );
6086
+ setting === undefined || typeof setting === 'string',
6087
+ X`Environment option value ${q(setting)}, if present, must be a string.`);
6088
+
6111
6089
  return setting;
6112
6090
  };
6113
6091
  freeze(getEnvironmentOption);
@@ -6120,7 +6098,6 @@ const makeEnvironmentCaptor = aGlobal => {
6120
6098
  return { getEnvironmentOption, getCapturedEnvironmentOptionNames };
6121
6099
  };$h‍_once.makeEnvironmentCaptor(makeEnvironmentCaptor);
6122
6100
  freeze(makeEnvironmentCaptor);
6123
-
6124
6101
  })
6125
6102
  ,
6126
6103
  // === functors[25] ===
@@ -6174,47 +6151,47 @@ freeze(makeEnvironmentCaptor);
6174
6151
 
6175
6152
  /** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */
6176
6153
  const consoleLevelMethods = freeze([
6177
- ['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome
6178
- ['log', 'log'], // (fmt?, ...args) info level on Chrome
6179
- ['info', 'info'], // (fmt?, ...args)
6180
- ['warn', 'warn'], // (fmt?, ...args)
6181
- ['error', 'error'], // (fmt?, ...args)
6182
-
6183
- ['trace', 'log'], // (fmt?, ...args)
6184
- ['dirxml', 'log'], // (fmt?, ...args)
6185
- ['group', 'log'], // (fmt?, ...args)
6186
- ['groupCollapsed', 'log'], // (fmt?, ...args)
6154
+ ['debug', 'debug'], // (fmt?, ...args) verbose level on Chrome
6155
+ ['log', 'log'], // (fmt?, ...args) info level on Chrome
6156
+ ['info', 'info'], // (fmt?, ...args)
6157
+ ['warn', 'warn'], // (fmt?, ...args)
6158
+ ['error', 'error'], // (fmt?, ...args)
6159
+
6160
+ ['trace', 'log'], // (fmt?, ...args)
6161
+ ['dirxml', 'log'], // (fmt?, ...args)
6162
+ ['group', 'log'], // (fmt?, ...args)
6163
+ ['groupCollapsed', 'log'] // (fmt?, ...args)
6187
6164
  ]);
6188
6165
 
6189
6166
  /** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */
6190
6167
  const consoleOtherMethods = freeze([
6191
- ['assert', 'error'], // (value, fmt?, ...args)
6192
- ['timeLog', 'log'], // (label?, ...args) no fmt string
6193
-
6194
- // Insensitive to whether any argument is an error. All arguments can pass
6195
- // thru to baseConsole as is.
6196
- ['clear', undefined], // ()
6197
- ['count', 'info'], // (label?)
6198
- ['countReset', undefined], // (label?)
6199
- ['dir', 'log'], // (item, options?)
6200
- ['groupEnd', 'log'], // ()
6201
- // In theory tabular data may be or contain an error. However, we currently
6202
- // do not detect these and may never.
6203
- ['table', 'log'], // (tabularData, properties?)
6204
- ['time', 'info'], // (label?)
6205
- ['timeEnd', 'info'], // (label?)
6206
-
6207
- // Node Inspector only, MDN, and TypeScript, but not whatwg
6208
- ['profile', undefined], // (label?)
6209
- ['profileEnd', undefined], // (label?)
6210
- ['timeStamp', undefined], // (label?)
6168
+ ['assert', 'error'], // (value, fmt?, ...args)
6169
+ ['timeLog', 'log'], // (label?, ...args) no fmt string
6170
+
6171
+ // Insensitive to whether any argument is an error. All arguments can pass
6172
+ // thru to baseConsole as is.
6173
+ ['clear', undefined], // ()
6174
+ ['count', 'info'], // (label?)
6175
+ ['countReset', undefined], // (label?)
6176
+ ['dir', 'log'], // (item, options?)
6177
+ ['groupEnd', 'log'], // ()
6178
+ // In theory tabular data may be or contain an error. However, we currently
6179
+ // do not detect these and may never.
6180
+ ['table', 'log'], // (tabularData, properties?)
6181
+ ['time', 'info'], // (label?)
6182
+ ['timeEnd', 'info'], // (label?)
6183
+
6184
+ // Node Inspector only, MDN, and TypeScript, but not whatwg
6185
+ ['profile', undefined], // (label?)
6186
+ ['profileEnd', undefined], // (label?)
6187
+ ['timeStamp', undefined] // (label?)
6211
6188
  ]);
6212
6189
 
6213
6190
  /** @type {readonly [ConsoleProps, LogSeverity | undefined][]} */
6214
6191
  const consoleWhitelist = freeze([
6215
- ...consoleLevelMethods,
6216
- ...consoleOtherMethods,
6217
- ]);$h‍_once.consoleWhitelist(consoleWhitelist);
6192
+ ...consoleLevelMethods,
6193
+ ...consoleOtherMethods]);$h‍_once.consoleWhitelist(consoleWhitelist);
6194
+
6218
6195
 
6219
6196
  /**
6220
6197
  * consoleOmittedProperties is currently unused. I record and maintain it here
@@ -6247,9 +6224,9 @@ const consoleWhitelist = freeze([
6247
6224
 
6248
6225
  /** @type {MakeLoggingConsoleKit} */
6249
6226
  const makeLoggingConsoleKit = (
6250
- loggedErrorHandler,
6251
- { shouldResetForDebugging = false } = {},
6252
- ) => {
6227
+ loggedErrorHandler,
6228
+ { shouldResetForDebugging = false } = {}) =>
6229
+ {
6253
6230
  if (shouldResetForDebugging) {
6254
6231
  // eslint-disable-next-line @endo/no-polymorphic-call
6255
6232
  loggedErrorHandler.resetErrorTagNum();
@@ -6259,20 +6236,20 @@ const makeLoggingConsoleKit = (
6259
6236
  let logArray = [];
6260
6237
 
6261
6238
  const loggingConsole = fromEntries(
6262
- arrayMap(consoleWhitelist, ([name, _]) => {
6263
- // Use an arrow function so that it doesn't come with its own name in
6264
- // its printed form. Instead, we're hoping that tooling uses only
6265
- // the `.name` property set below.
6266
- /**
6267
- * @param {...any} args
6268
- */
6269
- const method = (...args) => {
6270
- arrayPush(logArray, [name, ...args]);
6271
- };
6272
- defineProperty(method, 'name', { value: name });
6273
- return [name, freeze(method)];
6274
- }),
6275
- );
6239
+ arrayMap(consoleWhitelist, ([name, _]) => {
6240
+ // Use an arrow function so that it doesn't come with its own name in
6241
+ // its printed form. Instead, we're hoping that tooling uses only
6242
+ // the `.name` property set below.
6243
+ /**
6244
+ * @param {...any} args
6245
+ */
6246
+ const method = (...args) => {
6247
+ arrayPush(logArray, [name, ...args]);
6248
+ };
6249
+ defineProperty(method, 'name', { value: name });
6250
+ return [name, freeze(method)];
6251
+ }));
6252
+
6276
6253
  freeze(loggingConsole);
6277
6254
 
6278
6255
  const takeLog = () => {
@@ -6282,7 +6259,7 @@ const makeLoggingConsoleKit = (
6282
6259
  };
6283
6260
  freeze(takeLog);
6284
6261
 
6285
- const typedLoggingConsole = /** @type {VirtualConsole} */ (loggingConsole);
6262
+ const typedLoggingConsole = /** @type {VirtualConsole} */loggingConsole;
6286
6263
 
6287
6264
  return freeze({ loggingConsole: typedLoggingConsole, takeLog });
6288
6265
  };$h‍_once.makeLoggingConsoleKit(makeLoggingConsoleKit);
@@ -6294,8 +6271,8 @@ freeze(makeLoggingConsoleKit);
6294
6271
  /** @type {ErrorInfo} */
6295
6272
  const ErrorInfo = {
6296
6273
  NOTE: 'ERROR_NOTE:',
6297
- MESSAGE: 'ERROR_MESSAGE:',
6298
- };
6274
+ MESSAGE: 'ERROR_MESSAGE:' };
6275
+
6299
6276
  freeze(ErrorInfo);
6300
6277
 
6301
6278
  /**
@@ -6313,8 +6290,8 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6313
6290
  getStackString,
6314
6291
  tagError,
6315
6292
  takeMessageLogArgs,
6316
- takeNoteLogArgsArray,
6317
- } = loggedErrorHandler;
6293
+ takeNoteLogArgsArray } =
6294
+ loggedErrorHandler;
6318
6295
 
6319
6296
  /**
6320
6297
  * @param {ReadonlyArray<any>} logArgs
@@ -6322,7 +6299,7 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6322
6299
  * @returns {any}
6323
6300
  */
6324
6301
  const extractErrorArgs = (logArgs, subErrorsSink) => {
6325
- const argTags = arrayMap(logArgs, arg => {
6302
+ const argTags = arrayMap(logArgs, (arg) => {
6326
6303
  if (isError(arg)) {
6327
6304
  arrayPush(subErrorsSink, arg);
6328
6305
  return `(${tagError(arg)})`;
@@ -6341,7 +6318,7 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6341
6318
  const logErrorInfo = (error, kind, logArgs, subErrorsSink) => {
6342
6319
  const errorTag = tagError(error);
6343
6320
  const errorName =
6344
- kind === ErrorInfo.MESSAGE ? `${errorTag}:` : `${errorTag} ${kind}`;
6321
+ kind === ErrorInfo.MESSAGE ? `${errorTag}:` : `${errorTag} ${kind}`;
6345
6322
  const argTags = extractErrorArgs(logArgs, subErrorsSink);
6346
6323
  // eslint-disable-next-line @endo/no-polymorphic-call
6347
6324
  baseConsole[BASE_CONSOLE_LEVEL](errorName, ...argTags);
@@ -6399,7 +6376,7 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6399
6376
  /**
6400
6377
  * @param {Error} error
6401
6378
  */
6402
- const logError = error => {
6379
+ const logError = (error) => {
6403
6380
  if (weaksetHas(errorsLogged, error)) {
6404
6381
  return;
6405
6382
  }
@@ -6422,10 +6399,10 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6422
6399
  // After the message but before any other annotations, show the stack.
6423
6400
  let stackString = getStackString(error);
6424
6401
  if (
6425
- typeof stackString === 'string' &&
6426
- stackString.length >= 1 &&
6427
- !stringEndsWith(stackString, '\n')
6428
- ) {
6402
+ typeof stackString === 'string' &&
6403
+ stackString.length >= 1 &&
6404
+ !stringEndsWith(stackString, '\n'))
6405
+ {
6429
6406
  stackString += '\n';
6430
6407
  }
6431
6408
  // eslint-disable-next-line @endo/no-polymorphic-call
@@ -6454,9 +6431,9 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6454
6431
  return [level, freeze(levelMethod)];
6455
6432
  });
6456
6433
  const otherMethodNames = arrayFilter(
6457
- consoleOtherMethods,
6458
- ([name, _]) => name in baseConsole,
6459
- );
6434
+ consoleOtherMethods,
6435
+ ([name, _]) => name in baseConsole);
6436
+
6460
6437
  const otherMethods = arrayMap(otherMethodNames, ([name, _]) => {
6461
6438
  /**
6462
6439
  * @param {...any} args
@@ -6472,7 +6449,7 @@ const makeCausalConsole = (baseConsole, loggedErrorHandler) => {
6472
6449
  });
6473
6450
 
6474
6451
  const causalConsole = fromEntries([...levelMethods, ...otherMethods]);
6475
- return /** @type {VirtualConsole} */ (freeze(causalConsole));
6452
+ return (/** @type {VirtualConsole} */freeze(causalConsole));
6476
6453
  };$h‍_once.makeCausalConsole(makeCausalConsole);
6477
6454
  freeze(makeCausalConsole);
6478
6455
 
@@ -6483,9 +6460,9 @@ freeze(makeCausalConsole);
6483
6460
  const filterConsole = (baseConsole, filter, _topic = undefined) => {
6484
6461
  // TODO do something with optional topic string
6485
6462
  const whitelist = arrayFilter(
6486
- consoleWhitelist,
6487
- ([name, _]) => name in baseConsole,
6488
- );
6463
+ consoleWhitelist,
6464
+ ([name, _]) => name in baseConsole);
6465
+
6489
6466
  const methods = arrayMap(whitelist, ([name, severity]) => {
6490
6467
  /**
6491
6468
  * @param {...any} args
@@ -6501,10 +6478,9 @@ const filterConsole = (baseConsole, filter, _topic = undefined) => {
6501
6478
  return [name, freeze(method)];
6502
6479
  });
6503
6480
  const filteringConsole = fromEntries(methods);
6504
- return /** @type {VirtualConsole} */ (freeze(filteringConsole));
6481
+ return (/** @type {VirtualConsole} */freeze(filteringConsole));
6505
6482
  };$h‍_once.filterConsole(filterConsole);
6506
6483
  freeze(filterConsole);
6507
-
6508
6484
  })
6509
6485
  ,
6510
6486
  // === functors[26] ===
@@ -6530,10 +6506,10 @@ const originalConsole = console;
6530
6506
  * @param {GetStackString=} optGetStackString
6531
6507
  */
6532
6508
  const tameConsole = (
6533
- consoleTaming = 'safe',
6534
- errorTrapping = 'platform',
6535
- optGetStackString = undefined,
6536
- ) => {
6509
+ consoleTaming = 'safe',
6510
+ errorTrapping = 'platform',
6511
+ optGetStackString = undefined) =>
6512
+ {
6537
6513
  if (consoleTaming !== 'safe' && consoleTaming !== 'unsafe') {
6538
6514
  throw new TypeError(`unrecognized consoleTaming ${consoleTaming}`);
6539
6515
  }
@@ -6547,8 +6523,8 @@ const tameConsole = (
6547
6523
  } else {
6548
6524
  loggedErrorHandler = {
6549
6525
  ...defaultHandler,
6550
- getStackString: optGetStackString,
6551
- };
6526
+ getStackString: optGetStackString };
6527
+
6552
6528
  }
6553
6529
  const causalConsole = makeCausalConsole(originalConsole, loggedErrorHandler);
6554
6530
 
@@ -6566,7 +6542,7 @@ const tameConsole = (
6566
6542
  // Node.js
6567
6543
  if (errorTrapping !== 'none' && globalThis.process !== undefined) {
6568
6544
  // eslint-disable-next-line @endo/no-polymorphic-call
6569
- globalThis.process.on('uncaughtException', error => {
6545
+ globalThis.process.on('uncaughtException', (error) => {
6570
6546
  // causalConsole is born frozen so not vulnerable to method tampering.
6571
6547
  // eslint-disable-next-line @endo/no-polymorphic-call
6572
6548
  causalConsole.error(error);
@@ -6583,7 +6559,7 @@ const tameConsole = (
6583
6559
  // Browser
6584
6560
  if (errorTrapping !== 'none' && globalThis.window !== undefined) {
6585
6561
  // eslint-disable-next-line @endo/no-polymorphic-call
6586
- globalThis.window.addEventListener('error', event => {
6562
+ globalThis.window.addEventListener('error', (event) => {
6587
6563
  // eslint-disable-next-line @endo/no-polymorphic-call
6588
6564
  event.preventDefault();
6589
6565
  // eslint-disable-next-line @endo/no-polymorphic-call
@@ -6596,7 +6572,6 @@ const tameConsole = (
6596
6572
 
6597
6573
  return { console: causalConsole };
6598
6574
  };$h‍_once.tameConsole(tameConsole);
6599
-
6600
6575
  })
6601
6576
  ,
6602
6577
  // === functors[27] ===
@@ -6625,35 +6600,35 @@ const tameConsole = (
6625
6600
  // Whitelisting only the names used by error-stack-shim/src/v8StackFrames
6626
6601
  // callSiteToFrame to shim the error stack proposal.
6627
6602
  const safeV8CallSiteMethodNames = [
6628
- // suppress 'getThis' definitely
6629
- 'getTypeName',
6630
- // suppress 'getFunction' definitely
6631
- 'getFunctionName',
6632
- 'getMethodName',
6633
- 'getFileName',
6634
- 'getLineNumber',
6635
- 'getColumnNumber',
6636
- 'getEvalOrigin',
6637
- 'isToplevel',
6638
- 'isEval',
6639
- 'isNative',
6640
- 'isConstructor',
6641
- 'isAsync',
6642
- // suppress 'isPromiseAll' for now
6643
- // suppress 'getPromiseIndex' for now
6644
-
6645
- // Additional names found by experiment, absent from
6646
- // https://v8.dev/docs/stack-trace-api
6647
- 'getPosition',
6648
- 'getScriptNameOrSourceURL',
6649
-
6650
- 'toString', // TODO replace to use only whitelisted info
6603
+ // suppress 'getThis' definitely
6604
+ 'getTypeName',
6605
+ // suppress 'getFunction' definitely
6606
+ 'getFunctionName',
6607
+ 'getMethodName',
6608
+ 'getFileName',
6609
+ 'getLineNumber',
6610
+ 'getColumnNumber',
6611
+ 'getEvalOrigin',
6612
+ 'isToplevel',
6613
+ 'isEval',
6614
+ 'isNative',
6615
+ 'isConstructor',
6616
+ 'isAsync',
6617
+ // suppress 'isPromiseAll' for now
6618
+ // suppress 'getPromiseIndex' for now
6619
+
6620
+ // Additional names found by experiment, absent from
6621
+ // https://v8.dev/docs/stack-trace-api
6622
+ 'getPosition',
6623
+ 'getScriptNameOrSourceURL',
6624
+
6625
+ 'toString' // TODO replace to use only whitelisted info
6651
6626
  ];
6652
6627
 
6653
6628
  // TODO this is a ridiculously expensive way to attenuate callsites.
6654
6629
  // Before that matters, we should switch to a reasonable representation.
6655
- const safeV8CallSiteFacet = callSite => {
6656
- const methodEntry = name => {
6630
+ const safeV8CallSiteFacet = (callSite) => {
6631
+ const methodEntry = (name) => {
6657
6632
  const method = callSite[name];
6658
6633
  return [name, () => apply(method, callSite, [])];
6659
6634
  };
@@ -6661,7 +6636,7 @@ const safeV8CallSiteFacet = callSite => {
6661
6636
  return create(o, {});
6662
6637
  };
6663
6638
 
6664
- const safeV8SST = sst => arrayMap(sst, safeV8CallSiteFacet);
6639
+ const safeV8SST = (sst) => arrayMap(sst, safeV8CallSiteFacet);
6665
6640
 
6666
6641
  // If it has `/node_modules/` anywhere in it, on Node it is likely
6667
6642
  // to be a dependent package of the current package, and so to
@@ -6689,17 +6664,17 @@ const FILENAME_EVENTUAL_SEND_CENSOR = /\/packages\/eventual-send\/src\//;
6689
6664
  // will be omitted from concise stacks.
6690
6665
  // TODO Enable users to configure FILENAME_CENSORS via `lockdown` options.
6691
6666
  const FILENAME_CENSORS = [
6692
- FILENAME_NODE_DEPENDENTS_CENSOR,
6693
- FILENAME_NODE_INTERNALS_CENSOR,
6694
- FILENAME_ASSERT_CENSOR,
6695
- FILENAME_EVENTUAL_SEND_CENSOR,
6696
- ];
6667
+ FILENAME_NODE_DEPENDENTS_CENSOR,
6668
+ FILENAME_NODE_INTERNALS_CENSOR,
6669
+ FILENAME_ASSERT_CENSOR,
6670
+ FILENAME_EVENTUAL_SEND_CENSOR];
6671
+
6697
6672
 
6698
6673
  // Should a stack frame with this as its fileName be included in a concise
6699
6674
  // stack trace?
6700
6675
  // Exported only so it can be unit tested.
6701
6676
  // TODO Move so that it applies not just to v8.
6702
- const filterFileName = fileName => {
6677
+ const filterFileName = (fileName) => {
6703
6678
  if (!fileName) {
6704
6679
  // Stack frames with no fileName should appear in concise stack traces.
6705
6680
  return true;
@@ -6742,16 +6717,16 @@ const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
6742
6717
  // stacks.
6743
6718
  // TODO Enable users to configure CALLSITE_PATTERNS via `lockdown` options.
6744
6719
  const CALLSITE_PATTERNS = [
6745
- CALLSITE_ELLIPSES_PATTERN,
6746
- CALLSITE_PACKAGES_PATTERN,
6747
- ];
6720
+ CALLSITE_ELLIPSES_PATTERN,
6721
+ CALLSITE_PACKAGES_PATTERN];
6722
+
6748
6723
 
6749
6724
  // For a stack frame that should be included in a concise stack trace, if
6750
6725
  // `callSiteString` is the original stringified stack frame, return the
6751
6726
  // possibly-shorter stringified stack frame that should be shown instead.
6752
6727
  // Exported only so it can be unit tested.
6753
6728
  // TODO Move so that it applies not just to v8.
6754
- const shortenCallSiteString = callSiteString => {
6729
+ const shortenCallSiteString = (callSiteString) => {
6755
6730
  for (const filter of CALLSITE_PATTERNS) {
6756
6731
  const match = regexpExec(filter, callSiteString);
6757
6732
  if (match) {
@@ -6762,15 +6737,15 @@ const shortenCallSiteString = callSiteString => {
6762
6737
  };$h‍_once.shortenCallSiteString(shortenCallSiteString);
6763
6738
 
6764
6739
  const tameV8ErrorConstructor = (
6765
- OriginalError,
6766
- InitialError,
6767
- errorTaming,
6768
- stackFiltering,
6769
- ) => {
6740
+ OriginalError,
6741
+ InitialError,
6742
+ errorTaming,
6743
+ stackFiltering) =>
6744
+ {
6770
6745
  const originalCaptureStackTrace = OriginalError.captureStackTrace;
6771
6746
 
6772
6747
  // const callSiteFilter = _callSite => true;
6773
- const callSiteFilter = callSite => {
6748
+ const callSiteFilter = (callSite) => {
6774
6749
  if (stackFiltering === 'verbose') {
6775
6750
  return true;
6776
6751
  }
@@ -6778,7 +6753,7 @@ const tameV8ErrorConstructor = (
6778
6753
  return filterFileName(callSite.getFileName());
6779
6754
  };
6780
6755
 
6781
- const callSiteStringifier = callSite => {
6756
+ const callSiteStringifier = (callSite) => {
6782
6757
  let callSiteString = `${callSite}`;
6783
6758
  if (stackFiltering === 'concise') {
6784
6759
  callSiteString = shortenCallSiteString(callSiteString);
@@ -6787,10 +6762,10 @@ const tameV8ErrorConstructor = (
6787
6762
  };
6788
6763
 
6789
6764
  const stackStringFromSST = (_error, sst) =>
6790
- arrayJoin(
6791
- arrayMap(arrayFilter(sst, callSiteFilter), callSiteStringifier),
6792
- '',
6793
- );
6765
+ arrayJoin(
6766
+ arrayMap(arrayFilter(sst, callSiteFilter), callSiteStringifier),
6767
+ '');
6768
+
6794
6769
 
6795
6770
  // Mapping from error instance to the structured stack trace capturing the
6796
6771
  // stack for that instance.
@@ -6833,8 +6808,8 @@ const tameV8ErrorConstructor = (
6833
6808
  return `${error}${stackString}`;
6834
6809
  }
6835
6810
  return '';
6836
- },
6837
- };
6811
+ } };
6812
+
6838
6813
 
6839
6814
  // A prepareFn is a prepareStackTrace function.
6840
6815
  // An sst is a `structuredStackTrace`, which is an array of
@@ -6860,7 +6835,7 @@ const tameV8ErrorConstructor = (
6860
6835
  // unattenuated sst.
6861
6836
  const systemPrepareFnSet = new WeakSet([defaultPrepareFn]);
6862
6837
 
6863
- const systemPrepareFnFor = inputPrepareFn => {
6838
+ const systemPrepareFnFor = (inputPrepareFn) => {
6864
6839
  if (weaksetHas(systemPrepareFnSet, inputPrepareFn)) {
6865
6840
  return inputPrepareFn;
6866
6841
  }
@@ -6869,8 +6844,8 @@ const tameV8ErrorConstructor = (
6869
6844
  prepareStackTrace(error, sst) {
6870
6845
  weakmapSet(ssts, error, sst);
6871
6846
  return inputPrepareFn(error, safeV8SST(sst));
6872
- },
6873
- };
6847
+ } };
6848
+
6874
6849
  weaksetAdd(systemPrepareFnSet, systemMethods.prepareStackTrace);
6875
6850
  return systemMethods.prepareStackTrace;
6876
6851
  };
@@ -6882,8 +6857,8 @@ const tameV8ErrorConstructor = (
6882
6857
  value: tamedMethods.captureStackTrace,
6883
6858
  writable: true,
6884
6859
  enumerable: false,
6885
- configurable: true,
6886
- },
6860
+ configurable: true },
6861
+
6887
6862
  prepareStackTrace: {
6888
6863
  get() {
6889
6864
  return OriginalError.prepareStackTrace;
@@ -6897,13 +6872,12 @@ const tameV8ErrorConstructor = (
6897
6872
  }
6898
6873
  },
6899
6874
  enumerable: false,
6900
- configurable: true,
6901
- },
6902
- });
6875
+ configurable: true } });
6876
+
6877
+
6903
6878
 
6904
6879
  return tamedMethods.getStackString;
6905
6880
  };$h‍_once.tameV8ErrorConstructor(tameV8ErrorConstructor);
6906
-
6907
6881
  })
6908
6882
  ,
6909
6883
  // === functors[28] ===
@@ -6934,10 +6908,13 @@ const tamedMethods = {
6934
6908
  return `${error.stack}`;
6935
6909
  }
6936
6910
  return '';
6937
- },
6938
- };
6911
+ } };
6912
+
6939
6913
 
6940
- function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise') {
6914
+ function tameErrorConstructor(
6915
+ errorTaming = 'safe',
6916
+ stackFiltering = 'concise')
6917
+ {
6941
6918
  if (errorTaming !== 'safe' && errorTaming !== 'unsafe') {
6942
6919
  throw new TypeError(`unrecognized errorTaming ${errorTaming}`);
6943
6920
  }
@@ -6947,7 +6924,7 @@ function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise')
6947
6924
  const ErrorPrototype = FERAL_ERROR.prototype;
6948
6925
 
6949
6926
  const platform =
6950
- typeof FERAL_ERROR.captureStackTrace === 'function' ? 'v8' : 'unknown';
6927
+ typeof FERAL_ERROR.captureStackTrace === 'function' ? 'v8' : 'unknown';
6951
6928
  const { captureStackTrace: originalCaptureStackTrace } = FERAL_ERROR;
6952
6929
 
6953
6930
  const makeErrorConstructor = (_ = {}) => {
@@ -6971,15 +6948,15 @@ function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise')
6971
6948
  value: ErrorPrototype,
6972
6949
  writable: false,
6973
6950
  enumerable: false,
6974
- configurable: false,
6975
- },
6976
- });
6951
+ configurable: false } });
6952
+
6953
+
6977
6954
  return ResultError;
6978
6955
  };
6979
6956
  const InitialError = makeErrorConstructor({ powers: 'original' });
6980
6957
  const SharedError = makeErrorConstructor({ powers: 'none' });
6981
6958
  defineProperties(ErrorPrototype, {
6982
- constructor: { value: SharedError },
6959
+ constructor: { value: SharedError }
6983
6960
  /* TODO
6984
6961
  stack: {
6985
6962
  get() {
@@ -6989,8 +6966,8 @@ function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise')
6989
6966
  // ignore
6990
6967
  },
6991
6968
  },
6992
- */
6993
- });
6969
+ */ });
6970
+
6994
6971
 
6995
6972
  for (const NativeError of NativeErrors) {
6996
6973
  setPrototypeOf(NativeError, SharedError);
@@ -7032,9 +7009,9 @@ function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise')
7032
7009
  },
7033
7010
  // WTF on v8 stackTraceLimit is enumerable
7034
7011
  enumerable: false,
7035
- configurable: true,
7036
- },
7037
- });
7012
+ configurable: true } });
7013
+
7014
+
7038
7015
 
7039
7016
  // The default SharedError much be completely powerless even on v8,
7040
7017
  // so the lenient `stackTraceLimit` accessor does nothing on all
@@ -7048,26 +7025,25 @@ function tameErrorConstructor(errorTaming = 'safe', stackFiltering = 'concise')
7048
7025
  // do nothing
7049
7026
  },
7050
7027
  enumerable: false,
7051
- configurable: true,
7052
- },
7053
- });
7028
+ configurable: true } });
7029
+
7030
+
7054
7031
 
7055
7032
  let initialGetStackString = tamedMethods.getStackString;
7056
7033
  if (platform === 'v8') {
7057
7034
  initialGetStackString = tameV8ErrorConstructor(
7058
- FERAL_ERROR,
7059
- InitialError,
7060
- errorTaming,
7061
- stackFiltering,
7062
- );
7035
+ FERAL_ERROR,
7036
+ InitialError,
7037
+ errorTaming,
7038
+ stackFiltering);
7039
+
7063
7040
  }
7064
7041
  return {
7065
7042
  '%InitialGetStackString%': initialGetStackString,
7066
7043
  '%InitialError%': InitialError,
7067
- '%SharedError%': SharedError,
7068
- };
7069
- }$h‍_once.default(tameErrorConstructor);
7044
+ '%SharedError%': SharedError };
7070
7045
 
7046
+ }$h‍_once.default(tameErrorConstructor);
7071
7047
  })
7072
7048
  ,
7073
7049
  // === functors[29] ===
@@ -7118,8 +7094,8 @@ const getAnonymousIntrinsics = () => {
7118
7094
 
7119
7095
  // 9.2.4.1 %ThrowTypeError%
7120
7096
 
7121
- const ThrowTypeError = getOwnPropertyDescriptor(makeArguments(), 'callee')
7122
- .get;
7097
+ const ThrowTypeError = getOwnPropertyDescriptor(makeArguments(), 'callee').
7098
+ get;
7123
7099
 
7124
7100
  // 21.1.5.2 The %StringIteratorPrototype% Object
7125
7101
 
@@ -7129,9 +7105,9 @@ const getAnonymousIntrinsics = () => {
7129
7105
 
7130
7106
  // 21.2.7.1 The %RegExpStringIteratorPrototype% Object
7131
7107
  const RegExpStringIterator =
7132
- regexpPrototype[matchAllSymbol] && matchAllRegExp(/./);
7108
+ regexpPrototype[matchAllSymbol] && matchAllRegExp(/./);
7133
7109
  const RegExpStringIteratorPrototype =
7134
- RegExpStringIterator && getPrototypeOf(RegExpStringIterator);
7110
+ RegExpStringIterator && getPrototypeOf(RegExpStringIterator);
7135
7111
 
7136
7112
  // 22.1.5.2 The %ArrayIteratorPrototype% Object
7137
7113
 
@@ -7172,8 +7148,8 @@ const getAnonymousIntrinsics = () => {
7172
7148
  // eslint-disable-next-line no-empty-function
7173
7149
  async function* AsyncGeneratorFunctionInstance() {}
7174
7150
  const AsyncGeneratorFunction = getConstructorOf(
7175
- AsyncGeneratorFunctionInstance,
7176
- );
7151
+ AsyncGeneratorFunctionInstance);
7152
+
7177
7153
 
7178
7154
  // 25.3.2.2 AsyncGeneratorFunction.prototype
7179
7155
  const AsyncGenerator = AsyncGeneratorFunction.prototype;
@@ -7204,12 +7180,11 @@ const getAnonymousIntrinsics = () => {
7204
7180
  '%StringIteratorPrototype%': StringIteratorPrototype,
7205
7181
  '%ThrowTypeError%': ThrowTypeError,
7206
7182
  '%TypedArray%': TypedArray,
7207
- '%InertCompartment%': InertCompartment,
7208
- };
7183
+ '%InertCompartment%': InertCompartment };
7184
+
7209
7185
 
7210
7186
  return intrinsics;
7211
7187
  };$h‍_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
7212
-
7213
7188
  })
7214
7189
  ,
7215
7190
  // === functors[30] ===
@@ -7327,12 +7302,12 @@ const makeHardener = () => {
7327
7302
  const proto = getPrototypeOf(obj);
7328
7303
  enqueue(proto, `${path}.__proto__`);
7329
7304
 
7330
- arrayForEach(ownKeys(descs), (/** @type {string | symbol} */ name) => {
7305
+ arrayForEach(ownKeys(descs), ( /** @type {string | symbol} */name) => {
7331
7306
  const pathname = `${path}.${String(name)}`;
7332
7307
  // The 'name' may be a symbol, and TypeScript doesn't like us to
7333
7308
  // index arbitrary symbols on objects, so we pretend they're just
7334
7309
  // strings.
7335
- const desc = descs[/** @type {string} */ (name)];
7310
+ const desc = descs[/** @type {string} */name];
7336
7311
  // getOwnPropertyDescriptors is guaranteed to return well-formed
7337
7312
  // descriptors, but they still inherit from Object.prototype. If
7338
7313
  // someone has poisoned Object.prototype to add 'value' or 'get'
@@ -7369,12 +7344,11 @@ const makeHardener = () => {
7369
7344
  commit();
7370
7345
 
7371
7346
  return root;
7372
- },
7373
- };
7347
+ } };
7348
+
7374
7349
 
7375
7350
  return harden;
7376
7351
  };$h‍_once.makeHardener(makeHardener);
7377
-
7378
7352
  })
7379
7353
  ,
7380
7354
  // === functors[31] ===
@@ -7399,8 +7373,8 @@ function tameDateConstructor(dateTaming = 'safe') {
7399
7373
  const tamedMethods = {
7400
7374
  now() {
7401
7375
  return NaN;
7402
- },
7403
- };
7376
+ } };
7377
+
7404
7378
 
7405
7379
  // Tame the Date constructor.
7406
7380
  // Common behavior
@@ -7446,21 +7420,21 @@ function tameDateConstructor(dateTaming = 'safe') {
7446
7420
  value: DatePrototype,
7447
7421
  writable: false,
7448
7422
  enumerable: false,
7449
- configurable: false,
7450
- },
7423
+ configurable: false },
7424
+
7451
7425
  parse: {
7452
7426
  value: Date.parse,
7453
7427
  writable: true,
7454
7428
  enumerable: false,
7455
- configurable: true,
7456
- },
7429
+ configurable: true },
7430
+
7457
7431
  UTC: {
7458
7432
  value: Date.UTC,
7459
7433
  writable: true,
7460
7434
  enumerable: false,
7461
- configurable: true,
7462
- },
7463
- });
7435
+ configurable: true } });
7436
+
7437
+
7464
7438
  return ResultDate;
7465
7439
  };
7466
7440
  const InitialDate = makeDateConstructor({ powers: 'original' });
@@ -7471,28 +7445,27 @@ function tameDateConstructor(dateTaming = 'safe') {
7471
7445
  value: Date.now,
7472
7446
  writable: true,
7473
7447
  enumerable: false,
7474
- configurable: true,
7475
- },
7476
- });
7448
+ configurable: true } });
7449
+
7450
+
7477
7451
  defineProperties(SharedDate, {
7478
7452
  now: {
7479
7453
  value: tamedMethods.now,
7480
7454
  writable: true,
7481
7455
  enumerable: false,
7482
- configurable: true,
7483
- },
7484
- });
7456
+ configurable: true } });
7457
+
7458
+
7485
7459
 
7486
7460
  defineProperties(DatePrototype, {
7487
- constructor: { value: SharedDate },
7488
- });
7461
+ constructor: { value: SharedDate } });
7462
+
7489
7463
 
7490
7464
  return {
7491
7465
  '%InitialDate%': InitialDate,
7492
- '%SharedDate%': SharedDate,
7493
- };
7494
- }$h‍_once.default(tameDateConstructor);
7466
+ '%SharedDate%': SharedDate };
7495
7467
 
7468
+ }$h‍_once.default(tameDateConstructor);
7496
7469
  })
7497
7470
  ,
7498
7471
  // === functors[32] ===
@@ -7518,15 +7491,15 @@ function tameDomains(domainTaming = 'safe') {
7518
7491
  if (typeof globalThis.process === 'object' && globalThis.process !== null) {
7519
7492
  // Check whether domains were initialized.
7520
7493
  const domainDescriptor = getOwnPropertyDescriptor(
7521
- globalThis.process,
7522
- 'domain',
7523
- );
7494
+ globalThis.process,
7495
+ 'domain');
7496
+
7524
7497
  if (domainDescriptor !== undefined && domainDescriptor.get !== undefined) {
7525
7498
  // The domain descriptor on Node.js initially has value: null, which
7526
7499
  // becomes a get, set pair after domains initialize.
7527
7500
  throw new TypeError(
7528
- `SES failed to lockdown, Node.js domains have been initialized (SES_NO_DOMAINS)`,
7529
- );
7501
+ `SES failed to lockdown, Node.js domains have been initialized (SES_NO_DOMAINS)`);
7502
+
7530
7503
  }
7531
7504
  // Prevent domains from initializing.
7532
7505
  // This is clunky because the exception thrown from the domains package does
@@ -7538,11 +7511,10 @@ function tameDomains(domainTaming = 'safe') {
7538
7511
  value: null,
7539
7512
  configurable: false,
7540
7513
  writable: false,
7541
- enumerable: false,
7542
- });
7514
+ enumerable: false });
7515
+
7543
7516
  }
7544
7517
  }
7545
-
7546
7518
  })
7547
7519
  ,
7548
7520
  // === functors[33] ===
@@ -7630,10 +7602,10 @@ function tameFunctionConstructors() {
7630
7602
  // Prevents the evaluation of source when calling constructor on the
7631
7603
  // prototype of functions.
7632
7604
  // eslint-disable-next-line func-names
7633
- const InertConstructor = function() {
7605
+ const InertConstructor = function () {
7634
7606
  throw new TypeError(
7635
- 'Function.prototype.constructor is not a valid constructor.',
7636
- );
7607
+ 'Function.prototype.constructor is not a valid constructor.');
7608
+
7637
7609
  };
7638
7610
  defineProperties(InertConstructor, {
7639
7611
  prototype: { value: FunctionPrototype },
@@ -7641,13 +7613,13 @@ function tameFunctionConstructors() {
7641
7613
  value: name,
7642
7614
  writable: false,
7643
7615
  enumerable: false,
7644
- configurable: true,
7645
- },
7646
- });
7616
+ configurable: true } });
7617
+
7618
+
7647
7619
 
7648
7620
  defineProperties(FunctionPrototype, {
7649
- constructor: { value: InertConstructor },
7650
- });
7621
+ constructor: { value: InertConstructor } });
7622
+
7651
7623
 
7652
7624
  // Reconstructs the inheritance among the new tamed constructors
7653
7625
  // to mirror the original specified in normal JS.
@@ -7664,24 +7636,23 @@ function tameFunctionConstructors() {
7664
7636
 
7665
7637
  repairFunction('Function', '%InertFunction%', '(function(){})');
7666
7638
  repairFunction(
7667
- 'GeneratorFunction',
7668
- '%InertGeneratorFunction%',
7669
- '(function*(){})',
7670
- );
7639
+ 'GeneratorFunction',
7640
+ '%InertGeneratorFunction%',
7641
+ '(function*(){})');
7642
+
7671
7643
  repairFunction(
7672
- 'AsyncFunction',
7673
- '%InertAsyncFunction%',
7674
- '(async function(){})',
7675
- );
7644
+ 'AsyncFunction',
7645
+ '%InertAsyncFunction%',
7646
+ '(async function(){})');
7647
+
7676
7648
  repairFunction(
7677
- 'AsyncGeneratorFunction',
7678
- '%InertAsyncGeneratorFunction%',
7679
- '(async function*(){})',
7680
- );
7649
+ 'AsyncGeneratorFunction',
7650
+ '%InertAsyncGeneratorFunction%',
7651
+ '(async function*(){})');
7652
+
7681
7653
 
7682
7654
  return newIntrinsics;
7683
7655
  }$h‍_once.default(tameFunctionConstructors);
7684
-
7685
7656
  })
7686
7657
  ,
7687
7658
  // === functors[34] ===
@@ -7716,26 +7687,25 @@ const tameFunctionToString = () => {
7716
7687
  toString() {
7717
7688
  const str = functionToString(this, []);
7718
7689
  if (
7719
- stringEndsWith(str, nativeSuffix) ||
7720
- !weaksetHas(virtualizedNativeFunctions, this)
7721
- ) {
7690
+ stringEndsWith(str, nativeSuffix) ||
7691
+ !weaksetHas(virtualizedNativeFunctions, this))
7692
+ {
7722
7693
  return str;
7723
7694
  }
7724
7695
  return `function ${this.name}() { [native code] }`;
7725
- },
7726
- };
7696
+ } };
7697
+
7727
7698
 
7728
7699
  defineProperty(functionPrototype, 'toString', {
7729
- value: tamingMethods.toString,
7730
- });
7700
+ value: tamingMethods.toString });
7701
+
7702
+
7703
+ markVirtualizedNativeFunction = freeze((func) =>
7704
+ weaksetAdd(virtualizedNativeFunctions, func));
7731
7705
 
7732
- markVirtualizedNativeFunction = freeze(func =>
7733
- weaksetAdd(virtualizedNativeFunctions, func),
7734
- );
7735
7706
  }
7736
7707
  return markVirtualizedNativeFunction;
7737
7708
  };$h‍_once.tameFunctionToString(tameFunctionToString);
7738
-
7739
7709
  })
7740
7710
  ,
7741
7711
  // === functors[35] ===
@@ -7760,8 +7730,8 @@ const tamedMethods = {
7760
7730
  localeCompare(that) {
7761
7731
  if (this === null || this === undefined) {
7762
7732
  throw new TypeError(
7763
- 'Cannot localeCompare with null or undefined "this" value',
7764
- );
7733
+ 'Cannot localeCompare with null or undefined "this" value');
7734
+
7765
7735
  }
7766
7736
  const s = `${this}`;
7767
7737
  that = `${that}`;
@@ -7773,8 +7743,8 @@ const tamedMethods = {
7773
7743
  }
7774
7744
  assert(s === that, d`expected ${q(s)} and ${q(that)} to compare`);
7775
7745
  return 0;
7776
- },
7777
- };
7746
+ } };
7747
+
7778
7748
 
7779
7749
  const nonLocaleCompare = tamedMethods.localeCompare;
7780
7750
 
@@ -7787,8 +7757,8 @@ function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
7787
7757
  }
7788
7758
 
7789
7759
  defineProperty(String.prototype, 'localeCompare', {
7790
- value: nonLocaleCompare,
7791
- });
7760
+ value: nonLocaleCompare });
7761
+
7792
7762
 
7793
7763
  for (const intrinsicName of getOwnPropertyNames(intrinsics)) {
7794
7764
  const intrinsic = intrinsics[intrinsicName];
@@ -7797,22 +7767,21 @@ function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
7797
7767
  const match = regexpExec(localePattern, methodName);
7798
7768
  if (match) {
7799
7769
  assert(
7800
- typeof intrinsic[methodName] === 'function',
7801
- d`expected ${q(methodName)} to be a function`,
7802
- );
7770
+ typeof intrinsic[methodName] === 'function',
7771
+ d`expected ${q(methodName)} to be a function`);
7772
+
7803
7773
  const nonLocaleMethodName = `${match[1]}${match[2]}`;
7804
7774
  const method = intrinsic[nonLocaleMethodName];
7805
7775
  assert(
7806
- typeof method === 'function',
7807
- d`function ${q(nonLocaleMethodName)} not found`,
7808
- );
7776
+ typeof method === 'function',
7777
+ d`function ${q(nonLocaleMethodName)} not found`);
7778
+
7809
7779
  defineProperty(intrinsic, methodName, { value: method });
7810
7780
  }
7811
7781
  }
7812
7782
  }
7813
7783
  }
7814
7784
  }$h‍_once.default(tameLocaleMethods);
7815
-
7816
7785
  })
7817
7786
  ,
7818
7787
  // === functors[36] ===
@@ -7832,17 +7801,16 @@ function tameMathObject(mathTaming = 'safe') {
7832
7801
  const initialMath = originalMath; // to follow the naming pattern
7833
7802
 
7834
7803
  const { random: _, ...otherDescriptors } = getOwnPropertyDescriptors(
7835
- originalMath,
7836
- );
7804
+ originalMath);
7805
+
7837
7806
 
7838
7807
  const sharedMath = create(objectPrototype, otherDescriptors);
7839
7808
 
7840
7809
  return {
7841
7810
  '%InitialMath%': initialMath,
7842
- '%SharedMath%': sharedMath,
7843
- };
7844
- }$h‍_once.default(tameMathObject);
7811
+ '%SharedMath%': sharedMath };
7845
7812
 
7813
+ }$h‍_once.default(tameMathObject);
7846
7814
  })
7847
7815
  ,
7848
7816
  // === functors[37] ===
@@ -7876,10 +7844,10 @@ function tameRegExpConstructor(regExpTaming = 'safe') {
7876
7844
  value: RegExpPrototype,
7877
7845
  writable: false,
7878
7846
  enumerable: false,
7879
- configurable: false,
7880
- },
7881
- [speciesSymbol]: getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol),
7882
- });
7847
+ configurable: false },
7848
+
7849
+ [speciesSymbol]: getOwnPropertyDescriptor(FERAL_REG_EXP, speciesSymbol) });
7850
+
7883
7851
  return ResultRegExp;
7884
7852
  };
7885
7853
 
@@ -7890,15 +7858,14 @@ function tameRegExpConstructor(regExpTaming = 'safe') {
7890
7858
  delete RegExpPrototype.compile;
7891
7859
  }
7892
7860
  defineProperties(RegExpPrototype, {
7893
- constructor: { value: SharedRegExp },
7894
- });
7861
+ constructor: { value: SharedRegExp } });
7862
+
7895
7863
 
7896
7864
  return {
7897
7865
  '%InitialRegExp%': InitialRegExp,
7898
- '%SharedRegExp%': SharedRegExp,
7899
- };
7900
- }$h‍_once.default(tameRegExpConstructor);
7866
+ '%SharedRegExp%': SharedRegExp };
7901
7867
 
7868
+ }$h‍_once.default(tameRegExpConstructor);
7902
7869
  })
7903
7870
  ,
7904
7871
  // === functors[38] ===
@@ -7986,7 +7953,10 @@ function asStringPropertyName(path, prop) {
7986
7953
  * @param {Object} intrinsics
7987
7954
  * @param {(Object) => void} markVirtualizedNativeFunction
7988
7955
  */
7989
- function whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction) {
7956
+ function whitelistIntrinsics(
7957
+ intrinsics,
7958
+ markVirtualizedNativeFunction)
7959
+ {
7990
7960
  // These primities are allowed allowed for permits.
7991
7961
  const primitives = ['undefined', 'boolean', 'number', 'string', 'symbol'];
7992
7962
 
@@ -8017,8 +7987,8 @@ function whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction) {
8017
7987
 
8018
7988
  // We can't clean [[prototype]], therefore abort.
8019
7989
  throw new TypeError(
8020
- `Unexpected intrinsic ${path}.__proto__ at ${protoName}`,
8021
- );
7990
+ `Unexpected intrinsic ${path}.__proto__ at ${protoName}`);
7991
+
8022
7992
  }
8023
7993
 
8024
7994
  /*
@@ -8065,8 +8035,8 @@ function whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction) {
8065
8035
  // eslint-disable-next-line valid-typeof
8066
8036
  if (typeof value !== permit) {
8067
8037
  throw new TypeError(
8068
- `At ${path} expected ${permit} not ${typeof value}`,
8069
- );
8038
+ `At ${path} expected ${permit} not ${typeof value}`);
8039
+
8070
8040
  }
8071
8041
  return true;
8072
8042
  }
@@ -8095,8 +8065,8 @@ function whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction) {
8095
8065
  }
8096
8066
  return (
8097
8067
  isAllowedPropertyValue(`${path}<get>`, desc.get, prop, permit.get) &&
8098
- isAllowedPropertyValue(`${path}<set>`, desc.set, prop, permit.set)
8099
- );
8068
+ isAllowedPropertyValue(`${path}<set>`, desc.set, prop, permit.set));
8069
+
8100
8070
  }
8101
8071
 
8102
8072
  /*
@@ -8171,7 +8141,6 @@ function whitelistIntrinsics(intrinsics, markVirtualizedNativeFunction) {
8171
8141
  // removed from the global object by the whitelisting operation.
8172
8142
  visitProperties('intrinsics', intrinsics, whitelist);
8173
8143
  }$h‍_once.default(whitelistIntrinsics);
8174
-
8175
8144
  })
8176
8145
  ,
8177
8146
  // === functors[39] ===
@@ -8296,8 +8265,8 @@ const repairIntrinsics = (options = {}) => {
8296
8265
 
8297
8266
  const {
8298
8267
  getEnvironmentOption: getenv,
8299
- getCapturedEnvironmentOptionNames,
8300
- } = makeEnvironmentCaptor(globalThis);
8268
+ getCapturedEnvironmentOptionNames } =
8269
+ makeEnvironmentCaptor(globalThis);
8301
8270
 
8302
8271
  const {
8303
8272
  errorTaming = getenv('LOCKDOWN_ERROR_TAMING', 'safe'),
@@ -8309,43 +8278,43 @@ const repairIntrinsics = (options = {}) => {
8309
8278
  stackFiltering = getenv('LOCKDOWN_STACK_FILTERING', 'concise'),
8310
8279
  domainTaming = getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'),
8311
8280
  overrideDebug = arrayFilter(
8312
- stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
8313
- /** @param {string} debugName */
8314
- debugName => debugName !== '',
8315
- ),
8281
+ stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
8282
+ /** @param {string} debugName */
8283
+ (debugName) => debugName !== ''),
8284
+
8316
8285
  __allowUnsafeMonkeyPatching__ = getenv(
8317
- '__LOCKDOWN_ALLOW_UNSAFE_MONKEY_PATCHING__',
8318
- 'safe',
8319
- ),
8286
+ '__LOCKDOWN_ALLOW_UNSAFE_MONKEY_PATCHING__',
8287
+ 'safe'),
8288
+
8320
8289
  dateTaming = 'safe', // deprecated
8321
8290
  mathTaming = 'safe', // deprecated
8322
- ...extraOptions
8323
- } = options;
8291
+ ...extraOptions } =
8292
+ options;
8324
8293
 
8325
8294
  const capturedEnvironmentOptionNames = getCapturedEnvironmentOptionNames();
8326
8295
  if (capturedEnvironmentOptionNames.length > 0) {
8327
8296
  // eslint-disable-next-line @endo/no-polymorphic-call
8328
8297
  console.warn(
8329
- `SES Lockdown using options from environment variables ${enJoin(
8330
- arrayMap(capturedEnvironmentOptionNames, q),
8331
- 'and',
8332
- )}`,
8333
- );
8298
+ `SES Lockdown using options from environment variables ${enJoin(
8299
+ arrayMap(capturedEnvironmentOptionNames, q),
8300
+ 'and')
8301
+ }`);
8302
+
8334
8303
  }
8335
8304
 
8336
8305
  // Assert that only supported options were passed.
8337
8306
  // Use Reflect.ownKeys to reject symbol-named properties as well.
8338
8307
  const extraOptionsNames = ownKeys(extraOptions);
8339
8308
  assert(
8340
- extraOptionsNames.length === 0,
8341
- d`lockdown(): non supported option ${q(extraOptionsNames)}`,
8342
- );
8309
+ extraOptionsNames.length === 0,
8310
+ d`lockdown(): non supported option ${q(extraOptionsNames)}`);
8311
+
8343
8312
 
8344
8313
  assert(
8345
- priorLockdown === undefined,
8346
- `Already locked down at ${priorLockdown} (SES_ALREADY_LOCKED_DOWN)`,
8347
- TypeError,
8348
- );
8314
+ priorLockdown === undefined,
8315
+ `Already locked down at ${priorLockdown} (SES_ALREADY_LOCKED_DOWN)`,
8316
+ TypeError);
8317
+
8349
8318
  priorLockdown = new TypeError('Prior lockdown (SES_ALREADY_LOCKED_DOWN)');
8350
8319
  // Tease V8 to generate the stack string and release the closures the stack
8351
8320
  // trace retained:
@@ -8377,15 +8346,15 @@ const repairIntrinsics = (options = {}) => {
8377
8346
  typeof globalThis.Date.now === 'function' &&
8378
8347
  // @ts-ignore
8379
8348
  // eslint-disable-next-line @endo/no-polymorphic-call
8380
- is(globalThis.Date.prototype.constructor.now(), NaN)
8381
- );
8349
+ is(globalThis.Date.prototype.constructor.now(), NaN));
8350
+
8382
8351
  };
8383
8352
 
8384
8353
  if (seemsToBeLockedDown()) {
8385
8354
  // eslint-disable-next-line @endo/no-polymorphic-call
8386
8355
  throw new TypeError(
8387
- `Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)`,
8388
- );
8356
+ `Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)`);
8357
+
8389
8358
  }
8390
8359
 
8391
8360
  /**
@@ -8397,8 +8366,8 @@ const repairIntrinsics = (options = {}) => {
8397
8366
  const {
8398
8367
  addIntrinsics,
8399
8368
  completePrototypes,
8400
- finalIntrinsics,
8401
- } = makeIntrinsicsCollector();
8369
+ finalIntrinsics } =
8370
+ makeIntrinsicsCollector();
8402
8371
 
8403
8372
  addIntrinsics({ harden });
8404
8373
 
@@ -8424,12 +8393,12 @@ const repairIntrinsics = (options = {}) => {
8424
8393
  optGetStackString = intrinsics['%InitialGetStackString%'];
8425
8394
  }
8426
8395
  const consoleRecord = tameConsole(
8427
- // @ts-ignore tameConsole does its own input validation
8428
- consoleTaming,
8429
- errorTrapping,
8430
- optGetStackString,
8431
- );
8432
- globalThis.console = /** @type {Console} */ (consoleRecord.console);
8396
+ // @ts-ignore tameConsole does its own input validation
8397
+ consoleTaming,
8398
+ errorTrapping,
8399
+ optGetStackString);
8400
+
8401
+ globalThis.console = /** @type {Console} */consoleRecord.console;
8433
8402
 
8434
8403
  if (errorTaming === 'unsafe' && globalThis.assert === assert) {
8435
8404
  // If errorTaming is 'unsafe' we replace the global assert with
@@ -8468,8 +8437,8 @@ const repairIntrinsics = (options = {}) => {
8468
8437
  newGlobalPropertyNames: initialGlobalPropertyNames,
8469
8438
  makeCompartmentConstructor,
8470
8439
  safeEvaluate,
8471
- markVirtualizedNativeFunction,
8472
- });
8440
+ markVirtualizedNativeFunction });
8441
+
8473
8442
 
8474
8443
  /**
8475
8444
  * 3. HARDEN to share the intrinsics.
@@ -8517,7 +8486,6 @@ const lockdown = (options = {}) => {
8517
8486
  const hardenIntrinsics = repairIntrinsics(options);
8518
8487
  hardenIntrinsics();
8519
8488
  };$h‍_once.lockdown(lockdown);
8520
-
8521
8489
  })
8522
8490
  ,
8523
8491
  // === functors[40] ===
@@ -8555,17 +8523,15 @@ if (getThis()) {
8555
8523
  const markVirtualizedNativeFunction = tameFunctionToString();
8556
8524
 
8557
8525
  const Compartment = makeCompartmentConstructor(
8558
- makeCompartmentConstructor,
8559
- getGlobalIntrinsics(globalThis),
8560
- markVirtualizedNativeFunction,
8561
- );
8526
+ makeCompartmentConstructor,
8527
+ getGlobalIntrinsics(globalThis),
8528
+ markVirtualizedNativeFunction);
8529
+
8562
8530
 
8563
8531
  assign(globalThis, {
8564
8532
  lockdown,
8565
8533
  Compartment,
8566
- assert,
8567
- });
8568
-
8534
+ assert });
8569
8535
  })
8570
8536
  ,
8571
8537
  ]; // functors end