|
| 1 | +diff --git a/node_modules/@endo/import-bundle/src/index.js b/node_modules/@endo/import-bundle/src/index.js |
| 2 | +index f8b374b..9ddba4d 100644 |
| 3 | +--- a/node_modules/@endo/import-bundle/src/index.js |
| 4 | ++++ b/node_modules/@endo/import-bundle/src/index.js |
| 5 | +@@ -78,6 +78,28 @@ export async function importBundle(bundle, options = {}, powers = {}) { |
| 6 | + return namespace; |
| 7 | + } |
| 8 | + |
| 9 | ++ // The 'test' format is not generated by bundleSource and is not |
| 10 | ++ // serializable as JSON and is not passable because copy-records cannot have symbol keys. |
| 11 | ++ if (moduleFormat === 'test') { |
| 12 | ++ const exports = bundle[Symbol.for('exports')]; |
| 13 | ++ if (exports === undefined) { |
| 14 | ++ throw new Error( |
| 15 | ++ 'Cannot import bundle with moduleFormat "test" that lacks an symbol-named property @exports and has likely been partially transported via JSON or eventual-send', |
| 16 | ++ ); |
| 17 | ++ } |
| 18 | ++ return Object.assign( |
| 19 | ++ Object.create(null, { |
| 20 | ++ [Symbol.toStringTag]: { |
| 21 | ++ value: 'Module', |
| 22 | ++ writable: false, |
| 23 | ++ enumerable: false, |
| 24 | ++ configurable: false, |
| 25 | ++ }, |
| 26 | ++ }), |
| 27 | ++ exports, |
| 28 | ++ ); |
| 29 | ++ } |
| 30 | ++ |
| 31 | + let { source } = bundle; |
| 32 | + const { sourceMap } = bundle; |
| 33 | + if (moduleFormat === 'getExport') { |
| 34 | +@@ -124,6 +146,16 @@ export async function importBundle(bundle, options = {}, powers = {}) { |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | ++/** |
| 39 | ++ * A utility function for producing test bundles, which are not seerializable |
| 40 | ++ * as JSON or passable. |
| 41 | ++ * @param {Record<PropertyKey, unknown>} exports |
| 42 | ++ */ |
| 43 | ++export const bundleTestExports = exports => ({ |
| 44 | ++ moduleFormat: 'test', |
| 45 | ++ [Symbol.for('exports')]: exports, |
| 46 | ++}); |
| 47 | ++ |
| 48 | + /* |
| 49 | + importBundle(bundle, { metering: { getMeter, meteringOptions } }); |
| 50 | + importBundle(bundle, { transforms: [ meterTransform ], lexicals: { getMeter } }); |
0 commit comments