ses 0.18.0 → 0.18.2

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 (43) hide show
  1. package/NEWS.md +17 -0
  2. package/README.md +10 -5
  3. package/SECURITY.md +1 -1
  4. package/dist/lockdown.cjs +319 -243
  5. package/dist/lockdown.mjs +319 -243
  6. package/dist/lockdown.umd.js +319 -243
  7. package/dist/lockdown.umd.min.js +1 -1
  8. package/dist/ses.cjs +319 -243
  9. package/dist/ses.mjs +319 -243
  10. package/dist/ses.umd.js +319 -243
  11. package/dist/ses.umd.min.js +1 -1
  12. package/index.js +1 -0
  13. package/package.json +15 -12
  14. package/src/commons.js +2 -0
  15. package/src/compartment-evaluate.js +2 -4
  16. package/src/compartment-shim.js +3 -3
  17. package/src/enablements.js +12 -0
  18. package/src/environment-options.js +10 -19
  19. package/src/error/assert.js +24 -16
  20. package/src/error/console.js +2 -6
  21. package/src/error/internal-types.js +3 -3
  22. package/src/error/types.js +76 -81
  23. package/src/get-anonymous-intrinsics.js +6 -4
  24. package/src/get-source-url.js +3 -0
  25. package/src/global-object.js +9 -9
  26. package/src/intrinsics.js +1 -1
  27. package/src/lockdown-shim.js +11 -13
  28. package/src/make-hardener.js +1 -1
  29. package/src/make-safe-evaluator.js +4 -4
  30. package/src/module-instance.js +29 -13
  31. package/src/module-link.js +2 -6
  32. package/src/module-load.js +58 -21
  33. package/src/scope-constants.js +2 -2
  34. package/src/sloppy-globals-scope-terminator.js +1 -0
  35. package/src/tame-domains.js +1 -0
  36. package/src/tame-function-constructors.js +3 -2
  37. package/src/tame-locale-methods.js +2 -2
  38. package/src/tame-math-object.js +2 -3
  39. package/src/transforms.js +15 -0
  40. package/src/whitelist-intrinsics.js +2 -2
  41. package/tools.js +25 -0
  42. package/{index.d.ts → types.d.ts} +2 -1
  43. package/CHANGELOG.md +0 -596
@@ -13,6 +13,9 @@ const sourceMetaEntriesRegExp = new FERAL_REG_EXP(
13
13
  `(?:\\s*//${sourceMetaEntryRegExp}|/\\*${sourceMetaEntryRegExp}\\s*\\*/)\\s*$`,
14
14
  );
15
15
 
16
+ /**
17
+ * @param {string} src
18
+ */
16
19
  export const getSourceURL = src => {
17
20
  let sourceURL = '<unknown>';
18
21
 
@@ -22,7 +22,7 @@ import { constantProperties, universalPropertyNames } from './whitelist.js';
22
22
  * But, we can install this setter to prevent a program from proceding on
23
23
  * this false assumption.
24
24
  *
25
- * @param {Object} globalObject
25
+ * @param {object} globalObject
26
26
  */
27
27
  export const setGlobalObjectSymbolUnscopables = globalObject => {
28
28
  defineProperty(
@@ -48,7 +48,7 @@ export const setGlobalObjectSymbolUnscopables = globalObject => {
48
48
  * (SetDefaultGlobalBindings). This process is split between this function and
49
49
  * `setGlobalObjectMutableProperties`.
50
50
  *
51
- * @param {Object} globalObject
51
+ * @param {object} globalObject
52
52
  */
53
53
  export const setGlobalObjectConstantProperties = globalObject => {
54
54
  for (const [name, constant] of entries(constantProperties)) {
@@ -68,12 +68,12 @@ export const setGlobalObjectConstantProperties = globalObject => {
68
68
  * `newGlobalPropertyNames` should be either `initialGlobalPropertyNames` or
69
69
  * `sharedGlobalPropertyNames`.
70
70
  *
71
- * @param {Object} globalObject
72
- * @param {Object} param1
73
- * @param {Object} param1.intrinsics
74
- * @param {Object} param1.newGlobalPropertyNames
71
+ * @param {object} globalObject
72
+ * @param {object} param1
73
+ * @param {object} param1.intrinsics
74
+ * @param {object} param1.newGlobalPropertyNames
75
75
  * @param {Function} param1.makeCompartmentConstructor
76
- * @param {(Object) => void} param1.markVirtualizedNativeFunction
76
+ * @param {(object) => void} param1.markVirtualizedNativeFunction
77
77
  */
78
78
  export const setGlobalObjectMutableProperties = (
79
79
  globalObject,
@@ -135,9 +135,9 @@ export const setGlobalObjectMutableProperties = (
135
135
  * setGlobalObjectEvaluators()
136
136
  * Set the eval and the Function evaluator on the global object with given evalTaming policy.
137
137
  *
138
- * @param {Object} globalObject
138
+ * @param {object} globalObject
139
139
  * @param {Function} evaluator
140
- * @param {(Object) => void} markVirtualizedNativeFunction
140
+ * @param {(object) => void} markVirtualizedNativeFunction
141
141
  */
142
142
  export const setGlobalObjectEvaluators = (
143
143
  globalObject,
package/src/intrinsics.js CHANGED
@@ -160,7 +160,7 @@ export const makeIntrinsicsCollector = () => {
160
160
  * If run before lockdown, the returned intrinsics record will carry the
161
161
  * *original* unsafe (feral, untamed) bindings of these global variables.
162
162
  *
163
- * @param {Object} globalObject
163
+ * @param {object} globalObject
164
164
  */
165
165
  export const getGlobalIntrinsics = globalObject => {
166
166
  const { addIntrinsics, finalIntrinsics } = makeIntrinsicsCollector();
@@ -53,7 +53,7 @@ import { makeEnvironmentCaptor } from './environment-options.js';
53
53
  import { getAnonymousIntrinsics } from './get-anonymous-intrinsics.js';
54
54
  import { makeCompartmentConstructor } from './compartment-shim.js';
55
55
 
56
- /** @typedef {import('../index.js').LockdownOptions} LockdownOptions */
56
+ /** @typedef {import('../types.js').LockdownOptions} LockdownOptions */
57
57
 
58
58
  const { Fail, details: d, quote: q } = assert;
59
59
 
@@ -77,9 +77,9 @@ const harden = makeHardener();
77
77
 
78
78
  /**
79
79
  * @callback CompartmentConstructor
80
- * @param {Object} endowments
81
- * @param {Object} moduleMap
82
- * @param {Object} [options]
80
+ * @param {object} endowments
81
+ * @param {object} moduleMap
82
+ * @param {object} [options]
83
83
  * @param {Array<Transform>} [options.transforms]
84
84
  * @param {Array<Transform>} [options.__shimTransforms__]
85
85
  */
@@ -115,6 +115,7 @@ const assertDirectEvalAvailable = () => {
115
115
  allowed = true;
116
116
  }
117
117
  if (!allowed) {
118
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_DIRECT_EVAL.md
118
119
  throw new TypeError(
119
120
  `SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct-eval (dynamically scoped eval) (SES_DIRECT_EVAL)`,
120
121
  );
@@ -151,10 +152,8 @@ export const repairIntrinsics = (options = {}) => {
151
152
  // [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/lockdown-options.md#stackfiltering-options)
152
153
  // for an explanation.
153
154
 
154
- const {
155
- getEnvironmentOption: getenv,
156
- getCapturedEnvironmentOptionNames,
157
- } = makeEnvironmentCaptor(globalThis);
155
+ const { getEnvironmentOption: getenv, getCapturedEnvironmentOptionNames } =
156
+ makeEnvironmentCaptor(globalThis);
158
157
 
159
158
  const {
160
159
  errorTaming = getenv('LOCKDOWN_ERROR_TAMING', 'safe'),
@@ -208,6 +207,7 @@ export const repairIntrinsics = (options = {}) => {
208
207
  d`Already locked down at ${priorLockdown} (SES_ALREADY_LOCKED_DOWN)`,
209
208
  TypeError,
210
209
  );
210
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_ALREADY_LOCKED_DOWN.md
211
211
  priorLockdown = new TypeError('Prior lockdown (SES_ALREADY_LOCKED_DOWN)');
212
212
  // Tease V8 to generate the stack string and release the closures the stack
213
213
  // trace retained:
@@ -249,6 +249,7 @@ export const repairIntrinsics = (options = {}) => {
249
249
  };
250
250
 
251
251
  if (seemsToBeLockedDown()) {
252
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_MULTIPLE_INSTANCES.md
252
253
  throw new TypeError(
253
254
  `Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)`,
254
255
  );
@@ -260,11 +261,8 @@ export const repairIntrinsics = (options = {}) => {
260
261
 
261
262
  tameDomains(domainTaming);
262
263
 
263
- const {
264
- addIntrinsics,
265
- completePrototypes,
266
- finalIntrinsics,
267
- } = makeIntrinsicsCollector();
264
+ const { addIntrinsics, completePrototypes, finalIntrinsics } =
265
+ makeIntrinsicsCollector();
268
266
 
269
267
  addIntrinsics({ harden });
270
268
 
@@ -52,7 +52,7 @@ import {
52
52
  import { assert } from './error/assert.js';
53
53
 
54
54
  /**
55
- * @typedef {import('../index.js').Harden} Harden
55
+ * @typedef {import('../types.js').Harden} Harden
56
56
  */
57
57
 
58
58
  // Obtain the string tag accessor of of TypedArray so we can indirectly use the
@@ -16,9 +16,9 @@ const { Fail } = assert;
16
16
  * Build the low-level operation used by all evaluators:
17
17
  * eval(), Function(), Compartment.prototype.evaluate().
18
18
  *
19
- * @param {Object} options
20
- * @param {Object} options.globalObject
21
- * @param {Object} [options.moduleLexicals]
19
+ * @param {object} options
20
+ * @param {object} options.globalObject
21
+ * @param {object} [options.moduleLexicals]
22
22
  * @param {Array<Transform>} [options.globalTransforms]
23
23
  * @param {bool} [options.sloppyGlobalsMode]
24
24
  */
@@ -53,7 +53,7 @@ export const makeSafeEvaluator = ({
53
53
 
54
54
  /**
55
55
  * @param {string} source
56
- * @param {Object} [options]
56
+ * @param {object} [options]
57
57
  * @param {Array<Transform>} [options.localTransforms]
58
58
  */
59
59
  const safeEvaluate = (source, { localTransforms = [] } = {}) => {
@@ -134,7 +134,9 @@ export const makeModuleInstance = (
134
134
  __syncModuleProgram__: functorSource,
135
135
  __fixedExportMap__: fixedExportMap = {},
136
136
  __liveExportMap__: liveExportMap = {},
137
+ __reexportMap__: reexportMap = {},
137
138
  __needsImportMeta__: needsImportMeta = false,
139
+ __syncModuleFunctor__,
138
140
  } = staticModuleRecord;
139
141
 
140
142
  const compartmentFields = weakmapGet(privateFields, compartment);
@@ -387,26 +389,35 @@ export const makeModuleInstance = (
387
389
  }
388
390
  if (arrayIncludes(exportAlls, specifier)) {
389
391
  // Make all these imports candidates.
390
- for (const [importName, importNotify] of entries(importNotifiers)) {
391
- if (candidateAll[importName] === undefined) {
392
- candidateAll[importName] = importNotify;
392
+ // Note names don't change in reexporting all
393
+ for (const [importAndExportName, importNotify] of entries(
394
+ importNotifiers,
395
+ )) {
396
+ if (candidateAll[importAndExportName] === undefined) {
397
+ candidateAll[importAndExportName] = importNotify;
393
398
  } else {
394
399
  // Already a candidate: remove ambiguity.
395
- candidateAll[importName] = false;
400
+ candidateAll[importAndExportName] = false;
396
401
  }
397
402
  }
398
403
  }
404
+ if (reexportMap[specifier]) {
405
+ // Make named reexports candidates too.
406
+ for (const [localName, exportedName] of reexportMap[specifier]) {
407
+ candidateAll[exportedName] = importNotifiers[localName];
408
+ }
409
+ }
399
410
  }
400
411
 
401
- for (const [importName, notify] of entries(candidateAll)) {
402
- if (!notifiers[importName] && notify !== false) {
403
- notifiers[importName] = notify;
412
+ for (const [exportName, notify] of entries(candidateAll)) {
413
+ if (!notifiers[exportName] && notify !== false) {
414
+ notifiers[exportName] = notify;
404
415
 
405
416
  // exported live binding state
406
417
  let value;
407
418
  const update = newValue => (value = newValue);
408
419
  notify(update);
409
- exportsProps[importName] = {
420
+ exportsProps[exportName] = {
410
421
  get() {
411
422
  return value;
412
423
  },
@@ -434,11 +445,16 @@ export const makeModuleInstance = (
434
445
  activate();
435
446
  }
436
447
 
437
- let optFunctor = compartmentEvaluate(compartmentFields, functorSource, {
438
- globalObject: compartment.globalThis,
439
- transforms: __shimTransforms__,
440
- __moduleShimLexicals__: moduleLexicals,
441
- });
448
+ let optFunctor;
449
+ if (__syncModuleFunctor__ !== undefined) {
450
+ optFunctor = __syncModuleFunctor__;
451
+ } else {
452
+ optFunctor = compartmentEvaluate(compartmentFields, functorSource, {
453
+ globalObject: compartment.globalThis,
454
+ transforms: __shimTransforms__,
455
+ __moduleShimLexicals__: moduleLexicals,
456
+ });
457
+ }
442
458
  let didThrow = false;
443
459
  let thrownError;
444
460
  function execute() {
@@ -120,12 +120,8 @@ export const instantiate = (
120
120
  moduleAliases,
121
121
  moduleRecord,
122
122
  ) => {
123
- const {
124
- compartment,
125
- moduleSpecifier,
126
- resolvedImports,
127
- staticModuleRecord,
128
- } = moduleRecord;
123
+ const { compartment, moduleSpecifier, resolvedImports, staticModuleRecord } =
124
+ moduleRecord;
129
125
  const { instances } = weakmapGet(compartmentPrivateFields, compartment);
130
126
 
131
127
  // Memoize.
@@ -54,7 +54,7 @@ const resolveAll = (imports, resolveHook, fullReferrerSpecifier) => {
54
54
  return freeze(resolvedImports);
55
55
  };
56
56
 
57
- const loadRecord = async (
57
+ const loadRecord = (
58
58
  compartmentPrivateFields,
59
59
  moduleAliases,
60
60
  compartment,
@@ -175,27 +175,64 @@ const loadWithoutErrorAnnotation = async (
175
175
  )} in compartment ${q(compartment.name)}`;
176
176
  }
177
177
 
178
- if (staticModuleRecord.record !== undefined) {
179
- const {
180
- compartment: aliasCompartment = compartment,
181
- specifier: aliasSpecifier = moduleSpecifier,
182
- record: aliasModuleRecord,
183
- importMeta,
184
- } = staticModuleRecord;
178
+ // check if record is a RedirectStaticModuleInterface
179
+ if (staticModuleRecord.specifier !== undefined) {
180
+ // check if this redirect with an explicit record
181
+ if (staticModuleRecord.record !== undefined) {
182
+ // ensure expected record shape
183
+ if (staticModuleRecord.compartment !== undefined) {
184
+ throw new TypeError(
185
+ 'Cannot redirect to an explicit record with a specified compartment',
186
+ );
187
+ }
188
+ const {
189
+ compartment: aliasCompartment = compartment,
190
+ specifier: aliasSpecifier = moduleSpecifier,
191
+ record: aliasModuleRecord,
192
+ importMeta,
193
+ } = staticModuleRecord;
185
194
 
186
- const aliasRecord = await loadRecord(
187
- compartmentPrivateFields,
188
- moduleAliases,
189
- aliasCompartment,
190
- aliasSpecifier,
191
- aliasModuleRecord,
192
- pendingJobs,
193
- moduleLoads,
194
- errors,
195
- importMeta,
195
+ const aliasRecord = loadRecord(
196
+ compartmentPrivateFields,
197
+ moduleAliases,
198
+ aliasCompartment,
199
+ aliasSpecifier,
200
+ aliasModuleRecord,
201
+ pendingJobs,
202
+ moduleLoads,
203
+ errors,
204
+ importMeta,
205
+ );
206
+ mapSet(moduleRecords, moduleSpecifier, aliasRecord);
207
+ return aliasRecord;
208
+ }
209
+
210
+ // check if this redirect with an explicit compartment
211
+ if (staticModuleRecord.compartment !== undefined) {
212
+ // ensure expected record shape
213
+ if (staticModuleRecord.importMeta !== undefined) {
214
+ throw new TypeError(
215
+ 'Cannot redirect to an implicit record with a specified importMeta',
216
+ );
217
+ }
218
+ // Behold: recursion.
219
+ // eslint-disable-next-line no-use-before-define
220
+ const aliasRecord = await memoizedLoadWithErrorAnnotation(
221
+ compartmentPrivateFields,
222
+ moduleAliases,
223
+ staticModuleRecord.compartment,
224
+ staticModuleRecord.specifier,
225
+ pendingJobs,
226
+ moduleLoads,
227
+ errors,
228
+ );
229
+ mapSet(moduleRecords, moduleSpecifier, aliasRecord);
230
+ return aliasRecord;
231
+ }
232
+
233
+ throw new TypeError(
234
+ 'Unnexpected RedirectStaticModuleInterface record shape',
196
235
  );
197
- mapSet(moduleRecords, moduleSpecifier, aliasRecord);
198
- return aliasRecord;
199
236
  }
200
237
 
201
238
  return loadRecord(
@@ -282,7 +319,7 @@ export const load = async (
282
319
 
283
320
  /** @type {Set<Promise<undefined>>} */
284
321
  const pendingJobs = new Set();
285
- /** @type {Map<Object, Map<string, Promise<Record>>} */
322
+ /** @type {Map<object, Map<string, Promise<Record>>} */
286
323
  const moduleLoads = new Map();
287
324
  /** @type {Array<Error>} */
288
325
  const errors = [];
@@ -143,8 +143,8 @@ function isImmutableDataProperty(obj, name) {
143
143
  * service if any of the names are keywords or keyword-like. This is
144
144
  * safe and only prevent performance optimization.
145
145
  *
146
- * @param {Object} globalObject
147
- * @param {Object} moduleLexicals
146
+ * @param {object} globalObject
147
+ * @param {object} moduleLexicals
148
148
  */
149
149
  export const getScopeConstants = (globalObject, moduleLexicals = {}) => {
150
150
  // getOwnPropertyNames() does ignore Symbols so we don't need to
@@ -51,3 +51,4 @@ export const createSloppyGlobalsScopeTerminator = globalObject => {
51
51
 
52
52
  return sloppyGlobalsScopeTerminator;
53
53
  };
54
+ freeze(createSloppyGlobalsScopeTerminator);
@@ -26,6 +26,7 @@ export function tameDomains(domainTaming = 'safe') {
26
26
  if (domainDescriptor !== undefined && domainDescriptor.get !== undefined) {
27
27
  // The domain descriptor on Node.js initially has value: null, which
28
28
  // becomes a get, set pair after domains initialize.
29
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_NO_DOMAINS.md
29
30
  throw new TypeError(
30
31
  `SES failed to lockdown, Node.js domains have been initialized (SES_NO_DOMAINS)`,
31
32
  );
@@ -5,6 +5,7 @@ import {
5
5
  defineProperties,
6
6
  getPrototypeOf,
7
7
  setPrototypeOf,
8
+ freeze,
8
9
  } from './commons.js';
9
10
 
10
11
  // This module replaces the original `Function` constructor, and the original
@@ -49,7 +50,7 @@ export default function tameFunctionConstructors() {
49
50
  FERAL_FUNCTION.prototype.constructor('return 1');
50
51
  } catch (ignore) {
51
52
  // Throws, no need to patch.
52
- return harden({});
53
+ return freeze({});
53
54
  }
54
55
 
55
56
  const newIntrinsics = {};
@@ -82,7 +83,7 @@ export default function tameFunctionConstructors() {
82
83
  // Prevents the evaluation of source when calling constructor on the
83
84
  // prototype of functions.
84
85
  // eslint-disable-next-line func-names
85
- const InertConstructor = function() {
86
+ const InertConstructor = function () {
86
87
  throw new TypeError(
87
88
  'Function.prototype.constructor is not a valid constructor.',
88
89
  );
@@ -17,14 +17,14 @@ const localePattern = /^(\w*[a-z])Locale([A-Z]\w*)$/;
17
17
  // behavior or `.prototype` property.
18
18
  const tamedMethods = {
19
19
  // See https://tc39.es/ecma262/#sec-string.prototype.localecompare
20
- localeCompare(that) {
20
+ localeCompare(arg) {
21
21
  if (this === null || this === undefined) {
22
22
  throw new TypeError(
23
23
  'Cannot localeCompare with null or undefined "this" value',
24
24
  );
25
25
  }
26
26
  const s = `${this}`;
27
- that = `${that}`;
27
+ const that = `${arg}`;
28
28
  if (s < that) {
29
29
  return -1;
30
30
  }
@@ -13,9 +13,8 @@ export default function tameMathObject(mathTaming = 'safe') {
13
13
  const originalMath = Math;
14
14
  const initialMath = originalMath; // to follow the naming pattern
15
15
 
16
- const { random: _, ...otherDescriptors } = getOwnPropertyDescriptors(
17
- originalMath,
18
- );
16
+ const { random: _, ...otherDescriptors } =
17
+ getOwnPropertyDescriptors(originalMath);
19
18
 
20
19
  const sharedMath = create(objectPrototype, otherDescriptors);
21
20
 
package/src/transforms.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  stringSearch,
8
8
  stringSlice,
9
9
  stringSplit,
10
+ freeze,
10
11
  } from './commons.js';
11
12
  import { getSourceURL } from './get-source-url.js';
12
13
 
@@ -69,6 +70,7 @@ export const rejectHtmlComments = src => {
69
70
  return src;
70
71
  }
71
72
  const name = getSourceURL(src);
73
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_HTML_COMMENT_REJECTED.md
72
74
  throw new SyntaxError(
73
75
  `Possible HTML comment rejected at ${name}:${lineNumber}. (SES_HTML_COMMENT_REJECTED)`,
74
76
  );
@@ -144,6 +146,7 @@ export const rejectImportExpressions = src => {
144
146
  return src;
145
147
  }
146
148
  const name = getSourceURL(src);
149
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_IMPORT_REJECTED.md
147
150
  throw new SyntaxError(
148
151
  `Possible import expression rejected at ${name}:${lineNumber}. (SES_IMPORT_REJECTED)`,
149
152
  );
@@ -215,6 +218,7 @@ export const rejectSomeDirectEvalExpressions = src => {
215
218
  return src;
216
219
  }
217
220
  const name = getSourceURL(src);
221
+ // See https://github.com/endojs/endo/blob/master/packages/ses/error-codes/SES_EVAL_REJECTED.md
218
222
  throw new SyntaxError(
219
223
  `Possible direct eval expression rejected at ${name}:${lineNumber}. (SES_EVAL_REJECTED)`,
220
224
  );
@@ -249,3 +253,14 @@ export const applyTransforms = (source, transforms) => {
249
253
  }
250
254
  return source;
251
255
  };
256
+
257
+ // export all as a frozen object
258
+ export const transforms = freeze({
259
+ rejectHtmlComments: freeze(rejectHtmlComments),
260
+ evadeHtmlCommentTest: freeze(evadeHtmlCommentTest),
261
+ rejectImportExpressions: freeze(rejectImportExpressions),
262
+ evadeImportExpressionTest: freeze(evadeImportExpressionTest),
263
+ rejectSomeDirectEvalExpressions: freeze(rejectSomeDirectEvalExpressions),
264
+ mandatoryTransforms: freeze(mandatoryTransforms),
265
+ applyTransforms: freeze(applyTransforms),
266
+ });
@@ -66,8 +66,8 @@ import {
66
66
  * Removes all non-allowed properties found by recursively and
67
67
  * reflectively walking own property chains.
68
68
  *
69
- * @param {Object} intrinsics
70
- * @param {(Object) => void} markVirtualizedNativeFunction
69
+ * @param {object} intrinsics
70
+ * @param {(object) => void} markVirtualizedNativeFunction
71
71
  */
72
72
  export default function whitelistIntrinsics(
73
73
  intrinsics,
package/tools.js ADDED
@@ -0,0 +1,25 @@
1
+ // Copyright (C) 2018 Agoric
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import { freeze } from './src/commons.js';
16
+ import { transforms } from './src/transforms.js';
17
+ import { strictScopeTerminator } from './src/strict-scope-terminator.js';
18
+ import { createSloppyGlobalsScopeTerminator } from './src/sloppy-globals-scope-terminator.js';
19
+
20
+ export { transforms };
21
+
22
+ export const scopeTerminators = freeze({
23
+ strictScopeTerminator,
24
+ createSloppyGlobalsScopeTerminator,
25
+ });
@@ -64,9 +64,10 @@ export type FinalStaticModuleType =
64
64
  | ThirdPartyStaticModuleInterface;
65
65
 
66
66
  export interface RedirectStaticModuleInterface {
67
- record: FinalStaticModuleType;
68
67
  specifier: string;
68
+ record?: FinalStaticModuleType;
69
69
  importMeta?: any;
70
+ compartment?: Compartment;
70
71
  }
71
72
 
72
73
  export type StaticModuleType =