1/**
2 * Copyright © 2022 650 Industries.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7import { loadBundleAsync } from './loadBundle';
8/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */
9export function buildAsyncRequire() {
10    const cache = new Map();
11    return async function universal_loadBundleAsync(path) {
12        if (cache.has(path)) {
13            return cache.get(path);
14        }
15        const promise = loadBundleAsync(path).catch((error) => {
16            cache.delete(path);
17            throw error;
18        });
19        cache.set(path, promise);
20        return promise;
21    };
22}
23//# sourceMappingURL=buildAsyncRequire.js.map