ses 1.13.1 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +70 -52
  2. package/dist/lockdown.cjs +1346 -948
  3. package/dist/lockdown.mjs +1346 -948
  4. package/dist/lockdown.umd.js +1346 -948
  5. package/dist/lockdown.umd.min.js +1 -1
  6. package/dist/ses-hermes.cjs +1328 -804
  7. package/dist/ses.cjs +1346 -948
  8. package/dist/ses.mjs +1346 -948
  9. package/dist/ses.umd.js +1346 -948
  10. package/dist/ses.umd.min.js +1 -1
  11. package/dist/types.d.cts +115 -141
  12. package/package.json +19 -102
  13. package/src/assert-shim.js +2 -2
  14. package/src/cauterize-property.js +2 -2
  15. package/src/commons.js +111 -50
  16. package/src/compartment.js +25 -8
  17. package/src/enable-property-overrides.js +4 -4
  18. package/src/enablements.js +7 -8
  19. package/src/error/assert.js +126 -101
  20. package/src/error/note-log-args.js +5 -4
  21. package/src/error/stringify-utils.js +2 -2
  22. package/src/error/tame-v8-error-constructor.js +15 -12
  23. package/src/error/types.js +1 -1
  24. package/src/get-anonymous-intrinsics.js +0 -1
  25. package/src/global-object.js +3 -3
  26. package/src/intrinsics.js +8 -8
  27. package/src/lockdown.js +34 -12
  28. package/src/make-hardener.js +4 -4
  29. package/src/module-instance.js +22 -18
  30. package/src/module-link.js +4 -4
  31. package/src/module-load.js +48 -13
  32. package/src/permits-intrinsics.js +8 -8
  33. package/src/permits.js +5 -0
  34. package/src/reporting.js +48 -12
  35. package/src/scope-constants.js +19 -25
  36. package/src/tame-locale-methods.js +2 -2
  37. package/src/tame-regenerator-runtime.js +2 -2
  38. package/src/transforms.js +9 -7
  39. package/types.d.ts +115 -141
  40. package/src/error/README.md +0 -99
  41. package/src/make-lru-cachemap.js +0 -221
package/dist/lockdown.cjs CHANGED
@@ -1,4 +1,4 @@
1
- // ses@1.13.1
1
+ // ses@1.15.0
2
2
  (functors => options => {
3
3
  'use strict';
4
4
 
@@ -99,6 +99,7 @@
99
99
  toStringTagSymbol: cell("toStringTagSymbol"),
100
100
  iteratorSymbol: cell("iteratorSymbol"),
101
101
  matchAllSymbol: cell("matchAllSymbol"),
102
+ replaceSymbol: cell("replaceSymbol"),
102
103
  unscopablesSymbol: cell("unscopablesSymbol"),
103
104
  symbolKeyFor: cell("symbolKeyFor"),
104
105
  symbolFor: cell("symbolFor"),
@@ -130,7 +131,7 @@
130
131
  iteratorPrototype: cell("iteratorPrototype"),
131
132
  typedArrayPrototype: cell("typedArrayPrototype"),
132
133
  uncurryThis: cell("uncurryThis"),
133
- objectHasOwnProperty: cell("objectHasOwnProperty"),
134
+ hasOwn: cell("hasOwn"),
134
135
  arrayFilter: cell("arrayFilter"),
135
136
  arrayForEach: cell("arrayForEach"),
136
137
  arrayIncludes: cell("arrayIncludes"),
@@ -157,16 +158,14 @@
157
158
  setForEach: cell("setForEach"),
158
159
  setHas: cell("setHas"),
159
160
  iterateSet: cell("iterateSet"),
160
- regexpTest: cell("regexpTest"),
161
161
  regexpExec: cell("regexpExec"),
162
+ regexpReplace: cell("regexpReplace"),
162
163
  matchAllRegExp: cell("matchAllRegExp"),
164
+ sealRegexp: cell("sealRegexp"),
163
165
  stringEndsWith: cell("stringEndsWith"),
164
166
  stringIncludes: cell("stringIncludes"),
165
167
  stringIndexOf: cell("stringIndexOf"),
166
168
  stringMatch: cell("stringMatch"),
167
- generatorNext: cell("generatorNext"),
168
- generatorThrow: cell("generatorThrow"),
169
- stringReplace: cell("stringReplace"),
170
169
  stringSearch: cell("stringSearch"),
171
170
  stringSlice: cell("stringSlice"),
172
171
  stringSplit: cell("stringSplit"),
@@ -180,13 +179,14 @@
180
179
  weaksetHas: cell("weaksetHas"),
181
180
  functionToString: cell("functionToString"),
182
181
  functionBind: cell("functionBind"),
182
+ generatorNext: cell("generatorNext"),
183
+ generatorThrow: cell("generatorThrow"),
183
184
  promiseAll: cell("promiseAll"),
184
185
  promiseCatch: cell("promiseCatch"),
185
186
  promiseThen: cell("promiseThen"),
186
187
  finalizationRegistryRegister: cell("finalizationRegistryRegister"),
187
188
  finalizationRegistryUnregister: cell("finalizationRegistryUnregister"),
188
- getConstructorOf: cell("getConstructorOf"),
189
- isObject: cell("isObject"),
189
+ isPrimitive: cell("isPrimitive"),
190
190
  isError: cell("isError"),
191
191
  identity: cell("identity"),
192
192
  FERAL_EVAL: cell("FERAL_EVAL"),
@@ -207,9 +207,11 @@
207
207
  {
208
208
  },
209
209
  {
210
- transferBufferToImmutable: cell("transferBufferToImmutable"),
211
210
  isBufferImmutable: cell("isBufferImmutable"),
212
211
  sliceBufferToImmutable: cell("sliceBufferToImmutable"),
212
+ optTransferBufferToImmutable: cell("optTransferBufferToImmutable"),
213
+ },
214
+ {
213
215
  },
214
216
  {
215
217
  },
@@ -223,7 +225,10 @@
223
225
  {
224
226
  },
225
227
  {
226
- makeLRUCacheMap: cell("makeLRUCacheMap"),
228
+ makeCacheMapKit: cell("makeCacheMapKit"),
229
+ },
230
+ {
231
+ makeCacheMapKit: cell("makeCacheMapKit"),
227
232
  },
228
233
  {
229
234
  makeNoteLogArgsArrayKit: cell("makeNoteLogArgsArrayKit"),
@@ -236,10 +241,10 @@
236
241
  makeError: cell("makeError"),
237
242
  annotateError: cell("annotateError"),
238
243
  loggedErrorHandler: cell("loggedErrorHandler"),
239
- makeAssert: cell("makeAssert"),
240
244
  assert: cell("assert"),
241
245
  assertEqual: cell("assertEqual"),
242
246
  sanitizeError: cell("sanitizeError"),
247
+ makeAssert: cell("makeAssert"),
243
248
  },
244
249
  {
245
250
  isTypedArray: cell("isTypedArray"),
@@ -435,6 +440,8 @@
435
440
 
436
441
  defineProperties(cells[3], getOwnPropertyDescriptors(cells[2]));
437
442
 
443
+ defineProperties(cells[11], {"makeCacheMapKit": { value: cells[10]["makeCacheMapKit"] } });
444
+
438
445
  const namespaces = cells.map(cells => freeze(create(null, {
439
446
  ...cells,
440
447
  // Make this appear like an ESM module namespace object.
@@ -520,6 +527,7 @@ function observeImports(map, importName, importIndex) {
520
527
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
521
528
  iteratorSymbol: cells[0].iteratorSymbol.set,
522
529
  matchAllSymbol: cells[0].matchAllSymbol.set,
530
+ replaceSymbol: cells[0].replaceSymbol.set,
523
531
  unscopablesSymbol: cells[0].unscopablesSymbol.set,
524
532
  symbolKeyFor: cells[0].symbolKeyFor.set,
525
533
  symbolFor: cells[0].symbolFor.set,
@@ -551,7 +559,7 @@ function observeImports(map, importName, importIndex) {
551
559
  iteratorPrototype: cells[0].iteratorPrototype.set,
552
560
  typedArrayPrototype: cells[0].typedArrayPrototype.set,
553
561
  uncurryThis: cells[0].uncurryThis.set,
554
- objectHasOwnProperty: cells[0].objectHasOwnProperty.set,
562
+ hasOwn: cells[0].hasOwn.set,
555
563
  arrayFilter: cells[0].arrayFilter.set,
556
564
  arrayForEach: cells[0].arrayForEach.set,
557
565
  arrayIncludes: cells[0].arrayIncludes.set,
@@ -578,16 +586,14 @@ function observeImports(map, importName, importIndex) {
578
586
  setForEach: cells[0].setForEach.set,
579
587
  setHas: cells[0].setHas.set,
580
588
  iterateSet: cells[0].iterateSet.set,
581
- regexpTest: cells[0].regexpTest.set,
582
589
  regexpExec: cells[0].regexpExec.set,
590
+ regexpReplace: cells[0].regexpReplace.set,
583
591
  matchAllRegExp: cells[0].matchAllRegExp.set,
592
+ sealRegexp: cells[0].sealRegexp.set,
584
593
  stringEndsWith: cells[0].stringEndsWith.set,
585
594
  stringIncludes: cells[0].stringIncludes.set,
586
595
  stringIndexOf: cells[0].stringIndexOf.set,
587
596
  stringMatch: cells[0].stringMatch.set,
588
- generatorNext: cells[0].generatorNext.set,
589
- generatorThrow: cells[0].generatorThrow.set,
590
- stringReplace: cells[0].stringReplace.set,
591
597
  stringSearch: cells[0].stringSearch.set,
592
598
  stringSlice: cells[0].stringSlice.set,
593
599
  stringSplit: cells[0].stringSplit.set,
@@ -601,13 +607,14 @@ function observeImports(map, importName, importIndex) {
601
607
  weaksetHas: cells[0].weaksetHas.set,
602
608
  functionToString: cells[0].functionToString.set,
603
609
  functionBind: cells[0].functionBind.set,
610
+ generatorNext: cells[0].generatorNext.set,
611
+ generatorThrow: cells[0].generatorThrow.set,
604
612
  promiseAll: cells[0].promiseAll.set,
605
613
  promiseCatch: cells[0].promiseCatch.set,
606
614
  promiseThen: cells[0].promiseThen.set,
607
615
  finalizationRegistryRegister: cells[0].finalizationRegistryRegister.set,
608
616
  finalizationRegistryUnregister: cells[0].finalizationRegistryUnregister.set,
609
- getConstructorOf: cells[0].getConstructorOf.set,
610
- isObject: cells[0].isObject.set,
617
+ isPrimitive: cells[0].isPrimitive.set,
611
618
  isError: cells[0].isError.set,
612
619
  identity: cells[0].identity.set,
613
620
  FERAL_EVAL: cells[0].FERAL_EVAL.set,
@@ -662,16 +669,16 @@ function observeImports(map, importName, importIndex) {
662
669
  liveVar: {
663
670
  },
664
671
  onceVar: {
665
- transferBufferToImmutable: cells[4].transferBufferToImmutable.set,
666
672
  isBufferImmutable: cells[4].isBufferImmutable.set,
667
673
  sliceBufferToImmutable: cells[4].sliceBufferToImmutable.set,
674
+ optTransferBufferToImmutable: cells[4].optTransferBufferToImmutable.set,
668
675
  },
669
676
  importMeta: {},
670
677
  });
671
678
  functors[5]({
672
679
  imports(entries) {
673
680
  const map = new Map(entries);
674
- observeImports(map, "./index.js", 4);
681
+ observeImports(map, "./immutable-arraybuffer-pony.js", 4);
675
682
  },
676
683
  liveVar: {
677
684
  },
@@ -682,24 +689,25 @@ function observeImports(map, importName, importIndex) {
682
689
  functors[6]({
683
690
  imports(entries) {
684
691
  const map = new Map(entries);
685
- observeImports(map, "../commons.js", 0);
692
+ observeImports(map, "./src/immutable-arraybuffer-shim.js", 5);
686
693
  },
687
694
  liveVar: {
688
695
  },
689
696
  onceVar: {
690
- an: cells[6].an.set,
691
- bestEffortStringify: cells[6].bestEffortStringify.set,
692
- enJoin: cells[6].enJoin.set,
693
697
  },
694
698
  importMeta: {},
695
699
  });
696
700
  functors[7]({
697
701
  imports(entries) {
698
702
  const map = new Map(entries);
703
+ observeImports(map, "../commons.js", 0);
699
704
  },
700
705
  liveVar: {
701
706
  },
702
707
  onceVar: {
708
+ an: cells[7].an.set,
709
+ bestEffortStringify: cells[7].bestEffortStringify.set,
710
+ enJoin: cells[7].enJoin.set,
703
711
  },
704
712
  importMeta: {},
705
713
  });
@@ -720,71 +728,66 @@ function observeImports(map, importName, importIndex) {
720
728
  liveVar: {
721
729
  },
722
730
  onceVar: {
723
- makeLRUCacheMap: cells[9].makeLRUCacheMap.set,
724
731
  },
725
732
  importMeta: {},
726
733
  });
727
734
  functors[10]({
728
735
  imports(entries) {
729
736
  const map = new Map(entries);
730
- observeImports(map, "../make-lru-cachemap.js", 9);
731
737
  },
732
738
  liveVar: {
733
739
  },
734
740
  onceVar: {
735
- makeNoteLogArgsArrayKit: cells[10].makeNoteLogArgsArrayKit.set,
741
+ makeCacheMapKit: cells[10].makeCacheMapKit.set,
736
742
  },
737
743
  importMeta: {},
738
744
  });
739
745
  functors[11]({
740
746
  imports(entries) {
741
747
  const map = new Map(entries);
742
- observeImports(map, "../commons.js", 0);
743
- observeImports(map, "./stringify-utils.js", 6);
744
- observeImports(map, "./types.js", 7);
745
- observeImports(map, "./internal-types.js", 8);
746
- observeImports(map, "./note-log-args.js", 10);
748
+ observeImports(map, "./src/cachemap.js", 10);
747
749
  },
748
750
  liveVar: {
749
751
  },
750
752
  onceVar: {
751
- quote: cells[11].q.set,
752
- bare: cells[11].b.set,
753
- redactedDetails: cells[11].X.set,
754
- unredactedDetails: cells[11].unredactedDetails.set,
755
- makeError: cells[11].makeError.set,
756
- note: cells[11].annotateError.set,
757
- loggedErrorHandler: cells[11].loggedErrorHandler.set,
758
- makeAssert: cells[11].makeAssert.set,
759
- assert: cells[11].assert.set,
760
- assertEqual: cells[11].assertEqual.set,
761
- sanitizeError: cells[11].sanitizeError.set,
762
753
  },
763
754
  importMeta: {},
764
755
  });
765
756
  functors[12]({
766
757
  imports(entries) {
767
758
  const map = new Map(entries);
768
- observeImports(map, "./commons.js", 0);
769
- observeImports(map, "./error/assert.js", 11);
759
+ observeImports(map, "@endo/cache-map", 11);
770
760
  },
771
761
  liveVar: {
772
762
  },
773
763
  onceVar: {
774
- isTypedArray: cells[12].isTypedArray.set,
775
- makeHardener: cells[12].makeHardener.set,
764
+ makeNoteLogArgsArrayKit: cells[12].makeNoteLogArgsArrayKit.set,
776
765
  },
777
766
  importMeta: {},
778
767
  });
779
768
  functors[13]({
780
769
  imports(entries) {
781
770
  const map = new Map(entries);
782
- observeImports(map, "./commons.js", 0);
771
+ observeImports(map, "../commons.js", 0);
772
+ observeImports(map, "./stringify-utils.js", 7);
773
+ observeImports(map, "./types.js", 8);
774
+ observeImports(map, "./internal-types.js", 9);
775
+ observeImports(map, "./note-log-args.js", 12);
783
776
  },
784
777
  liveVar: {
785
778
  },
786
779
  onceVar: {
787
- cauterizeProperty: cells[13].cauterizeProperty.set,
780
+ quote: cells[13].q.set,
781
+ bare: cells[13].b.set,
782
+ redactedDetails: cells[13].X.set,
783
+ unredactedDetails: cells[13].unredactedDetails.set,
784
+ makeError: cells[13].makeError.set,
785
+ note: cells[13].annotateError.set,
786
+ loggedErrorHandler: cells[13].loggedErrorHandler.set,
787
+ assert: cells[13].assert.set,
788
+ assertEqual: cells[13].assertEqual.set,
789
+ sanitizeError: cells[13].sanitizeError.set,
790
+ makeAssert: cells[13].makeAssert.set,
788
791
  },
789
792
  importMeta: {},
790
793
  });
@@ -792,68 +795,70 @@ function observeImports(map, importName, importIndex) {
792
795
  imports(entries) {
793
796
  const map = new Map(entries);
794
797
  observeImports(map, "./commons.js", 0);
798
+ observeImports(map, "./error/assert.js", 13);
795
799
  },
796
800
  liveVar: {
797
801
  },
798
802
  onceVar: {
799
- NativeErrors: cells[14].NativeErrors.set,
800
- constantProperties: cells[14].constantProperties.set,
801
- universalPropertyNames: cells[14].universalPropertyNames.set,
802
- initialGlobalPropertyNames: cells[14].initialGlobalPropertyNames.set,
803
- sharedGlobalPropertyNames: cells[14].sharedGlobalPropertyNames.set,
804
- uniqueGlobalPropertyNames: cells[14].uniqueGlobalPropertyNames.set,
805
- FunctionInstance: cells[14].FunctionInstance.set,
806
- AsyncFunctionInstance: cells[14].AsyncFunctionInstance.set,
807
- isAccessorPermit: cells[14].isAccessorPermit.set,
808
- permitted: cells[14].permitted.set,
803
+ isTypedArray: cells[14].isTypedArray.set,
804
+ makeHardener: cells[14].makeHardener.set,
809
805
  },
810
806
  importMeta: {},
811
807
  });
812
808
  functors[15]({
813
809
  imports(entries) {
814
810
  const map = new Map(entries);
815
- observeImports(map, "./cauterize-property.js", 13);
816
811
  observeImports(map, "./commons.js", 0);
817
- observeImports(map, "./permits.js", 14);
818
812
  },
819
813
  liveVar: {
820
814
  },
821
815
  onceVar: {
822
- makeIntrinsicsCollector: cells[15].makeIntrinsicsCollector.set,
823
- getGlobalIntrinsics: cells[15].getGlobalIntrinsics.set,
816
+ cauterizeProperty: cells[15].cauterizeProperty.set,
824
817
  },
825
818
  importMeta: {},
826
819
  });
827
820
  functors[16]({
828
821
  imports(entries) {
829
822
  const map = new Map(entries);
830
- observeImports(map, "./permits.js", 14);
831
823
  observeImports(map, "./commons.js", 0);
832
- observeImports(map, "./cauterize-property.js", 13);
833
824
  },
834
825
  liveVar: {
835
826
  },
836
827
  onceVar: {
837
- default: cells[16].default.set,
828
+ NativeErrors: cells[16].NativeErrors.set,
829
+ constantProperties: cells[16].constantProperties.set,
830
+ universalPropertyNames: cells[16].universalPropertyNames.set,
831
+ initialGlobalPropertyNames: cells[16].initialGlobalPropertyNames.set,
832
+ sharedGlobalPropertyNames: cells[16].sharedGlobalPropertyNames.set,
833
+ uniqueGlobalPropertyNames: cells[16].uniqueGlobalPropertyNames.set,
834
+ FunctionInstance: cells[16].FunctionInstance.set,
835
+ AsyncFunctionInstance: cells[16].AsyncFunctionInstance.set,
836
+ isAccessorPermit: cells[16].isAccessorPermit.set,
837
+ permitted: cells[16].permitted.set,
838
838
  },
839
839
  importMeta: {},
840
840
  });
841
841
  functors[17]({
842
842
  imports(entries) {
843
843
  const map = new Map(entries);
844
+ observeImports(map, "./cauterize-property.js", 15);
844
845
  observeImports(map, "./commons.js", 0);
846
+ observeImports(map, "./permits.js", 16);
845
847
  },
846
848
  liveVar: {
847
849
  },
848
850
  onceVar: {
849
- default: cells[17].default.set,
851
+ makeIntrinsicsCollector: cells[17].makeIntrinsicsCollector.set,
852
+ getGlobalIntrinsics: cells[17].getGlobalIntrinsics.set,
850
853
  },
851
854
  importMeta: {},
852
855
  });
853
856
  functors[18]({
854
857
  imports(entries) {
855
858
  const map = new Map(entries);
859
+ observeImports(map, "./permits.js", 16);
856
860
  observeImports(map, "./commons.js", 0);
861
+ observeImports(map, "./cauterize-property.js", 15);
857
862
  },
858
863
  liveVar: {
859
864
  },
@@ -894,9 +899,7 @@ function observeImports(map, importName, importIndex) {
894
899
  liveVar: {
895
900
  },
896
901
  onceVar: {
897
- minEnablements: cells[21].minEnablements.set,
898
- moderateEnablements: cells[21].moderateEnablements.set,
899
- severeEnablements: cells[21].severeEnablements.set,
902
+ default: cells[21].default.set,
900
903
  },
901
904
  importMeta: {},
902
905
  });
@@ -904,7 +907,6 @@ function observeImports(map, importName, importIndex) {
904
907
  imports(entries) {
905
908
  const map = new Map(entries);
906
909
  observeImports(map, "./commons.js", 0);
907
- observeImports(map, "./enablements.js", 21);
908
910
  },
909
911
  liveVar: {
910
912
  },
@@ -917,23 +919,26 @@ function observeImports(map, importName, importIndex) {
917
919
  imports(entries) {
918
920
  const map = new Map(entries);
919
921
  observeImports(map, "./commons.js", 0);
920
- observeImports(map, "./error/assert.js", 11);
921
922
  },
922
923
  liveVar: {
923
924
  },
924
925
  onceVar: {
925
- default: cells[23].default.set,
926
+ minEnablements: cells[23].minEnablements.set,
927
+ moderateEnablements: cells[23].moderateEnablements.set,
928
+ severeEnablements: cells[23].severeEnablements.set,
926
929
  },
927
930
  importMeta: {},
928
931
  });
929
932
  functors[24]({
930
933
  imports(entries) {
931
934
  const map = new Map(entries);
935
+ observeImports(map, "./commons.js", 0);
936
+ observeImports(map, "./enablements.js", 23);
932
937
  },
933
938
  liveVar: {
934
939
  },
935
940
  onceVar: {
936
- makeEvalFunction: cells[24].makeEvalFunction.set,
941
+ default: cells[24].default.set,
937
942
  },
938
943
  importMeta: {},
939
944
  });
@@ -941,30 +946,23 @@ function observeImports(map, importName, importIndex) {
941
946
  imports(entries) {
942
947
  const map = new Map(entries);
943
948
  observeImports(map, "./commons.js", 0);
944
- observeImports(map, "./error/assert.js", 11);
949
+ observeImports(map, "./error/assert.js", 13);
945
950
  },
946
951
  liveVar: {
947
952
  },
948
953
  onceVar: {
949
- makeFunctionConstructor: cells[25].makeFunctionConstructor.set,
954
+ default: cells[25].default.set,
950
955
  },
951
956
  importMeta: {},
952
957
  });
953
958
  functors[26]({
954
959
  imports(entries) {
955
960
  const map = new Map(entries);
956
- observeImports(map, "./commons.js", 0);
957
- observeImports(map, "./make-eval-function.js", 24);
958
- observeImports(map, "./make-function-constructor.js", 25);
959
- observeImports(map, "./permits.js", 14);
960
961
  },
961
962
  liveVar: {
962
963
  },
963
964
  onceVar: {
964
- setGlobalObjectSymbolUnscopables: cells[26].setGlobalObjectSymbolUnscopables.set,
965
- setGlobalObjectConstantProperties: cells[26].setGlobalObjectConstantProperties.set,
966
- setGlobalObjectMutableProperties: cells[26].setGlobalObjectMutableProperties.set,
967
- setGlobalObjectEvaluators: cells[26].setGlobalObjectEvaluators.set,
965
+ makeEvalFunction: cells[26].makeEvalFunction.set,
968
966
  },
969
967
  importMeta: {},
970
968
  });
@@ -972,14 +970,12 @@ function observeImports(map, importName, importIndex) {
972
970
  imports(entries) {
973
971
  const map = new Map(entries);
974
972
  observeImports(map, "./commons.js", 0);
975
- observeImports(map, "./error/assert.js", 11);
973
+ observeImports(map, "./error/assert.js", 13);
976
974
  },
977
975
  liveVar: {
978
976
  },
979
977
  onceVar: {
980
- alwaysThrowHandler: cells[27].alwaysThrowHandler.set,
981
- strictScopeTerminatorHandler: cells[27].strictScopeTerminatorHandler.set,
982
- strictScopeTerminator: cells[27].strictScopeTerminator.set,
978
+ makeFunctionConstructor: cells[27].makeFunctionConstructor.set,
983
979
  },
984
980
  importMeta: {},
985
981
  });
@@ -987,12 +983,17 @@ function observeImports(map, importName, importIndex) {
987
983
  imports(entries) {
988
984
  const map = new Map(entries);
989
985
  observeImports(map, "./commons.js", 0);
990
- observeImports(map, "./strict-scope-terminator.js", 27);
986
+ observeImports(map, "./make-eval-function.js", 26);
987
+ observeImports(map, "./make-function-constructor.js", 27);
988
+ observeImports(map, "./permits.js", 16);
991
989
  },
992
990
  liveVar: {
993
991
  },
994
992
  onceVar: {
995
- createSloppyGlobalsScopeTerminator: cells[28].createSloppyGlobalsScopeTerminator.set,
993
+ setGlobalObjectSymbolUnscopables: cells[28].setGlobalObjectSymbolUnscopables.set,
994
+ setGlobalObjectConstantProperties: cells[28].setGlobalObjectConstantProperties.set,
995
+ setGlobalObjectMutableProperties: cells[28].setGlobalObjectMutableProperties.set,
996
+ setGlobalObjectEvaluators: cells[28].setGlobalObjectEvaluators.set,
996
997
  },
997
998
  importMeta: {},
998
999
  });
@@ -1000,12 +1001,14 @@ function observeImports(map, importName, importIndex) {
1000
1001
  imports(entries) {
1001
1002
  const map = new Map(entries);
1002
1003
  observeImports(map, "./commons.js", 0);
1003
- observeImports(map, "./error/assert.js", 11);
1004
+ observeImports(map, "./error/assert.js", 13);
1004
1005
  },
1005
1006
  liveVar: {
1006
1007
  },
1007
1008
  onceVar: {
1008
- makeEvalScopeKit: cells[29].makeEvalScopeKit.set,
1009
+ alwaysThrowHandler: cells[29].alwaysThrowHandler.set,
1010
+ strictScopeTerminatorHandler: cells[29].strictScopeTerminatorHandler.set,
1011
+ strictScopeTerminator: cells[29].strictScopeTerminator.set,
1009
1012
  },
1010
1013
  importMeta: {},
1011
1014
  });
@@ -1013,11 +1016,12 @@ function observeImports(map, importName, importIndex) {
1013
1016
  imports(entries) {
1014
1017
  const map = new Map(entries);
1015
1018
  observeImports(map, "./commons.js", 0);
1019
+ observeImports(map, "./strict-scope-terminator.js", 29);
1016
1020
  },
1017
1021
  liveVar: {
1018
1022
  },
1019
1023
  onceVar: {
1020
- getSourceURL: cells[30].getSourceURL.set,
1024
+ createSloppyGlobalsScopeTerminator: cells[30].createSloppyGlobalsScopeTerminator.set,
1021
1025
  },
1022
1026
  importMeta: {},
1023
1027
  });
@@ -1025,19 +1029,12 @@ function observeImports(map, importName, importIndex) {
1025
1029
  imports(entries) {
1026
1030
  const map = new Map(entries);
1027
1031
  observeImports(map, "./commons.js", 0);
1028
- observeImports(map, "./get-source-url.js", 30);
1032
+ observeImports(map, "./error/assert.js", 13);
1029
1033
  },
1030
1034
  liveVar: {
1031
1035
  },
1032
1036
  onceVar: {
1033
- rejectHtmlComments: cells[31].rejectHtmlComments.set,
1034
- evadeHtmlCommentTest: cells[31].evadeHtmlCommentTest.set,
1035
- rejectImportExpressions: cells[31].rejectImportExpressions.set,
1036
- evadeImportExpressionTest: cells[31].evadeImportExpressionTest.set,
1037
- rejectSomeDirectEvalExpressions: cells[31].rejectSomeDirectEvalExpressions.set,
1038
- mandatoryTransforms: cells[31].mandatoryTransforms.set,
1039
- applyTransforms: cells[31].applyTransforms.set,
1040
- transforms: cells[31].transforms.set,
1037
+ makeEvalScopeKit: cells[31].makeEvalScopeKit.set,
1041
1038
  },
1042
1039
  importMeta: {},
1043
1040
  });
@@ -1049,8 +1046,7 @@ function observeImports(map, importName, importIndex) {
1049
1046
  liveVar: {
1050
1047
  },
1051
1048
  onceVar: {
1052
- isValidIdentifierName: cells[32].isValidIdentifierName.set,
1053
- getScopeConstants: cells[32].getScopeConstants.set,
1049
+ getSourceURL: cells[32].getSourceURL.set,
1054
1050
  },
1055
1051
  importMeta: {},
1056
1052
  });
@@ -1058,12 +1054,19 @@ function observeImports(map, importName, importIndex) {
1058
1054
  imports(entries) {
1059
1055
  const map = new Map(entries);
1060
1056
  observeImports(map, "./commons.js", 0);
1061
- observeImports(map, "./scope-constants.js", 32);
1057
+ observeImports(map, "./get-source-url.js", 32);
1062
1058
  },
1063
1059
  liveVar: {
1064
1060
  },
1065
1061
  onceVar: {
1066
- makeEvaluate: cells[33].makeEvaluate.set,
1062
+ rejectHtmlComments: cells[33].rejectHtmlComments.set,
1063
+ evadeHtmlCommentTest: cells[33].evadeHtmlCommentTest.set,
1064
+ rejectImportExpressions: cells[33].rejectImportExpressions.set,
1065
+ evadeImportExpressionTest: cells[33].evadeImportExpressionTest.set,
1066
+ rejectSomeDirectEvalExpressions: cells[33].rejectSomeDirectEvalExpressions.set,
1067
+ mandatoryTransforms: cells[33].mandatoryTransforms.set,
1068
+ applyTransforms: cells[33].applyTransforms.set,
1069
+ transforms: cells[33].transforms.set,
1067
1070
  },
1068
1071
  importMeta: {},
1069
1072
  });
@@ -1071,17 +1074,12 @@ function observeImports(map, importName, importIndex) {
1071
1074
  imports(entries) {
1072
1075
  const map = new Map(entries);
1073
1076
  observeImports(map, "./commons.js", 0);
1074
- observeImports(map, "./strict-scope-terminator.js", 27);
1075
- observeImports(map, "./sloppy-globals-scope-terminator.js", 28);
1076
- observeImports(map, "./eval-scope.js", 29);
1077
- observeImports(map, "./transforms.js", 31);
1078
- observeImports(map, "./make-evaluate.js", 33);
1079
- observeImports(map, "./error/assert.js", 11);
1080
1077
  },
1081
1078
  liveVar: {
1082
1079
  },
1083
1080
  onceVar: {
1084
- makeSafeEvaluator: cells[34].makeSafeEvaluator.set,
1081
+ isValidIdentifierName: cells[34].isValidIdentifierName.set,
1082
+ getScopeConstants: cells[34].getScopeConstants.set,
1085
1083
  },
1086
1084
  importMeta: {},
1087
1085
  });
@@ -1089,11 +1087,12 @@ function observeImports(map, importName, importIndex) {
1089
1087
  imports(entries) {
1090
1088
  const map = new Map(entries);
1091
1089
  observeImports(map, "./commons.js", 0);
1090
+ observeImports(map, "./scope-constants.js", 34);
1092
1091
  },
1093
1092
  liveVar: {
1094
1093
  },
1095
1094
  onceVar: {
1096
- tameFunctionToString: cells[35].tameFunctionToString.set,
1095
+ makeEvaluate: cells[35].makeEvaluate.set,
1097
1096
  },
1098
1097
  importMeta: {},
1099
1098
  });
@@ -1101,11 +1100,17 @@ function observeImports(map, importName, importIndex) {
1101
1100
  imports(entries) {
1102
1101
  const map = new Map(entries);
1103
1102
  observeImports(map, "./commons.js", 0);
1103
+ observeImports(map, "./strict-scope-terminator.js", 29);
1104
+ observeImports(map, "./sloppy-globals-scope-terminator.js", 30);
1105
+ observeImports(map, "./eval-scope.js", 31);
1106
+ observeImports(map, "./transforms.js", 33);
1107
+ observeImports(map, "./make-evaluate.js", 35);
1108
+ observeImports(map, "./error/assert.js", 13);
1104
1109
  },
1105
1110
  liveVar: {
1106
1111
  },
1107
1112
  onceVar: {
1108
- tameDomains: cells[36].tameDomains.set,
1113
+ makeSafeEvaluator: cells[36].makeSafeEvaluator.set,
1109
1114
  },
1110
1115
  importMeta: {},
1111
1116
  });
@@ -1117,37 +1122,31 @@ function observeImports(map, importName, importIndex) {
1117
1122
  liveVar: {
1118
1123
  },
1119
1124
  onceVar: {
1120
- tameModuleSource: cells[37].tameModuleSource.set,
1125
+ tameFunctionToString: cells[37].tameFunctionToString.set,
1121
1126
  },
1122
1127
  importMeta: {},
1123
1128
  });
1124
1129
  functors[38]({
1125
1130
  imports(entries) {
1126
1131
  const map = new Map(entries);
1127
- observeImports(map, "../commons.js", 0);
1132
+ observeImports(map, "./commons.js", 0);
1128
1133
  },
1129
1134
  liveVar: {
1130
1135
  },
1131
1136
  onceVar: {
1132
- consoleLevelMethods: cells[38].consoleLevelMethods.set,
1133
- consoleOtherMethods: cells[38].consoleOtherMethods.set,
1134
- makeLoggingConsoleKit: cells[38].makeLoggingConsoleKit.set,
1135
- pumpLogToConsole: cells[38].pumpLogToConsole.set,
1136
- makeCausalConsole: cells[38].makeCausalConsole.set,
1137
- defineCausalConsoleFromLogger: cells[38].defineCausalConsoleFromLogger.set,
1138
- filterConsole: cells[38].filterConsole.set,
1137
+ tameDomains: cells[38].tameDomains.set,
1139
1138
  },
1140
1139
  importMeta: {},
1141
1140
  });
1142
1141
  functors[39]({
1143
1142
  imports(entries) {
1144
1143
  const map = new Map(entries);
1145
- observeImports(map, "../commons.js", 0);
1144
+ observeImports(map, "./commons.js", 0);
1146
1145
  },
1147
1146
  liveVar: {
1148
1147
  },
1149
1148
  onceVar: {
1150
- makeRejectionHandlers: cells[39].makeRejectionHandlers.set,
1149
+ tameModuleSource: cells[39].tameModuleSource.set,
1151
1150
  },
1152
1151
  importMeta: {},
1153
1152
  });
@@ -1155,14 +1154,17 @@ function observeImports(map, importName, importIndex) {
1155
1154
  imports(entries) {
1156
1155
  const map = new Map(entries);
1157
1156
  observeImports(map, "../commons.js", 0);
1158
- observeImports(map, "./assert.js", 11);
1159
- observeImports(map, "./console.js", 38);
1160
- observeImports(map, "./unhandled-rejection.js", 39);
1161
1157
  },
1162
1158
  liveVar: {
1163
1159
  },
1164
1160
  onceVar: {
1165
- tameConsole: cells[40].tameConsole.set,
1161
+ consoleLevelMethods: cells[40].consoleLevelMethods.set,
1162
+ consoleOtherMethods: cells[40].consoleOtherMethods.set,
1163
+ makeLoggingConsoleKit: cells[40].makeLoggingConsoleKit.set,
1164
+ pumpLogToConsole: cells[40].pumpLogToConsole.set,
1165
+ makeCausalConsole: cells[40].makeCausalConsole.set,
1166
+ defineCausalConsoleFromLogger: cells[40].defineCausalConsoleFromLogger.set,
1167
+ filterConsole: cells[40].filterConsole.set,
1166
1168
  },
1167
1169
  importMeta: {},
1168
1170
  });
@@ -1174,9 +1176,7 @@ function observeImports(map, importName, importIndex) {
1174
1176
  liveVar: {
1175
1177
  },
1176
1178
  onceVar: {
1177
- filterFileName: cells[41].filterFileName.set,
1178
- shortenCallSiteString: cells[41].shortenCallSiteString.set,
1179
- tameV8ErrorConstructor: cells[41].tameV8ErrorConstructor.set,
1179
+ makeRejectionHandlers: cells[41].makeRejectionHandlers.set,
1180
1180
  },
1181
1181
  importMeta: {},
1182
1182
  });
@@ -1184,126 +1184,119 @@ function observeImports(map, importName, importIndex) {
1184
1184
  imports(entries) {
1185
1185
  const map = new Map(entries);
1186
1186
  observeImports(map, "../commons.js", 0);
1187
- observeImports(map, "../permits.js", 14);
1188
- observeImports(map, "./tame-v8-error-constructor.js", 41);
1187
+ observeImports(map, "./assert.js", 13);
1188
+ observeImports(map, "./console.js", 40);
1189
+ observeImports(map, "./unhandled-rejection.js", 41);
1189
1190
  },
1190
1191
  liveVar: {
1191
1192
  },
1192
1193
  onceVar: {
1193
- default: cells[42].default.set,
1194
+ tameConsole: cells[42].tameConsole.set,
1194
1195
  },
1195
1196
  importMeta: {},
1196
1197
  });
1197
1198
  functors[43]({
1198
1199
  imports(entries) {
1199
1200
  const map = new Map(entries);
1200
- observeImports(map, "@endo/env-options", 3);
1201
- observeImports(map, "./commons.js", 0);
1202
- observeImports(map, "./error/assert.js", 11);
1201
+ observeImports(map, "../commons.js", 0);
1203
1202
  },
1204
1203
  liveVar: {
1205
1204
  },
1206
1205
  onceVar: {
1207
- makeAlias: cells[43].makeAlias.set,
1208
- load: cells[43].load.set,
1209
- loadNow: cells[43].loadNow.set,
1206
+ filterFileName: cells[43].filterFileName.set,
1207
+ shortenCallSiteString: cells[43].shortenCallSiteString.set,
1208
+ tameV8ErrorConstructor: cells[43].tameV8ErrorConstructor.set,
1210
1209
  },
1211
1210
  importMeta: {},
1212
1211
  });
1213
1212
  functors[44]({
1214
1213
  imports(entries) {
1215
1214
  const map = new Map(entries);
1216
- observeImports(map, "./module-load.js", 43);
1217
- observeImports(map, "./commons.js", 0);
1218
- observeImports(map, "./error/assert.js", 11);
1215
+ observeImports(map, "../commons.js", 0);
1216
+ observeImports(map, "../permits.js", 16);
1217
+ observeImports(map, "./tame-v8-error-constructor.js", 43);
1219
1218
  },
1220
1219
  liveVar: {
1221
1220
  },
1222
1221
  onceVar: {
1223
- deferExports: cells[44].deferExports.set,
1224
- getDeferredExports: cells[44].getDeferredExports.set,
1222
+ default: cells[44].default.set,
1225
1223
  },
1226
1224
  importMeta: {},
1227
1225
  });
1228
1226
  functors[45]({
1229
1227
  imports(entries) {
1230
1228
  const map = new Map(entries);
1229
+ observeImports(map, "@endo/env-options", 3);
1231
1230
  observeImports(map, "./commons.js", 0);
1232
- observeImports(map, "./transforms.js", 31);
1233
- observeImports(map, "./make-safe-evaluator.js", 34);
1231
+ observeImports(map, "./error/assert.js", 13);
1234
1232
  },
1235
1233
  liveVar: {
1236
1234
  },
1237
1235
  onceVar: {
1238
- provideCompartmentEvaluator: cells[45].provideCompartmentEvaluator.set,
1239
- compartmentEvaluate: cells[45].compartmentEvaluate.set,
1236
+ makeAlias: cells[45].makeAlias.set,
1237
+ load: cells[45].load.set,
1238
+ loadNow: cells[45].loadNow.set,
1240
1239
  },
1241
1240
  importMeta: {},
1242
1241
  });
1243
1242
  functors[46]({
1244
1243
  imports(entries) {
1245
1244
  const map = new Map(entries);
1246
- observeImports(map, "./error/assert.js", 11);
1247
- observeImports(map, "./module-proxy.js", 44);
1245
+ observeImports(map, "./module-load.js", 45);
1248
1246
  observeImports(map, "./commons.js", 0);
1249
- observeImports(map, "./compartment-evaluate.js", 45);
1247
+ observeImports(map, "./error/assert.js", 13);
1250
1248
  },
1251
1249
  liveVar: {
1252
1250
  },
1253
1251
  onceVar: {
1254
- makeVirtualModuleInstance: cells[46].makeVirtualModuleInstance.set,
1255
- makeModuleInstance: cells[46].makeModuleInstance.set,
1252
+ deferExports: cells[46].deferExports.set,
1253
+ getDeferredExports: cells[46].getDeferredExports.set,
1256
1254
  },
1257
1255
  importMeta: {},
1258
1256
  });
1259
1257
  functors[47]({
1260
1258
  imports(entries) {
1261
1259
  const map = new Map(entries);
1262
- observeImports(map, "./error/assert.js", 11);
1263
- observeImports(map, "./module-instance.js", 46);
1264
1260
  observeImports(map, "./commons.js", 0);
1261
+ observeImports(map, "./transforms.js", 33);
1262
+ observeImports(map, "./make-safe-evaluator.js", 36);
1265
1263
  },
1266
1264
  liveVar: {
1267
1265
  },
1268
1266
  onceVar: {
1269
- link: cells[47].link.set,
1270
- instantiate: cells[47].instantiate.set,
1267
+ provideCompartmentEvaluator: cells[47].provideCompartmentEvaluator.set,
1268
+ compartmentEvaluate: cells[47].compartmentEvaluate.set,
1271
1269
  },
1272
1270
  importMeta: {},
1273
1271
  });
1274
1272
  functors[48]({
1275
1273
  imports(entries) {
1276
1274
  const map = new Map(entries);
1275
+ observeImports(map, "./error/assert.js", 13);
1276
+ observeImports(map, "./module-proxy.js", 46);
1277
1277
  observeImports(map, "./commons.js", 0);
1278
- observeImports(map, "./global-object.js", 26);
1279
- observeImports(map, "./error/assert.js", 11);
1280
- observeImports(map, "./permits.js", 14);
1281
- observeImports(map, "./module-load.js", 43);
1282
- observeImports(map, "./module-link.js", 47);
1283
- observeImports(map, "./module-proxy.js", 44);
1284
- observeImports(map, "./compartment-evaluate.js", 45);
1285
- observeImports(map, "./make-safe-evaluator.js", 34);
1278
+ observeImports(map, "./compartment-evaluate.js", 47);
1286
1279
  },
1287
1280
  liveVar: {
1288
1281
  },
1289
1282
  onceVar: {
1290
- InertCompartment: cells[48].InertCompartment.set,
1291
- CompartmentPrototype: cells[48].CompartmentPrototype.set,
1292
- compartmentOptions: cells[48].compartmentOptions.set,
1293
- makeCompartmentConstructor: cells[48].makeCompartmentConstructor.set,
1283
+ makeVirtualModuleInstance: cells[48].makeVirtualModuleInstance.set,
1284
+ makeModuleInstance: cells[48].makeModuleInstance.set,
1294
1285
  },
1295
1286
  importMeta: {},
1296
1287
  });
1297
1288
  functors[49]({
1298
1289
  imports(entries) {
1299
1290
  const map = new Map(entries);
1291
+ observeImports(map, "./error/assert.js", 13);
1292
+ observeImports(map, "./module-instance.js", 48);
1300
1293
  observeImports(map, "./commons.js", 0);
1301
- observeImports(map, "./compartment.js", 48);
1302
1294
  },
1303
1295
  liveVar: {
1304
1296
  },
1305
1297
  onceVar: {
1306
- getAnonymousIntrinsics: cells[49].getAnonymousIntrinsics.set,
1298
+ link: cells[49].link.set,
1299
+ instantiate: cells[49].instantiate.set,
1307
1300
  },
1308
1301
  importMeta: {},
1309
1302
  });
@@ -1311,11 +1304,22 @@ function observeImports(map, importName, importIndex) {
1311
1304
  imports(entries) {
1312
1305
  const map = new Map(entries);
1313
1306
  observeImports(map, "./commons.js", 0);
1307
+ observeImports(map, "./global-object.js", 28);
1308
+ observeImports(map, "./error/assert.js", 13);
1309
+ observeImports(map, "./permits.js", 16);
1310
+ observeImports(map, "./module-load.js", 45);
1311
+ observeImports(map, "./module-link.js", 49);
1312
+ observeImports(map, "./module-proxy.js", 46);
1313
+ observeImports(map, "./compartment-evaluate.js", 47);
1314
+ observeImports(map, "./make-safe-evaluator.js", 36);
1314
1315
  },
1315
1316
  liveVar: {
1316
1317
  },
1317
1318
  onceVar: {
1318
- tameHarden: cells[50].tameHarden.set,
1319
+ InertCompartment: cells[50].InertCompartment.set,
1320
+ CompartmentPrototype: cells[50].CompartmentPrototype.set,
1321
+ compartmentOptions: cells[50].compartmentOptions.set,
1322
+ makeCompartmentConstructor: cells[50].makeCompartmentConstructor.set,
1319
1323
  },
1320
1324
  importMeta: {},
1321
1325
  });
@@ -1323,11 +1327,12 @@ function observeImports(map, importName, importIndex) {
1323
1327
  imports(entries) {
1324
1328
  const map = new Map(entries);
1325
1329
  observeImports(map, "./commons.js", 0);
1330
+ observeImports(map, "./compartment.js", 50);
1326
1331
  },
1327
1332
  liveVar: {
1328
1333
  },
1329
1334
  onceVar: {
1330
- tameSymbolConstructor: cells[51].tameSymbolConstructor.set,
1335
+ getAnonymousIntrinsics: cells[51].getAnonymousIntrinsics.set,
1331
1336
  },
1332
1337
  importMeta: {},
1333
1338
  });
@@ -1339,8 +1344,7 @@ function observeImports(map, importName, importIndex) {
1339
1344
  liveVar: {
1340
1345
  },
1341
1346
  onceVar: {
1342
- tameFauxDataProperty: cells[52].tameFauxDataProperty.set,
1343
- tameFauxDataProperties: cells[52].tameFauxDataProperties.set,
1347
+ tameHarden: cells[52].tameHarden.set,
1344
1348
  },
1345
1349
  importMeta: {},
1346
1350
  });
@@ -1352,7 +1356,7 @@ function observeImports(map, importName, importIndex) {
1352
1356
  liveVar: {
1353
1357
  },
1354
1358
  onceVar: {
1355
- tameRegeneratorRuntime: cells[53].tameRegeneratorRuntime.set,
1359
+ tameSymbolConstructor: cells[53].tameSymbolConstructor.set,
1356
1360
  },
1357
1361
  importMeta: {},
1358
1362
  });
@@ -1364,7 +1368,8 @@ function observeImports(map, importName, importIndex) {
1364
1368
  liveVar: {
1365
1369
  },
1366
1370
  onceVar: {
1367
- shimArrayBufferTransfer: cells[54].shimArrayBufferTransfer.set,
1371
+ tameFauxDataProperty: cells[54].tameFauxDataProperty.set,
1372
+ tameFauxDataProperties: cells[54].tameFauxDataProperties.set,
1368
1373
  },
1369
1374
  importMeta: {},
1370
1375
  });
@@ -1372,89 +1377,86 @@ function observeImports(map, importName, importIndex) {
1372
1377
  imports(entries) {
1373
1378
  const map = new Map(entries);
1374
1379
  observeImports(map, "./commons.js", 0);
1375
- observeImports(map, "./error/assert.js", 11);
1376
1380
  },
1377
1381
  liveVar: {
1378
1382
  },
1379
1383
  onceVar: {
1380
- chooseReporter: cells[55].chooseReporter.set,
1381
- reportInGroup: cells[55].reportInGroup.set,
1384
+ tameRegeneratorRuntime: cells[55].tameRegeneratorRuntime.set,
1382
1385
  },
1383
1386
  importMeta: {},
1384
1387
  });
1385
1388
  functors[56]({
1386
1389
  imports(entries) {
1387
1390
  const map = new Map(entries);
1388
- observeImports(map, "@endo/env-options", 3);
1389
- observeImports(map, "@endo/immutable-arraybuffer/shim.js", 5);
1390
1391
  observeImports(map, "./commons.js", 0);
1391
- observeImports(map, "./make-hardener.js", 12);
1392
- observeImports(map, "./intrinsics.js", 15);
1393
- observeImports(map, "./permits-intrinsics.js", 16);
1394
- observeImports(map, "./tame-function-constructors.js", 17);
1395
- observeImports(map, "./tame-date-constructor.js", 18);
1396
- observeImports(map, "./tame-math-object.js", 19);
1397
- observeImports(map, "./tame-regexp-constructor.js", 20);
1398
- observeImports(map, "./enable-property-overrides.js", 22);
1399
- observeImports(map, "./tame-locale-methods.js", 23);
1400
- observeImports(map, "./global-object.js", 26);
1401
- observeImports(map, "./make-safe-evaluator.js", 34);
1402
- observeImports(map, "./permits.js", 14);
1403
- observeImports(map, "./tame-function-tostring.js", 35);
1404
- observeImports(map, "./tame-domains.js", 36);
1405
- observeImports(map, "./tame-module-source.js", 37);
1406
- observeImports(map, "./error/tame-console.js", 40);
1407
- observeImports(map, "./error/tame-error-constructor.js", 42);
1408
- observeImports(map, "./error/assert.js", 11);
1409
- observeImports(map, "./get-anonymous-intrinsics.js", 49);
1410
- observeImports(map, "./compartment.js", 48);
1411
- observeImports(map, "./tame-harden.js", 50);
1412
- observeImports(map, "./tame-symbol-constructor.js", 51);
1413
- observeImports(map, "./tame-faux-data-properties.js", 52);
1414
- observeImports(map, "./tame-regenerator-runtime.js", 53);
1415
- observeImports(map, "./shim-arraybuffer-transfer.js", 54);
1416
- observeImports(map, "./reporting.js", 55);
1417
1392
  },
1418
1393
  liveVar: {
1419
1394
  },
1420
1395
  onceVar: {
1421
- repairIntrinsics: cells[56].repairIntrinsics.set,
1396
+ shimArrayBufferTransfer: cells[56].shimArrayBufferTransfer.set,
1422
1397
  },
1423
1398
  importMeta: {},
1424
1399
  });
1425
1400
  functors[57]({
1426
1401
  imports(entries) {
1427
1402
  const map = new Map(entries);
1428
- observeImports(map, "./assert-sloppy-mode.js", 1);
1429
1403
  observeImports(map, "./commons.js", 0);
1430
- observeImports(map, "./lockdown.js", 56);
1404
+ observeImports(map, "./error/assert.js", 13);
1431
1405
  },
1432
1406
  liveVar: {
1433
1407
  },
1434
1408
  onceVar: {
1409
+ chooseReporter: cells[57].chooseReporter.set,
1410
+ reportInGroup: cells[57].reportInGroup.set,
1435
1411
  },
1436
1412
  importMeta: {},
1437
1413
  });
1438
1414
  functors[58]({
1439
1415
  imports(entries) {
1440
1416
  const map = new Map(entries);
1417
+ observeImports(map, "@endo/env-options", 3);
1418
+ observeImports(map, "@endo/immutable-arraybuffer/shim.js", 6);
1441
1419
  observeImports(map, "./commons.js", 0);
1442
- observeImports(map, "./compartment.js", 48);
1443
- observeImports(map, "./tame-function-tostring.js", 35);
1444
- observeImports(map, "./intrinsics.js", 15);
1445
- observeImports(map, "./reporting.js", 55);
1420
+ observeImports(map, "./make-hardener.js", 14);
1421
+ observeImports(map, "./intrinsics.js", 17);
1422
+ observeImports(map, "./permits-intrinsics.js", 18);
1423
+ observeImports(map, "./tame-function-constructors.js", 19);
1424
+ observeImports(map, "./tame-date-constructor.js", 20);
1425
+ observeImports(map, "./tame-math-object.js", 21);
1426
+ observeImports(map, "./tame-regexp-constructor.js", 22);
1427
+ observeImports(map, "./enable-property-overrides.js", 24);
1428
+ observeImports(map, "./tame-locale-methods.js", 25);
1429
+ observeImports(map, "./global-object.js", 28);
1430
+ observeImports(map, "./make-safe-evaluator.js", 36);
1431
+ observeImports(map, "./permits.js", 16);
1432
+ observeImports(map, "./tame-function-tostring.js", 37);
1433
+ observeImports(map, "./tame-domains.js", 38);
1434
+ observeImports(map, "./tame-module-source.js", 39);
1435
+ observeImports(map, "./error/tame-console.js", 42);
1436
+ observeImports(map, "./error/tame-error-constructor.js", 44);
1437
+ observeImports(map, "./error/assert.js", 13);
1438
+ observeImports(map, "./get-anonymous-intrinsics.js", 51);
1439
+ observeImports(map, "./compartment.js", 50);
1440
+ observeImports(map, "./tame-harden.js", 52);
1441
+ observeImports(map, "./tame-symbol-constructor.js", 53);
1442
+ observeImports(map, "./tame-faux-data-properties.js", 54);
1443
+ observeImports(map, "./tame-regenerator-runtime.js", 55);
1444
+ observeImports(map, "./shim-arraybuffer-transfer.js", 56);
1445
+ observeImports(map, "./reporting.js", 57);
1446
1446
  },
1447
1447
  liveVar: {
1448
1448
  },
1449
1449
  onceVar: {
1450
+ repairIntrinsics: cells[58].repairIntrinsics.set,
1450
1451
  },
1451
1452
  importMeta: {},
1452
1453
  });
1453
1454
  functors[59]({
1454
1455
  imports(entries) {
1455
1456
  const map = new Map(entries);
1457
+ observeImports(map, "./assert-sloppy-mode.js", 1);
1456
1458
  observeImports(map, "./commons.js", 0);
1457
- observeImports(map, "./error/assert.js", 11);
1459
+ observeImports(map, "./lockdown.js", 58);
1458
1460
  },
1459
1461
  liveVar: {
1460
1462
  },
@@ -1466,8 +1468,10 @@ function observeImports(map, importName, importIndex) {
1466
1468
  imports(entries) {
1467
1469
  const map = new Map(entries);
1468
1470
  observeImports(map, "./commons.js", 0);
1469
- observeImports(map, "./error/console.js", 38);
1470
- observeImports(map, "./error/assert.js", 11);
1471
+ observeImports(map, "./compartment.js", 50);
1472
+ observeImports(map, "./tame-function-tostring.js", 37);
1473
+ observeImports(map, "./intrinsics.js", 17);
1474
+ observeImports(map, "./reporting.js", 57);
1471
1475
  },
1472
1476
  liveVar: {
1473
1477
  },
@@ -1478,10 +1482,35 @@ function observeImports(map, importName, importIndex) {
1478
1482
  functors[61]({
1479
1483
  imports(entries) {
1480
1484
  const map = new Map(entries);
1481
- observeImports(map, "./src/lockdown-shim.js", 57);
1482
- observeImports(map, "./src/compartment-shim.js", 58);
1483
- observeImports(map, "./src/assert-shim.js", 59);
1484
- observeImports(map, "./src/console-shim.js", 60);
1485
+ observeImports(map, "./commons.js", 0);
1486
+ observeImports(map, "./error/assert.js", 13);
1487
+ },
1488
+ liveVar: {
1489
+ },
1490
+ onceVar: {
1491
+ },
1492
+ importMeta: {},
1493
+ });
1494
+ functors[62]({
1495
+ imports(entries) {
1496
+ const map = new Map(entries);
1497
+ observeImports(map, "./commons.js", 0);
1498
+ observeImports(map, "./error/console.js", 40);
1499
+ observeImports(map, "./error/assert.js", 13);
1500
+ },
1501
+ liveVar: {
1502
+ },
1503
+ onceVar: {
1504
+ },
1505
+ importMeta: {},
1506
+ });
1507
+ functors[63]({
1508
+ imports(entries) {
1509
+ const map = new Map(entries);
1510
+ observeImports(map, "./src/lockdown-shim.js", 59);
1511
+ observeImports(map, "./src/compartment-shim.js", 60);
1512
+ observeImports(map, "./src/assert-shim.js", 61);
1513
+ observeImports(map, "./src/console-shim.js", 62);
1485
1514
  },
1486
1515
  liveVar: {
1487
1516
  },
@@ -1579,10 +1608,11 @@ const universalThis = globalThis;$h͏_once.universalThis(universalThis);
1579
1608
  toStringTag: toStringTagSymbol,
1580
1609
  iterator: iteratorSymbol,
1581
1610
  matchAll: matchAllSymbol,
1611
+ replace: replaceSymbol,
1582
1612
  unscopables: unscopablesSymbol,
1583
1613
  keyFor: symbolKeyFor,
1584
1614
  for: symbolFor,
1585
- } = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
1615
+ } = Symbol;$h͏_once.speciesSymbol(speciesSymbol);$h͏_once.toStringTagSymbol(toStringTagSymbol);$h͏_once.iteratorSymbol(iteratorSymbol);$h͏_once.matchAllSymbol(matchAllSymbol);$h͏_once.replaceSymbol(replaceSymbol);$h͏_once.unscopablesSymbol(unscopablesSymbol);$h͏_once.symbolKeyFor(symbolKeyFor);$h͏_once.symbolFor(symbolFor);
1586
1616
 
1587
1617
  const { isInteger } = Number;$h͏_once.isInteger(isInteger);
1588
1618
 
@@ -1660,10 +1690,30 @@ const { bind } = functionPrototype;
1660
1690
  * @type {<F extends (this: any, ...args: any[]) => any>(fn: F) => ((thisArg: ThisParameterType<F>, ...args: Parameters<F>) => ReturnType<F>)}
1661
1691
  */
1662
1692
  const uncurryThis = bind.bind(bind.call); // eslint-disable-line @endo/no-polymorphic-call
1663
- $h͏_once.uncurryThis(uncurryThis);
1664
- const objectHasOwnProperty = uncurryThis(objectPrototype.hasOwnProperty);
1693
+
1694
+ // See https://github.com/endojs/endo/issues/2930
1695
+ $h͏_once.uncurryThis(uncurryThis);if(!('hasOwn'in Object)){
1696
+ const ObjectPrototypeHasOwnProperty = objectPrototype.hasOwnProperty;
1697
+ const hasOwnShim = (obj, key) => {
1698
+ if (obj === undefined || obj === null) {
1699
+ // We need to add this extra test because of differences in
1700
+ // the order in which `hasOwn` vs `hasOwnProperty` validates
1701
+ // arguments.
1702
+ throw TypeError('Cannot convert undefined or null to object');
1703
+ }
1704
+ return apply(ObjectPrototypeHasOwnProperty, obj, [key]);
1705
+ };
1706
+ defineProperty(Object, 'hasOwn', {
1707
+ value: hasOwnShim,
1708
+ writable: true,
1709
+ enumerable: false,
1710
+ configurable: true,
1711
+ });
1712
+ }
1713
+
1714
+ const { hasOwn } = Object;
1665
1715
  //
1666
- $h͏_once.objectHasOwnProperty(objectHasOwnProperty);const arrayFilter=uncurryThis(arrayPrototype.filter);$h͏_once.arrayFilter(arrayFilter);
1716
+ $h͏_once.hasOwn(hasOwn);const arrayFilter=uncurryThis(arrayPrototype.filter);$h͏_once.arrayFilter(arrayFilter);
1667
1717
  const arrayForEach = uncurryThis(arrayPrototype.forEach);$h͏_once.arrayForEach(arrayForEach);
1668
1718
  const arrayIncludes = uncurryThis(arrayPrototype.includes);$h͏_once.arrayIncludes(arrayIncludes);
1669
1719
  const arrayJoin = uncurryThis(arrayPrototype.join);
@@ -1702,32 +1752,53 @@ $h͏_once.iterateMap(iterateMap);const setAdd=uncurryThis(setPrototype.add);$h͏
1702
1752
  const setHas = uncurryThis(setPrototype.has);$h͏_once.setHas(setHas);
1703
1753
  const iterateSet = uncurryThis(setPrototype[iteratorSymbol]);
1704
1754
  //
1705
- $h͏_once.iterateSet(iterateSet);const regexpTest=uncurryThis(regexpPrototype.test);$h͏_once.regexpTest(regexpTest);
1706
- const regexpExec = uncurryThis(regexpPrototype.exec);$h͏_once.regexpExec(regexpExec);
1707
- const matchAllRegExp = uncurryThis(regexpPrototype[matchAllSymbol]);
1708
- //
1709
- $h͏_once.matchAllRegExp(matchAllRegExp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
1710
- const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
1711
- const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
1712
- const stringMatch = uncurryThis(stringPrototype.match);$h͏_once.stringMatch(stringMatch);
1713
- const generatorNext = uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
1714
- const generatorThrow = uncurryThis(generatorPrototype.throw);
1715
-
1755
+ /**
1756
+ * `regexpExec` is provided in exclusion of `regexpTest`, which would be
1757
+ * vulnerable to RegExp.prototype poisoning.
1758
+ */$h͏_once.iterateSet(iterateSet);
1759
+ const regexpExec = uncurryThis(regexpPrototype.exec);
1716
1760
  /**
1717
1761
  * @type { &
1718
- * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string) => string) &
1719
- * ((thisArg: string, searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string) => string)
1762
+ * ((thisArg: RegExp, string: string, replaceValue: string) => string) &
1763
+ * ((thisArg: RegExp, string: string, replacer: (substring: string, ...args: any[]) => string) => string)
1720
1764
  * }
1721
- */$h͏_once.generatorThrow(generatorThrow);
1722
- const stringReplace = /** @type {any} */ (
1723
- uncurryThis(stringPrototype.replace)
1724
- );$h͏_once.stringReplace(stringReplace);
1725
- const stringSearch = uncurryThis(stringPrototype.search);$h͏_once.stringSearch(stringSearch);
1726
- const stringSlice = uncurryThis(stringPrototype.slice);$h͏_once.stringSlice(stringSlice);
1727
- const stringSplit =
1728
- /** @type {(thisArg: string, splitter: string | RegExp | { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number) => string[]} */ (
1729
- uncurryThis(stringPrototype.split)
1730
- );$h͏_once.stringSplit(stringSplit);
1765
+ */$h͏_once.regexpExec(regexpExec);
1766
+ const regexpReplace = /** @type {any} */ (
1767
+ uncurryThis(regexpPrototype[replaceSymbol])
1768
+ );$h͏_once.regexpReplace(regexpReplace);
1769
+ const matchAllRegExp = uncurryThis(regexpPrototype[matchAllSymbol]);$h͏_once.matchAllRegExp(matchAllRegExp);
1770
+ const { _regexpConstructor, ...regexpDescriptors } =
1771
+ getOwnPropertyDescriptors(regexpPrototype);
1772
+ arrayForEach(ownKeys(regexpDescriptors), key => {
1773
+ const desc = regexpDescriptors[/** @type {any} */ (key)];
1774
+ desc.configurable = false;
1775
+ if (desc.writable) desc.writable = false;
1776
+ });
1777
+ /**
1778
+ * Protect a RegExp instance against RegExp.prototype poisoning ("exec",
1779
+ * "flags", Symbol.replace, etc.).
1780
+ * @type {<T extends RegExp>(regexp: T) => T}
1781
+ */
1782
+ const sealRegexp = regexp =>
1783
+ seal(defineProperties(regexp, regexpDescriptors));
1784
+ //
1785
+ $h͏_once.sealRegexp(sealRegexp);const stringEndsWith=uncurryThis(stringPrototype.endsWith);$h͏_once.stringEndsWith(stringEndsWith);
1786
+ const stringIncludes = uncurryThis(stringPrototype.includes);$h͏_once.stringIncludes(stringIncludes);
1787
+ const stringIndexOf = uncurryThis(stringPrototype.indexOf);$h͏_once.stringIndexOf(stringIndexOf);
1788
+ const stringMatch = uncurryThis(stringPrototype.match);
1789
+ // `stringReplace` is intentionally omitted because it would be vulnerable to
1790
+ // RegExp.prototype poisoning; use `regexpReplace(re, str, replacer)` instead
1791
+ // (and `sealRegexp` on its regular expressions).
1792
+ $h͏_once.stringMatch(stringMatch);const stringSearch=uncurryThis(stringPrototype.search);$h͏_once.stringSearch(stringSearch);
1793
+ const stringSlice = uncurryThis(stringPrototype.slice);
1794
+ /**
1795
+ * `stringSplit` should only be used with a string separator; regular
1796
+ * expressions are vulnerable to RegExp.prototype poisoning.
1797
+ * @type {(thisArg: string, separator: string, limit?: number) => string[]}
1798
+ */$h͏_once.stringSlice(stringSlice);
1799
+ const stringSplit = /** @type {any} */ (
1800
+ uncurryThis(stringPrototype.split)
1801
+ );$h͏_once.stringSplit(stringSplit);
1731
1802
  const stringStartsWith = uncurryThis(stringPrototype.startsWith);$h͏_once.stringStartsWith(stringStartsWith);
1732
1803
  const iterateString = uncurryThis(stringPrototype[iteratorSymbol]);
1733
1804
  //
@@ -1743,7 +1814,10 @@ $h͏_once.weakmapSet(weakmapSet);const weaksetAdd=uncurryThis(weaksetPrototype.a
1743
1814
  $h͏_once.weaksetHas(weaksetHas);const functionToString=uncurryThis(functionPrototype.toString);$h͏_once.functionToString(functionToString);
1744
1815
  const functionBind = uncurryThis(bind);
1745
1816
  //
1746
- $h͏_once.functionBind(functionBind);const{all}=Promise;
1817
+ $h͏_once.functionBind(functionBind);const generatorNext=uncurryThis(generatorPrototype.next);$h͏_once.generatorNext(generatorNext);
1818
+ const generatorThrow = uncurryThis(generatorPrototype.throw);
1819
+ //
1820
+ $h͏_once.generatorThrow(generatorThrow);const{all}=Promise;
1747
1821
  const promiseAll = promises => apply(all, Promise, [promises]);$h͏_once.promiseAll(promiseAll);
1748
1822
  const promiseCatch = uncurryThis(promisePrototype.catch);
1749
1823
  /** @type {<T, TResult1 = T, TResult2 = never>(thisArg: T, onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null) => Promise<TResult1 | TResult2>} */$h͏_once.promiseCatch(promiseCatch);
@@ -1758,32 +1832,20 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
1758
1832
  uncurryThis(FinalizationRegistry.prototype.unregister);
1759
1833
 
1760
1834
  /**
1761
- * getConstructorOf()
1762
- * Return the constructor from an instance.
1835
+ * TODO Consolidate with `isPrimitive` that's currently in `@endo/pass-style`.
1836
+ * Layering constraints make this tricky, which is why we haven't yet figured
1837
+ * out how to do this.
1763
1838
  *
1764
- * @param {Function} fn
1839
+ * @type {(val: unknown) => val is (undefined
1840
+ * | null
1841
+ * | boolean
1842
+ * | number
1843
+ * | bigint
1844
+ * | string
1845
+ * | symbol)}
1765
1846
  */$h͏_once.finalizationRegistryUnregister(finalizationRegistryUnregister);
1766
- const getConstructorOf = fn =>
1767
- reflectGet(getPrototypeOf(fn), 'constructor');
1768
-
1769
- /**
1770
- * isObject tests whether a value is an object.
1771
- * Today, this is equivalent to:
1772
- *
1773
- * const isObject = value => {
1774
- * if (value === null) return false;
1775
- * const type = typeof value;
1776
- * return type === 'object' || type === 'function';
1777
- * };
1778
- *
1779
- * But this is not safe in the face of possible evolution of the language, for
1780
- * example new types or semantics of records and tuples.
1781
- * We use this implementation despite the unnecessary allocation implied by
1782
- * attempting to box a primitive.
1783
- *
1784
- * @param {any} value
1785
- */$h͏_once.getConstructorOf(getConstructorOf);
1786
- const isObject = value => Object(value) === value;
1847
+ const isPrimitive = val =>
1848
+ !val || (typeof val !== 'object' && typeof val !== 'function');
1787
1849
 
1788
1850
  /**
1789
1851
  * isError tests whether an object inherits from the intrinsic
@@ -1795,7 +1857,7 @@ $h͏_once.promiseThen(promiseThen);const finalizationRegistryRegister=
1795
1857
  * for such a trivial case outside commons.js, we provide a utility function.
1796
1858
  *
1797
1859
  * @param {any} value
1798
- */$h͏_once.isObject(isObject);
1860
+ */$h͏_once.isPrimitive(isPrimitive);
1799
1861
  const isError = value => value instanceof FERAL_ERROR;
1800
1862
 
1801
1863
  /**
@@ -1821,13 +1883,40 @@ $h͏_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION=Function;$h͏_once.FERAL_F
1821
1883
  };
1822
1884
 
1823
1885
  // ////////////////// FERAL_STACK_GETTER FERAL_STACK_SETTER ////////////////////
1824
- $h͏_once.noEvalEvaluate(noEvalEvaluate);
1825
- const er1StackDesc = getOwnPropertyDescriptor(Error('er1'), 'stack');
1826
- const er2StackDesc = getOwnPropertyDescriptor(TypeError('er2'), 'stack');
1886
+
1887
+ // The error repair mechanism is very similar to code in
1888
+ // pass-style/src/error.js and these implementations should be kept in sync.
1889
+
1890
+ /**
1891
+ * We gratuitiously construct a TypeError instance using syntax in order to
1892
+ * obviate the possibility that code that ran before SES (for which we are
1893
+ * irreducable vulnerable) may have replaced the global TypeError constructor.
1894
+ * We treat the nature of this error instance as the source of truth for the
1895
+ * nature of runtime constructed errors on the platform, particularly whether
1896
+ * such errors will have an own "stack" property with getters and setters.
1897
+ * At time of writing (2025) we know of no comparable mechanism for obtaining a
1898
+ * host-generated base Error instance, but we corroborate the nature of the
1899
+ * global Error constructor's instances and refuse to initialize SES in an
1900
+ * environment where the syntactic TypeError and global Error produce
1901
+ * inconsistent "stack" properties.
1902
+ * @returns {TypeError}
1903
+ */$h͏_once.noEvalEvaluate(noEvalEvaluate);
1904
+ const makeTypeError = () => {
1905
+ try {
1906
+ // @ts-expect-error deliberate TypeError
1907
+ null.null;
1908
+ throw TypeError('obligatory'); // To convince the type flow inferrence.
1909
+ } catch (error) {
1910
+ return error;
1911
+ }
1912
+ };
1913
+
1914
+ const errorStackDesc = getOwnPropertyDescriptor(Error('obligatory'), 'stack');
1915
+ const typeErrorStackDesc = getOwnPropertyDescriptor(makeTypeError(), 'stack');
1827
1916
 
1828
1917
  let feralStackGetter;
1829
1918
  let feralStackSetter;
1830
- if (er1StackDesc && er2StackDesc && er1StackDesc.get) {
1919
+ if (typeErrorStackDesc && typeErrorStackDesc.get) {
1831
1920
  // We should only encounter this case on v8 because of its problematic
1832
1921
  // error own stack accessor behavior.
1833
1922
  // Note that FF/SpiderMonkey, Moddable/XS, and the error stack proposal
@@ -1838,16 +1927,17 @@ if (er1StackDesc && er2StackDesc && er1StackDesc.get) {
1838
1927
  // accessor property, but within the same realm, all these accessor
1839
1928
  // properties have the same getter and have the same setter.
1840
1929
  // This is therefore the case that we repair.
1841
- typeof er1StackDesc.get === 'function' &&
1842
- er1StackDesc.get === er2StackDesc.get &&
1843
- typeof er1StackDesc.set === 'function' &&
1844
- er1StackDesc.set === er2StackDesc.set
1930
+ errorStackDesc &&
1931
+ typeof typeErrorStackDesc.get === 'function' &&
1932
+ typeErrorStackDesc.get === errorStackDesc.get &&
1933
+ typeof typeErrorStackDesc.set === 'function' &&
1934
+ typeErrorStackDesc.set === errorStackDesc.set
1845
1935
  ) {
1846
1936
  // Otherwise, we have own stack accessor properties that are outside
1847
1937
  // our expectations, that therefore need to be understood better
1848
1938
  // before we know how to repair them.
1849
- feralStackGetter = freeze(er1StackDesc.get);
1850
- feralStackSetter = freeze(er1StackDesc.set);
1939
+ feralStackGetter = freeze(typeErrorStackDesc.get);
1940
+ feralStackSetter = freeze(typeErrorStackDesc.set);
1851
1941
  } else {
1852
1942
  // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_UNEXPECTED_ERROR_OWN_STACK_ACCESSOR.md
1853
1943
  throw TypeError(
@@ -1944,6 +2034,10 @@ if (getThis()) {
1944
2034
  // Prelude of cheap good - enough imitations of things we'd use or
1945
2035
  // do differently if we could depend on ses
1946
2036
 
2037
+ // eslint-disable-next-line no-restricted-globals
2038
+ const localThis = globalThis;
2039
+
2040
+ const { Object, Reflect, Array, String, JSON, Error } = localThis;
1947
2041
  const { freeze } = Object;
1948
2042
  const { apply } = Reflect;
1949
2043
 
@@ -2078,272 +2172,298 @@ freeze(makeEnvironmentCaptor);
2078
2172
  getEnvironmentOption,
2079
2173
  getEnvironmentOptionsList,
2080
2174
  environmentOptionsListHas,
2081
- } = makeEnvironmentCaptor(globalThis, true);$h͏_once.getEnvironmentOption(getEnvironmentOption);$h͏_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h͏_once.environmentOptionsListHas(environmentOptionsListHas);
2175
+ } = makeEnvironmentCaptor(localThis, true);$h͏_once.getEnvironmentOption(getEnvironmentOption);$h͏_once.getEnvironmentOptionsList(getEnvironmentOptionsList);$h͏_once.environmentOptionsListHas(environmentOptionsListHas);
2082
2176
  })()
2083
2177
  ,
2084
2178
  // === 3. env-options ./index.js ===
2085
2179
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/env-options.js", []]]);
2086
2180
  })()
2087
2181
  ,
2088
- // === 4. immutable-arraybuffer ./index.js ===
2182
+ // === 4. immutable-arraybuffer ./src/immutable-arraybuffer-pony.js ===
2089
2183
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/* global globalThis */
2090
2184
 
2091
- const { setPrototypeOf, getOwnPropertyDescriptors, defineProperties } = Object;
2092
- const { apply } = Reflect;
2185
+ const {
2186
+ ArrayBuffer,
2187
+ Object,
2188
+ Reflect,
2189
+ Symbol,
2190
+ TypeError,
2191
+ Uint8Array,
2192
+ WeakMap,
2193
+ // Capture structuredClone before it can be scuttled.
2194
+ structuredClone: optStructuredClone
2195
+ // eslint-disable-next-line no-restricted-globals
2196
+ } = globalThis;
2197
+
2198
+ const { freeze, defineProperty, getPrototypeOf, getOwnPropertyDescriptor } =
2199
+ Object;
2200
+ const { apply, ownKeys } = Reflect;
2201
+ const { toStringTag } = Symbol;
2202
+
2093
2203
  const { prototype: arrayBufferPrototype } = ArrayBuffer;
2094
- // Capture structuredClone before it could be scuttled.
2095
- const { structuredClone: originalStructuredCloneMaybe } = globalThis;
2204
+ const { slice, transfer: optTransfer } = arrayBufferPrototype;
2205
+ // @ts-expect-error TS doesn't know it'll be there
2206
+ const { get: arrayBufferByteLength } = getOwnPropertyDescriptor(
2207
+ arrayBufferPrototype,
2208
+ 'byteLength',
2209
+ );
2096
2210
 
2097
- const {
2098
- slice,
2099
- // TODO used to be a-ts-expect-error, but my local IDE's TS server
2100
- // seems to use a more recent definition of the `ArrayBuffer` type.
2101
- // @ts-ignore At the time of this writing, the `ArrayBuffer` type built
2102
- // into TypeScript does not know about the recent standard `transfer` method.
2103
- // Indeed, the `transfer` method is absent from Node <= 20.
2104
- transfer,
2105
- } = arrayBufferPrototype;
2211
+ const typedArrayPrototype = getPrototypeOf(Uint8Array.prototype);
2212
+ const { set: uint8ArraySet } = typedArrayPrototype;
2213
+ // @ts-expect-error TS doesn't know it'll be there
2214
+ const { get: uint8ArrayBuffer } = getOwnPropertyDescriptor(
2215
+ typedArrayPrototype,
2216
+ 'buffer',
2217
+ );
2106
2218
 
2107
2219
  /**
2108
- * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2220
+ * Copy a range of values from a genuine ArrayBuffer exotic object into a new
2221
+ * ArrayBuffer.
2109
2222
  *
2110
- * @param {ArrayBuffer} arrayBuffer
2223
+ * @param {ArrayBuffer} realBuffer
2111
2224
  * @param {number} [start]
2112
2225
  * @param {number} [end]
2113
2226
  * @returns {ArrayBuffer}
2114
2227
  */
2115
- const arrayBufferSlice = (arrayBuffer, start = undefined, end = undefined) =>
2116
- apply(slice, arrayBuffer, [start, end]);
2228
+ const arrayBufferSlice = (realBuffer, start = undefined, end = undefined) =>
2229
+ apply(slice, realBuffer, [start, end]);
2117
2230
 
2118
2231
  /**
2119
- * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2120
- * Return a new fresh `ArrayBuffer` exotic object, where the contents of the
2121
- * original `arrayBuffer` has been moved into the new one, and the original
2122
- * `arrayBuffer` has been detached.
2232
+ * Move the contents of a genuine ArrayBuffer exotic object into a new fresh
2233
+ * ArrayBuffer and detach the original source.
2234
+ * We can only do this on platforms that support `structuredClone` or
2235
+ * `ArrayBuffer.prototype.transfer`.
2236
+ * On other platforms, we can still emulate
2237
+ * `ArrayBuffer.prototoype.sliceToImmutable`, but not
2238
+ * `ArrayBuffer.prototype.transferToImmutable`.
2239
+ * Currently, these known-deficient platforms are
2240
+ * - Hermes
2241
+ * - Node.js <= 16
2242
+ * - Apparently some versions of JavaScriptCore that are still of concern.
2123
2243
  *
2124
2244
  * @param {ArrayBuffer} arrayBuffer
2125
2245
  * @returns {ArrayBuffer}
2126
2246
  */
2127
- let arrayBufferTransfer;
2247
+ let optArrayBufferTransfer;
2128
2248
 
2129
- if (transfer) {
2130
- arrayBufferTransfer = arrayBuffer => apply(transfer, arrayBuffer, []);
2131
- } else if (originalStructuredCloneMaybe) {
2132
- arrayBufferTransfer = arrayBuffer => {
2249
+ if (optTransfer) {
2250
+ optArrayBufferTransfer = arrayBuffer => apply(optTransfer, arrayBuffer, []);
2251
+ } else if (optStructuredClone) {
2252
+ optArrayBufferTransfer = arrayBuffer => {
2133
2253
  // Hopefully, a zero-length slice is cheap, but still enforces that
2134
2254
  // `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2135
2255
  arrayBufferSlice(arrayBuffer, 0, 0);
2136
- return originalStructuredCloneMaybe(arrayBuffer, {
2256
+ return optStructuredClone(arrayBuffer, {
2137
2257
  transfer: [arrayBuffer],
2138
2258
  });
2139
2259
  };
2140
2260
  } else {
2141
- // Indeed, Node <= 16 has neither.
2142
- throw TypeError(
2143
- `Can only emulate immutable ArrayBuffer on a platform with either "structuredClone" or "ArrayBuffer.prototype.transfer"`,
2144
- );
2261
+ // Assignment is redundant, but remains for clarity.
2262
+ optArrayBufferTransfer = undefined;
2145
2263
  }
2146
2264
 
2147
2265
  /**
2148
- * This class only exists as an artifact of this ponyfill and shim,
2149
- * as a convenience for imperfectly emulating the
2150
- * *Immutable ArrayBuffer* proposal, which would not have this class.
2151
- * In the proposal,
2152
- * `transferToImmutable` makes a new `ArrayBuffer` that inherits directly from
2153
- * `ArrayBuffer.prototype` as you'd expect. In the ponyfill and shim,
2154
- * `transferToImmutable` makes a normal object that inherits directly from
2155
- * `immutableArrayBufferPrototype`, which has been surgically
2156
- * altered to inherit directly from `ArrayBuffer.prototype`. The constructor is
2157
- * captured for use internal to this module, and is made otherwise inaccessible.
2158
- * Therefore, `immutableArrayBufferPrototype` and all its methods
2159
- * and accessor functions effectively become hidden intrinsics.
2160
- * They are not encapsulated. Rather, they are trivially discoverable if you
2161
- * know how, but are not discoverable merely by enumerating naming paths.
2266
+ * If we could use classes with private fields everywhere, this would have
2267
+ * been a `this.#buffer` private field on an `ImmutableArrayBufferInternal`
2268
+ * class. But we cannot do so on Hermes. So, instead, we
2269
+ * emulate the `this.#buffer` private field, including its use as a brand check.
2270
+ * Maps from all and only emulated Immutable ArrayBuffers to real ArrayBuffers.
2271
+ *
2272
+ * @type {Pick<WeakMap<ArrayBuffer, ArrayBuffer>, 'get' | 'has' | 'set'>}
2162
2273
  */
2163
- class ImmutableArrayBufferInternal {
2164
- /** @type {ArrayBuffer} */
2165
- #buffer;
2166
-
2167
- constructor(buffer) {
2168
- // This constructor is deleted from the prototype below.
2169
- this.#buffer = arrayBufferTransfer(buffer);
2274
+ const buffers = new WeakMap();
2275
+ // Avoid post-hoc prototype lookups.
2276
+ for (const methodName of ['get', 'has', 'set']) {
2277
+ defineProperty(buffers, methodName, { value: buffers[methodName] });
2278
+ }
2279
+ const getBuffer = immuAB => {
2280
+ // Safe because this WeakMap owns its get method.
2281
+ // eslint-disable-next-line @endo/no-polymorphic-call
2282
+ const result = buffers.get(immuAB);
2283
+ if (result) {
2284
+ return result;
2170
2285
  }
2286
+ throw TypeError('Not an emulated Immutable ArrayBuffer');
2287
+ };
2171
2288
 
2289
+ // Omits `constructor` so `Array.prototype.constructor` is inherited.
2290
+ const ImmutableArrayBufferInternalPrototype = {
2291
+ __proto__: arrayBufferPrototype,
2172
2292
  get byteLength() {
2173
- return this.#buffer.byteLength;
2174
- }
2175
-
2293
+ return apply(arrayBufferByteLength, getBuffer(this), []);
2294
+ },
2176
2295
  get detached() {
2177
- this.#buffer; // shim brand check
2296
+ getBuffer(this); // shim brand check
2178
2297
  return false;
2179
- }
2180
-
2298
+ },
2181
2299
  get maxByteLength() {
2182
2300
  // Not underlying maxByteLength, which is irrelevant
2183
- return this.#buffer.byteLength;
2184
- }
2185
-
2301
+ return apply(arrayBufferByteLength, getBuffer(this), []);
2302
+ },
2186
2303
  get resizable() {
2187
- this.#buffer; // shim brand check
2304
+ getBuffer(this); // shim brand check
2188
2305
  return false;
2189
- }
2190
-
2306
+ },
2191
2307
  get immutable() {
2192
- this.#buffer; // shim brand check
2308
+ getBuffer(this); // shim brand check
2193
2309
  return true;
2194
- }
2195
-
2310
+ },
2196
2311
  slice(start = undefined, end = undefined) {
2197
- return arrayBufferSlice(this.#buffer, start, end);
2198
- }
2199
-
2312
+ return arrayBufferSlice(getBuffer(this), start, end);
2313
+ },
2200
2314
  sliceToImmutable(start = undefined, end = undefined) {
2201
2315
  // eslint-disable-next-line no-use-before-define
2202
- return sliceBufferToImmutable(this.#buffer, start, end);
2203
- }
2204
-
2316
+ return sliceBufferToImmutable(getBuffer(this), start, end);
2317
+ },
2205
2318
  resize(_newByteLength = undefined) {
2206
- this.#buffer; // shim brand check
2319
+ getBuffer(this); // shim brand check
2207
2320
  throw TypeError('Cannot resize an immutable ArrayBuffer');
2208
- }
2209
-
2321
+ },
2210
2322
  transfer(_newLength = undefined) {
2211
- this.#buffer; // shim brand check
2323
+ getBuffer(this); // shim brand check
2212
2324
  throw TypeError('Cannot detach an immutable ArrayBuffer');
2213
- }
2214
-
2325
+ },
2215
2326
  transferToFixedLength(_newLength = undefined) {
2216
- this.#buffer; // shim brand check
2327
+ getBuffer(this); // shim brand check
2217
2328
  throw TypeError('Cannot detach an immutable ArrayBuffer');
2218
- }
2219
-
2329
+ },
2220
2330
  transferToImmutable(_newLength = undefined) {
2221
- this.#buffer; // shim brand check
2331
+ getBuffer(this); // shim brand check
2222
2332
  throw TypeError('Cannot detach an immutable ArrayBuffer');
2223
- }
2224
- }
2225
-
2226
- const immutableArrayBufferPrototype = ImmutableArrayBufferInternal.prototype;
2227
- // @ts-expect-error can only delete optionals
2228
- delete immutableArrayBufferPrototype.constructor;
2229
-
2230
- const {
2231
- slice: { value: sliceOfImmutable },
2232
- immutable: { get: isImmutableGetter },
2233
- } = getOwnPropertyDescriptors(immutableArrayBufferPrototype);
2234
-
2235
- setPrototypeOf(immutableArrayBufferPrototype, arrayBufferPrototype);
2333
+ },
2334
+ /**
2335
+ * See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
2336
+ */
2337
+ [toStringTag]: 'ImmutableArrayBuffer',
2338
+ };
2236
2339
 
2237
- // See https://github.com/endojs/endo/tree/master/packages/immutable-arraybuffer#purposeful-violation
2238
- defineProperties(immutableArrayBufferPrototype, {
2239
- [Symbol.toStringTag]: {
2240
- value: 'ImmutableArrayBuffer',
2241
- writable: false,
2340
+ // Better fidelity emulation of a class prototype
2341
+ for (const key of ownKeys(ImmutableArrayBufferInternalPrototype)) {
2342
+ defineProperty(ImmutableArrayBufferInternalPrototype, key, {
2242
2343
  enumerable: false,
2243
- configurable: true,
2244
- },
2245
- });
2344
+ });
2345
+ }
2246
2346
 
2247
2347
  /**
2248
- * Transfer the contents to a new Immutable ArrayBuffer
2348
+ * Emulates what would have been the encapsulated `ImmutableArrayBufferInternal`
2349
+ * class constructor. This function takes the `realBuffer` which its
2350
+ * result encapsulates. Security demands that this result has exclusive access
2351
+ * to the `realBuffer` it is given, which its callers must ensure.
2249
2352
  *
2250
- * @param {ArrayBuffer} buffer The original buffer.
2251
- * @param {number} [newLength] The start index.
2353
+ * @param {ArrayBuffer} realBuffer
2252
2354
  * @returns {ArrayBuffer}
2253
2355
  */
2254
- const transferBufferToImmutable = (buffer, newLength = undefined) => {
2255
- if (newLength !== undefined) {
2256
- if (transfer) {
2257
- buffer = apply(transfer, buffer, [newLength]);
2258
- } else {
2259
- buffer = arrayBufferTransfer(buffer);
2260
- const oldLength = buffer.byteLength;
2261
- // eslint-disable-next-line @endo/restrict-comparison-operands
2262
- if (newLength <= oldLength) {
2263
- buffer = arrayBufferSlice(buffer, 0, newLength);
2264
- } else {
2265
- const oldTA = new Uint8Array(buffer);
2266
- const newTA = new Uint8Array(newLength);
2267
- newTA.set(oldTA);
2268
- buffer = newTA.buffer;
2269
- }
2270
- }
2271
- }
2272
- const result = new ImmutableArrayBufferInternal(buffer);
2273
- return /** @type {ArrayBuffer} */ (/** @type {unknown} */ (result));
2274
- };$h͏_once.transferBufferToImmutable(transferBufferToImmutable);
2275
-
2276
- const isBufferImmutable = buffer => {
2277
- try {
2278
- // @ts-expect-error Getter should be typed as this-sensitive
2279
- return apply(isImmutableGetter, buffer, []);
2280
- } catch (err) {
2281
- if (err instanceof TypeError) {
2282
- // Enforce that `buffer` is a genuine ArrayBuffer before returning.
2283
- arrayBufferSlice(buffer, 0, 0);
2284
- return false;
2285
- }
2286
- throw err;
2287
- }
2356
+ const makeImmutableArrayBufferInternal = realBuffer => {
2357
+ const result = /** @type {ArrayBuffer} */ (
2358
+ /** @type {unknown} */ ({
2359
+ __proto__: ImmutableArrayBufferInternalPrototype,
2360
+ })
2361
+ );
2362
+ // Safe because this WeakMap owns its set method.
2363
+ // eslint-disable-next-line @endo/no-polymorphic-call
2364
+ buffers.set(result, realBuffer);
2365
+ return result;
2288
2366
  };
2367
+ // Since `makeImmutableArrayBufferInternal` MUST not escape,
2368
+ // this `freeze` is just belt-and-suspenders.
2369
+ freeze(makeImmutableArrayBufferInternal);
2289
2370
 
2290
2371
  /**
2291
- * Enforces that `arrayBuffer` is a genuine `ArrayBuffer` exotic object.
2292
- *
2293
2372
  * @param {ArrayBuffer} buffer
2294
- * @param {number} [start]
2295
- * @param {number} [end]
2296
- * @returns {ArrayBuffer}
2297
- */$h͏_once.isBufferImmutable(isBufferImmutable);
2298
- const sliceBuffer = (buffer, start = undefined, end = undefined) => {
2299
- try {
2300
- // @ts-expect-error We know it is really there
2301
- return apply(sliceOfImmutable, buffer, [start, end]);
2302
- } catch (err) {
2303
- if (err instanceof TypeError) {
2304
- return arrayBufferSlice(buffer, start, end);
2305
- }
2306
- throw err;
2307
- }
2308
- };
2373
+ * @returns {boolean}
2374
+ */
2375
+ // eslint-disable-next-line @endo/no-polymorphic-call
2376
+ const isBufferImmutable = buffer => buffers.has(buffer);
2309
2377
 
2310
2378
  /**
2311
2379
  * Creates an immutable slice of the given buffer.
2312
- *
2313
2380
  * @param {ArrayBuffer} buffer The original buffer.
2314
2381
  * @param {number} [start] The start index.
2315
2382
  * @param {number} [end] The end index.
2316
2383
  * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2317
- */
2384
+ */$h͏_once.isBufferImmutable(isBufferImmutable);
2318
2385
  const sliceBufferToImmutable = (
2319
2386
  buffer,
2320
2387
  start = undefined,
2321
2388
  end = undefined,
2322
- ) => transferBufferToImmutable(sliceBuffer(buffer, start, end));$h͏_once.sliceBufferToImmutable(sliceBufferToImmutable);
2389
+ ) => {
2390
+ // Safe because this WeakMap owns its get method.
2391
+ // eslint-disable-next-line @endo/no-polymorphic-call
2392
+ let realBuffer = buffers.get(buffer);
2393
+ if (realBuffer === undefined) {
2394
+ realBuffer = buffer;
2395
+ }
2396
+ return makeImmutableArrayBufferInternal(
2397
+ arrayBufferSlice(realBuffer, start, end),
2398
+ );
2399
+ };$h͏_once.sliceBufferToImmutable(sliceBufferToImmutable);
2400
+
2401
+ let transferBufferToImmutable;
2402
+ if (optArrayBufferTransfer) {
2403
+ /**
2404
+ * Transfer the contents to a new Immutable ArrayBuffer
2405
+ *
2406
+ * @param {ArrayBuffer} buffer The original buffer.
2407
+ * @param {number} [newLength] The start index.
2408
+ * @returns {ArrayBuffer}
2409
+ */
2410
+ transferBufferToImmutable = (buffer, newLength = undefined) => {
2411
+ if (newLength === undefined) {
2412
+ buffer = optArrayBufferTransfer(buffer);
2413
+ } else if (optTransfer) {
2414
+ buffer = apply(optTransfer, buffer, [newLength]);
2415
+ } else {
2416
+ buffer = optArrayBufferTransfer(buffer);
2417
+ const oldLength = buffer.byteLength;
2418
+ // eslint-disable-next-line @endo/restrict-comparison-operands
2419
+ if (newLength <= oldLength) {
2420
+ buffer = arrayBufferSlice(buffer, 0, newLength);
2421
+ } else {
2422
+ const oldTA = new Uint8Array(buffer);
2423
+ const newTA = new Uint8Array(newLength);
2424
+ apply(uint8ArraySet, newTA, [oldTA]);
2425
+ buffer = apply(uint8ArrayBuffer, newTA, []);
2426
+ }
2427
+ }
2428
+ const result = makeImmutableArrayBufferInternal(buffer);
2429
+ return /** @type {ArrayBuffer} */ (/** @type {unknown} */ (result));
2430
+ };
2431
+ } else {
2432
+ transferBufferToImmutable = undefined;
2433
+ }
2434
+
2435
+ const optTransferBufferToImmutable = transferBufferToImmutable;$h͏_once.optTransferBufferToImmutable(optTransferBufferToImmutable);
2323
2436
  })()
2324
2437
  ,
2325
- // === 5. immutable-arraybuffer ./shim.js ===
2326
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let transferBufferToImmutable,isBufferImmutable,sliceBufferToImmutable;$h͏_imports([["./index.js", [["transferBufferToImmutable",[$h͏_a => (transferBufferToImmutable = $h͏_a)]],["isBufferImmutable",[$h͏_a => (isBufferImmutable = $h͏_a)]],["sliceBufferToImmutable",[$h͏_a => (sliceBufferToImmutable = $h͏_a)]]]]]);
2438
+ // === 5. immutable-arraybuffer ./src/immutable-arraybuffer-shim.js ===
2439
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let isBufferImmutable,sliceBufferToImmutable,optXferBuf2Immu;$h͏_imports([["./immutable-arraybuffer-pony.js", [["isBufferImmutable",[$h͏_a => (isBufferImmutable = $h͏_a)]],["sliceBufferToImmutable",[$h͏_a => (sliceBufferToImmutable = $h͏_a)]],["optTransferBufferToImmutable",[$h͏_a => (optXferBuf2Immu = $h͏_a)]]]]]);
2440
+
2327
2441
 
2328
2442
 
2329
2443
 
2330
2444
 
2331
2445
 
2332
- const { getOwnPropertyDescriptors, defineProperties } = Object;
2446
+
2447
+ const {
2448
+ ArrayBuffer,
2449
+ JSON,
2450
+ Object,
2451
+ Reflect
2452
+ // eslint-disable-next-line no-restricted-globals
2453
+ } = globalThis;
2454
+
2455
+ // Even though the imported one is not exported by the pony as a live binding,
2456
+ // TS doesn't know that,
2457
+ // so it cannot do its normal flow-based inference. By making and using a local
2458
+ // copy, no problem.
2459
+ const optTransferBufferToImmutable = optXferBuf2Immu;
2460
+
2461
+ const { getOwnPropertyDescriptors, defineProperties, defineProperty } = Object;
2462
+ const { ownKeys } = Reflect;
2333
2463
  const { prototype: arrayBufferPrototype } = ArrayBuffer;
2464
+ const { stringify } = JSON;
2334
2465
 
2335
2466
  const arrayBufferMethods = {
2336
- /**
2337
- * Transfer the contents to a new Immutable ArrayBuffer
2338
- *
2339
- * @this {ArrayBuffer} buffer The original buffer.
2340
- * @param {number} [newLength] The start index.
2341
- * @returns {ArrayBuffer} The sliced immutable ArrayBuffer.
2342
- */
2343
- transferToImmutable(newLength = undefined) {
2344
- return transferBufferToImmutable(this, newLength);
2345
- },
2346
-
2347
2467
  /**
2348
2468
  * Creates an immutable slice of the given buffer.
2349
2469
  *
@@ -2356,24 +2476,56 @@ const arrayBufferMethods = {
2356
2476
  return sliceBufferToImmutable(this, start, end);
2357
2477
  },
2358
2478
 
2479
+ /**
2480
+ * @this {ArrayBuffer}
2481
+ */
2359
2482
  get immutable() {
2360
2483
  return isBufferImmutable(this);
2361
2484
  },
2485
+
2486
+ ...(optTransferBufferToImmutable
2487
+ ? {
2488
+ /**
2489
+ * Transfer the contents to a new immutable ArrayBuffer
2490
+ *
2491
+ * @this {ArrayBuffer} buffer The original buffer.
2492
+ * @param {number} [newLength] The start index.
2493
+ * @returns {ArrayBuffer} The new immutable ArrayBuffer.
2494
+ */
2495
+ transferToImmutable(newLength = undefined) {
2496
+ return optTransferBufferToImmutable(this, newLength);
2497
+ },
2498
+ }
2499
+ : {}),
2362
2500
  };
2363
2501
 
2364
- if ('sliceToImmutable' in arrayBufferPrototype) {
2365
- // Modern shim practice frowns on conditional installation, at least for
2366
- // proposals prior to stage 3. This is so changes to the proposal since
2367
- // an old shim was distributed don't need to worry about the proposal
2368
- // breaking old code depending on the old shim. Thus, if we detect that
2369
- // we're about to overwrite a prior installation, we simply issue this
2370
- // warning and continue.
2371
- //
2372
- // TODO, if the primordials are frozen after the prior implementation, such as
2373
- // by `lockdown`, then this precludes overwriting as expected. However, for
2374
- // this case, the following warning text will be confusing.
2502
+ // Better fidelity emulation of a class prototype
2503
+ for (const key of ownKeys(arrayBufferMethods)) {
2504
+ defineProperty(arrayBufferMethods, key, {
2505
+ enumerable: false,
2506
+ });
2507
+ }
2508
+
2509
+ // Modern shim practice frowns on conditional installation, at least for
2510
+ // proposals prior to stage 3. This is so changes to the proposal since
2511
+ // an old shim was distributed don't need to worry about the proposal
2512
+ // breaking old code depending on the old shim. Thus, if we detect that
2513
+ // we're about to overwrite a prior installation, we simply issue this
2514
+ // warning and continue.
2515
+ //
2516
+ // TODO, if the primordials are frozen after the prior implementation, such as
2517
+ // by `lockdown`, then this precludes overwriting as expected. However, for
2518
+ // this case, the following warning text will be confusing.
2519
+ //
2520
+ // Allowing polymorphic calls because these occur during initialization.
2521
+ // eslint-disable-next-line @endo/no-polymorphic-call
2522
+ const overwrites = ownKeys(arrayBufferMethods).filter(
2523
+ key => key in arrayBufferPrototype,
2524
+ );
2525
+ if (overwrites.length > 0) {
2526
+ // eslint-disable-next-line @endo/no-polymorphic-call
2375
2527
  console.warn(
2376
- 'About to overwrite a prior implementation of "sliceToImmutable"',
2528
+ `About to overwrite ArrayBuffer.prototype properties ${stringify(overwrites)}`,
2377
2529
  );
2378
2530
  }
2379
2531
 
@@ -2383,7 +2535,11 @@ defineProperties(
2383
2535
  );
2384
2536
  })()
2385
2537
  ,
2386
- // === 6. ses ./src/error/stringify-utils.js ===
2538
+ // === 6. immutable-arraybuffer ./shim.js ===
2539
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/immutable-arraybuffer-shim.js", []]]);
2540
+ })()
2541
+ ,
2542
+ // === 7. ses ./src/error/stringify-utils.js ===
2387
2543
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,isArray,arrayJoin,arraySlice,arraySort,arrayMap,keys,fromEntries,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h͏_imports([["../commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["arraySort",[$h͏_a => (arraySort = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["keys",[$h͏_a => (keys = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["stringifyJson",[$h͏_a => (stringifyJson = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]]]]]);
2388
2544
 
2389
2545
 
@@ -2407,12 +2563,12 @@ defineProperties(
2407
2563
 
2408
2564
 
2409
2565
 
2410
- /** @import {StringablePayload} from '../../types.js' */
2566
+ /** @import {Stringable} from '../../types.js' */
2411
2567
 
2412
2568
  /**
2413
2569
  * Joins English terms with commas and an optional conjunction.
2414
2570
  *
2415
- * @param {(string | StringablePayload)[]} terms
2571
+ * @param {(string | Stringable)[]} terms
2416
2572
  * @param {"and" | "or"} conjunction
2417
2573
  */
2418
2574
  const enJoin = (terms, conjunction) => {
@@ -2580,10 +2736,10 @@ const bestEffortStringify = (payload, spaces = undefined) => {
2580
2736
  freeze(bestEffortStringify);
2581
2737
  })()
2582
2738
  ,
2583
- // === 7. ses ./src/error/types.js ===
2739
+ // === 8. ses ./src/error/types.js ===
2584
2740
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2585
2741
 
2586
- /** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, StringablePayload} from '../../types.js' */
2742
+ /** @import {GenericErrorConstructor, AssertMakeErrorOptions, DetailsToken, Stringable} from '../../types.js' */
2587
2743
 
2588
2744
  /**
2589
2745
  * @typedef {object} VirtualConsole
@@ -2642,7 +2798,7 @@ freeze(bestEffortStringify);
2642
2798
  */
2643
2799
  })()
2644
2800
  ,
2645
- // === 8. ses ./src/error/internal-types.js ===
2801
+ // === 9. ses ./src/error/internal-types.js ===
2646
2802
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2647
2803
 
2648
2804
  /**
@@ -2743,10 +2899,15 @@ freeze(bestEffortStringify);
2743
2899
  */
2744
2900
  })()
2745
2901
  ,
2746
- // === 9. ses ./src/make-lru-cachemap.js ===
2902
+ // === 10. cache-map ./src/cachemap.js ===
2747
2903
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);// @ts-check
2904
+ /* global globalThis */
2748
2905
  /* eslint-disable @endo/no-polymorphic-call */
2749
2906
 
2907
+ // eslint-disable-next-line no-restricted-globals
2908
+ const { Error, TypeError, WeakMap } = globalThis;
2909
+ // eslint-disable-next-line no-restricted-globals
2910
+ const { parse, stringify } = JSON;
2750
2911
  // eslint-disable-next-line no-restricted-globals
2751
2912
  const { isSafeInteger } = Number;
2752
2913
  // eslint-disable-next-line no-restricted-globals
@@ -2754,227 +2915,323 @@ const { freeze } = Object;
2754
2915
  // eslint-disable-next-line no-restricted-globals
2755
2916
  const { toStringTag: toStringTagSymbol } = Symbol;
2756
2917
 
2918
+ // eslint-disable-next-line no-restricted-globals
2919
+ const UNKNOWN_KEY = Symbol('UNKNOWN_KEY');
2920
+
2757
2921
  /**
2758
- * @template Data
2759
- * @typedef {object} DoublyLinkedCell
2760
- * A cell of a doubly-linked ring, i.e., a doubly-linked circular list.
2761
- * DoublyLinkedCells are not frozen, and so should be closely encapsulated by
2762
- * any abstraction that uses them.
2763
- * @property {DoublyLinkedCell<Data>} next
2764
- * @property {DoublyLinkedCell<Data>} prev
2765
- * @property {Data} data
2922
+ * @template T
2923
+ * @typedef {T extends object ? { -readonly [K in keyof T]: T[K] } : never} WritableDeep
2924
+ * Intentionally limited to local needs; refer to
2925
+ * https://github.com/sindresorhus/type-fest if insufficient.
2766
2926
  */
2767
2927
 
2768
2928
  /**
2769
- * Makes a new self-linked cell. There are two reasons to do so:
2770
- * * To make the head sigil of a new initially-empty doubly-linked ring.
2771
- * * To make a non-sigil cell to be `spliceAfter`ed.
2929
+ * @template T
2930
+ * @param {T} value
2931
+ * @param {<U,>(name: string, value: U) => U} [reviver]
2932
+ * @returns {WritableDeep<T>}
2933
+ */
2934
+ const deepCopyJsonable = (value, reviver) => {
2935
+ const encoded = stringify(value);
2936
+ const decoded = parse(encoded, reviver);
2937
+ return decoded;
2938
+ };
2939
+
2940
+ const freezingReviver = (_name, value) => freeze(value);
2941
+
2942
+ /** @type {<T,>(value: T) => T} */
2943
+ const deepCopyAndFreezeJsonable = value =>
2944
+ deepCopyJsonable(value, freezingReviver);
2945
+
2946
+ /**
2947
+ * A cache of bounded size, implementing the WeakMap interface but holding keys
2948
+ * strongly if created with a non-weak `makeMap` option of
2949
+ * {@link makeCacheMapKit}.
2772
2950
  *
2773
- * @template Data
2774
- * @param {Data} data
2775
- * @returns {DoublyLinkedCell<Data>}
2951
+ * @template K
2952
+ * @template V
2953
+ * @typedef {Pick<Map<K, V>, Exclude<keyof WeakMap<WeakKey, *>, 'set'>> & {set: (key: K, value: V) => WeakMapAPI<K, V>}} WeakMapAPI
2776
2954
  */
2777
- const makeSelfCell = data => {
2778
- /** @type {Partial<DoublyLinkedCell<Data>>} */
2779
- const incompleteCell = {
2780
- next: undefined,
2781
- prev: undefined,
2782
- data,
2783
- };
2784
- const selfCell = /** @type {DoublyLinkedCell<Data>} */ (incompleteCell);
2785
- selfCell.next = selfCell;
2786
- selfCell.prev = selfCell;
2787
- // Not frozen!
2788
- return selfCell;
2789
- };
2790
2955
 
2791
2956
  /**
2792
- * Splices a self-linked non-sigil cell into a ring after `prev`.
2793
- * `prev` could be the head sigil, or it could be some other non-sigil
2794
- * cell within a ring.
2957
+ * @template K
2958
+ * @template V
2959
+ * @typedef {WeakMapAPI<K, V> & ({clear?: undefined} | Pick<Map<K, V>, 'clear'>)} SingleEntryMap
2960
+ */
2961
+
2962
+ /**
2963
+ * A cell of a doubly-linked ring (circular list) for a cache map.
2964
+ * Instances are not frozen, and so should be closely encapsulated.
2795
2965
  *
2796
- * @template Data
2797
- * @param {DoublyLinkedCell<Data>} prev
2798
- * @param {DoublyLinkedCell<Data>} selfCell
2966
+ * @template K
2967
+ * @template V
2968
+ * @typedef {object} CacheMapCell
2969
+ * @property {number} id for debugging
2970
+ * @property {CacheMapCell<K, V>} next
2971
+ * @property {CacheMapCell<K, V>} prev
2972
+ * @property {SingleEntryMap<K, V>} data
2799
2973
  */
2800
- const spliceAfter = (prev, selfCell) => {
2801
- if (prev === selfCell) {
2802
- // eslint-disable-next-line no-restricted-globals
2803
- throw TypeError('Cannot splice a cell into itself');
2804
- }
2805
- if (selfCell.next !== selfCell || selfCell.prev !== selfCell) {
2806
- // eslint-disable-next-line no-restricted-globals
2807
- throw TypeError('Expected self-linked cell');
2808
- }
2809
- const cell = selfCell;
2810
- // rename variable cause it isn't self-linked after this point.
2811
2974
 
2812
- const next = prev.next;
2813
- cell.prev = prev;
2814
- cell.next = next;
2975
+ /**
2976
+ * @template K
2977
+ * @template V
2978
+ * @param {CacheMapCell<K, V>} prev
2979
+ * @param {number} id
2980
+ * @param {SingleEntryMap<K, V>} data
2981
+ * @returns {CacheMapCell<K, V>}
2982
+ */
2983
+ const appendNewCell = (prev, id, data) => {
2984
+ const next = prev?.next;
2985
+ const cell = { id, next, prev, data };
2815
2986
  prev.next = cell;
2816
2987
  next.prev = cell;
2817
- // Not frozen!
2818
2988
  return cell;
2819
2989
  };
2820
2990
 
2821
2991
  /**
2822
- * @template Data
2823
- * @param {DoublyLinkedCell<Data>} cell
2824
- * No-op if the cell is self-linked.
2992
+ * @template K
2993
+ * @template V
2994
+ * @param {CacheMapCell<K, V>} cell
2995
+ * @param {CacheMapCell<K, V>} prev
2996
+ * @param {CacheMapCell<K, V>} [next]
2825
2997
  */
2826
- const spliceOut = cell => {
2827
- const { prev, next } = cell;
2828
- prev.next = next;
2829
- next.prev = prev;
2830
- cell.prev = cell;
2831
- cell.next = cell;
2998
+ const moveCellAfter = (cell, prev, next = prev.next) => {
2999
+ if (cell === prev || cell === next) return; // already in position
3000
+
3001
+ // Splice out cell.
3002
+ const { prev: oldPrev, next: oldNext } = cell;
3003
+ oldPrev.next = oldNext;
3004
+ oldNext.prev = oldPrev;
3005
+
3006
+ // Splice in cell after prev.
3007
+ cell.prev = prev;
3008
+ cell.next = next;
3009
+ prev.next = cell;
3010
+ next.prev = cell;
2832
3011
  };
2833
3012
 
2834
3013
  /**
2835
- * The LRUCacheMap is used within the implementation of `assert` and so
2836
- * at a layer below SES or harden. Thus, we give it a `WeakMap`-like interface
2837
- * rather than a `WeakMapStore`-like interface. To work before `lockdown`,
2838
- * the implementation must use `freeze` manually, but still exhaustively.
3014
+ * Clear out a cell to prepare it for future use. Its map is preserved when
3015
+ * possible, but must instead be replaced if the associated key is not known.
2839
3016
  *
2840
- * It implements the WeakMap interface, and holds its keys weakly. Cached
2841
- * values are only held while the key is held by the user and the key/value
2842
- * bookkeeping cell has not been pushed off the end of the cache by `budget`
2843
- * number of more recently referenced cells. If the key is dropped by the user,
2844
- * the value will no longer be held by the cache, but the bookkeeping cell
2845
- * itself will stay in memory.
2846
- *
2847
- * @template {{}} K
2848
- * @template {unknown} V
2849
- * @param {number} keysBudget
2850
- * @returns {WeakMap<K,V>}
3017
+ * @template K
3018
+ * @template V
3019
+ * @param {CacheMapCell<K, V>} cell
3020
+ * @param {K | UNKNOWN_KEY} oldKey
3021
+ * @param {() => SingleEntryMap<K, V>} [makeMap] required when the key is unknown
2851
3022
  */
2852
- const makeLRUCacheMap = keysBudget => {
2853
- if (!isSafeInteger(keysBudget) || keysBudget < 0) {
2854
- // eslint-disable-next-line no-restricted-globals
2855
- throw TypeError('keysBudget must be a safe non-negative integer number');
3023
+ const resetCell = (cell, oldKey, makeMap) => {
3024
+ if (oldKey !== UNKNOWN_KEY) {
3025
+ cell.data.delete(oldKey);
3026
+ return;
2856
3027
  }
2857
- /** @typedef {DoublyLinkedCell<WeakMap<K, V> | undefined>} LRUCacheCell */
2858
- /** @type {WeakMap<K, LRUCacheCell>} */
2859
- // eslint-disable-next-line no-restricted-globals
2860
- const keyToCell = new WeakMap();
2861
- let size = 0; // `size` must remain <= `keysBudget`
2862
- // As a sigil, `head` uniquely is not in the `keyToCell` map.
2863
- /** @type {LRUCacheCell} */
2864
- const head = makeSelfCell(undefined);
3028
+ if (cell.data.clear) {
3029
+ cell.data.clear();
3030
+ return;
3031
+ }
3032
+ // WeakMap instances must be replaced when the key is unknown.
3033
+ if (!makeMap) {
3034
+ throw Error('internal: makeMap is required with UNKNOWN_KEY');
3035
+ }
3036
+ cell.data = makeMap();
3037
+ };
2865
3038
 
2866
- const touchCell = key => {
2867
- const cell = keyToCell.get(key);
2868
- if (cell === undefined || cell.data === undefined) {
2869
- // Either the key was GCed, or the cell was condemned.
2870
- return undefined;
2871
- }
2872
- // Becomes most recently used
2873
- spliceOut(cell);
2874
- spliceAfter(head, cell);
2875
- return cell;
2876
- };
3039
+ const zeroMetrics = freeze({
3040
+ totalQueryCount: 0,
3041
+ totalHitCount: 0
3042
+ // TODO?
3043
+ // * method-specific counts
3044
+ // * liveTouchStats/evictedTouchStats { count, sum, mean, min, max }
3045
+ // * p50/p90/p95/p99 via Ben-Haim/Tom-Tov streaming histograms
3046
+ });
3047
+ /** @typedef {typeof zeroMetrics} CacheMapMetrics */
3048
+
3049
+ /**
3050
+ * @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
3051
+ * @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
3052
+ * @template {unknown} [V=unknown]
3053
+ * @typedef {object} CacheMapKit
3054
+ * @property {WeakMapAPI<K, V>} cache
3055
+ * @property {() => CacheMapMetrics} getMetrics
3056
+ */
3057
+
3058
+ /**
3059
+ * Create a bounded-size cache having WeakMap-compatible
3060
+ * `has`/`get`/`set`/`delete` methods, capable of supporting SES (specifically
3061
+ * `assert` error notes).
3062
+ * Key validity, comparison, and referential strength are controlled by the
3063
+ * `makeMap` option, which defaults to `WeakMap` but can be set to any producer
3064
+ * of objects with those methods (e.g., using `Map` allows for arbitrary keys
3065
+ * which will be strongly held).
3066
+ * Cache eviction policy is not currently configurable, but strives for a hit
3067
+ * ratio at least as good as
3068
+ * [LRU](https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU) (e.g., it
3069
+ * might be
3070
+ * [CLOCK](https://en.wikipedia.org/wiki/Page_replacement_algorithm#Clock)
3071
+ * or [SIEVE](https://sievecache.com/)).
3072
+ *
3073
+ * @template {MapConstructor | WeakMapConstructor} [C=WeakMapConstructor]
3074
+ * @template {Parameters<InstanceType<C>['set']>[0]} [K=Parameters<InstanceType<C>['set']>[0]]
3075
+ * @template {unknown} [V=unknown]
3076
+ * @param {number} capacity
3077
+ * @param {object} [options]
3078
+ * @param {C | (() => SingleEntryMap<K, V>)} [options.makeMap]
3079
+ * @returns {CacheMapKit<C, K, V>}
3080
+ */
3081
+ const makeCacheMapKit = (capacity, options = {}) => {
3082
+ if (!isSafeInteger(capacity) || capacity < 0) {
3083
+ throw TypeError(
3084
+ 'capacity must be a non-negative safe integer number <= 2**53 - 1',
3085
+ );
3086
+ }
2877
3087
 
2878
3088
  /**
2879
- * @param {K} key
3089
+ * @template V
3090
+ * @type {<V,>() => SingleEntryMap<K, V>}
2880
3091
  */
2881
- const has = key => touchCell(key) !== undefined;
2882
- freeze(has);
3092
+ const makeMap = (MaybeCtor => {
3093
+ try {
3094
+ // @ts-expect-error
3095
+ MaybeCtor();
3096
+ return /** @type {any} */ (MaybeCtor);
3097
+ } catch (err) {
3098
+ // @ts-expect-error
3099
+ const constructNewMap = () => new MaybeCtor();
3100
+ return constructNewMap;
3101
+ }
3102
+ })(options.makeMap ?? WeakMap);
3103
+ const tag =
3104
+ /** @type {any} */ (makeMap()).clear === undefined
3105
+ ? 'WeakCacheMap'
3106
+ : 'CacheMap';
3107
+
3108
+ /** @type {WeakMapAPI<K, CacheMapCell<K, V>>} */
3109
+ const keyToCell = makeMap();
3110
+ // @ts-expect-error this sentinel head is special
3111
+ const head = /** @type {CacheMapCell<K, V>} */ ({
3112
+ id: 0,
3113
+ // next and prev are established below as self-referential.
3114
+ next: undefined,
3115
+ prev: undefined,
3116
+ data: {
3117
+ has: () => {
3118
+ throw Error('internal: sentinel head cell has no data');
3119
+ },
3120
+ },
3121
+ });
3122
+ head.next = head;
3123
+ head.prev = head;
3124
+ let cellCount = 0;
3125
+
3126
+ const metrics = deepCopyJsonable(zeroMetrics);
3127
+ const getMetrics = () => deepCopyAndFreezeJsonable(metrics);
2883
3128
 
2884
3129
  /**
2885
- * @param {K} key
3130
+ * Touching moves a cell to first position so LRU eviction can target the last
3131
+ * cell (`head.prev`).
3132
+ *
3133
+ * @type {(key: K) => (CacheMapCell<K, V> | undefined)}
2886
3134
  */
2887
- // UNTIL https://github.com/endojs/endo/issues/1514
2888
- // Prefer: const get = key => touchCell(key)?.data?.get(key);
3135
+ const touchKey = key => {
3136
+ metrics.totalQueryCount += 1;
3137
+ const cell = keyToCell.get(key);
3138
+ if (!cell?.data.has(key)) return undefined;
3139
+
3140
+ metrics.totalHitCount += 1;
3141
+ moveCellAfter(cell, head);
3142
+ return cell;
3143
+ };
3144
+
3145
+ /** @type {WeakMapAPI<K, V>['has']} */
3146
+ const has = key => {
3147
+ const cell = touchKey(key);
3148
+ return cell !== undefined;
3149
+ };
3150
+ freeze(has);
3151
+
3152
+ /** @type {WeakMapAPI<K, V>['get']} */
2889
3153
  const get = key => {
2890
- const cell = touchCell(key);
2891
- return cell && cell.data && cell.data.get(key);
3154
+ const cell = touchKey(key);
3155
+ return cell?.data.get(key);
2892
3156
  };
2893
3157
  freeze(get);
2894
3158
 
2895
- /**
2896
- * @param {K} key
2897
- * @param {V} value
2898
- */
3159
+ /** @type {WeakMapAPI<K, V>['set']} */
2899
3160
  const set = (key, value) => {
2900
- if (keysBudget < 1) {
3161
+ let cell = touchKey(key);
3162
+ if (cell) {
3163
+ cell.data.set(key, value);
2901
3164
  // eslint-disable-next-line no-use-before-define
2902
- return lruCacheMap; // Implements WeakMap.set
3165
+ return implementation;
2903
3166
  }
2904
3167
 
2905
- let cell = touchCell(key);
2906
- if (cell === undefined) {
2907
- cell = makeSelfCell(undefined);
2908
- spliceAfter(head, cell); // start most recently used
2909
- }
2910
- if (!cell.data) {
2911
- // Either a fresh cell or a reused condemned cell.
2912
- size += 1;
2913
- // Add its data.
2914
- // eslint-disable-next-line no-restricted-globals
2915
- cell.data = new WeakMap();
2916
- // Advertise the cell for this key.
2917
- keyToCell.set(key, cell);
2918
- while (size > keysBudget) {
2919
- const condemned = head.prev;
2920
- spliceOut(condemned); // Drop least recently used
2921
- condemned.data = undefined;
2922
- size -= 1;
2923
- }
3168
+ if (cellCount < capacity) {
3169
+ // Add and use a new cell at first position.
3170
+ cell = appendNewCell(head, cellCount + 1, makeMap());
3171
+ cellCount += 1; // intentionally follows cell creation
3172
+ cell.data.set(key, value);
3173
+ } else if (capacity > 0) {
3174
+ // Reuse the current tail, moving it to first position.
3175
+ cell = head.prev;
3176
+ resetCell(/** @type {any} */ (cell), UNKNOWN_KEY, makeMap);
3177
+ cell.data.set(key, value);
3178
+ moveCellAfter(cell, head);
2924
3179
  }
2925
3180
 
2926
- // Update the data.
2927
- cell.data.set(key, value);
3181
+ // Don't establish this entry until prior steps succeed.
3182
+ if (cell) keyToCell.set(key, cell);
2928
3183
 
2929
3184
  // eslint-disable-next-line no-use-before-define
2930
- return lruCacheMap; // Implements WeakMap.set
3185
+ return implementation;
2931
3186
  };
2932
3187
  freeze(set);
2933
3188
 
2934
3189
  // "delete" is a keyword.
2935
- /**
2936
- * @param {K} key
2937
- */
2938
- const deleteIt = key => {
2939
- const cell = keyToCell.get(key);
2940
- if (cell === undefined) {
2941
- return false;
2942
- }
2943
- spliceOut(cell);
2944
- keyToCell.delete(key);
2945
- if (cell.data === undefined) {
2946
- // Already condemned.
2947
- return false;
2948
- }
2949
-
2950
- cell.data = undefined;
2951
- size -= 1;
2952
- return true;
3190
+ const { delete: deleteEntry } = {
3191
+ /** @type {WeakMapAPI<K, V>['delete']} */
3192
+ delete: key => {
3193
+ const cell = keyToCell.get(key);
3194
+ if (!cell?.data.has(key)) {
3195
+ keyToCell.delete(key);
3196
+ return false;
3197
+ }
3198
+ moveCellAfter(cell, head.prev);
3199
+ resetCell(cell, key);
3200
+ keyToCell.delete(key);
3201
+ return true;
3202
+ },
2953
3203
  };
2954
- freeze(deleteIt);
3204
+ freeze(deleteEntry);
2955
3205
 
2956
- const lruCacheMap = freeze({
3206
+ const implementation = /** @type {WeakMapAPI<K, V>} */ ({
2957
3207
  has,
2958
3208
  get,
2959
3209
  set,
2960
- delete: deleteIt,
3210
+ delete: deleteEntry,
2961
3211
  // eslint-disable-next-line jsdoc/check-types
2962
- [/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]:
2963
- 'LRUCacheMap',
3212
+ [/** @type {typeof Symbol.toStringTag} */ (toStringTagSymbol)]: tag,
2964
3213
  });
2965
- return lruCacheMap;
2966
- };$h͏_once.makeLRUCacheMap(makeLRUCacheMap);
2967
- freeze(makeLRUCacheMap);
3214
+ freeze(implementation);
3215
+
3216
+ const kit = { cache: implementation, getMetrics };
3217
+ return freeze(kit);
3218
+ };$h͏_once.makeCacheMapKit(makeCacheMapKit);
3219
+ freeze(makeCacheMapKit);
3220
+ })()
3221
+ ,
3222
+ // === 11. cache-map ./index.js ===
3223
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/cachemap.js", []]]);
2968
3224
  })()
2969
3225
  ,
2970
- // === 10. ses ./src/error/note-log-args.js ===
2971
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeLRUCacheMap;$h͏_imports([["../make-lru-cachemap.js", [["makeLRUCacheMap",[$h͏_a => (makeLRUCacheMap = $h͏_a)]]]]]);
3226
+ // === 12. ses ./src/error/note-log-args.js ===
3227
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeCacheMapKit;$h͏_imports([["@endo/cache-map", [["makeCacheMapKit",[$h͏_a => (makeCacheMapKit = $h͏_a)]]]]]);
2972
3228
 
2973
3229
 
2974
3230
 
2975
3231
 
2976
3232
 
2977
3233
  /**
3234
+ * @import {CacheMapKit} from '@endo/cache-map';
2978
3235
  * @import {LogArgs} from './internal-types.js';
2979
3236
  */
2980
3237
 
@@ -2999,16 +3256,16 @@ const defaultArgsPerErrorBudget = 100;
2999
3256
  }
3000
3257
 
3001
3258
  /**
3002
- * @type {WeakMap<Error, LogArgs[]>}
3003
- *
3004
3259
  * Maps from an error to an array of log args, where each log args is
3005
3260
  * remembered as an annotation on that error. This can be used, for example,
3006
3261
  * to keep track of additional causes of the error. The elements of any
3007
3262
  * log args may include errors which are associated with further annotations.
3008
3263
  * An augmented console, like the causal console of `console.js`, could
3009
3264
  * then retrieve the graph of such annotations.
3265
+ *
3266
+ * @type {CacheMapKit<WeakMapConstructor, Error, LogArgs[]>}
3010
3267
  */
3011
- const noteLogArgsArrayMap = makeLRUCacheMap(errorsBudget);
3268
+ const { cache: noteLogArgsArrayMap } = makeCacheMapKit(errorsBudget);
3012
3269
 
3013
3270
  /**
3014
3271
  * @param {Error} error
@@ -3046,8 +3303,9 @@ const defaultArgsPerErrorBudget = 100;
3046
3303
  freeze(makeNoteLogArgsArrayKit);
3047
3304
  })()
3048
3305
  ,
3049
- // === 11. ses ./src/error/assert.js ===
3050
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpTest,stringIndexOf,stringReplace,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,objectHasOwnProperty,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringReplace",[$h͏_a => (stringReplace = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
3306
+ // === 13. ses ./src/error/assert.js ===
3307
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let RangeError,TypeError,WeakMap,arrayJoin,arrayMap,arrayPop,arrayPush,assign,freeze,defineProperty,globalThis,is,isError,regexpExec,regexpReplace,sealRegexp,stringIndexOf,stringSlice,stringStartsWith,weakmapDelete,weakmapGet,weakmapHas,weakmapSet,AggregateError,getOwnPropertyDescriptors,ownKeys,create,objectPrototype,hasOwn,an,bestEffortStringify,makeNoteLogArgsArrayKit;$h͏_imports([["../commons.js", [["RangeError",[$h͏_a => (RangeError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringIndexOf",[$h͏_a => (stringIndexOf = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringStartsWith",[$h͏_a => (stringStartsWith = $h͏_a)]],["weakmapDelete",[$h͏_a => (weakmapDelete = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["AggregateError",[$h͏_a => (AggregateError = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]],["./stringify-utils.js", [["an",[$h͏_a => (an = $h͏_a)]],["bestEffortStringify",[$h͏_a => (bestEffortStringify = $h͏_a)]]]],["./types.js", []],["./internal-types.js", []],["./note-log-args.js", [["makeNoteLogArgsArrayKit",[$h͏_a => (makeNoteLogArgsArrayKit = $h͏_a)]]]]]);
3308
+
3051
3309
 
3052
3310
 
3053
3311
 
@@ -3096,24 +3354,28 @@ freeze(makeNoteLogArgsArrayKit);
3096
3354
 
3097
3355
 
3098
3356
  /**
3099
- * @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, StringablePayload, DetailsToken, MakeAssert} from '../../types.js'
3100
- * @import {LogArgs, NoteCallback, LoggedErrorHandler} from "./internal-types.js";
3357
+ * @import {BaseAssert, Assert, AssertionFunctions, AssertionUtilities, DeprecatedAssertionUtilities, Stringable, DetailsToken, MakeAssert} from '../../types.js';
3358
+ * @import {LogArgs, NoteCallback, LoggedErrorHandler} from './internal-types.js';
3101
3359
  */
3102
3360
 
3103
- // For our internal debugging purposes, uncomment
3361
+ // For internal debugging purposes, uncomment
3104
3362
  // const internalDebugConsole = console;
3105
3363
 
3106
3364
  // /////////////////////////////////////////////////////////////////////////////
3107
3365
 
3108
- /** @type {WeakMap<StringablePayload, any>} */
3366
+ /**
3367
+ * Maps the result of a `quote` or `bare` call back to its input value.
3368
+ *
3369
+ * @type {WeakMap<Stringable, any>}
3370
+ */
3109
3371
  const declassifiers = new WeakMap();
3110
3372
 
3111
3373
  /** @type {AssertionUtilities['quote']} */
3112
- const quote = (payload, spaces = undefined) => {
3374
+ const quote = (value, spaces = undefined) => {
3113
3375
  const result = freeze({
3114
- toString: freeze(() => bestEffortStringify(payload, spaces)),
3376
+ toString: freeze(() => bestEffortStringify(value, spaces)),
3115
3377
  });
3116
- weakmapSet(declassifiers, result, payload);
3378
+ weakmapSet(declassifiers, result, value);
3117
3379
  return result;
3118
3380
  };$h͏_once.quote(quote);
3119
3381
  freeze(quote);
@@ -3123,14 +3385,14 @@ const canBeBare = freeze(/^[\w:-]( ?[\w:-])*$/);
3123
3385
  /**
3124
3386
  * @type {AssertionUtilities['bare']}
3125
3387
  */
3126
- const bare = (payload, spaces = undefined) => {
3127
- if (typeof payload !== 'string' || !regexpTest(canBeBare, payload)) {
3128
- return quote(payload, spaces);
3388
+ const bare = (text, spaces = undefined) => {
3389
+ if (typeof text !== 'string' || !regexpExec(canBeBare, text)) {
3390
+ return quote(text, spaces);
3129
3391
  }
3130
3392
  const result = freeze({
3131
- toString: freeze(() => payload),
3393
+ toString: freeze(() => text),
3132
3394
  });
3133
- weakmapSet(declassifiers, result, payload);
3395
+ weakmapSet(declassifiers, result, text);
3134
3396
  return result;
3135
3397
  };$h͏_once.bare(bare);
3136
3398
  freeze(bare);
@@ -3138,24 +3400,28 @@ freeze(bare);
3138
3400
  // /////////////////////////////////////////////////////////////////////////////
3139
3401
 
3140
3402
  /**
3141
- * @typedef {object} HiddenDetails
3403
+ * @typedef {{ template: TemplateStringsArray | string[], args: any[] }} DetailsParts
3142
3404
  *
3143
- * Captures the arguments passed to the `details` template string tag.
3405
+ * The contents of a `details` template literal tag: literal strings (always at
3406
+ * least one) and arbitrary substitution values from in between them.
3144
3407
  *
3145
- * @property {TemplateStringsArray | string[]} template
3146
- * @property {any[]} args
3408
+ * Unquoted substitution values are sensitive (and are redacted in error
3409
+ * `message` strings), so a DetailsPart must not leak outside of this file.
3147
3410
  */
3148
3411
 
3149
3412
  /**
3150
- * @type {WeakMap<DetailsToken, HiddenDetails>}
3413
+ * Maps the result of a `details` tagged template literal back to a record of
3414
+ * that template literal's contents.
3151
3415
  *
3152
- * Maps from a details token which a `details` template literal returned
3153
- * to a record of the contents of that template literal expression.
3416
+ * @type {WeakMap<DetailsToken, DetailsParts>}
3154
3417
  */
3155
3418
  const hiddenDetailsMap = new WeakMap();
3156
3419
 
3157
3420
  /**
3158
- * @param {HiddenDetails} hiddenDetails
3421
+ * Construct an error message string from `details` template literal contents,
3422
+ * replacing unquoted substitution values with redactions.
3423
+ *
3424
+ * @param {DetailsParts} hiddenDetails
3159
3425
  * @returns {string}
3160
3426
  */
3161
3427
  const getMessageString = ({ template, args }) => {
@@ -3176,16 +3442,14 @@ const getMessageString = ({ template, args }) => {
3176
3442
  };
3177
3443
 
3178
3444
  /**
3179
- * Give detailsTokens a toString behavior. To minimize the overhead of
3180
- * creating new detailsTokens, we do this with an
3181
- * inherited `this` sensitive `toString` method, even though we normally
3182
- * avoid `this` sensitivity. To protect the method from inappropriate
3183
- * `this` application, it does something interesting only for objects
3184
- * registered in `redactedDetails`, which should be exactly the detailsTokens.
3445
+ * Define `toString` behavior for DetailsToken. To minimize the overhead of
3446
+ * creating new instances, we do this with an inherited `this`-sensitive method,
3447
+ * even though we normally avoid such sensitivity. To protect the method from
3448
+ * inappropriate application, it verifies that `this` is registered in
3449
+ * `redactedDetails` before doing interesting work.
3185
3450
  *
3186
- * The printing behavior must not reveal anything redacted, so we just use
3187
- * the same `getMessageString` we use to construct the redacted message
3188
- * string for a thrown assertion error.
3451
+ * The behavior must not reveal anything redacted, so we use `getMessageString`
3452
+ * to return the same value as the message for a thrown assertion-failure error.
3189
3453
  */
3190
3454
  const DetailsTokenProto = freeze({
3191
3455
  toString() {
@@ -3205,16 +3469,15 @@ freeze(DetailsTokenProto.toString);
3205
3469
  * given to `lockdown`, then `unredactedDetails` is used instead.
3206
3470
  *
3207
3471
  * There are some unconditional uses of `redactedDetails` in this module. All
3208
- * of them should be uses where the template literal has no redacted
3209
- * substitution values. In those cases, the two are equivalent.
3472
+ * of them should be uses where the template literal has no redacted (unquoted)
3473
+ * substitution values. In those cases, `redactedDetails` is equivalent to
3474
+ * `unredactedDetails`.
3210
3475
  *
3211
3476
  * @type {AssertionUtilities['details']}
3212
3477
  */
3213
3478
  const redactedDetails = (template, ...args) => {
3214
- // Keep in mind that the vast majority of calls to `details` creates
3215
- // a details token that is never used, so this path must remain as fast as
3216
- // possible. Hence we store what we've got with little processing, postponing
3217
- // all the work to happen only if needed, for example, if an assertion fails.
3479
+ // In case the result of this call is never used, perform as little processing
3480
+ // as possible here to keep things fast.
3218
3481
  const detailsToken = freeze({ __proto__: DetailsTokenProto });
3219
3482
  weakmapSet(hiddenDetailsMap, detailsToken, { template, args });
3220
3483
  return /** @type {DetailsToken} */ (/** @type {unknown} */ (detailsToken));
@@ -3244,8 +3507,15 @@ const unredactedDetails = (template, ...args) => {
3244
3507
  freeze(unredactedDetails);
3245
3508
 
3246
3509
 
3510
+ const leadingSpacePattern = sealRegexp(/^ /);
3511
+ const trailingSpacePattern = sealRegexp(/ $/);
3512
+
3247
3513
  /**
3248
- * @param {HiddenDetails} hiddenDetails
3514
+ * Get arguments suitable for a console logger function (e.g., `console.error`)
3515
+ * from `details` template literal contents, unquoting quoted substitution
3516
+ * values.
3517
+ *
3518
+ * @param {DetailsParts} hiddenDetails
3249
3519
  * @returns {LogArgs}
3250
3520
  */
3251
3521
  const getLogArgs = ({ template, args }) => {
@@ -3255,14 +3525,22 @@ const getLogArgs = ({ template, args }) => {
3255
3525
  if (weakmapHas(declassifiers, arg)) {
3256
3526
  arg = weakmapGet(declassifiers, arg);
3257
3527
  }
3258
- // Remove the extra spaces (since console.error puts them
3259
- // between each cause).
3260
- const priorWithoutSpace = stringReplace(arrayPop(logArgs) || '', / $/, '');
3261
- if (priorWithoutSpace !== '') {
3262
- arrayPush(logArgs, priorWithoutSpace);
3528
+ // Remove substitution-adjacent spaces from template fixed-string parts
3529
+ // (since console logging inserts its own argument-separating spaces).
3530
+ const prevLiteralPart = regexpReplace(
3531
+ trailingSpacePattern,
3532
+ arrayPop(logArgs) || '',
3533
+ '',
3534
+ );
3535
+ if (prevLiteralPart !== '') {
3536
+ arrayPush(logArgs, prevLiteralPart);
3263
3537
  }
3264
- const nextWithoutSpace = stringReplace(template[i + 1], /^ /, '');
3265
- arrayPush(logArgs, arg, nextWithoutSpace);
3538
+ const nextLiteralPart = regexpReplace(
3539
+ leadingSpacePattern,
3540
+ template[i + 1],
3541
+ '',
3542
+ );
3543
+ arrayPush(logArgs, arg, nextLiteralPart);
3266
3544
  }
3267
3545
  if (logArgs[logArgs.length - 1] === '') {
3268
3546
  arrayPop(logArgs);
@@ -3271,11 +3549,11 @@ const getLogArgs = ({ template, args }) => {
3271
3549
  };
3272
3550
 
3273
3551
  /**
3274
- * @type {WeakMap<Error, LogArgs>}
3552
+ * Maps from an error object to arguments suitable for a privileged console
3553
+ * logger function such as `console.error`, including values that may be
3554
+ * redacted in the error's `message`.
3275
3555
  *
3276
- * Maps from an error object to the log args that are a more informative
3277
- * alternative message for that error. When logging the error, these
3278
- * log args should be preferred to `error.message`.
3556
+ * @type {WeakMap<Error, LogArgs>}
3279
3557
  */
3280
3558
  const hiddenMessageLogArgs = new WeakMap();
3281
3559
 
@@ -3346,27 +3624,24 @@ const tagError = (err, optErrorName = err.name) => {
3346
3624
  for (const name of restNames) {
3347
3625
  delete error[name];
3348
3626
  }
3349
- const droppedNote = create(objectPrototype, restDescs);
3627
+ const dropped = create(objectPrototype, restDescs);
3628
+ const droppedDetails = redactedDetails`originally with properties ${quote(dropped)}`;
3350
3629
  // eslint-disable-next-line no-use-before-define
3351
- note(
3352
- error,
3353
- redactedDetails`originally with properties ${quote(droppedNote)}`,
3354
- );
3630
+ note(error, droppedDetails);
3355
3631
  }
3356
3632
  for (const name of ownKeys(error)) {
3357
- // @ts-expect-error TS still confused by symbols as property names
3633
+ // @ts-expect-error TypeScript is still confused by symbols as property keys
3358
3634
  const desc = descs[name];
3359
- if (desc && objectHasOwnProperty(desc, 'get')) {
3360
- defineProperty(error, name, {
3361
- value: error[name] // invoke the getter to convert to data property
3362
- });
3635
+ if (desc && hasOwn(desc, 'get')) {
3636
+ const value = error[name]; // invokes the getter
3637
+ defineProperty(error, name, { value });
3363
3638
  }
3364
3639
  }
3365
3640
  freeze(error);
3366
3641
  };
3367
3642
 
3368
3643
  /**
3369
- * @type {AssertionUtilities['error']}
3644
+ * @type {AssertionUtilities['makeError']}
3370
3645
  */$h͏_once.sanitizeError(sanitizeError);
3371
3646
  const makeError = (
3372
3647
  optDetails = redactedDetails`Assert failed`,
@@ -3378,9 +3653,9 @@ const makeError = (
3378
3653
  sanitize = true,
3379
3654
  } = {},
3380
3655
  ) => {
3656
+ // Promote string-valued `optDetails` into a minimal DetailsParts
3657
+ // consisting of that string as the sole literal part with no substitutions.
3381
3658
  if (typeof optDetails === 'string') {
3382
- // If it is a string, use it as the literal part of the template so
3383
- // it doesn't get quoted.
3384
3659
  optDetails = redactedDetails([optDetails]);
3385
3660
  }
3386
3661
  const hiddenDetails = weakmapGet(hiddenDetailsMap, optDetails);
@@ -3396,13 +3671,11 @@ const makeError = (
3396
3671
  ) {
3397
3672
  error = AggregateError(errors || [], messageString, opts);
3398
3673
  } else {
3399
- error = /** @type {ErrorConstructor} */ (errConstructor)(
3400
- messageString,
3401
- opts,
3402
- );
3674
+ const ErrorCtor = /** @type {ErrorConstructor} */ (errConstructor);
3675
+ error = ErrorCtor(messageString, opts);
3676
+ // Since we need to tolerate `errors` on an AggregateError, we may as well
3677
+ // tolerate it on all errors.
3403
3678
  if (errors !== undefined) {
3404
- // Since we need to tolerate `errors` on an AggregateError, may as
3405
- // well tolerate it on all errors.
3406
3679
  defineProperty(error, 'errors', {
3407
3680
  value: errors,
3408
3681
  writable: true,
@@ -3425,11 +3698,10 @@ freeze(makeError);
3425
3698
 
3426
3699
  // /////////////////////////////////////////////////////////////////////////////
3427
3700
 
3428
- const { addLogArgs, takeLogArgsArray } = makeNoteLogArgsArrayKit();
3701
+ const { addLogArgs: addNoteLogArgs, takeLogArgsArray: takeAllNoteLogArgs } =
3702
+ makeNoteLogArgsArrayKit();
3429
3703
 
3430
3704
  /**
3431
- * @type {WeakMap<Error, NoteCallback[]>}
3432
- *
3433
3705
  * An augmented console will normally only take the hidden noteArgs array once,
3434
3706
  * when it logs the error being annotated. Once that happens, further
3435
3707
  * annotations of that error should go to the console immediately. We arrange
@@ -3438,14 +3710,16 @@ const { addLogArgs, takeLogArgsArray } = makeNoteLogArgsArrayKit();
3438
3710
  * callback per error, but that depends on console behavior which we should not
3439
3711
  * assume. We make this an array of callbacks so multiple registrations
3440
3712
  * are independent.
3713
+ *
3714
+ * @type {WeakMap<Error, NoteCallback[]>}
3441
3715
  */
3442
- const hiddenNoteCallbackArrays = new WeakMap();
3716
+ const hiddenNoteCallbacks = new WeakMap();
3443
3717
 
3444
3718
  /** @type {AssertionUtilities['note']} */
3445
3719
  const note = (error, detailsNote) => {
3720
+ // Promote string-valued `detailsNote` into a minimal DetailsParts consisting
3721
+ // of that string as the sole literal part with no substitutions.
3446
3722
  if (typeof detailsNote === 'string') {
3447
- // If it is a string, use it as the literal part of the template so
3448
- // it doesn't get quoted.
3449
3723
  detailsNote = redactedDetails([detailsNote]);
3450
3724
  }
3451
3725
  const hiddenDetails = weakmapGet(hiddenDetailsMap, detailsNote);
@@ -3453,13 +3727,13 @@ const note = (error, detailsNote) => {
3453
3727
  throw TypeError(`unrecognized details ${quote(detailsNote)}`);
3454
3728
  }
3455
3729
  const logArgs = getLogArgs(hiddenDetails);
3456
- const callbacks = weakmapGet(hiddenNoteCallbackArrays, error);
3730
+ const callbacks = weakmapGet(hiddenNoteCallbacks, error);
3457
3731
  if (callbacks !== undefined) {
3458
3732
  for (const callback of callbacks) {
3459
3733
  callback(error, logArgs);
3460
3734
  }
3461
3735
  } else {
3462
- addLogArgs(error, logArgs);
3736
+ addNoteLogArgs(error, logArgs);
3463
3737
  }
3464
3738
  };$h͏_once.note(note);
3465
3739
  freeze(note);
@@ -3493,21 +3767,21 @@ const loggedErrorHandler = {
3493
3767
  },
3494
3768
  getMessageLogArgs: error => weakmapGet(hiddenMessageLogArgs, error),
3495
3769
  takeMessageLogArgs: error => {
3496
- const result = weakmapGet(hiddenMessageLogArgs, error);
3770
+ const logArgs = weakmapGet(hiddenMessageLogArgs, error);
3497
3771
  weakmapDelete(hiddenMessageLogArgs, error);
3498
- return result;
3772
+ return logArgs;
3499
3773
  },
3500
3774
  takeNoteLogArgsArray: (error, callback) => {
3501
- const result = takeLogArgsArray(error);
3775
+ const logArgsArray = takeAllNoteLogArgs(error);
3502
3776
  if (callback !== undefined) {
3503
- const callbacks = weakmapGet(hiddenNoteCallbackArrays, error);
3777
+ const callbacks = weakmapGet(hiddenNoteCallbacks, error);
3504
3778
  if (callbacks) {
3505
3779
  arrayPush(callbacks, callback);
3506
3780
  } else {
3507
- weakmapSet(hiddenNoteCallbackArrays, error, [callback]);
3781
+ weakmapSet(hiddenNoteCallbacks, error, [callback]);
3508
3782
  }
3509
3783
  }
3510
- return result || [];
3784
+ return logArgsArray || [];
3511
3785
  },
3512
3786
  };$h͏_once.loggedErrorHandler(loggedErrorHandler);
3513
3787
  freeze(loggedErrorHandler);
@@ -3518,7 +3792,7 @@ freeze(loggedErrorHandler);
3518
3792
  /**
3519
3793
  * @type {MakeAssert}
3520
3794
  */
3521
- const makeAssert = (optRaise = undefined, unredacted = false) => {
3795
+ const makeAssert = (optRaise = undefined, unredacted = false) => {
3522
3796
  const details = unredacted ? unredactedDetails : redactedDetails;
3523
3797
  const assertFailedDetails = details`Check failed`;
3524
3798
 
@@ -3530,7 +3804,6 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
3530
3804
  ) => {
3531
3805
  const reason = makeError(optDetails, errConstructor, options);
3532
3806
  if (optRaise !== undefined) {
3533
- // @ts-ignore returns `never` doesn't mean it isn't callable
3534
3807
  optRaise(reason);
3535
3808
  }
3536
3809
  throw reason;
@@ -3540,18 +3813,16 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
3540
3813
  /** @type {AssertionUtilities['Fail']} */
3541
3814
  const Fail = (template, ...args) => fail(details(template, ...args));
3542
3815
 
3543
- // Don't freeze or export `baseAssert` until we add methods.
3544
- // TODO If I change this from a `function` function to an arrow
3545
- // function, I seem to get type errors from TypeScript. Why?
3816
+ // Don't freeze or export `assert` until we add methods.
3546
3817
  /** @type {BaseAssert} */
3547
- function baseAssert(
3548
- flag,
3818
+ const assert = (
3819
+ condition,
3549
3820
  optDetails = undefined,
3550
3821
  errConstructor = undefined,
3551
3822
  options = undefined,
3552
- ) {
3553
- flag || fail(optDetails, errConstructor, options);
3554
- }
3823
+ ) => {
3824
+ condition || fail(optDetails, errConstructor, options);
3825
+ };
3555
3826
 
3556
3827
  /** @type {AssertionFunctions['equal']} */
3557
3828
  const equal = (
@@ -3593,26 +3864,37 @@ const makeAssert = (optRaise = undefined, unredacted = false) => {
3593
3864
  const assertString = (specimen, optDetails = undefined) =>
3594
3865
  assertTypeof(specimen, 'string', optDetails);
3595
3866
 
3596
- // Note that "assert === baseAssert"
3597
- /** @type {Assert} */
3598
- const assert = assign(baseAssert, {
3599
- error: makeError,
3600
- fail,
3867
+ /** @type {Pick<AssertionFunctions, keyof AssertionFunctions>} */
3868
+ const assertionFunctions = {
3601
3869
  equal,
3602
3870
  typeof: assertTypeof,
3603
3871
  string: assertString,
3872
+ fail,
3873
+ };
3874
+
3875
+ /** @type {AssertionUtilities} */
3876
+ const assertionUtilities = {
3877
+ makeError,
3604
3878
  note,
3605
3879
  details,
3606
3880
  Fail,
3607
3881
  quote,
3608
3882
  bare,
3609
- makeAssert,
3883
+ };
3884
+
3885
+ /** @type {DeprecatedAssertionUtilities} */
3886
+ const deprecated = { error: makeError, makeAssert };
3887
+
3888
+ /** @type {Assert} */
3889
+ const finishedAssert = assign(assert, {
3890
+ ...assertionFunctions,
3891
+ ...assertionUtilities,
3892
+ ...deprecated,
3610
3893
  });
3611
- return freeze(assert);
3894
+ return freeze(finishedAssert);
3612
3895
  };$h͏_once.makeAssert(makeAssert);
3613
3896
  freeze(makeAssert);
3614
3897
 
3615
-
3616
3898
  /** @type {Assert} */
3617
3899
  const assert = makeAssert();$h͏_once.assert(assert);
3618
3900
 
@@ -3624,8 +3906,8 @@ const assert = makeAssert();$h͏_once.assert(assert);
3624
3906
  const assertEqual = assert.equal;$h͏_once.assertEqual(assertEqual);
3625
3907
  })()
3626
3908
  ,
3627
- // === 12. ses ./src/make-hardener.js ===
3628
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isObject,objectHasOwnProperty,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weaksetAdd,weaksetHas,FERAL_STACK_GETTER,FERAL_STACK_SETTER,isError,assert;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isInteger",[$h͏_a => (isInteger = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["preventExtensions",[$h͏_a => (preventExtensions = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["setForEach",[$h͏_a => (setForEach = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["typedArrayPrototype",[$h͏_a => (typedArrayPrototype = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["FERAL_STACK_GETTER",[$h͏_a => (FERAL_STACK_GETTER = $h͏_a)]],["FERAL_STACK_SETTER",[$h͏_a => (FERAL_STACK_SETTER = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
3909
+ // === 14. ses ./src/make-hardener.js ===
3910
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,WeakSet,globalThis,apply,arrayForEach,defineProperty,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,getPrototypeOf,isInteger,isPrimitive,hasOwn,ownKeys,preventExtensions,setAdd,setForEach,setHas,toStringTagSymbol,typedArrayPrototype,weaksetAdd,weaksetHas,FERAL_STACK_GETTER,FERAL_STACK_SETTER,isError,assert;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isInteger",[$h͏_a => (isInteger = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["preventExtensions",[$h͏_a => (preventExtensions = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["setForEach",[$h͏_a => (setForEach = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["typedArrayPrototype",[$h͏_a => (typedArrayPrototype = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["FERAL_STACK_GETTER",[$h͏_a => (FERAL_STACK_GETTER = $h͏_a)]],["FERAL_STACK_SETTER",[$h͏_a => (FERAL_STACK_SETTER = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
3629
3911
 
3630
3912
 
3631
3913
 
@@ -3778,7 +4060,7 @@ const freezeTypedArray = array => {
3778
4060
  * @param {any} val
3779
4061
  */
3780
4062
  function enqueue(val) {
3781
- if (!isObject(val)) {
4063
+ if (isPrimitive(val)) {
3782
4064
  // ignore primitives
3783
4065
  return;
3784
4066
  }
@@ -3833,7 +4115,7 @@ const freezeTypedArray = array => {
3833
4115
  // test could be confused. We use hasOwnProperty to be sure about
3834
4116
  // whether 'value' is present or not, which tells us for sure that
3835
4117
  // this is a data property.
3836
- if (objectHasOwnProperty(desc, 'value')) {
4118
+ if (hasOwn(desc, 'value')) {
3837
4119
  enqueue(desc.value);
3838
4120
  } else {
3839
4121
  enqueue(desc.get);
@@ -3902,8 +4184,8 @@ const freezeTypedArray = array => {
3902
4184
  };$h͏_once.makeHardener(makeHardener);
3903
4185
  })()
3904
4186
  ,
3905
- // === 13. ses ./src/cauterize-property.js ===
3906
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let objectHasOwnProperty;$h͏_imports([["./commons.js", [["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]]]]]);
4187
+ // === 15. ses ./src/cauterize-property.js ===
4188
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let hasOwn;$h͏_imports([["./commons.js", [["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]]]);
3907
4189
 
3908
4190
  /**
3909
4191
  * @import {Reporter} from './reporting-types.js'
@@ -3957,7 +4239,7 @@ const freezeTypedArray = array => {
3957
4239
  try {
3958
4240
  delete obj[prop];
3959
4241
  } catch (err) {
3960
- if (objectHasOwnProperty(obj, prop)) {
4242
+ if (hasOwn(obj, prop)) {
3961
4243
  if (typeof obj === 'function' && prop === 'prototype') {
3962
4244
  obj.prototype = undefined;
3963
4245
  if (obj.prototype === undefined) {
@@ -3974,7 +4256,7 @@ const freezeTypedArray = array => {
3974
4256
  };$h͏_once.cauterizeProperty(cauterizeProperty);
3975
4257
  })()
3976
4258
  ,
3977
- // === 14. ses ./src/permits.js ===
4259
+ // === 16. ses ./src/permits.js ===
3978
4260
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayPush,arrayForEach;$h͏_imports([["./commons.js", [["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]]]]]);
3979
4261
 
3980
4262
 
@@ -4484,6 +4766,11 @@ const CommonMath = {
4484
4766
  seal: fn,
4485
4767
  setPrototypeOf: fn,
4486
4768
  values: fn,
4769
+ 'RegisteredSymbol(harden)': {
4770
+ ...fn,
4771
+ // Installed with hardenTaming: 'unsafe'
4772
+ isFake: 'boolean',
4773
+ },
4487
4774
  // https://github.com/tc39/proposal-accessible-object-hasownproperty
4488
4775
  hasOwn: fn,
4489
4776
  // https://github.com/tc39/proposal-array-grouping
@@ -5738,8 +6025,8 @@ const CommonMath = {
5738
6025
  };$h͏_once.permitted(permitted);
5739
6026
  })()
5740
6027
  ,
5741
- // === 15. ses ./src/intrinsics.js ===
5742
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let cauterizeProperty,TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h͏_imports([["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]],["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["sharedGlobalPropertyNames",[$h͏_a => (sharedGlobalPropertyNames = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]],["permitted",[$h͏_a => (permitted = $h͏_a)]]]]]);
6028
+ // === 17. ses ./src/intrinsics.js ===
6029
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let cauterizeProperty,TypeError,WeakSet,arrayFilter,create,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isPrimitive,hasOwn,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,permitted;$h͏_imports([["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]],["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["sharedGlobalPropertyNames",[$h͏_a => (sharedGlobalPropertyNames = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]],["permitted",[$h͏_a => (permitted = $h͏_a)]]]]]);
5743
6030
 
5744
6031
 
5745
6032
 
@@ -5778,7 +6065,7 @@ const isFunction = obj => typeof obj === 'function';
5778
6065
  // get masked as one overwrites the other. Accordingly, the thrown error
5779
6066
  // complains of a "Conflicting definition".
5780
6067
  function initProperty(obj, name, desc) {
5781
- if (objectHasOwnProperty(obj, name)) {
6068
+ if (hasOwn(obj, name)) {
5782
6069
  const preDesc = getOwnPropertyDescriptor(obj, name);
5783
6070
  if (
5784
6071
  !preDesc ||
@@ -5810,7 +6097,7 @@ function initProperties(obj, descs) {
5810
6097
  function sampleGlobals(globalObject, newPropertyNames) {
5811
6098
  const newIntrinsics = { __proto__: null };
5812
6099
  for (const [globalName, intrinsicName] of entries(newPropertyNames)) {
5813
- if (objectHasOwnProperty(globalObject, globalName)) {
6100
+ if (hasOwn(globalObject, globalName)) {
5814
6101
  newIntrinsics[intrinsicName] = globalObject[globalName];
5815
6102
  }
5816
6103
  }
@@ -5835,11 +6122,11 @@ function sampleGlobals(globalObject, newPropertyNames) {
5835
6122
  // to the intrinsics.
5836
6123
  const completePrototypes = () => {
5837
6124
  for (const [name, intrinsic] of entries(intrinsics)) {
5838
- if (!isObject(intrinsic)) {
6125
+ if (isPrimitive(intrinsic)) {
5839
6126
  // eslint-disable-next-line no-continue
5840
6127
  continue;
5841
6128
  }
5842
- if (!objectHasOwnProperty(intrinsic, 'prototype')) {
6129
+ if (!hasOwn(intrinsic, 'prototype')) {
5843
6130
  // eslint-disable-next-line no-continue
5844
6131
  continue;
5845
6132
  }
@@ -5861,12 +6148,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
5861
6148
  }
5862
6149
  if (
5863
6150
  typeof namePrototype !== 'string' ||
5864
- !objectHasOwnProperty(permitted, namePrototype)
6151
+ !hasOwn(permitted, namePrototype)
5865
6152
  ) {
5866
6153
  throw TypeError(`Unrecognized ${name}.prototype permits entry`);
5867
6154
  }
5868
6155
  const intrinsicPrototype = intrinsic.prototype;
5869
- if (objectHasOwnProperty(intrinsics, namePrototype)) {
6156
+ if (hasOwn(intrinsics, namePrototype)) {
5870
6157
  if (intrinsics[namePrototype] !== intrinsicPrototype) {
5871
6158
  throw TypeError(`Conflicting bindings of ${namePrototype}`);
5872
6159
  }
@@ -5933,8 +6220,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
5933
6220
  };$h͏_once.getGlobalIntrinsics(getGlobalIntrinsics);
5934
6221
  })()
5935
6222
  ,
5936
- // === 16. ses ./src/permits-intrinsics.js ===
5937
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor,cauterizeProperty;$h͏_imports([["./permits.js", [["permitted",[$h͏_a => (permitted = $h͏_a)]],["FunctionInstance",[$h͏_a => (FunctionInstance = $h͏_a)]],["isAccessorPermit",[$h͏_a => (isAccessorPermit = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["Symbol",[$h͏_a => (Symbol = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["symbolKeyFor",[$h͏_a => (symbolKeyFor = $h͏_a)]]]],["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]]]);
6223
+ // === 18. ses ./src/permits-intrinsics.js ===
6224
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let permitted,FunctionInstance,isAccessorPermit,Map,String,Symbol,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isPrimitive,mapGet,hasOwn,ownKeys,symbolKeyFor,cauterizeProperty;$h͏_imports([["./permits.js", [["permitted",[$h͏_a => (permitted = $h͏_a)]],["FunctionInstance",[$h͏_a => (FunctionInstance = $h͏_a)]],["isAccessorPermit",[$h͏_a => (isAccessorPermit = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["Symbol",[$h͏_a => (Symbol = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["symbolKeyFor",[$h͏_a => (symbolKeyFor = $h͏_a)]]]],["./cauterize-property.js", [["cauterizeProperty",[$h͏_a => (cauterizeProperty = $h͏_a)]]]]]);
5938
6225
 
5939
6226
 
5940
6227
 
@@ -6067,8 +6354,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6067
6354
  * Validate the object's [[prototype]] against a permit.
6068
6355
  */
6069
6356
  function visitPrototype(path, obj, protoName) {
6070
- if (!isObject(obj)) {
6071
- throw TypeError(`Object expected: ${path}, ${obj}, ${protoName}`);
6357
+ if (isPrimitive(obj)) {
6358
+ throw TypeError(`Object expected: ${path}, ${String(obj)}, ${protoName}`);
6072
6359
  }
6073
6360
  const proto = getPrototypeOf(obj);
6074
6361
 
@@ -6121,7 +6408,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6121
6408
  // Assert: the permit is the name of an intrinsic.
6122
6409
  // Assert: the property value is equal to that intrinsic.
6123
6410
 
6124
- if (objectHasOwnProperty(intrinsics, permit)) {
6411
+ if (hasOwn(intrinsics, permit)) {
6125
6412
  if (value !== intrinsics[permit]) {
6126
6413
  throw TypeError(`Does not match permit for ${path}`);
6127
6414
  }
@@ -6161,7 +6448,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6161
6448
  }
6162
6449
 
6163
6450
  // Is this a value property?
6164
- if (objectHasOwnProperty(desc, 'value')) {
6451
+ if (hasOwn(desc, 'value')) {
6165
6452
  if (isAccessorPermit(permit)) {
6166
6453
  throw TypeError(`Accessor expected at ${path}`);
6167
6454
  }
@@ -6181,12 +6468,12 @@ function sampleGlobals(globalObject, newPropertyNames) {
6181
6468
  */
6182
6469
  function getSubPermit(obj, permit, prop) {
6183
6470
  const permitProp = prop === '__proto__' ? '--proto--' : prop;
6184
- if (objectHasOwnProperty(permit, permitProp)) {
6471
+ if (hasOwn(permit, permitProp)) {
6185
6472
  return permit[permitProp];
6186
6473
  }
6187
6474
 
6188
6475
  if (typeof obj === 'function') {
6189
- if (objectHasOwnProperty(FunctionInstance, permitProp)) {
6476
+ if (hasOwn(FunctionInstance, permitProp)) {
6190
6477
  return FunctionInstance[permitProp];
6191
6478
  }
6192
6479
  }
@@ -6227,7 +6514,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6227
6514
  }$h͏_once.default( removeUnpermittedIntrinsics);
6228
6515
  })()
6229
6516
  ,
6230
- // === 17. ses ./src/tame-function-constructors.js ===
6517
+ // === 19. ses ./src/tame-function-constructors.js ===
6231
6518
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,SyntaxError,TypeError,defineProperties,getPrototypeOf,setPrototypeOf,freeze,AsyncGeneratorFunctionInstance;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["AsyncGeneratorFunctionInstance",[$h͏_a => (AsyncGeneratorFunctionInstance = $h͏_a)]]]]]);
6232
6519
 
6233
6520
 
@@ -6370,7 +6657,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6370
6657
  }$h͏_once.default( tameFunctionConstructors);
6371
6658
  })()
6372
6659
  ,
6373
- // === 18. ses ./src/tame-date-constructor.js ===
6660
+ // === 20. ses ./src/tame-date-constructor.js ===
6374
6661
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Date,TypeError,apply,construct,defineProperties;$h͏_imports([["./commons.js", [["Date",[$h͏_a => (Date = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]]]]]);
6375
6662
 
6376
6663
 
@@ -6500,7 +6787,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6500
6787
  }$h͏_once.default( tameDateConstructor);
6501
6788
  })()
6502
6789
  ,
6503
- // === 19. ses ./src/tame-math-object.js ===
6790
+ // === 21. ses ./src/tame-math-object.js ===
6504
6791
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Math,TypeError,create,getOwnPropertyDescriptors,objectPrototype;$h͏_imports([["./commons.js", [["Math",[$h͏_a => (Math = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]]]]]);
6505
6792
 
6506
6793
 
@@ -6544,7 +6831,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6544
6831
  }$h͏_once.default( tameMathObject);
6545
6832
  })()
6546
6833
  ,
6547
- // === 20. ses ./src/tame-regexp-constructor.js ===
6834
+ // === 22. ses ./src/tame-regexp-constructor.js ===
6548
6835
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,TypeError,construct,defineProperties,getOwnPropertyDescriptor,speciesSymbol;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["speciesSymbol",[$h͏_a => (speciesSymbol = $h͏_a)]]]]]);
6549
6836
 
6550
6837
 
@@ -6612,7 +6899,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6612
6899
  }$h͏_once.default( tameRegExpConstructor);
6613
6900
  })()
6614
6901
  ,
6615
- // === 21. ses ./src/enablements.js ===
6902
+ // === 23. ses ./src/enablements.js ===
6616
6903
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let toStringTagSymbol,iteratorSymbol;$h͏_imports([["./commons.js", [["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]]]]]);
6617
6904
 
6618
6905
  /**
@@ -6693,6 +6980,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6693
6980
  '%ErrorPrototype%': {
6694
6981
  name: true // set by "precond", "ava", "node-fetch"
6695
6982
  },
6983
+
6696
6984
  '%IteratorPrototype%': {
6697
6985
  toString: true,
6698
6986
  // https://github.com/tc39/proposal-iterator-helpers
@@ -6706,6 +6994,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6706
6994
  * Moderate enablements are usually good enough for legacy compat.
6707
6995
  */$h͏_once.minEnablements(minEnablements);
6708
6996
  const moderateEnablements = {
6997
+ ...minEnablements,
6998
+
6709
6999
  '%ObjectPrototype%': {
6710
7000
  toString: true,
6711
7001
  valueOf: true,
@@ -6718,6 +7008,10 @@ function sampleGlobals(globalObject, newPropertyNames) {
6718
7008
  [iteratorSymbol]: true // set by mobx generated code (old TS compiler?)
6719
7009
  },
6720
7010
 
7011
+ '%IteratorPrototype%': {
7012
+ [iteratorSymbol]: true // is sometimes used in custom iterators and generators implementations eg. @rive-app/canvas
7013
+ },
7014
+
6721
7015
  // Function.prototype has no 'prototype' property to enable.
6722
7016
  // Function instances have their own 'name' and 'length' properties
6723
7017
  // which are configurable and non-writable. Thus, they are already
@@ -6783,14 +7077,6 @@ function sampleGlobals(globalObject, newPropertyNames) {
6783
7077
  name: true,
6784
7078
  toString: true,
6785
7079
  },
6786
-
6787
- '%IteratorPrototype%': {
6788
- toString: true,
6789
- // https://github.com/tc39/proposal-iterator-helpers
6790
- constructor: true,
6791
- // https://github.com/tc39/proposal-iterator-helpers
6792
- [toStringTagSymbol]: true,
6793
- },
6794
7080
  };
6795
7081
 
6796
7082
  /**
@@ -6859,8 +7145,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
6859
7145
  };$h͏_once.severeEnablements(severeEnablements);
6860
7146
  })()
6861
7147
  ,
6862
- // === 22. ses ./src/enable-property-overrides.js ===
6863
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,isObject,objectHasOwnProperty,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]],["./enablements.js", [["minEnablements",[$h͏_a => (minEnablements = $h͏_a)]],["moderateEnablements",[$h͏_a => (moderateEnablements = $h͏_a)]],["severeEnablements",[$h͏_a => (severeEnablements = $h͏_a)]]]]]);
7148
+ // === 24. ses ./src/enable-property-overrides.js ===
7149
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Set,String,TypeError,arrayForEach,defineProperty,getOwnPropertyDescriptor,getOwnPropertyDescriptors,isPrimitive,hasOwn,ownKeys,setHas,minEnablements,moderateEnablements,severeEnablements;$h͏_imports([["./commons.js", [["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]],["./enablements.js", [["minEnablements",[$h͏_a => (minEnablements = $h͏_a)]],["moderateEnablements",[$h͏_a => (moderateEnablements = $h͏_a)]],["severeEnablements",[$h͏_a => (severeEnablements = $h͏_a)]]]]]);
6864
7150
 
6865
7151
 
6866
7152
 
@@ -6971,7 +7257,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
6971
7257
  )}' of '${path}'`,
6972
7258
  );
6973
7259
  }
6974
- if (objectHasOwnProperty(this, prop)) {
7260
+ if (hasOwn(this, prop)) {
6975
7261
  this[prop] = newValue;
6976
7262
  } else {
6977
7263
  if (isDebug) {
@@ -7041,7 +7327,7 @@ function sampleGlobals(globalObject, newPropertyNames) {
7041
7327
  enableProperty(subPath, obj, prop);
7042
7328
  } else if (subPlan === '*') {
7043
7329
  enableAllProperties(subPath, desc.value);
7044
- } else if (isObject(subPlan)) {
7330
+ } else if (!isPrimitive(subPlan)) {
7045
7331
  enableProperties(subPath, desc.value, subPlan);
7046
7332
  } else {
7047
7333
  throw TypeError(`Unexpected override enablement plan ${subPath}`);
@@ -7073,8 +7359,8 @@ function sampleGlobals(globalObject, newPropertyNames) {
7073
7359
  }$h͏_once.default( enablePropertyOverrides);
7074
7360
  })()
7075
7361
  ,
7076
- // === 23. ses ./src/tame-locale-methods.js ===
7077
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h͏_imports([["./commons.js", [["Number",[$h͏_a => (Number = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7362
+ // === 25. ses ./src/tame-locale-methods.js ===
7363
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Number,String,TypeError,defineProperty,getOwnPropertyNames,isPrimitive,regexpExec,assert;$h͏_imports([["./commons.js", [["Number",[$h͏_a => (Number = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7078
7364
 
7079
7365
 
7080
7366
 
@@ -7130,7 +7416,7 @@ const numberToString = tamedMethods.toString;
7130
7416
 
7131
7417
  for (const intrinsicName of getOwnPropertyNames(intrinsics)) {
7132
7418
  const intrinsic = intrinsics[intrinsicName];
7133
- if (isObject(intrinsic)) {
7419
+ if (!isPrimitive(intrinsic)) {
7134
7420
  for (const methodName of getOwnPropertyNames(intrinsic)) {
7135
7421
  const match = regexpExec(localePattern, methodName);
7136
7422
  if (match) {
@@ -7154,7 +7440,7 @@ const numberToString = tamedMethods.toString;
7154
7440
  }$h͏_once.default( tameLocaleMethods);
7155
7441
  })()
7156
7442
  ,
7157
- // === 24. ses ./src/make-eval-function.js ===
7443
+ // === 26. ses ./src/make-eval-function.js ===
7158
7444
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([]);/**
7159
7445
  * makeEvalFunction()
7160
7446
  * A safe version of the native eval function which relies on
@@ -7185,7 +7471,7 @@ const numberToString = tamedMethods.toString;
7185
7471
  };$h͏_once.makeEvalFunction(makeEvalFunction);
7186
7472
  })()
7187
7473
  ,
7188
- // === 25. ses ./src/make-function-constructor.js ===
7474
+ // === 27. ses ./src/make-function-constructor.js ===
7189
7475
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,arrayJoin,arrayPop,defineProperties,getPrototypeOf,assert;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7190
7476
 
7191
7477
 
@@ -7267,8 +7553,8 @@ const { Fail } = assert;
7267
7553
  };$h͏_once.makeFunctionConstructor(makeFunctionConstructor);
7268
7554
  })()
7269
7555
  ,
7270
- // === 26. ses ./src/global-object.js ===
7271
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,assign,create,defineProperty,entries,freeze,objectHasOwnProperty,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["unscopablesSymbol",[$h͏_a => (unscopablesSymbol = $h͏_a)]]]],["./make-eval-function.js", [["makeEvalFunction",[$h͏_a => (makeEvalFunction = $h͏_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor",[$h͏_a => (makeFunctionConstructor = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]]]]]);
7556
+ // === 28. ses ./src/global-object.js ===
7557
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,assign,create,defineProperty,entries,freeze,hasOwn,unscopablesSymbol,makeEvalFunction,makeFunctionConstructor,constantProperties,universalPropertyNames;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["unscopablesSymbol",[$h͏_a => (unscopablesSymbol = $h͏_a)]]]],["./make-eval-function.js", [["makeEvalFunction",[$h͏_a => (makeEvalFunction = $h͏_a)]]]],["./make-function-constructor.js", [["makeFunctionConstructor",[$h͏_a => (makeFunctionConstructor = $h͏_a)]]]],["./permits.js", [["constantProperties",[$h͏_a => (constantProperties = $h͏_a)]],["universalPropertyNames",[$h͏_a => (universalPropertyNames = $h͏_a)]]]]]);
7272
7558
 
7273
7559
 
7274
7560
 
@@ -7357,7 +7643,7 @@ const { Fail } = assert;
7357
7643
  },
7358
7644
  ) => {
7359
7645
  for (const [name, intrinsicName] of entries(universalPropertyNames)) {
7360
- if (objectHasOwnProperty(intrinsics, intrinsicName)) {
7646
+ if (hasOwn(intrinsics, intrinsicName)) {
7361
7647
  defineProperty(globalObject, name, {
7362
7648
  value: intrinsics[intrinsicName],
7363
7649
  writable: true,
@@ -7368,7 +7654,7 @@ const { Fail } = assert;
7368
7654
  }
7369
7655
 
7370
7656
  for (const [name, intrinsicName] of entries(newGlobalPropertyNames)) {
7371
- if (objectHasOwnProperty(intrinsics, intrinsicName)) {
7657
+ if (hasOwn(intrinsics, intrinsicName)) {
7372
7658
  defineProperty(globalObject, name, {
7373
7659
  value: intrinsics[intrinsicName],
7374
7660
  writable: true,
@@ -7445,7 +7731,7 @@ const { Fail } = assert;
7445
7731
  };$h͏_once.setGlobalObjectEvaluators(setGlobalObjectEvaluators);
7446
7732
  })()
7447
7733
  ,
7448
- // === 27. ses ./src/strict-scope-terminator.js ===
7734
+ // === 29. ses ./src/strict-scope-terminator.js ===
7449
7735
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Proxy,String,TypeError,ReferenceError,create,freeze,getOwnPropertyDescriptors,assert;$h͏_imports([["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7450
7736
 
7451
7737
 
@@ -7547,7 +7833,7 @@ const scopeProxyHandlerProperties = {
7547
7833
  );$h͏_once.strictScopeTerminator(strictScopeTerminator);
7548
7834
  })()
7549
7835
  ,
7550
- // === 28. ses ./src/sloppy-globals-scope-terminator.js ===
7836
+ // === 30. ses ./src/sloppy-globals-scope-terminator.js ===
7551
7837
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Proxy,create,freeze,getOwnPropertyDescriptors,reflectSet,strictScopeTerminatorHandler,alwaysThrowHandler;$h͏_imports([["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminatorHandler",[$h͏_a => (strictScopeTerminatorHandler = $h͏_a)]],["alwaysThrowHandler",[$h͏_a => (alwaysThrowHandler = $h͏_a)]]]]]);
7552
7838
 
7553
7839
 
@@ -7611,7 +7897,7 @@ const objTarget = freeze({ __proto__: null });
7611
7897
  freeze(createSloppyGlobalsScopeTerminator);
7612
7898
  })()
7613
7899
  ,
7614
- // === 29. ses ./src/eval-scope.js ===
7900
+ // === 31. ses ./src/eval-scope.js ===
7615
7901
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_EVAL,create,defineProperties,freeze,assert;$h͏_imports([["./commons.js", [["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
7616
7902
 
7617
7903
 
@@ -7703,7 +7989,7 @@ const { Fail } = assert;
7703
7989
  };$h͏_once.makeEvalScopeKit(makeEvalScopeKit);
7704
7990
  })()
7705
7991
  ,
7706
- // === 30. ses ./src/get-source-url.js ===
7992
+ // === 32. ses ./src/get-source-url.js ===
7707
7993
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,regexpExec,stringSlice;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]]]]]);
7708
7994
 
7709
7995
  // Captures a key and value of the form #key=value or @key=value
@@ -7756,8 +8042,9 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
7756
8042
  };$h͏_once.getSourceURL(getSourceURL);
7757
8043
  })()
7758
8044
  ,
7759
- // === 31. ses ./src/transforms.js ===
7760
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,stringReplace,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["stringReplace",[$h͏_a => (stringReplace = $h͏_a)]],["stringSearch",[$h͏_a => (stringSearch = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
8045
+ // === 33. ses ./src/transforms.js ===
8046
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_REG_EXP,SyntaxError,regexpReplace,sealRegexp,stringSearch,stringSlice,stringSplit,freeze,getSourceURL;$h͏_imports([["./commons.js", [["FERAL_REG_EXP",[$h͏_a => (FERAL_REG_EXP = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["regexpReplace",[$h͏_a => (regexpReplace = $h͏_a)]],["sealRegexp",[$h͏_a => (sealRegexp = $h͏_a)]],["stringSearch",[$h͏_a => (stringSearch = $h͏_a)]],["stringSlice",[$h͏_a => (stringSlice = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]]]],["./get-source-url.js", [["getSourceURL",[$h͏_a => (getSourceURL = $h͏_a)]]]]]);
8047
+
7761
8048
 
7762
8049
 
7763
8050
 
@@ -7794,7 +8081,9 @@ function getLineNumber(src, pattern) {
7794
8081
 
7795
8082
  // /////////////////////////////////////////////////////////////////////////////
7796
8083
 
7797
- const htmlCommentPattern = new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g');
8084
+ const htmlCommentPattern = sealRegexp(
8085
+ new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g'),
8086
+ );
7798
8087
 
7799
8088
  /**
7800
8089
  * Conservatively reject the source text if it may contain text that some
@@ -7859,14 +8148,13 @@ const htmlCommentPattern = new FERAL_REG_EXP(`(?:${'<'}!--|--${'>'})`, 'g');
7859
8148
  */$h͏_once.rejectHtmlComments(rejectHtmlComments);
7860
8149
  const evadeHtmlCommentTest = src => {
7861
8150
  const replaceFn = match => (match[0] === '<' ? '< ! --' : '-- >');
7862
- return stringReplace(src, htmlCommentPattern, replaceFn);
8151
+ return regexpReplace(htmlCommentPattern, src, replaceFn);
7863
8152
  };
7864
8153
 
7865
8154
  // /////////////////////////////////////////////////////////////////////////////
7866
8155
  $h͏_once.evadeHtmlCommentTest(evadeHtmlCommentTest);
7867
- const importPattern = new FERAL_REG_EXP(
7868
- '(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))',
7869
- 'g',
8156
+ const importPattern = sealRegexp(
8157
+ new FERAL_REG_EXP('(^|[^.]|\\.\\.\\.)\\bimport(\\s*(?:\\(|/[/*]))', 'g'),
7870
8158
  );
7871
8159
 
7872
8160
  /**
@@ -7929,7 +8217,7 @@ const importPattern = new FERAL_REG_EXP(
7929
8217
  */$h͏_once.rejectImportExpressions(rejectImportExpressions);
7930
8218
  const evadeImportExpressionTest = src => {
7931
8219
  const replaceFn = (_, p1, p2) => `${p1}__import__${p2}`;
7932
- return stringReplace(src, importPattern, replaceFn);
8220
+ return regexpReplace(importPattern, src, replaceFn);
7933
8221
  };
7934
8222
 
7935
8223
  // /////////////////////////////////////////////////////////////////////////////
@@ -8026,8 +8314,10 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
8026
8314
  });$h͏_once.transforms(transforms);
8027
8315
  })()
8028
8316
  ,
8029
- // === 32. ses ./src/scope-constants.js ===
8030
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,objectHasOwnProperty,regexpTest;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]]]]]);
8317
+ // === 34. ses ./src/scope-constants.js ===
8318
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let arrayFilter,arrayIncludes,getOwnPropertyDescriptor,getOwnPropertyNames,hasOwn,regexpExec,Set,setHas;$h͏_imports([["./commons.js", [["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["setHas",[$h͏_a => (setHas = $h͏_a)]]]]]);
8319
+
8320
+
8031
8321
 
8032
8322
 
8033
8323
 
@@ -8037,11 +8327,12 @@ $h͏_once.applyTransforms(applyTransforms);const transforms=freeze({
8037
8327
 
8038
8328
 
8039
8329
  /**
8040
- * keywords
8041
- * In JavaScript you cannot use these reserved words as variables.
8042
- * See 11.6.1 Identifier Names
8330
+ * reservedNames
8331
+ * In JavaScript you cannot use reserved words as variable names (except for
8332
+ * "eval", which is specially reserved to prevent shadowing).
8333
+ * https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#sec-identifier-names
8043
8334
  */
8044
- const keywords = [
8335
+ const reservedNames = new Set([
8045
8336
  // 11.6.2.1 Keywords
8046
8337
  'await',
8047
8338
  'break',
@@ -8102,7 +8393,10 @@ const keywords = [
8102
8393
 
8103
8394
  'this',
8104
8395
  'arguments',
8105
- ];
8396
+
8397
+ // Reserved by us
8398
+ 'eval',
8399
+ ]);
8106
8400
 
8107
8401
  /**
8108
8402
  * identifierPattern
@@ -8118,24 +8412,12 @@ const identifierPattern = /^[a-zA-Z_$][\w$]*$/;
8118
8412
 
8119
8413
  /**
8120
8414
  * isValidIdentifierName()
8121
- * What variable names might it bring into scope? These include all
8122
- * property names which can be variable names, including the names
8123
- * of inherited properties. It excludes symbols and names which are
8124
- * keywords. We drop symbols safely. Currently, this shim refuses
8125
- * service if any of the names are keywords or keyword-like. This is
8126
- * safe and only prevent performance optimization.
8415
+ * Is a value allowed as an arbitrary identifier name?
8127
8416
  *
8128
8417
  * @param {string} name
8129
8418
  */
8130
- const isValidIdentifierName = name => {
8131
- // Ensure we have a valid identifier. We use regexpTest rather than
8132
- // /../.test() to guard against the case where RegExp has been poisoned.
8133
- return (
8134
- name !== 'eval' &&
8135
- !arrayIncludes(keywords, name) &&
8136
- regexpTest(identifierPattern, name)
8137
- );
8138
- };
8419
+ const isValidIdentifierName = name =>
8420
+ !setHas(reservedNames, name) && !!regexpExec(identifierPattern, name);
8139
8421
 
8140
8422
  /*
8141
8423
  * isImmutableDataProperty
@@ -8160,18 +8442,18 @@ function isImmutableDataProperty(obj, name) {
8160
8442
  // can't have accessors and value properties at the same time, therefore
8161
8443
  // this check is sufficient. Using explicit own property deal with the
8162
8444
  // case where Object.prototype has been poisoned.
8163
- objectHasOwnProperty(desc, 'value')
8445
+ hasOwn(desc, 'value')
8164
8446
  );
8165
8447
  }
8166
8448
 
8167
8449
  /**
8168
8450
  * getScopeConstants()
8169
- * What variable names might it bring into scope? These include all
8451
+ * What variable names might be brought into scope? These include all
8170
8452
  * property names which can be variable names, including the names
8171
8453
  * of inherited properties. It excludes symbols and names which are
8172
8454
  * keywords. We drop symbols safely. Currently, this shim refuses
8173
8455
  * service if any of the names are keywords or keyword-like. This is
8174
- * safe and only prevent performance optimization.
8456
+ * safe and only affects performance optimization.
8175
8457
  *
8176
8458
  * @param {object} globalObject
8177
8459
  * @param {object} moduleLexicals
@@ -8209,7 +8491,7 @@ function isImmutableDataProperty(obj, name) {
8209
8491
  };$h͏_once.getScopeConstants(getScopeConstants);
8210
8492
  })()
8211
8493
  ,
8212
- // === 33. ses ./src/make-evaluate.js ===
8494
+ // === 35. ses ./src/make-evaluate.js ===
8213
8495
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,arrayJoin,apply,getScopeConstants;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]]]],["./scope-constants.js", [["getScopeConstants",[$h͏_a => (getScopeConstants = $h͏_a)]]]]]);
8214
8496
 
8215
8497
 
@@ -8322,7 +8604,7 @@ function buildOptimizer(constants, name) {
8322
8604
  };$h͏_once.makeEvaluate(makeEvaluate);
8323
8605
  })()
8324
8606
  ,
8325
- // === 34. ses ./src/make-safe-evaluator.js ===
8607
+ // === 36. ses ./src/make-safe-evaluator.js ===
8326
8608
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let apply,arrayFlatMap,freeze,identity,strictScopeTerminator,createSloppyGlobalsScopeTerminator,makeEvalScopeKit,applyTransforms,mandatoryTransforms,makeEvaluate,assert;$h͏_imports([["./commons.js", [["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["identity",[$h͏_a => (identity = $h͏_a)]]]],["./strict-scope-terminator.js", [["strictScopeTerminator",[$h͏_a => (strictScopeTerminator = $h͏_a)]]]],["./sloppy-globals-scope-terminator.js", [["createSloppyGlobalsScopeTerminator",[$h͏_a => (createSloppyGlobalsScopeTerminator = $h͏_a)]]]],["./eval-scope.js", [["makeEvalScopeKit",[$h͏_a => (makeEvalScopeKit = $h͏_a)]]]],["./transforms.js", [["applyTransforms",[$h͏_a => (applyTransforms = $h͏_a)]],["mandatoryTransforms",[$h͏_a => (mandatoryTransforms = $h͏_a)]]]],["./make-evaluate.js", [["makeEvaluate",[$h͏_a => (makeEvaluate = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
8327
8609
 
8328
8610
 
@@ -8437,7 +8719,7 @@ const { Fail } = assert;
8437
8719
  };$h͏_once.makeSafeEvaluator(makeSafeEvaluator);
8438
8720
  })()
8439
8721
  ,
8440
- // === 35. ses ./src/tame-function-tostring.js ===
8722
+ // === 37. ses ./src/tame-function-tostring.js ===
8441
8723
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,defineProperty,freeze,functionPrototype,functionToString,stringEndsWith,weaksetAdd,weaksetHas;$h͏_imports([["./commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["functionPrototype",[$h͏_a => (functionPrototype = $h͏_a)]],["functionToString",[$h͏_a => (functionToString = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]]]);
8442
8724
 
8443
8725
 
@@ -8490,7 +8772,7 @@ let markVirtualizedNativeFunction;
8490
8772
  };$h͏_once.tameFunctionToString(tameFunctionToString);
8491
8773
  })()
8492
8774
  ,
8493
- // === 36. ses ./src/tame-domains.js ===
8775
+ // === 38. ses ./src/tame-domains.js ===
8494
8776
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,globalThis,getOwnPropertyDescriptor,defineProperty;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]]]]]);Object.defineProperty(tameDomains,'name',{value:"tameDomains"});$h͏_once.tameDomains(tameDomains);
8495
8777
 
8496
8778
 
@@ -8534,7 +8816,7 @@ let markVirtualizedNativeFunction;
8534
8816
  }
8535
8817
  })()
8536
8818
  ,
8537
- // === 37. ses ./src/tame-module-source.js ===
8819
+ // === 39. ses ./src/tame-module-source.js ===
8538
8820
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let functionPrototype,getPrototypeOf,globalThis,objectPrototype,setPrototypeOf;$h͏_imports([["./commons.js", [["functionPrototype",[$h͏_a => (functionPrototype = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["objectPrototype",[$h͏_a => (objectPrototype = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]]]]]);
8539
8821
 
8540
8822
 
@@ -8588,7 +8870,7 @@ let markVirtualizedNativeFunction;
8588
8870
  };$h͏_once.tameModuleSource(tameModuleSource);
8589
8871
  })()
8590
8872
  ,
8591
- // === 38. ses ./src/error/console.js ===
8873
+ // === 40. ses ./src/error/console.js ===
8592
8874
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakSet,arrayFilter,arrayFlatMap,arrayMap,arrayPop,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,stringIncludes,stringSplit,weaksetAdd,weaksetHas;$h͏_imports([["../commons.js", [["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPop",[$h͏_a => (arrayPop = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["isError",[$h͏_a => (isError = $h͏_a)]],["stringEndsWith",[$h͏_a => (stringEndsWith = $h͏_a)]],["stringIncludes",[$h͏_a => (stringIncludes = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]]]]]);
8593
8875
 
8594
8876
 
@@ -9132,7 +9414,7 @@ freeze(defineCausalConsoleFromLogger);
9132
9414
  freeze(filterConsole);
9133
9415
  })()
9134
9416
  ,
9135
- // === 39. ses ./src/error/unhandled-rejection.js ===
9417
+ // === 41. ses ./src/error/unhandled-rejection.js ===
9136
9418
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FinalizationRegistry,Map,mapGet,mapDelete,WeakMap,mapSet,finalizationRegistryRegister,weakmapSet,weakmapGet,mapEntries,mapHas;$h͏_imports([["../commons.js", [["FinalizationRegistry",[$h͏_a => (FinalizationRegistry = $h͏_a)]],["Map",[$h͏_a => (Map = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapDelete",[$h͏_a => (mapDelete = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["finalizationRegistryRegister",[$h͏_a => (finalizationRegistryRegister = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["mapEntries",[$h͏_a => (mapEntries = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]]]]]);
9137
9419
 
9138
9420
 
@@ -9257,7 +9539,7 @@ freeze(filterConsole);
9257
9539
  };$h͏_once.makeRejectionHandlers(makeRejectionHandlers);
9258
9540
  })()
9259
9541
  ,
9260
- // === 40. ses ./src/error/tame-console.js ===
9542
+ // === 42. ses ./src/error/tame-console.js ===
9261
9543
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,apply,defineProperty,freeze,globalThis,defaultHandler,makeCausalConsole,makeRejectionHandlers;$h͏_imports([["../commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./assert.js", [["loggedErrorHandler",[$h͏_a => (defaultHandler = $h͏_a)]]]],["./console.js", [["makeCausalConsole",[$h͏_a => (makeCausalConsole = $h͏_a)]]]],["./unhandled-rejection.js", [["makeRejectionHandlers",[$h͏_a => (makeRejectionHandlers = $h͏_a)]]]]]);
9262
9544
 
9263
9545
 
@@ -9457,9 +9739,8 @@ const wrapLogger = (logger, thisArg) =>
9457
9739
  };$h͏_once.tameConsole(tameConsole);
9458
9740
  })()
9459
9741
  ,
9460
- // === 41. ses ./src/error/tame-v8-error-constructor.js ===
9461
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,regexpTest,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["regexpTest",[$h͏_a => (regexpTest = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
9462
-
9742
+ // === 43. ses ./src/error/tame-v8-error-constructor.js ===
9743
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let WeakMap,WeakSet,apply,arrayFilter,arrayJoin,arrayMap,arraySlice,create,defineProperties,fromEntries,reflectSet,regexpExec,weakmapGet,weakmapSet,weaksetAdd,weaksetHas,TypeError;$h͏_imports([["../commons.js", [["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["WeakSet",[$h͏_a => (WeakSet = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arraySlice",[$h͏_a => (arraySlice = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["reflectSet",[$h͏_a => (reflectSet = $h͏_a)]],["regexpExec",[$h͏_a => (regexpExec = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]],["weaksetAdd",[$h͏_a => (weaksetAdd = $h͏_a)]],["weaksetHas",[$h͏_a => (weaksetHas = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]]]]]);
9463
9744
 
9464
9745
 
9465
9746
 
@@ -9562,12 +9843,12 @@ const FILENAME_CENSORS = [
9562
9843
  // Exported only so it can be unit tested.
9563
9844
  // TODO Move so that it applies not just to v8.
9564
9845
  const filterFileName = fileName => {
9565
- if (!fileName) {
9566
- // Stack frames with no fileName should appear in concise stack traces.
9567
- return true;
9846
+ if (fileName === null) {
9847
+ // Seems to suppress builtins like `Array.every (<anonymous>)`
9848
+ return false;
9568
9849
  }
9569
9850
  for (const filter of FILENAME_CENSORS) {
9570
- if (regexpTest(filter, fileName)) {
9851
+ if (regexpExec(filter, fileName)) {
9571
9852
  return false;
9572
9853
  }
9573
9854
  }
@@ -9578,9 +9859,9 @@ const FILENAME_CENSORS = [
9578
9859
  // likely url-path prefix, ending in a `/.../` should get dropped.
9579
9860
  // Anything to the left of the likely path text is kept.
9580
9861
  // Everything to the right of `/.../` is kept. Thus
9581
- // `'Object.bar (/vat-v1/.../eventual-send/test/deep-send.test.js:13:21)'`
9862
+ // `'Object.bar (/vat-v1/.../errors/test/deep-send.test.js:13:21)'`
9582
9863
  // simplifies to
9583
- // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9864
+ // `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
9584
9865
  //
9585
9866
  // See thread starting at
9586
9867
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
@@ -9590,9 +9871,9 @@ $h͏_once.filterFileName(filterFileName);const CALLSITE_ELLIPSIS_PATTERN1=/^((?:
9590
9871
  // likely url-path prefix consisting of `.../` should get dropped.
9591
9872
  // Anything to the left of the likely path text is kept.
9592
9873
  // Everything to the right of `.../` is kept. Thus
9593
- // `'Object.bar (.../eventual-send/test/deep-send.test.js:13:21)'`
9874
+ // `'Object.bar (.../errors/test/deep-send.test.js:13:21)'`
9594
9875
  // simplifies to
9595
- // `'Object.bar (eventual-send/test/deep-send.test.js:13:21)'`.
9876
+ // `'Object.bar (errors/test/deep-send.test.js:13:21)'`.
9596
9877
  //
9597
9878
  // See thread starting at
9598
9879
  // https://github.com/Agoric/agoric-sdk/issues/2326#issuecomment-773020389
@@ -9603,9 +9884,9 @@ const CALLSITE_ELLIPSIS_PATTERN2 = /^((?:.*[( ])?)\.\.\.\/(.+)$/;
9603
9884
  // dropped.
9604
9885
  // Anything to the left of the likely path prefix text is kept. `package/` and
9605
9886
  // everything to its right is kept. Thus
9606
- // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/eventual-send/test/deep-send.test.js:13:21)'`
9887
+ // `'Object.bar (/Users/markmiller/src/ongithub/agoric/agoric-sdk/packages/errors/test/deep-send.test.js:13:21)'`
9607
9888
  // simplifies to
9608
- // `'Object.bar (packages/eventual-send/test/deep-send.test.js:13:21)'`.
9889
+ // `'Object.bar (packages/errors/test/deep-send.test.js:13:21)'`.
9609
9890
  // Note that `/packages/` is a convention for monorepos encouraged by
9610
9891
  // lerna.
9611
9892
  const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
@@ -9615,7 +9896,7 @@ const CALLSITE_PACKAGES_PATTERN = /^((?:.*[( ])?)[:/\w_-]*\/(packages\/.+)$/;
9615
9896
  // dropped.
9616
9897
  // Anything to the left of the likely path prefix text is kept. Everything to
9617
9898
  // the right of `file://` is kept. Thus
9618
- // `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/eventual-send/test/deep-send.test.js:13:21)'` is unchanged but
9899
+ // `'Object.bar (file:///Users/markmiller/src/ongithub/endojs/endo/packages/errors/test/deep-send.test.js:13:21)'` is unchanged but
9619
9900
  // `'Object.bar (file://test/deep-send.test.js:13:21)'`
9620
9901
 
9621
9902
  // simplifies to
@@ -9681,6 +9962,10 @@ const CALLSITE_PATTERNS = [
9681
9962
  // const callSiteFilter = _callSite => true;
9682
9963
  const callSiteFilter = callSite => {
9683
9964
  if (omitFrames) {
9965
+ // eslint-disable-next-line @endo/no-polymorphic-call
9966
+ if (callSite.getFunctionName()?.startsWith('__HIDE_')) {
9967
+ return false;
9968
+ }
9684
9969
  // eslint-disable-next-line @endo/no-polymorphic-call
9685
9970
  return filterFileName(callSite.getFileName());
9686
9971
  }
@@ -9846,7 +10131,7 @@ const CALLSITE_PATTERNS = [
9846
10131
  };$h͏_once.tameV8ErrorConstructor(tameV8ErrorConstructor);
9847
10132
  })()
9848
10133
  ,
9849
- // === 42. ses ./src/error/tame-error-constructor.js ===
10134
+ // === 44. ses ./src/error/tame-error-constructor.js ===
9850
10135
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_ERROR,apply,construct,defineProperties,setPrototypeOf,getOwnPropertyDescriptor,defineProperty,getOwnPropertyDescriptors,NativeErrors,tameV8ErrorConstructor;$h͏_imports([["../commons.js", [["FERAL_ERROR",[$h͏_a => (FERAL_ERROR = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["construct",[$h͏_a => (construct = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["setPrototypeOf",[$h͏_a => (setPrototypeOf = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["../permits.js", [["NativeErrors",[$h͏_a => (NativeErrors = $h͏_a)]]]],["./tame-v8-error-constructor.js", [["tameV8ErrorConstructor",[$h͏_a => (tameV8ErrorConstructor = $h͏_a)]]]]]);
9851
10136
 
9852
10137
 
@@ -10133,8 +10418,8 @@ let initialGetStackString = tamedMethods.getStackString;
10133
10418
  }$h͏_once.default( tameErrorConstructor);
10134
10419
  })()
10135
10420
  ,
10136
- // === 43. ses ./src/module-load.js ===
10137
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,Map,Set,TypeError,arrayJoin,arrayMap,arrayPush,arraySome,create,freeze,generatorNext,generatorThrow,getOwnPropertyNames,isArray,isObject,mapGet,mapHas,mapSet,promiseThen,setAdd,values,weakmapGet,weakmapHas,makeError,annotateError,q,b,X;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arraySome",[$h͏_a => (arraySome = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["generatorNext",[$h͏_a => (generatorNext = $h͏_a)]],["generatorThrow",[$h͏_a => (generatorThrow = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["promiseThen",[$h͏_a => (promiseThen = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]]]],["./error/assert.js", [["makeError",[$h͏_a => (makeError = $h͏_a)]],["annotateError",[$h͏_a => (annotateError = $h͏_a)]],["q",[$h͏_a => (q = $h͏_a)]],["b",[$h͏_a => (b = $h͏_a)]],["X",[$h͏_a => (X = $h͏_a)]]]]]);
10421
+ // === 45. ses ./src/module-load.js ===
10422
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,Map,Set,TypeError,arrayJoin,arrayMap,arrayPush,arraySome,create,freeze,generatorNext,generatorThrow,getOwnPropertyNames,isArray,isPrimitive,mapGet,mapHas,mapSet,promiseThen,setAdd,values,weakmapGet,weakmapHas,makeError,annotateError,q,b,X;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayJoin",[$h͏_a => (arrayJoin = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arraySome",[$h͏_a => (arraySome = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["generatorNext",[$h͏_a => (generatorNext = $h͏_a)]],["generatorThrow",[$h͏_a => (generatorThrow = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["promiseThen",[$h͏_a => (promiseThen = $h͏_a)]],["setAdd",[$h͏_a => (setAdd = $h͏_a)]],["values",[$h͏_a => (values = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapHas",[$h͏_a => (weakmapHas = $h͏_a)]]]],["./error/assert.js", [["makeError",[$h͏_a => (makeError = $h͏_a)]],["annotateError",[$h͏_a => (annotateError = $h͏_a)]],["q",[$h͏_a => (q = $h͏_a)]],["b",[$h͏_a => (b = $h͏_a)]],["X",[$h͏_a => (X = $h͏_a)]]]]]);
10138
10423
 
10139
10424
 
10140
10425
 
@@ -10322,7 +10607,7 @@ function* loadWithoutErrorAnnotation(
10322
10607
  )} in parent compartment, use {source} module descriptor`,
10323
10608
  TypeError,
10324
10609
  );
10325
- } else if (isObject(moduleDescriptor)) {
10610
+ } else if (!isPrimitive(moduleDescriptor)) {
10326
10611
  // In this shim (and not in XS, and not in the standard we imagine), we
10327
10612
  // allow a module namespace object to stand in for a module descriptor that
10328
10613
  // describes its original {compartment, specifier} so that it can be used
@@ -10345,7 +10630,7 @@ function* loadWithoutErrorAnnotation(
10345
10630
  namespace: aliasSpecifier,
10346
10631
  } = moduleDescriptor;
10347
10632
  if (
10348
- !isObject(aliasCompartment) ||
10633
+ isPrimitive(aliasCompartment) ||
10349
10634
  !weakmapHas(compartmentPrivateFields, aliasCompartment)
10350
10635
  ) {
10351
10636
  throw makeError(
@@ -10369,7 +10654,7 @@ function* loadWithoutErrorAnnotation(
10369
10654
 
10370
10655
  // All remaining objects must either be a module namespace, or be
10371
10656
  // promoted into a module namespace with a virtual module source.
10372
- if (isObject(moduleDescriptor.namespace)) {
10657
+ if (!isPrimitive(moduleDescriptor.namespace)) {
10373
10658
  const { namespace } = moduleDescriptor;
10374
10659
  // Brand-check SES shim module exports namespaces:
10375
10660
  aliasDescriptor = weakmapGet(moduleAliases, namespace);
@@ -10542,7 +10827,7 @@ function* loadWithoutErrorAnnotation(
10542
10827
  moduleDescriptor.specifier !== undefined
10543
10828
  ) {
10544
10829
  if (
10545
- !isObject(moduleDescriptor.compartment) ||
10830
+ isPrimitive(moduleDescriptor.compartment) ||
10546
10831
  !weakmapHas(compartmentPrivateFields, moduleDescriptor.compartment) ||
10547
10832
  typeof moduleDescriptor.specifier !== 'string'
10548
10833
  ) {
@@ -10643,7 +10928,12 @@ const memoizedLoadWithErrorAnnotation = (
10643
10928
  return moduleLoading;
10644
10929
  };
10645
10930
 
10646
- const asyncJobQueue = (errors = []) => {
10931
+ /**
10932
+ * If `aggregateErrors` is `false`, the `errors` property of the fulfilled object
10933
+ * will always be empty.
10934
+ * @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
10935
+ */
10936
+ const asyncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
10647
10937
  /** @type {Set<Promise<undefined>>} */
10648
10938
  const pendingJobs = new Set();
10649
10939
 
@@ -10659,7 +10949,11 @@ const asyncJobQueue = (errors = []) => {
10659
10949
  setAdd(
10660
10950
  pendingJobs,
10661
10951
  promiseThen(func(...args), noop, error => {
10662
- arrayPush(errors, error);
10952
+ if (noAggregateErrors) {
10953
+ throw error;
10954
+ } else {
10955
+ arrayPush(errors, error);
10956
+ }
10663
10957
  }),
10664
10958
  );
10665
10959
  };
@@ -10676,7 +10970,12 @@ const asyncJobQueue = (errors = []) => {
10676
10970
  return { enqueueJob, drainQueue, errors };
10677
10971
  };
10678
10972
 
10679
- const syncJobQueue = (errors = []) => {
10973
+ /**
10974
+ * If `aggregateErrors` is `false`, the `errors` property of the returned object
10975
+ * will always be empty.
10976
+ * @param {{errors?: Error[], noAggregateErrors?: boolean}} [options]
10977
+ */
10978
+ const syncJobQueue = ({ errors = [], noAggregateErrors = false } = {}) => {
10680
10979
  let current = [];
10681
10980
  let next = [];
10682
10981
 
@@ -10700,7 +10999,11 @@ const syncJobQueue = (errors = []) => {
10700
10999
  try {
10701
11000
  func(...args);
10702
11001
  } catch (error) {
10703
- arrayPush(errors, error);
11002
+ if (noAggregateErrors) {
11003
+ throw error;
11004
+ } else {
11005
+ arrayPush(errors, error);
11006
+ }
10704
11007
  }
10705
11008
  }
10706
11009
  current = next;
@@ -10733,18 +11036,24 @@ const throwAggregateError = ({ errors, errorPrefix }) => {
10733
11036
  const preferSync = (_asyncImpl, syncImpl) => syncImpl;
10734
11037
  const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10735
11038
 
10736
- /*
11039
+ /**
10737
11040
  * `load` asynchronously gathers the module records for a module and its
10738
11041
  * transitive dependencies.
10739
11042
  * The module records refer to each other by a reference to the dependency's
10740
11043
  * compartment and the specifier of the module within its own compartment.
10741
11044
  * This graph is then ready to be synchronously linked and executed.
11045
+ * @param {WeakMap<Compartment, any>} compartmentPrivateFields
11046
+ * @param {WeakMap<object, object>} moduleAliases
11047
+ * @param {Compartment} compartment
11048
+ * @param {string} moduleSpecifier - The module specifier to load.
11049
+ * @param {{ noAggregateErrors?: boolean}} options
10742
11050
  */
10743
11051
  const load = async (
10744
11052
  compartmentPrivateFields,
10745
11053
  moduleAliases,
10746
11054
  compartment,
10747
11055
  moduleSpecifier,
11056
+ { noAggregateErrors = false } = {},
10748
11057
  ) => {
10749
11058
  const { name: compartmentName } = weakmapGet(
10750
11059
  compartmentPrivateFields,
@@ -10754,7 +11063,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10754
11063
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10755
11064
  const moduleLoads = new Map();
10756
11065
 
10757
- const { enqueueJob, drainQueue, errors } = asyncJobQueue();
11066
+ const { enqueueJob, drainQueue, errors } = asyncJobQueue({
11067
+ noAggregateErrors,
11068
+ });
10758
11069
 
10759
11070
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10760
11071
  compartmentPrivateFields,
@@ -10776,18 +11087,25 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10776
11087
  });
10777
11088
  };
10778
11089
 
10779
- /*
11090
+ /**
10780
11091
  * `loadNow` synchronously gathers the module records for a specified module
10781
11092
  * and its transitive dependencies.
10782
11093
  * The module records refer to each other by a reference to the dependency's
10783
11094
  * compartment and the specifier of the module within its own compartment.
10784
11095
  * This graph is then ready to be synchronously linked and executed.
11096
+ * @param {WeakMap<Compartment, any>} compartmentPrivateFields
11097
+ * @param {WeakMap<object, object>} moduleAliases
11098
+ * @param {Compartment} compartment
11099
+ * @param {string} moduleSpecifier - The module specifier to load.
11100
+ * @param {{ noAggregateErrors?: boolean}} options
10785
11101
  */$h͏_once.load(load);
11102
+
10786
11103
  const loadNow = (
10787
11104
  compartmentPrivateFields,
10788
11105
  moduleAliases,
10789
11106
  compartment,
10790
11107
  moduleSpecifier,
11108
+ { noAggregateErrors = false } = {},
10791
11109
  ) => {
10792
11110
  const { name: compartmentName } = weakmapGet(
10793
11111
  compartmentPrivateFields,
@@ -10797,7 +11115,9 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10797
11115
  /** @type {Map<object, Map<string, Promise<Record<any, any>>>>} */
10798
11116
  const moduleLoads = new Map();
10799
11117
 
10800
- const { enqueueJob, drainQueue, errors } = syncJobQueue();
11118
+ const { enqueueJob, drainQueue, errors } = syncJobQueue({
11119
+ noAggregateErrors,
11120
+ });
10801
11121
 
10802
11122
  enqueueJob(memoizedLoadWithErrorAnnotation, [
10803
11123
  compartmentPrivateFields,
@@ -10820,7 +11140,7 @@ const preferAsync = (asyncImpl, _syncImpl) => asyncImpl;
10820
11140
  };$h͏_once.loadNow(loadNow);
10821
11141
  })()
10822
11142
  ,
10823
- // === 44. ses ./src/module-proxy.js ===
11143
+ // === 46. ses ./src/module-proxy.js ===
10824
11144
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let makeAlias,Proxy,TypeError,create,freeze,mapGet,mapHas,mapSet,ownKeys,reflectGet,reflectGetOwnPropertyDescriptor,reflectHas,reflectIsExtensible,reflectPreventExtensions,toStringTagSymbol,weakmapSet,assert;$h͏_imports([["./module-load.js", [["makeAlias",[$h͏_a => (makeAlias = $h͏_a)]]]],["./commons.js", [["Proxy",[$h͏_a => (Proxy = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["reflectGet",[$h͏_a => (reflectGet = $h͏_a)]],["reflectGetOwnPropertyDescriptor",[$h͏_a => (reflectGetOwnPropertyDescriptor = $h͏_a)]],["reflectHas",[$h͏_a => (reflectHas = $h͏_a)]],["reflectIsExtensible",[$h͏_a => (reflectIsExtensible = $h͏_a)]],["reflectPreventExtensions",[$h͏_a => (reflectPreventExtensions = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
10825
11145
 
10826
11146
 
@@ -11023,7 +11343,7 @@ const { quote: q } = assert;
11023
11343
  };$h͏_once.getDeferredExports(getDeferredExports);
11024
11344
  })()
11025
11345
  ,
11026
- // === 45. ses ./src/compartment-evaluate.js ===
11346
+ // === 47. ses ./src/compartment-evaluate.js ===
11027
11347
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let TypeError,arrayPush,create,getOwnPropertyDescriptors,evadeHtmlCommentTest,evadeImportExpressionTest,rejectSomeDirectEvalExpressions,makeSafeEvaluator;$h͏_imports([["./commons.js", [["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]]]],["./transforms.js", [["evadeHtmlCommentTest",[$h͏_a => (evadeHtmlCommentTest = $h͏_a)]],["evadeImportExpressionTest",[$h͏_a => (evadeImportExpressionTest = $h͏_a)]],["rejectSomeDirectEvalExpressions",[$h͏_a => (rejectSomeDirectEvalExpressions = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]]]);
11028
11348
 
11029
11349
 
@@ -11119,7 +11439,7 @@ const { quote: q } = assert;
11119
11439
  };$h͏_once.compartmentEvaluate(compartmentEvaluate);
11120
11440
  })()
11121
11441
  ,
11122
- // === 46. ses ./src/module-instance.js ===
11442
+ // === 48. ses ./src/module-instance.js ===
11123
11443
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,assign,compartmentEvaluate;$h͏_imports([["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]],["./module-proxy.js", [["getDeferredExports",[$h͏_a => (getDeferredExports = $h͏_a)]]]],["./commons.js", [["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["SyntaxError",[$h͏_a => (SyntaxError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayForEach",[$h͏_a => (arrayForEach = $h͏_a)]],["arrayIncludes",[$h͏_a => (arrayIncludes = $h͏_a)]],["arrayPush",[$h͏_a => (arrayPush = $h͏_a)]],["arraySome",[$h͏_a => (arraySome = $h͏_a)]],["arraySort",[$h͏_a => (arraySort = $h͏_a)]],["create",[$h͏_a => (create = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["freeze",[$h͏_a => (freeze = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["keys",[$h͏_a => (keys = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["reflectHas",[$h͏_a => (reflectHas = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate",[$h͏_a => (compartmentEvaluate = $h͏_a)]]]]]);
11124
11444
 
11125
11445
 
@@ -11476,6 +11796,25 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
11476
11796
  };
11477
11797
  notifiers['*'] = notifyStar;
11478
11798
 
11799
+ const wireUpExportNotifier = (exportName, notify) => {
11800
+ if (!notifiers[exportName] && notify !== false) {
11801
+ notifiers[exportName] = notify;
11802
+
11803
+ // exported live binding state
11804
+ let value;
11805
+ const update = newValue => (value = newValue);
11806
+ notify(update);
11807
+ exportsProps[exportName] = {
11808
+ get() {
11809
+ return value;
11810
+ },
11811
+ set: undefined,
11812
+ enumerable: true,
11813
+ configurable: false,
11814
+ };
11815
+ }
11816
+ };
11817
+
11479
11818
  // Per the calling convention for the moduleFunctor generated from
11480
11819
  // an ESM, the `imports` function gets called once up front
11481
11820
  // to populate or arrange the population of imports and reexports.
@@ -11529,30 +11868,15 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
11529
11868
  }
11530
11869
  }
11531
11870
  if (reexportMap[specifier]) {
11532
- // Make named reexports candidates too.
11871
+ // Set up reexport notifiers instantly so they are available in cycles.
11533
11872
  for (const [localName, exportedName] of reexportMap[specifier]) {
11534
- candidateAll[exportedName] = importNotifiers[localName];
11873
+ wireUpExportNotifier(exportedName, importNotifiers[localName]);
11535
11874
  }
11536
11875
  }
11537
11876
  }
11538
11877
 
11539
11878
  for (const [exportName, notify] of entries(candidateAll)) {
11540
- if (!notifiers[exportName] && notify !== false) {
11541
- notifiers[exportName] = notify;
11542
-
11543
- // exported live binding state
11544
- let value;
11545
- const update = newValue => (value = newValue);
11546
- notify(update);
11547
- exportsProps[exportName] = {
11548
- get() {
11549
- return value;
11550
- },
11551
- set: undefined,
11552
- enumerable: true,
11553
- configurable: false,
11554
- };
11555
- }
11879
+ wireUpExportNotifier(exportName, notify);
11556
11880
  }
11557
11881
 
11558
11882
  // Sort the module exports namespace as per spec.
@@ -11619,8 +11943,8 @@ $h͏_once.makeVirtualModuleInstance(makeVirtualModuleInstance);const makeModuleI
11619
11943
  };$h͏_once.makeModuleInstance(makeModuleInstance);
11620
11944
  })()
11621
11945
  ,
11622
- // === 47. ses ./src/module-link.js ===
11623
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,makeModuleInstance,makeVirtualModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isObject,mapGet,mapHas,mapSet,weakmapGet;$h͏_imports([["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]],["./module-instance.js", [["makeModuleInstance",[$h͏_a => (makeModuleInstance = $h͏_a)]],["makeVirtualModuleInstance",[$h͏_a => (makeVirtualModuleInstance = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isObject",[$h͏_a => (isObject = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]]]]]);
11946
+ // === 49. ses ./src/module-link.js ===
11947
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let assert,makeModuleInstance,makeVirtualModuleInstance,Map,ReferenceError,TypeError,entries,isArray,isPrimitive,mapGet,mapHas,mapSet,weakmapGet;$h͏_imports([["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]],["./module-instance.js", [["makeModuleInstance",[$h͏_a => (makeModuleInstance = $h͏_a)]],["makeVirtualModuleInstance",[$h͏_a => (makeVirtualModuleInstance = $h͏_a)]]]],["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["ReferenceError",[$h͏_a => (ReferenceError = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["isArray",[$h͏_a => (isArray = $h͏_a)]],["isPrimitive",[$h͏_a => (isPrimitive = $h͏_a)]],["mapGet",[$h͏_a => (mapGet = $h͏_a)]],["mapHas",[$h͏_a => (mapHas = $h͏_a)]],["mapSet",[$h͏_a => (mapSet = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]]]]]);
11624
11948
 
11625
11949
 
11626
11950
 
@@ -11681,11 +12005,11 @@ function mayBePrecompiledModuleSource(moduleSource) {
11681
12005
 
11682
12006
  function validatePrecompiledModuleSource(moduleSource, moduleSpecifier) {
11683
12007
  const { __fixedExportMap__, __liveExportMap__ } = moduleSource;
11684
- isObject(__fixedExportMap__) ||
12008
+ !isPrimitive(__fixedExportMap__) ||
11685
12009
  Fail`Property '__fixedExportMap__' of a precompiled module source must be an object, got ${q(
11686
12010
  __fixedExportMap__,
11687
12011
  )}, for module ${q(moduleSpecifier)}`;
11688
- isObject(__liveExportMap__) ||
12012
+ !isPrimitive(__liveExportMap__) ||
11689
12013
  Fail`Property '__liveExportMap__' of a precompiled module source must be an object, got ${q(
11690
12014
  __liveExportMap__,
11691
12015
  )}, for module ${q(moduleSpecifier)}`;
@@ -11704,7 +12028,7 @@ function validateVirtualModuleSource(moduleSource, moduleSpecifier) {
11704
12028
  }
11705
12029
 
11706
12030
  function validateModuleSource(moduleSource, moduleSpecifier) {
11707
- isObject(moduleSource) ||
12031
+ !isPrimitive(moduleSource) ||
11708
12032
  Fail`Invalid module source: must be of type object, got ${q(
11709
12033
  moduleSource,
11710
12034
  )}, for module ${q(moduleSpecifier)}`;
@@ -11781,7 +12105,7 @@ function validateModuleSource(moduleSource, moduleSpecifier) {
11781
12105
  };$h͏_once.instantiate(instantiate);
11782
12106
  })()
11783
12107
  ,
11784
- // === 48. ses ./src/compartment.js ===
12108
+ // === 50. ses ./src/compartment.js ===
11785
12109
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Map,TypeError,WeakMap,arrayFlatMap,assign,defineProperties,identity,promiseThen,toStringTagSymbol,weakmapGet,weakmapSet,setGlobalObjectSymbolUnscopables,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,assert,assertEqual,q,sharedGlobalPropertyNames,load,loadNow,link,getDeferredExports,compartmentEvaluate,makeSafeEvaluator;$h͏_imports([["./commons.js", [["Map",[$h͏_a => (Map = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["WeakMap",[$h͏_a => (WeakMap = $h͏_a)]],["arrayFlatMap",[$h͏_a => (arrayFlatMap = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["identity",[$h͏_a => (identity = $h͏_a)]],["promiseThen",[$h͏_a => (promiseThen = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]],["weakmapGet",[$h͏_a => (weakmapGet = $h͏_a)]],["weakmapSet",[$h͏_a => (weakmapSet = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectSymbolUnscopables",[$h͏_a => (setGlobalObjectSymbolUnscopables = $h͏_a)]],["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["assertEqual",[$h͏_a => (assertEqual = $h͏_a)]],["q",[$h͏_a => (q = $h͏_a)]]]],["./permits.js", [["sharedGlobalPropertyNames",[$h͏_a => (sharedGlobalPropertyNames = $h͏_a)]]]],["./module-load.js", [["load",[$h͏_a => (load = $h͏_a)]],["loadNow",[$h͏_a => (loadNow = $h͏_a)]]]],["./module-link.js", [["link",[$h͏_a => (link = $h͏_a)]]]],["./module-proxy.js", [["getDeferredExports",[$h͏_a => (getDeferredExports = $h͏_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate",[$h͏_a => (compartmentEvaluate = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]]]);
11786
12110
 
11787
12111
 
@@ -11888,6 +12212,7 @@ const moduleAliases = new WeakMap();
11888
12212
  * @property {Compartment} [parentCompartment]
11889
12213
  * @property {boolean} noNamespaceBox
11890
12214
  * @property {(fullSpecifier: string) => Promise<ModuleExportsNamespace>} compartmentImport
12215
+ * @property {boolean} [noAggregateLoadErrors]
11891
12216
  */
11892
12217
 
11893
12218
  /**
@@ -11957,16 +12282,17 @@ const compartmentImportNow = (compartment, specifier) => {
11957
12282
  },
11958
12283
 
11959
12284
  async import(specifier) {
11960
- const { noNamespaceBox } = /** @type {CompartmentFields} */ (
11961
- weakmapGet(privateFields, this)
11962
- );
12285
+ const { noNamespaceBox, noAggregateLoadErrors } =
12286
+ /** @type {CompartmentFields} */ (weakmapGet(privateFields, this));
11963
12287
 
11964
12288
  if (typeof specifier !== 'string') {
11965
12289
  throw TypeError('first argument of import() must be a string');
11966
12290
  }
11967
12291
 
11968
12292
  return promiseThen(
11969
- load(privateFields, moduleAliases, this, specifier),
12293
+ load(privateFields, moduleAliases, this, specifier, {
12294
+ noAggregateErrors: noAggregateLoadErrors,
12295
+ }),
11970
12296
  () => {
11971
12297
  // The namespace box is a contentious design and likely to be a breaking
11972
12298
  // change in an appropriately numbered future version.
@@ -11989,16 +12315,27 @@ const compartmentImportNow = (compartment, specifier) => {
11989
12315
  throw TypeError('first argument of load() must be a string');
11990
12316
  }
11991
12317
 
11992
- return load(privateFields, moduleAliases, this, specifier);
12318
+ const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
12319
+ weakmapGet(privateFields, this)
12320
+ );
12321
+
12322
+ return load(privateFields, moduleAliases, this, specifier, {
12323
+ noAggregateErrors: noAggregateLoadErrors,
12324
+ });
11993
12325
  },
11994
12326
 
11995
12327
  importNow(specifier) {
11996
12328
  if (typeof specifier !== 'string') {
11997
12329
  throw TypeError('first argument of importNow() must be a string');
11998
12330
  }
12331
+ const { noAggregateLoadErrors } = /** @type {CompartmentFields} */ (
12332
+ weakmapGet(privateFields, this)
12333
+ );
11999
12334
 
12000
- loadNow(privateFields, moduleAliases, this, specifier);
12001
- return compartmentImportNow(this, specifier);
12335
+ loadNow(privateFields, moduleAliases, this, specifier, {
12336
+ noAggregateErrors: noAggregateLoadErrors,
12337
+ });
12338
+ return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
12002
12339
  },
12003
12340
  };
12004
12341
 
@@ -12129,6 +12466,7 @@ defineProperties(InertCompartment, {
12129
12466
  moduleMapHook,
12130
12467
  importMetaHook,
12131
12468
  __noNamespaceBox__: noNamespaceBox = false,
12469
+ noAggregateLoadErrors = false,
12132
12470
  } = compartmentOptions(...args);
12133
12471
  const globalTransforms = arrayFlatMap(
12134
12472
  [transforms, __shimTransforms__],
@@ -12206,7 +12544,9 @@ defineProperties(InertCompartment, {
12206
12544
  `Compartment does not support dynamic import: no configured resolveHook for compartment ${q(name)}`,
12207
12545
  );
12208
12546
  }
12209
- await load(privateFields, moduleAliases, compartment, fullSpecifier);
12547
+ await load(privateFields, moduleAliases, compartment, fullSpecifier, {
12548
+ noAggregateErrors: noAggregateLoadErrors,
12549
+ });
12210
12550
  const { execute, exportsProxy } = link(
12211
12551
  privateFields,
12212
12552
  moduleAliases,
@@ -12235,6 +12575,7 @@ defineProperties(InertCompartment, {
12235
12575
  parentCompartment,
12236
12576
  noNamespaceBox,
12237
12577
  compartmentImport,
12578
+ noAggregateLoadErrors,
12238
12579
  });
12239
12580
  }
12240
12581
 
@@ -12244,7 +12585,7 @@ defineProperties(InertCompartment, {
12244
12585
  };$h͏_once.makeCompartmentConstructor(makeCompartmentConstructor);
12245
12586
  })()
12246
12587
  ,
12247
- // === 49. ses ./src/get-anonymous-intrinsics.js ===
12588
+ // === 51. ses ./src/get-anonymous-intrinsics.js ===
12248
12589
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,globalThis,assign,AsyncGeneratorFunctionInstance,ArrayBuffer,InertCompartment;$h͏_imports([["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["Float32Array",[$h͏_a => (Float32Array = $h͏_a)]],["Map",[$h͏_a => (Map = $h͏_a)]],["Set",[$h͏_a => (Set = $h͏_a)]],["String",[$h͏_a => (String = $h͏_a)]],["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]],["iterateArray",[$h͏_a => (iterateArray = $h͏_a)]],["iterateMap",[$h͏_a => (iterateMap = $h͏_a)]],["iterateSet",[$h͏_a => (iterateSet = $h͏_a)]],["iterateString",[$h͏_a => (iterateString = $h͏_a)]],["matchAllRegExp",[$h͏_a => (matchAllRegExp = $h͏_a)]],["matchAllSymbol",[$h͏_a => (matchAllSymbol = $h͏_a)]],["regexpPrototype",[$h͏_a => (regexpPrototype = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["assign",[$h͏_a => (assign = $h͏_a)]],["AsyncGeneratorFunctionInstance",[$h͏_a => (AsyncGeneratorFunctionInstance = $h͏_a)]],["ArrayBuffer",[$h͏_a => (ArrayBuffer = $h͏_a)]]]],["./compartment.js", [["InertCompartment",[$h͏_a => (InertCompartment = $h͏_a)]]]]]);
12249
12590
 
12250
12591
 
@@ -12415,7 +12756,6 @@ function makeArguments() {
12415
12756
  }
12416
12757
 
12417
12758
  const ab = new ArrayBuffer(0);
12418
- // @ts-expect-error TODO How do I add sliceToImmutable to ArrayBuffer type?
12419
12759
  // eslint-disable-next-line @endo/no-polymorphic-call
12420
12760
  const iab = ab.sliceToImmutable();
12421
12761
  const iabProto = getPrototypeOf(iab);
@@ -12428,7 +12768,7 @@ function makeArguments() {
12428
12768
  };$h͏_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
12429
12769
  })()
12430
12770
  ,
12431
- // === 50. ses ./src/tame-harden.js ===
12771
+ // === 52. ses ./src/tame-harden.js ===
12432
12772
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let freeze;$h͏_imports([["./commons.js", [["freeze",[$h͏_a => (freeze = $h͏_a)]]]]]);
12433
12773
 
12434
12774
 
@@ -12460,7 +12800,7 @@ function makeArguments() {
12460
12800
  freeze(tameHarden);
12461
12801
  })()
12462
12802
  ,
12463
- // === 51. ses ./src/tame-symbol-constructor.js ===
12803
+ // === 53. ses ./src/tame-symbol-constructor.js ===
12464
12804
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let Symbol,entries,fromEntries,getOwnPropertyDescriptors,defineProperties,arrayMap,functionBind;$h͏_imports([["./commons.js", [["Symbol",[$h͏_a => (Symbol = $h͏_a)]],["entries",[$h͏_a => (entries = $h͏_a)]],["fromEntries",[$h͏_a => (fromEntries = $h͏_a)]],["getOwnPropertyDescriptors",[$h͏_a => (getOwnPropertyDescriptors = $h͏_a)]],["defineProperties",[$h͏_a => (defineProperties = $h͏_a)]],["arrayMap",[$h͏_a => (arrayMap = $h͏_a)]],["functionBind",[$h͏_a => (functionBind = $h͏_a)]]]]]);
12465
12805
 
12466
12806
 
@@ -12527,7 +12867,7 @@ freeze(tameHarden);
12527
12867
  };$h͏_once.tameSymbolConstructor(tameSymbolConstructor);
12528
12868
  })()
12529
12869
  ,
12530
- // === 52. ses ./src/tame-faux-data-properties.js ===
12870
+ // === 54. ses ./src/tame-faux-data-properties.js ===
12531
12871
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getOwnPropertyDescriptor,apply,defineProperty,toStringTagSymbol;$h͏_imports([["./commons.js", [["getOwnPropertyDescriptor",[$h͏_a => (getOwnPropertyDescriptor = $h͏_a)]],["apply",[$h͏_a => (apply = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["toStringTagSymbol",[$h͏_a => (toStringTagSymbol = $h͏_a)]]]]]);
12532
12872
 
12533
12873
 
@@ -12740,8 +13080,8 @@ const throws = thunk => {
12740
13080
  };$h͏_once.tameFauxDataProperties(tameFauxDataProperties);
12741
13081
  })()
12742
13082
  ,
12743
- // === 53. ses ./src/tame-regenerator-runtime.js ===
12744
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let defineProperty,iteratorPrototype,iteratorSymbol,objectHasOwnProperty;$h͏_imports([["./commons.js", [["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["iteratorPrototype",[$h͏_a => (iteratorPrototype = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]],["objectHasOwnProperty",[$h͏_a => (objectHasOwnProperty = $h͏_a)]]]]]);
13083
+ // === 55. ses ./src/tame-regenerator-runtime.js ===
13084
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let defineProperty,iteratorPrototype,iteratorSymbol,hasOwn;$h͏_imports([["./commons.js", [["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]],["iteratorPrototype",[$h͏_a => (iteratorPrototype = $h͏_a)]],["iteratorSymbol",[$h͏_a => (iteratorSymbol = $h͏_a)]],["hasOwn",[$h͏_a => (hasOwn = $h͏_a)]]]]]);
12745
13085
 
12746
13086
 
12747
13087
 
@@ -12758,7 +13098,7 @@ const throws = thunk => {
12758
13098
  set(value) {
12759
13099
  // ignore the assignment on IteratorPrototype
12760
13100
  if (this === iteratorPrototype) return;
12761
- if (objectHasOwnProperty(this, iteratorSymbol)) {
13101
+ if (hasOwn(this, iteratorSymbol)) {
12762
13102
  this[iteratorSymbol] = value;
12763
13103
  }
12764
13104
  defineProperty(this, iteratorSymbol, {
@@ -12772,7 +13112,7 @@ const throws = thunk => {
12772
13112
  };$h͏_once.tameRegeneratorRuntime(tameRegeneratorRuntime);
12773
13113
  })()
12774
13114
  ,
12775
- // === 54. ses ./src/shim-arraybuffer-transfer.js ===
13115
+ // === 56. ses ./src/shim-arraybuffer-transfer.js ===
12776
13116
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let ArrayBuffer,arrayBufferPrototype,arrayBufferSlice,arrayBufferGetByteLength,Uint8Array,typedArraySet,globalThis,TypeError,defineProperty;$h͏_imports([["./commons.js", [["ArrayBuffer",[$h͏_a => (ArrayBuffer = $h͏_a)]],["arrayBufferPrototype",[$h͏_a => (arrayBufferPrototype = $h͏_a)]],["arrayBufferSlice",[$h͏_a => (arrayBufferSlice = $h͏_a)]],["arrayBufferGetByteLength",[$h͏_a => (arrayBufferGetByteLength = $h͏_a)]],["Uint8Array",[$h͏_a => (Uint8Array = $h͏_a)]],["typedArraySet",[$h͏_a => (typedArraySet = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["defineProperty",[$h͏_a => (defineProperty = $h͏_a)]]]]]);
12777
13117
 
12778
13118
 
@@ -12860,17 +13200,49 @@ const throws = thunk => {
12860
13200
  };$h͏_once.shimArrayBufferTransfer(shimArrayBufferTransfer);
12861
13201
  })()
12862
13202
  ,
12863
- // === 55. ses ./src/reporting.js ===
12864
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let functionBind,globalThis,assert;$h͏_imports([["./commons.js", [["functionBind",[$h͏_a => (functionBind = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
13203
+ // === 57. ses ./src/reporting.js ===
13204
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,assert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
12865
13205
 
12866
13206
 
12867
13207
  /**
12868
13208
  * @import {Reporter, GroupReporter} from './reporting-types.js'
12869
13209
  */
12870
13210
 
13211
+ /* eslint-disable @endo/no-polymorphic-call */
13212
+ /**
13213
+ * To address https://github.com/endojs/endo/issues/2908,
13214
+ * the `consoleReporter` uses the current `console` rather
13215
+ * than the original one.
13216
+ *
13217
+ * @type {GroupReporter}
13218
+ */
13219
+ const consoleReporter = {
13220
+ warn(...args) {
13221
+ globalThis.console.warn(...args);
13222
+ },
13223
+ error(...args) {
13224
+ globalThis.console.error(...args);
13225
+ },
13226
+ ...(globalThis.console?.groupCollapsed
13227
+ ? {
13228
+ groupCollapsed(...args) {
13229
+ globalThis.console.groupCollapsed(...args);
13230
+ },
13231
+ }
13232
+ : undefined),
13233
+ ...(globalThis.console?.groupEnd
13234
+ ? {
13235
+ groupEnd() {
13236
+ globalThis.console.groupEnd();
13237
+ },
13238
+ }
13239
+ : undefined),
13240
+ };
13241
+ /* eslint-enable @endo/no-polymorphic-call */
13242
+
12871
13243
  /**
12872
13244
  * Creates a suitable reporter for internal errors and warnings out of the
12873
- * Node.js console.error to ensure all messages to go stderr, including the
13245
+ * Node.js console.error to ensure all messages go to stderr, including the
12874
13246
  * group label.
12875
13247
  * Accounts for the extra space introduced by console.error as a delimiter
12876
13248
  * between the indent and subsequent arguments.
@@ -12914,18 +13286,22 @@ const mute = () => {};
12914
13286
  if (reporting === 'none') {
12915
13287
  return makeReportPrinter(mute);
12916
13288
  }
12917
- if (
12918
- reporting === 'console' ||
12919
- globalThis.window === globalThis ||
12920
- globalThis.importScripts !== undefined
12921
- ) {
12922
- return console;
12923
- }
12924
13289
  if (globalThis.console !== undefined) {
13290
+ if (
13291
+ reporting === 'console' || // asks for console explicitly
13292
+ globalThis.window === globalThis || // likely on browser
13293
+ globalThis.importScripts !== undefined // likely on worker
13294
+ ) {
13295
+ // reporter just delegates directly to the current console
13296
+ return consoleReporter;
13297
+ }
13298
+ assert(reporting === 'platform');
12925
13299
  // On Node.js, we send all feedback to stderr, regardless of purported level.
12926
- const console = globalThis.console;
12927
- const error = functionBind(console.error, console);
12928
- return makeReportPrinter(error);
13300
+ // This uses `consoleReporter.error` instead of `console.error` because we
13301
+ // want the constructed reporter to use the `console.error` of the current
13302
+ // `console`, not the `console` that was installed when the reporter
13303
+ // was created.
13304
+ return makeReportPrinter(consoleReporter.error);
12929
13305
  }
12930
13306
  if (globalThis.print !== undefined) {
12931
13307
  return makeReportPrinter(globalThis.print);
@@ -12968,8 +13344,9 @@ const mute = () => {};
12968
13344
  };$h͏_once.reportInGroup(reportInGroup);
12969
13345
  })()
12970
13346
  ,
12971
- // === 56. ses ./src/lockdown.js ===
12972
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim.js", []],["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["noEvalEvaluate",[$h͏_a => (noEvalEvaluate = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./make-hardener.js", [["makeHardener",[$h͏_a => (makeHardener = $h͏_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector",[$h͏_a => (makeIntrinsicsCollector = $h͏_a)]]]],["./permits-intrinsics.js", [["default",[$h͏_a => (removeUnpermittedIntrinsics = $h͏_a)]]]],["./tame-function-constructors.js", [["default",[$h͏_a => (tameFunctionConstructors = $h͏_a)]]]],["./tame-date-constructor.js", [["default",[$h͏_a => (tameDateConstructor = $h͏_a)]]]],["./tame-math-object.js", [["default",[$h͏_a => (tameMathObject = $h͏_a)]]]],["./tame-regexp-constructor.js", [["default",[$h͏_a => (tameRegExpConstructor = $h͏_a)]]]],["./enable-property-overrides.js", [["default",[$h͏_a => (enablePropertyOverrides = $h͏_a)]]]],["./tame-locale-methods.js", [["default",[$h͏_a => (tameLocaleMethods = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]],["./permits.js", [["initialGlobalPropertyNames",[$h͏_a => (initialGlobalPropertyNames = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./tame-domains.js", [["tameDomains",[$h͏_a => (tameDomains = $h͏_a)]]]],["./tame-module-source.js", [["tameModuleSource",[$h͏_a => (tameModuleSource = $h͏_a)]]]],["./error/tame-console.js", [["tameConsole",[$h͏_a => (tameConsole = $h͏_a)]]]],["./error/tame-error-constructor.js", [["default",[$h͏_a => (tameErrorConstructor = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics",[$h͏_a => (getAnonymousIntrinsics = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-harden.js", [["tameHarden",[$h͏_a => (tameHarden = $h͏_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor",[$h͏_a => (tameSymbolConstructor = $h͏_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties",[$h͏_a => (tameFauxDataProperties = $h͏_a)]]]],["./tame-regenerator-runtime.js", [["tameRegeneratorRuntime",[$h͏_a => (tameRegeneratorRuntime = $h͏_a)]]]],["./shim-arraybuffer-transfer.js", [["shimArrayBufferTransfer",[$h͏_a => (shimArrayBufferTransfer = $h͏_a)]]]],["./reporting.js", [["reportInGroup",[$h͏_a => (reportInGroup = $h͏_a)]],["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
13347
+ // === 58. ses ./src/lockdown.js ===
13348
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let getenv,FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,globalThis,is,ownKeys,stringSplit,symbolFor,noEvalEvaluate,getOwnPropertyNames,getPrototypeOf,makeHardener,makeIntrinsicsCollector,removeUnpermittedIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,setGlobalObjectEvaluators,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameModuleSource,tameConsole,tameErrorConstructor,assert,makeAssert,getAnonymousIntrinsics,makeCompartmentConstructor,tameHarden,tameSymbolConstructor,tameFauxDataProperties,tameRegeneratorRuntime,shimArrayBufferTransfer,reportInGroup,chooseReporter;$h͏_imports([["@endo/env-options", [["getEnvironmentOption",[$h͏_a => (getenv = $h͏_a)]]]],["@endo/immutable-arraybuffer/shim.js", []],["./commons.js", [["FERAL_FUNCTION",[$h͏_a => (FERAL_FUNCTION = $h͏_a)]],["FERAL_EVAL",[$h͏_a => (FERAL_EVAL = $h͏_a)]],["TypeError",[$h͏_a => (TypeError = $h͏_a)]],["arrayFilter",[$h͏_a => (arrayFilter = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]],["is",[$h͏_a => (is = $h͏_a)]],["ownKeys",[$h͏_a => (ownKeys = $h͏_a)]],["stringSplit",[$h͏_a => (stringSplit = $h͏_a)]],["symbolFor",[$h͏_a => (symbolFor = $h͏_a)]],["noEvalEvaluate",[$h͏_a => (noEvalEvaluate = $h͏_a)]],["getOwnPropertyNames",[$h͏_a => (getOwnPropertyNames = $h͏_a)]],["getPrototypeOf",[$h͏_a => (getPrototypeOf = $h͏_a)]]]],["./make-hardener.js", [["makeHardener",[$h͏_a => (makeHardener = $h͏_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector",[$h͏_a => (makeIntrinsicsCollector = $h͏_a)]]]],["./permits-intrinsics.js", [["default",[$h͏_a => (removeUnpermittedIntrinsics = $h͏_a)]]]],["./tame-function-constructors.js", [["default",[$h͏_a => (tameFunctionConstructors = $h͏_a)]]]],["./tame-date-constructor.js", [["default",[$h͏_a => (tameDateConstructor = $h͏_a)]]]],["./tame-math-object.js", [["default",[$h͏_a => (tameMathObject = $h͏_a)]]]],["./tame-regexp-constructor.js", [["default",[$h͏_a => (tameRegExpConstructor = $h͏_a)]]]],["./enable-property-overrides.js", [["default",[$h͏_a => (enablePropertyOverrides = $h͏_a)]]]],["./tame-locale-methods.js", [["default",[$h͏_a => (tameLocaleMethods = $h͏_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties",[$h͏_a => (setGlobalObjectConstantProperties = $h͏_a)]],["setGlobalObjectMutableProperties",[$h͏_a => (setGlobalObjectMutableProperties = $h͏_a)]],["setGlobalObjectEvaluators",[$h͏_a => (setGlobalObjectEvaluators = $h͏_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator",[$h͏_a => (makeSafeEvaluator = $h͏_a)]]]],["./permits.js", [["initialGlobalPropertyNames",[$h͏_a => (initialGlobalPropertyNames = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./tame-domains.js", [["tameDomains",[$h͏_a => (tameDomains = $h͏_a)]]]],["./tame-module-source.js", [["tameModuleSource",[$h͏_a => (tameModuleSource = $h͏_a)]]]],["./error/tame-console.js", [["tameConsole",[$h͏_a => (tameConsole = $h͏_a)]]]],["./error/tame-error-constructor.js", [["default",[$h͏_a => (tameErrorConstructor = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]],["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics",[$h͏_a => (getAnonymousIntrinsics = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-harden.js", [["tameHarden",[$h͏_a => (tameHarden = $h͏_a)]]]],["./tame-symbol-constructor.js", [["tameSymbolConstructor",[$h͏_a => (tameSymbolConstructor = $h͏_a)]]]],["./tame-faux-data-properties.js", [["tameFauxDataProperties",[$h͏_a => (tameFauxDataProperties = $h͏_a)]]]],["./tame-regenerator-runtime.js", [["tameRegeneratorRuntime",[$h͏_a => (tameRegeneratorRuntime = $h͏_a)]]]],["./shim-arraybuffer-transfer.js", [["shimArrayBufferTransfer",[$h͏_a => (shimArrayBufferTransfer = $h͏_a)]]]],["./reporting.js", [["reportInGroup",[$h͏_a => (reportInGroup = $h͏_a)]],["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
13349
+
12973
13350
 
12974
13351
 
12975
13352
 
@@ -13334,6 +13711,30 @@ const probeHostEvaluators = () => {
13334
13711
 
13335
13712
  const intrinsics = finalIntrinsics();
13336
13713
 
13714
+ // Install Object[@harden] or abort.
13715
+ const symbolForHarden = symbolFor('harden');
13716
+ const priorHarden = intrinsics.Object[symbolForHarden];
13717
+ if (priorHarden) {
13718
+ // By convention, if a module like @endo/harden gets used before lockdown,
13719
+ // it will install itself as a non-configurable, non-writable property over
13720
+ // Object[@harden] so that versions of SES predating the introduction of
13721
+ // Object[@harden] will fail to lockdown because they cannot remove an
13722
+ // unknown intrinsic.
13723
+ // All newer versions explicitly check for Object[@harden] (here).
13724
+ // The @endo/harden implementation additionally captures a stack trace
13725
+ // where harden was first used to assist developers in tracking down the
13726
+ // hardened module that was initialized before lockdown.
13727
+ if (priorHarden.lockdownError) {
13728
+ throw priorHarden.lockdownError;
13729
+ }
13730
+ // And in the event a library installs Object[@harden] without leaving a
13731
+ // hint, we fall back to a generic lockdown error.
13732
+ throw new TypeError(
13733
+ 'Cannot lockdown (repairIntrinsics) if a prior harden implementation has been used and installed. Check for libraries using @endo/harden before lockdown.',
13734
+ );
13735
+ }
13736
+ intrinsics.Object[symbolForHarden] = tamedHarden;
13737
+
13337
13738
  const hostIntrinsics = { __proto__: null };
13338
13739
 
13339
13740
  // The Node.js Buffer is a derived class of Uint8Array, and as such is often
@@ -13375,19 +13776,16 @@ const probeHostEvaluators = () => {
13375
13776
  );
13376
13777
  }
13377
13778
 
13779
+ // The default `assert` installed by `assert-shim.js` does not redact errors,
13780
+ // leaving `lockdown` or `repairIntrinsics` with the obligation to replace it
13781
+ // with a redacting version, unless the caller opts-out with errorTaming set
13782
+ // to `unsafe` or `unsafe-debug`.
13783
+ // The inverse was true through version 1.13.0, except the configuration
13784
+ // was disregarded and the redacting `assert` left in place if lexical
13785
+ // `assert` differed from `globalThis.assert`.
13378
13786
  // @ts-ignore assert is absent on globalThis type def.
13379
- if (
13380
- (errorTaming === 'unsafe' || errorTaming === 'unsafe-debug') &&
13381
- globalThis.assert === assert
13382
- ) {
13383
- // If errorTaming is 'unsafe' or 'unsafe-debug' we replace the
13384
- // global assert with
13385
- // one whose `details` template literal tag does not redact
13386
- // unmarked substitution values. IOW, it blabs information that
13387
- // was supposed to be secret from callers, as an aid to debugging
13388
- // at a further cost in safety.
13389
- // @ts-ignore assert is absent on globalThis type def.
13390
- globalThis.assert = makeAssert(undefined, true);
13787
+ if (errorTaming !== 'unsafe' && errorTaming !== 'unsafe-debug') {
13788
+ globalThis.assert = makeAssert();
13391
13789
  }
13392
13790
 
13393
13791
  // Replace *Locale* methods with their non-locale equivalents
@@ -13529,7 +13927,7 @@ const probeHostEvaluators = () => {
13529
13927
  };$h͏_once.repairIntrinsics(repairIntrinsics);
13530
13928
  })()
13531
13929
  ,
13532
- // === 57. ses ./src/lockdown-shim.js ===
13930
+ // === 59. ses ./src/lockdown-shim.js ===
13533
13931
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,repairIntrinsics;$h͏_imports([["./assert-sloppy-mode.js", []],["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./lockdown.js", [["repairIntrinsics",[$h͏_a => (repairIntrinsics = $h͏_a)]]]]]);
13534
13932
 
13535
13933
 
@@ -13569,7 +13967,7 @@ globalThis.repairIntrinsics = options => {
13569
13967
  };
13570
13968
  })()
13571
13969
  ,
13572
- // === 58. ses ./src/compartment-shim.js ===
13970
+ // === 60. ses ./src/compartment-shim.js ===
13573
13971
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,makeCompartmentConstructor,tameFunctionToString,getGlobalIntrinsics,chooseReporter;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./compartment.js", [["makeCompartmentConstructor",[$h͏_a => (makeCompartmentConstructor = $h͏_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString",[$h͏_a => (tameFunctionToString = $h͏_a)]]]],["./intrinsics.js", [["getGlobalIntrinsics",[$h͏_a => (getGlobalIntrinsics = $h͏_a)]]]],["./reporting.js", [["chooseReporter",[$h͏_a => (chooseReporter = $h͏_a)]]]]]);
13574
13972
 
13575
13973
 
@@ -13594,14 +13992,14 @@ globalThis.Compartment = makeCompartmentConstructor(
13594
13992
  );
13595
13993
  })()
13596
13994
  ,
13597
- // === 59. ses ./src/assert-shim.js ===
13598
- ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,assert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["assert",[$h͏_a => (assert = $h͏_a)]]]]]);
13995
+ // === 61. ses ./src/assert-shim.js ===
13996
+ ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let globalThis,makeAssert;$h͏_imports([["./commons.js", [["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/assert.js", [["makeAssert",[$h͏_a => (makeAssert = $h͏_a)]]]]]);
13599
13997
 
13600
13998
 
13601
- globalThis.assert = assert;
13999
+ globalThis.assert = makeAssert(undefined, true);
13602
14000
  })()
13603
14001
  ,
13604
- // === 60. ses ./src/console-shim.js ===
14002
+ // === 62. ses ./src/console-shim.js ===
13605
14003
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';let symbolFor,globalThis,defineCausalConsoleFromLogger,loggedErrorHandler;$h͏_imports([["./commons.js", [["symbolFor",[$h͏_a => (symbolFor = $h͏_a)]],["globalThis",[$h͏_a => (globalThis = $h͏_a)]]]],["./error/console.js", [["defineCausalConsoleFromLogger",[$h͏_a => (defineCausalConsoleFromLogger = $h͏_a)]]]],["./error/assert.js", [["loggedErrorHandler",[$h͏_a => (loggedErrorHandler = $h͏_a)]]]]]);
13606
14004
 
13607
14005
 
@@ -13654,7 +14052,7 @@ globalThis[MAKE_CAUSAL_CONSOLE_FROM_LOGGER_KEY_FOR_SES_AVA] =
13654
14052
  makeCausalConsoleFromLoggerForSesAva;
13655
14053
  })()
13656
14054
  ,
13657
- // === 61. ses ./index.js ===
14055
+ // === 63. ses ./index.js ===
13658
14056
  ({imports:$h͏_imports,liveVar:$h͏_live,onceVar:$h͏_once,import:$h͏_import,importMeta:$h͏____meta})=>(function(){'use strict';$h͏_imports([["./src/lockdown-shim.js", []],["./src/compartment-shim.js", []],["./src/assert-shim.js", []],["./src/console-shim.js", []]]);
13659
14057
  })()
13660
14058
  ,