ses 0.18.5 → 0.18.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -12,34 +12,6 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- import { globalThis, TypeError, assign } from './src/commons.js';
16
-
17
- import { tameFunctionToString } from './src/tame-function-tostring.js';
18
- import { getGlobalIntrinsics } from './src/intrinsics.js';
19
- import { lockdown } from './src/lockdown-shim.js';
20
- import { makeCompartmentConstructor } from './src/compartment-shim.js';
21
- import { assert } from './src/error/assert.js';
22
-
23
- /** getThis returns globalThis in sloppy mode or undefined in strict mode. */
24
- function getThis() {
25
- return this;
26
- }
27
-
28
- if (getThis()) {
29
- // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_SLOPPY.md
30
- throw TypeError(`SES failed to initialize, sloppy mode (SES_NO_SLOPPY)`);
31
- }
32
-
33
- const markVirtualizedNativeFunction = tameFunctionToString();
34
-
35
- const Compartment = makeCompartmentConstructor(
36
- makeCompartmentConstructor,
37
- getGlobalIntrinsics(globalThis),
38
- markVirtualizedNativeFunction,
39
- );
40
-
41
- assign(globalThis, {
42
- lockdown,
43
- Compartment,
44
- assert,
45
- });
15
+ import './src/lockdown-shim.js';
16
+ import './src/compartment-shim.js';
17
+ import './src/assert-shim.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ses",
3
- "version": "0.18.5",
3
+ "version": "0.18.8",
4
4
  "description": "Hardened JavaScript for Fearless Cooperation",
5
5
  "keywords": [
6
6
  "lockdown",
@@ -60,17 +60,17 @@
60
60
  "test:platform-compatibility": "node test/package/test.cjs"
61
61
  },
62
62
  "dependencies": {
63
- "@endo/env-options": "^0.1.1"
63
+ "@endo/env-options": "^0.1.4"
64
64
  },
65
65
  "devDependencies": {
66
- "@endo/compartment-mapper": "^0.8.5",
67
- "@endo/static-module-record": "^0.7.20",
66
+ "@endo/compartment-mapper": "^0.9.2",
67
+ "@endo/static-module-record": "^0.8.2",
68
68
  "@endo/test262-runner": "^0.1.32",
69
69
  "ava": "^5.3.0",
70
70
  "babel-eslint": "^10.0.3",
71
71
  "c8": "^7.14.0",
72
72
  "core-js": "^3.31.0",
73
- "eslint": "^8.44.0",
73
+ "eslint": "^8.46.0",
74
74
  "eslint-config-airbnb-base": "^15.0.0",
75
75
  "eslint-config-prettier": "^8.8.0",
76
76
  "eslint-plugin-eslint-comments": "^3.1.2",
@@ -79,7 +79,7 @@
79
79
  "sinon": "^15.1.0",
80
80
  "terser": "^5.16.6",
81
81
  "tsd": "^0.28.1",
82
- "typescript": "~5.1.3"
82
+ "typescript": "~5.2.2"
83
83
  },
84
84
  "files": [
85
85
  "LICENSE*",
@@ -179,5 +179,5 @@
179
179
  ],
180
180
  "timeout": "2m"
181
181
  },
182
- "gitHead": "106da55b8bcea3067f70c29c357806f3f2e55c52"
182
+ "gitHead": "9c779d317c4b02133172dbe142c5b2d1727efc49"
183
183
  }
@@ -0,0 +1,4 @@
1
+ import { globalThis } from './commons.js';
2
+ import { assert } from './error/assert.js';
3
+
4
+ globalThis.assert = assert;
@@ -0,0 +1,11 @@
1
+ import { TypeError } from './commons.js';
2
+
3
+ /** getThis returns globalThis in sloppy mode or undefined in strict mode. */
4
+ function getThis() {
5
+ return this;
6
+ }
7
+
8
+ if (getThis()) {
9
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_SLOPPY.md
10
+ throw TypeError(`SES failed to initialize, sloppy mode (SES_NO_SLOPPY)`);
11
+ }
@@ -1,292 +1,15 @@
1
- // @ts-check
2
- /* eslint-disable no-underscore-dangle */
3
- /// <reference types="ses">
1
+ /// <reference types="ses"/>
4
2
 
5
- import {
6
- Map,
7
- ReferenceError,
8
- TypeError,
9
- WeakMap,
10
- assign,
11
- defineProperties,
12
- entries,
13
- promiseThen,
14
- weakmapGet,
15
- weakmapSet,
16
- } from './commons.js';
17
- import {
18
- setGlobalObjectSymbolUnscopables,
19
- setGlobalObjectConstantProperties,
20
- setGlobalObjectMutableProperties,
21
- setGlobalObjectEvaluators,
22
- } from './global-object.js';
23
- import { sharedGlobalPropertyNames } from './permits.js';
24
- import { load } from './module-load.js';
25
- import { link } from './module-link.js';
26
- import { getDeferredExports } from './module-proxy.js';
27
- import { assert } from './error/assert.js';
28
- import { compartmentEvaluate } from './compartment-evaluate.js';
29
- import { makeSafeEvaluator } from './make-safe-evaluator.js';
3
+ import { globalThis } from './commons.js';
4
+ import { makeCompartmentConstructor } from './compartment.js';
5
+ import { tameFunctionToString } from './tame-function-tostring.js';
6
+ import { getGlobalIntrinsics } from './intrinsics.js';
30
7
 
31
- const { quote: q } = assert;
8
+ const markVirtualizedNativeFunction = tameFunctionToString();
32
9
 
33
- // moduleAliases associates every public module exports namespace with its
34
- // corresponding compartment and specifier so they can be used to link modules
35
- // across compartments.
36
- // The mechanism to thread an alias is to use the compartment.module function
37
- // to obtain the exports namespace of a foreign module and pass it into another
38
- // compartment's moduleMap constructor option.
39
- const moduleAliases = new WeakMap();
40
-
41
- // privateFields captures the private state for each compartment.
42
- const privateFields = new WeakMap();
43
-
44
- // Compartments do not need an importHook or resolveHook to be useful
45
- // as a vessel for evaluating programs.
46
- // However, any method that operates the module system will throw an exception
47
- // if these hooks are not available.
48
- const assertModuleHooks = compartment => {
49
- const { importHook, resolveHook } = weakmapGet(privateFields, compartment);
50
- if (typeof importHook !== 'function' || typeof resolveHook !== 'function') {
51
- throw TypeError(
52
- 'Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules',
53
- );
54
- }
55
- };
56
-
57
- export const InertCompartment = function Compartment(
58
- _endowments = {},
59
- _modules = {},
60
- _options = {},
61
- ) {
62
- throw TypeError(
63
- 'Compartment.prototype.constructor is not a valid constructor.',
64
- );
65
- };
66
-
67
- /**
68
- * @param {Compartment} compartment
69
- * @param {string} specifier
70
- */
71
- const compartmentImportNow = (compartment, specifier) => {
72
- const { execute, exportsProxy } = link(
73
- privateFields,
74
- moduleAliases,
75
- compartment,
76
- specifier,
77
- );
78
- execute();
79
- return exportsProxy;
80
- };
81
-
82
- export const CompartmentPrototype = {
83
- constructor: InertCompartment,
84
-
85
- get globalThis() {
86
- return weakmapGet(privateFields, this).globalObject;
87
- },
88
-
89
- get name() {
90
- return weakmapGet(privateFields, this).name;
91
- },
92
-
93
- /**
94
- * @param {string} source is a JavaScript program grammar construction.
95
- * @param {object} [options]
96
- * @param {Array<import('./lockdown-shim').Transform>} [options.transforms]
97
- * @param {boolean} [options.sloppyGlobalsMode]
98
- * @param {object} [options.__moduleShimLexicals__]
99
- * @param {boolean} [options.__evadeHtmlCommentTest__]
100
- * @param {boolean} [options.__evadeImportExpressionTest__]
101
- * @param {boolean} [options.__rejectSomeDirectEvalExpressions__]
102
- */
103
- evaluate(source, options = {}) {
104
- const compartmentFields = weakmapGet(privateFields, this);
105
- return compartmentEvaluate(compartmentFields, source, options);
106
- },
107
-
108
- toString() {
109
- return '[object Compartment]';
110
- },
111
-
112
- module(specifier) {
113
- if (typeof specifier !== 'string') {
114
- throw TypeError('first argument of module() must be a string');
115
- }
116
-
117
- assertModuleHooks(this);
118
-
119
- const { exportsProxy } = getDeferredExports(
120
- this,
121
- weakmapGet(privateFields, this),
122
- moduleAliases,
123
- specifier,
124
- );
125
-
126
- return exportsProxy;
127
- },
128
-
129
- async import(specifier) {
130
- if (typeof specifier !== 'string') {
131
- throw TypeError('first argument of import() must be a string');
132
- }
133
-
134
- assertModuleHooks(this);
135
-
136
- return promiseThen(
137
- load(privateFields, moduleAliases, this, specifier),
138
- () => {
139
- // The namespace box is a contentious design and likely to be a breaking
140
- // change in an appropriately numbered future version.
141
- const namespace = compartmentImportNow(
142
- /** @type {Compartment} */ (this),
143
- specifier,
144
- );
145
- return { namespace };
146
- },
147
- );
148
- },
149
-
150
- async load(specifier) {
151
- if (typeof specifier !== 'string') {
152
- throw TypeError('first argument of load() must be a string');
153
- }
154
-
155
- assertModuleHooks(this);
156
-
157
- return load(privateFields, moduleAliases, this, specifier);
158
- },
159
-
160
- importNow(specifier) {
161
- if (typeof specifier !== 'string') {
162
- throw TypeError('first argument of importNow() must be a string');
163
- }
164
-
165
- assertModuleHooks(this);
166
-
167
- return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
168
- },
169
- };
170
-
171
- defineProperties(InertCompartment, {
172
- prototype: { value: CompartmentPrototype },
173
- });
174
-
175
- /**
176
- * @callback MakeCompartmentConstructor
177
- * @param {MakeCompartmentConstructor} targetMakeCompartmentConstructor
178
- * @param {Record<string, any>} intrinsics
179
- * @param {(object: object) => void} markVirtualizedNativeFunction
180
- * @returns {Compartment['constructor']}
181
- */
182
-
183
- /** @type {MakeCompartmentConstructor} */
184
- export const makeCompartmentConstructor = (
185
- targetMakeCompartmentConstructor,
186
- intrinsics,
10
+ // @ts-ignore Compartment is definitely on globalThis.
11
+ globalThis.Compartment = makeCompartmentConstructor(
12
+ makeCompartmentConstructor,
13
+ getGlobalIntrinsics(globalThis),
187
14
  markVirtualizedNativeFunction,
188
- ) => {
189
- function Compartment(endowments = {}, moduleMap = {}, options = {}) {
190
- if (new.target === undefined) {
191
- throw TypeError(
192
- "Class constructor Compartment cannot be invoked without 'new'",
193
- );
194
- }
195
-
196
- // Extract options, and shallow-clone transforms.
197
- const {
198
- name = '<unknown>',
199
- transforms = [],
200
- __shimTransforms__ = [],
201
- resolveHook,
202
- importHook,
203
- moduleMapHook,
204
- importMetaHook,
205
- } = options;
206
- const globalTransforms = [...transforms, ...__shimTransforms__];
207
-
208
- // Map<FullSpecifier, ModuleCompartmentRecord>
209
- const moduleRecords = new Map();
210
- // Map<FullSpecifier, ModuleInstance>
211
- const instances = new Map();
212
- // Map<FullSpecifier, {ExportsProxy, ProxiedExports, activate()}>
213
- const deferredExports = new Map();
214
-
215
- // Validate given moduleMap.
216
- // The module map gets translated on-demand in module-load.js and the
217
- // moduleMap can be invalid in ways that cannot be detected in the
218
- // constructor, but these checks allow us to throw early for a better
219
- // developer experience.
220
- for (const [specifier, aliasNamespace] of entries(moduleMap || {})) {
221
- if (typeof aliasNamespace === 'string') {
222
- // TODO implement parent module record retrieval.
223
- throw TypeError(
224
- `Cannot map module ${q(specifier)} to ${q(
225
- aliasNamespace,
226
- )} in parent compartment`,
227
- );
228
- } else if (weakmapGet(moduleAliases, aliasNamespace) === undefined) {
229
- // TODO create and link a synthetic module instance from the given
230
- // namespace object.
231
- throw ReferenceError(
232
- `Cannot map module ${q(
233
- specifier,
234
- )} because it has no known compartment in this realm`,
235
- );
236
- }
237
- }
238
-
239
- const globalObject = {};
240
-
241
- setGlobalObjectSymbolUnscopables(globalObject);
242
-
243
- // We must initialize all constant properties first because
244
- // `makeSafeEvaluator` may use them to create optimized bindings
245
- // in the evaluator.
246
- // TODO: consider merging into a single initialization if internal
247
- // evaluator is no longer eagerly created
248
- setGlobalObjectConstantProperties(globalObject);
249
-
250
- const { safeEvaluate } = makeSafeEvaluator({
251
- globalObject,
252
- globalTransforms,
253
- sloppyGlobalsMode: false,
254
- });
255
-
256
- setGlobalObjectMutableProperties(globalObject, {
257
- intrinsics,
258
- newGlobalPropertyNames: sharedGlobalPropertyNames,
259
- makeCompartmentConstructor: targetMakeCompartmentConstructor,
260
- markVirtualizedNativeFunction,
261
- });
262
-
263
- // TODO: maybe add evalTaming to the Compartment constructor 3rd options?
264
- setGlobalObjectEvaluators(
265
- globalObject,
266
- safeEvaluate,
267
- markVirtualizedNativeFunction,
268
- );
269
-
270
- assign(globalObject, endowments);
271
-
272
- weakmapSet(privateFields, this, {
273
- name: `${name}`,
274
- globalTransforms,
275
- globalObject,
276
- safeEvaluate,
277
- resolveHook,
278
- importHook,
279
- moduleMap,
280
- moduleMapHook,
281
- importMetaHook,
282
- moduleRecords,
283
- __shimTransforms__,
284
- deferredExports,
285
- instances,
286
- });
287
- }
288
-
289
- Compartment.prototype = CompartmentPrototype;
290
-
291
- return Compartment;
292
- };
15
+ );
@@ -0,0 +1,292 @@
1
+ // @ts-check
2
+ /* eslint-disable no-underscore-dangle */
3
+ /// <reference types="ses">
4
+
5
+ import {
6
+ Map,
7
+ ReferenceError,
8
+ TypeError,
9
+ WeakMap,
10
+ assign,
11
+ defineProperties,
12
+ entries,
13
+ promiseThen,
14
+ weakmapGet,
15
+ weakmapSet,
16
+ } from './commons.js';
17
+ import {
18
+ setGlobalObjectSymbolUnscopables,
19
+ setGlobalObjectConstantProperties,
20
+ setGlobalObjectMutableProperties,
21
+ setGlobalObjectEvaluators,
22
+ } from './global-object.js';
23
+ import { sharedGlobalPropertyNames } from './permits.js';
24
+ import { load } from './module-load.js';
25
+ import { link } from './module-link.js';
26
+ import { getDeferredExports } from './module-proxy.js';
27
+ import { assert } from './error/assert.js';
28
+ import { compartmentEvaluate } from './compartment-evaluate.js';
29
+ import { makeSafeEvaluator } from './make-safe-evaluator.js';
30
+
31
+ const { quote: q } = assert;
32
+
33
+ // moduleAliases associates every public module exports namespace with its
34
+ // corresponding compartment and specifier so they can be used to link modules
35
+ // across compartments.
36
+ // The mechanism to thread an alias is to use the compartment.module function
37
+ // to obtain the exports namespace of a foreign module and pass it into another
38
+ // compartment's moduleMap constructor option.
39
+ const moduleAliases = new WeakMap();
40
+
41
+ // privateFields captures the private state for each compartment.
42
+ const privateFields = new WeakMap();
43
+
44
+ // Compartments do not need an importHook or resolveHook to be useful
45
+ // as a vessel for evaluating programs.
46
+ // However, any method that operates the module system will throw an exception
47
+ // if these hooks are not available.
48
+ const assertModuleHooks = compartment => {
49
+ const { importHook, resolveHook } = weakmapGet(privateFields, compartment);
50
+ if (typeof importHook !== 'function' || typeof resolveHook !== 'function') {
51
+ throw TypeError(
52
+ 'Compartment must be constructed with an importHook and a resolveHook for it to be able to load modules',
53
+ );
54
+ }
55
+ };
56
+
57
+ export const InertCompartment = function Compartment(
58
+ _endowments = {},
59
+ _modules = {},
60
+ _options = {},
61
+ ) {
62
+ throw TypeError(
63
+ 'Compartment.prototype.constructor is not a valid constructor.',
64
+ );
65
+ };
66
+
67
+ /**
68
+ * @param {Compartment} compartment
69
+ * @param {string} specifier
70
+ */
71
+ const compartmentImportNow = (compartment, specifier) => {
72
+ const { execute, exportsProxy } = link(
73
+ privateFields,
74
+ moduleAliases,
75
+ compartment,
76
+ specifier,
77
+ );
78
+ execute();
79
+ return exportsProxy;
80
+ };
81
+
82
+ export const CompartmentPrototype = {
83
+ constructor: InertCompartment,
84
+
85
+ get globalThis() {
86
+ return weakmapGet(privateFields, this).globalObject;
87
+ },
88
+
89
+ get name() {
90
+ return weakmapGet(privateFields, this).name;
91
+ },
92
+
93
+ /**
94
+ * @param {string} source is a JavaScript program grammar construction.
95
+ * @param {object} [options]
96
+ * @param {Array<import('./lockdown-shim').Transform>} [options.transforms]
97
+ * @param {boolean} [options.sloppyGlobalsMode]
98
+ * @param {object} [options.__moduleShimLexicals__]
99
+ * @param {boolean} [options.__evadeHtmlCommentTest__]
100
+ * @param {boolean} [options.__evadeImportExpressionTest__]
101
+ * @param {boolean} [options.__rejectSomeDirectEvalExpressions__]
102
+ */
103
+ evaluate(source, options = {}) {
104
+ const compartmentFields = weakmapGet(privateFields, this);
105
+ return compartmentEvaluate(compartmentFields, source, options);
106
+ },
107
+
108
+ toString() {
109
+ return '[object Compartment]';
110
+ },
111
+
112
+ module(specifier) {
113
+ if (typeof specifier !== 'string') {
114
+ throw TypeError('first argument of module() must be a string');
115
+ }
116
+
117
+ assertModuleHooks(this);
118
+
119
+ const { exportsProxy } = getDeferredExports(
120
+ this,
121
+ weakmapGet(privateFields, this),
122
+ moduleAliases,
123
+ specifier,
124
+ );
125
+
126
+ return exportsProxy;
127
+ },
128
+
129
+ async import(specifier) {
130
+ if (typeof specifier !== 'string') {
131
+ throw TypeError('first argument of import() must be a string');
132
+ }
133
+
134
+ assertModuleHooks(this);
135
+
136
+ return promiseThen(
137
+ load(privateFields, moduleAliases, this, specifier),
138
+ () => {
139
+ // The namespace box is a contentious design and likely to be a breaking
140
+ // change in an appropriately numbered future version.
141
+ const namespace = compartmentImportNow(
142
+ /** @type {Compartment} */ (this),
143
+ specifier,
144
+ );
145
+ return { namespace };
146
+ },
147
+ );
148
+ },
149
+
150
+ async load(specifier) {
151
+ if (typeof specifier !== 'string') {
152
+ throw TypeError('first argument of load() must be a string');
153
+ }
154
+
155
+ assertModuleHooks(this);
156
+
157
+ return load(privateFields, moduleAliases, this, specifier);
158
+ },
159
+
160
+ importNow(specifier) {
161
+ if (typeof specifier !== 'string') {
162
+ throw TypeError('first argument of importNow() must be a string');
163
+ }
164
+
165
+ assertModuleHooks(this);
166
+
167
+ return compartmentImportNow(/** @type {Compartment} */ (this), specifier);
168
+ },
169
+ };
170
+
171
+ defineProperties(InertCompartment, {
172
+ prototype: { value: CompartmentPrototype },
173
+ });
174
+
175
+ /**
176
+ * @callback MakeCompartmentConstructor
177
+ * @param {MakeCompartmentConstructor} targetMakeCompartmentConstructor
178
+ * @param {Record<string, any>} intrinsics
179
+ * @param {(object: object) => void} markVirtualizedNativeFunction
180
+ * @returns {Compartment['constructor']}
181
+ */
182
+
183
+ /** @type {MakeCompartmentConstructor} */
184
+ export const makeCompartmentConstructor = (
185
+ targetMakeCompartmentConstructor,
186
+ intrinsics,
187
+ markVirtualizedNativeFunction,
188
+ ) => {
189
+ function Compartment(endowments = {}, moduleMap = {}, options = {}) {
190
+ if (new.target === undefined) {
191
+ throw TypeError(
192
+ "Class constructor Compartment cannot be invoked without 'new'",
193
+ );
194
+ }
195
+
196
+ // Extract options, and shallow-clone transforms.
197
+ const {
198
+ name = '<unknown>',
199
+ transforms = [],
200
+ __shimTransforms__ = [],
201
+ resolveHook,
202
+ importHook,
203
+ moduleMapHook,
204
+ importMetaHook,
205
+ } = options;
206
+ const globalTransforms = [...transforms, ...__shimTransforms__];
207
+
208
+ // Map<FullSpecifier, ModuleCompartmentRecord>
209
+ const moduleRecords = new Map();
210
+ // Map<FullSpecifier, ModuleInstance>
211
+ const instances = new Map();
212
+ // Map<FullSpecifier, {ExportsProxy, ProxiedExports, activate()}>
213
+ const deferredExports = new Map();
214
+
215
+ // Validate given moduleMap.
216
+ // The module map gets translated on-demand in module-load.js and the
217
+ // moduleMap can be invalid in ways that cannot be detected in the
218
+ // constructor, but these checks allow us to throw early for a better
219
+ // developer experience.
220
+ for (const [specifier, aliasNamespace] of entries(moduleMap || {})) {
221
+ if (typeof aliasNamespace === 'string') {
222
+ // TODO implement parent module record retrieval.
223
+ throw TypeError(
224
+ `Cannot map module ${q(specifier)} to ${q(
225
+ aliasNamespace,
226
+ )} in parent compartment`,
227
+ );
228
+ } else if (weakmapGet(moduleAliases, aliasNamespace) === undefined) {
229
+ // TODO create and link a synthetic module instance from the given
230
+ // namespace object.
231
+ throw ReferenceError(
232
+ `Cannot map module ${q(
233
+ specifier,
234
+ )} because it has no known compartment in this realm`,
235
+ );
236
+ }
237
+ }
238
+
239
+ const globalObject = {};
240
+
241
+ setGlobalObjectSymbolUnscopables(globalObject);
242
+
243
+ // We must initialize all constant properties first because
244
+ // `makeSafeEvaluator` may use them to create optimized bindings
245
+ // in the evaluator.
246
+ // TODO: consider merging into a single initialization if internal
247
+ // evaluator is no longer eagerly created
248
+ setGlobalObjectConstantProperties(globalObject);
249
+
250
+ const { safeEvaluate } = makeSafeEvaluator({
251
+ globalObject,
252
+ globalTransforms,
253
+ sloppyGlobalsMode: false,
254
+ });
255
+
256
+ setGlobalObjectMutableProperties(globalObject, {
257
+ intrinsics,
258
+ newGlobalPropertyNames: sharedGlobalPropertyNames,
259
+ makeCompartmentConstructor: targetMakeCompartmentConstructor,
260
+ markVirtualizedNativeFunction,
261
+ });
262
+
263
+ // TODO: maybe add evalTaming to the Compartment constructor 3rd options?
264
+ setGlobalObjectEvaluators(
265
+ globalObject,
266
+ safeEvaluate,
267
+ markVirtualizedNativeFunction,
268
+ );
269
+
270
+ assign(globalObject, endowments);
271
+
272
+ weakmapSet(privateFields, this, {
273
+ name: `${name}`,
274
+ globalTransforms,
275
+ globalObject,
276
+ safeEvaluate,
277
+ resolveHook,
278
+ importHook,
279
+ moduleMap,
280
+ moduleMapHook,
281
+ importMetaHook,
282
+ moduleRecords,
283
+ __shimTransforms__,
284
+ deferredExports,
285
+ instances,
286
+ });
287
+ }
288
+
289
+ Compartment.prototype = CompartmentPrototype;
290
+
291
+ return Compartment;
292
+ };