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