diff --git a/packages/SwingSet/tools/bundleTool.js b/packages/SwingSet/tools/bundleTool.js index d5d2cbd54949..43b9da59a0bd 100755 --- a/packages/SwingSet/tools/bundleTool.js +++ b/packages/SwingSet/tools/bundleTool.js @@ -1,8 +1,14 @@ // eslint-disable-next-line import/no-extraneous-dependencies import { makeNodeBundleCache as wrappedMaker } from '@endo/bundle-source/cache.js'; +import { randomInt } from 'crypto'; import styles from 'ansi-styles'; // less authority than 'chalk' -export const makeNodeBundleCache = async (dest, options, loadModule) => { +const getUniquishNumber = () => { + return randomInt(2 ** 32); +}; + +/** @type {typeof wrappedMaker} */ +export const makeNodeBundleCache = async (dest, options, loadModule, pid) => { const log = (...args) => { const flattened = args.map(arg => // Don't print stack traces. @@ -15,7 +21,7 @@ export const makeNodeBundleCache = async (dest, options, loadModule) => { styles.dim.close, ); }; - return wrappedMaker(dest, { log, ...options }, loadModule); + return wrappedMaker(dest, { log, ...options }, loadModule, pid); }; /** @type {Map>} */ @@ -33,7 +39,12 @@ export const provideBundleCache = (dest, options, loadModule) => { const uniqueDest = [dest, options.format, options.dev].join('-'); let bundleCache = providedCaches.get(uniqueDest); if (!bundleCache) { - bundleCache = makeNodeBundleCache(dest, options, loadModule); + bundleCache = makeNodeBundleCache( + dest, + options, + loadModule, + getUniquishNumber(), + ); providedCaches.set(uniqueDest, bundleCache); } return bundleCache; @@ -41,4 +52,4 @@ export const provideBundleCache = (dest, options, loadModule) => { harden(provideBundleCache); export const unsafeMakeBundleCache = dest => - makeNodeBundleCache(dest, {}, s => import(s)); + makeNodeBundleCache(dest, {}, s => import(s), getUniquishNumber()); diff --git a/packages/deploy-script-support/exported.js b/packages/deploy-script-support/exported.js index f4e93c01349e..25402b3902a8 100644 --- a/packages/deploy-script-support/exported.js +++ b/packages/deploy-script-support/exported.js @@ -1,3 +1 @@ -import '@endo/bundle-source/exported.js'; - import './src/externalTypes.js'; diff --git a/packages/deploy-script-support/src/install.js b/packages/deploy-script-support/src/install.js index 5dd573514bdc..c73410db2a3b 100644 --- a/packages/deploy-script-support/src/install.js +++ b/packages/deploy-script-support/src/install.js @@ -5,18 +5,9 @@ import { E } from '@endo/far'; /** @typedef {import('@agoric/deploy-script-support/src/externalTypes').Petname} Petname */ -/** - * @callback BundleSource - * @param {string} startFilename - the filepath to start the bundling from - * @param {ModuleFormat | BundleOptions} [moduleFormat] - * @param {object} [powers] - * @param {ReadFn} [powers.read] - * @param {CanonicalFn} [powers.canonical] - */ - // XXX board is Board but specifying that leads to type errors with imports which aren't worth fixing right now /** - * @param {BundleSource} bundleSource + * @param {typeof import('@endo/bundle-source')['default']} bundleSource * @param {ERef} zoe * @param {ERef} installationManager * @param {ERef} board diff --git a/packages/smart-wallet/test/test-addAsset.js b/packages/smart-wallet/test/test-addAsset.js index ef24b961c777..adb334397c74 100644 --- a/packages/smart-wallet/test/test-addAsset.js +++ b/packages/smart-wallet/test/test-addAsset.js @@ -362,9 +362,11 @@ test.serial('trading in non-vbank asset: game real-estate NFTs', async t => { const { consume, simpleProvideWallet, sendToBridge } = t.context; const bundles = { - game: await importSpec('./gameAssetContract.js').then(bundleSource), + game: await importSpec('./gameAssetContract.js').then(spec => + bundleSource(spec), + ), centralSupply: await importSpec('@agoric/vats/src/centralSupply.js').then( - bundleSource, + spec => bundleSource(spec), ), };