@agoric/swingset-vat 0.32.3-dev-62ea793.0 → 0.32.3-dev-6581fd3.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 (2) hide show
  1. package/package.json +12 -12
  2. package/tools/bundleTool.js +9 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/swingset-vat",
3
- "version": "0.32.3-dev-62ea793.0+62ea793",
3
+ "version": "0.32.3-dev-6581fd3.0+6581fd3",
4
4
  "description": "Vat/Container Launcher",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -27,16 +27,16 @@
27
27
  "@types/yargs-parser": "^21.0.0"
28
28
  },
29
29
  "dependencies": {
30
- "@agoric/internal": "0.3.3-dev-62ea793.0+62ea793",
31
- "@agoric/kmarshal": "0.1.1-dev-62ea793.0+62ea793",
32
- "@agoric/store": "0.9.3-dev-62ea793.0+62ea793",
33
- "@agoric/swing-store": "0.9.2-dev-62ea793.0+62ea793",
34
- "@agoric/swingset-liveslots": "0.10.3-dev-62ea793.0+62ea793",
35
- "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-62ea793.0+62ea793",
36
- "@agoric/time": "0.3.3-dev-62ea793.0+62ea793",
37
- "@agoric/vat-data": "0.5.3-dev-62ea793.0+62ea793",
38
- "@agoric/xsnap": "0.14.3-dev-62ea793.0+62ea793",
39
- "@agoric/xsnap-lockdown": "0.14.1-dev-62ea793.0+62ea793",
30
+ "@agoric/internal": "0.3.3-dev-6581fd3.0+6581fd3",
31
+ "@agoric/kmarshal": "0.1.1-dev-6581fd3.0+6581fd3",
32
+ "@agoric/store": "0.9.3-dev-6581fd3.0+6581fd3",
33
+ "@agoric/swing-store": "0.9.2-dev-6581fd3.0+6581fd3",
34
+ "@agoric/swingset-liveslots": "0.10.3-dev-6581fd3.0+6581fd3",
35
+ "@agoric/swingset-xsnap-supervisor": "0.10.3-dev-6581fd3.0+6581fd3",
36
+ "@agoric/time": "0.3.3-dev-6581fd3.0+6581fd3",
37
+ "@agoric/vat-data": "0.5.3-dev-6581fd3.0+6581fd3",
38
+ "@agoric/xsnap": "0.14.3-dev-6581fd3.0+6581fd3",
39
+ "@agoric/xsnap-lockdown": "0.14.1-dev-6581fd3.0+6581fd3",
40
40
  "@endo/base64": "^1.0.5",
41
41
  "@endo/bundle-source": "^3.2.3",
42
42
  "@endo/captp": "^4.2.0",
@@ -102,5 +102,5 @@
102
102
  "typeCoverage": {
103
103
  "atLeast": 75.02
104
104
  },
105
- "gitHead": "62ea79368de79a697b8ef04ea9946cf621c81239"
105
+ "gitHead": "6581fd366ea1284a2da3a63f851da88aa1d1ea6f"
106
106
  }
@@ -1,6 +1,7 @@
1
1
  import { makeNodeBundleCache as wrappedMaker } from '@endo/bundle-source/cache.js';
2
2
  import styles from 'ansi-styles'; // less authority than 'chalk'
3
3
 
4
+ /** @type {typeof wrappedMaker} */
4
5
  export const makeNodeBundleCache = async (dest, options, loadModule, pid) => {
5
6
  const log = (...args) => {
6
7
  const flattened = args.map(arg =>
@@ -16,9 +17,9 @@ export const makeNodeBundleCache = async (dest, options, loadModule, pid) => {
16
17
  };
17
18
  return wrappedMaker(dest, { log, ...options }, loadModule, pid);
18
19
  };
19
- /** @typedef {ReturnType<typeof makeNodeBundleCache>} BundleCache */
20
+ /** @typedef {Awaited<ReturnType<typeof makeNodeBundleCache>>} BundleCache */
20
21
 
21
- /** @type {Map<string, BundleCache>} */
22
+ /** @type {Map<string, Promise<BundleCache>>} */
22
23
  const providedCaches = new Map();
23
24
 
24
25
  /**
@@ -29,10 +30,11 @@ const providedCaches = new Map();
29
30
  * @param {{ format?: string, dev?: boolean }} options
30
31
  * @param {(id: string) => Promise<any>} loadModule
31
32
  * @param {number} [pid]
32
- * @returns {BundleCache}
33
+ * @returns {Promise<BundleCache>}
33
34
  */
34
35
  export const provideBundleCache = (dest, options, loadModule, pid) => {
35
36
  const uniqueDest = [dest, options.format, options.dev].join('-');
37
+ // store the promise instead of awaiting to prevent a race
36
38
  let bundleCache = providedCaches.get(uniqueDest);
37
39
  if (!bundleCache) {
38
40
  bundleCache = makeNodeBundleCache(dest, options, loadModule, pid);
@@ -42,5 +44,9 @@ export const provideBundleCache = (dest, options, loadModule, pid) => {
42
44
  };
43
45
  harden(provideBundleCache);
44
46
 
47
+ /**
48
+ * @param {string} dest
49
+ * @returns {Promise<BundleCache>}
50
+ */
45
51
  export const unsafeMakeBundleCache = dest =>
46
52
  makeNodeBundleCache(dest, {}, s => import(s));