From 70217877869e75aab99f05b75e100cc18b5f4032 Mon Sep 17 00:00:00 2001 From: Kris Kowal Date: Tue, 25 Jul 2023 14:57:43 -0700 Subject: [PATCH] feat(bundle-source): Provide high resolution timer to read governor --- packages/bundle-source/cache.js | 3 ++- packages/bundle-source/src/index.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/bundle-source/cache.js b/packages/bundle-source/cache.js index e355596966..b1ea425830 100644 --- a/packages/bundle-source/cache.js +++ b/packages/bundle-source/cache.js @@ -1,3 +1,4 @@ +/* global performance */ // @ts-check import { makePromiseKit } from '@endo/promise-kit'; import { makeReadPowers } from '@endo/compartment-mapper/node-powers.js'; @@ -350,7 +351,7 @@ export const makeNodeBundleCache = async (dest, options, loadModule) => { ]); const readPowers = { - ...makeReadPowers({ fs, url, crypto }), + ...makeReadPowers({ fs, url, crypto, now: performance.now }), delay: ms => new Promise(resolve => timers.setTimeout(resolve, ms)), basename: path.basename, }; diff --git a/packages/bundle-source/src/index.js b/packages/bundle-source/src/index.js index c1681df355..58f884e705 100644 --- a/packages/bundle-source/src/index.js +++ b/packages/bundle-source/src/index.js @@ -1,4 +1,4 @@ -/* global process */ +/* global process performance */ import fs from 'fs'; import { rollup as rollup0 } from 'rollup'; @@ -34,7 +34,7 @@ const HTML_COMMENT_END_RE = new RegExp(`--${'>'}`, 'g'); const textEncoder = new TextEncoder(); const textDecoder = new TextDecoder(); -const readPowers = makeReadPowers({ fs, url, crypto }); +const readPowers = makeReadPowers({ fs, url, crypto, now: performance.now }); /** * Finds the longest common prefix in an array of strings.