1*a5fb1ba8SEvan Bacon"use strict"; 226ad19fcSEvan Bacon/** 326ad19fcSEvan Bacon * Copyright © 2022 650 Industries. 426ad19fcSEvan Bacon * 526ad19fcSEvan Bacon * This source code is licensed under the MIT license found in the 626ad19fcSEvan Bacon * LICENSE file in the root directory of this source tree. 726ad19fcSEvan Bacon */ 8*a5fb1ba8SEvan BaconObject.defineProperty(exports, "__esModule", { value: true }); 9*a5fb1ba8SEvan Baconexports.buildAsyncRequire = void 0; 10*a5fb1ba8SEvan Baconconst loadBundle_1 = require("./loadBundle"); 1126ad19fcSEvan Bacon/** Create an `loadBundleAsync` function in the expected shape for Metro bundler. */ 12*a5fb1ba8SEvan Baconfunction buildAsyncRequire() { 1326ad19fcSEvan Bacon const cache = new Map(); 1426ad19fcSEvan Bacon return async function universal_loadBundleAsync(path) { 1526ad19fcSEvan Bacon if (cache.has(path)) { 1626ad19fcSEvan Bacon return cache.get(path); 1726ad19fcSEvan Bacon } 18*a5fb1ba8SEvan Bacon const promise = (0, loadBundle_1.loadBundleAsync)(path).catch((error) => { 1926ad19fcSEvan Bacon cache.delete(path); 2026ad19fcSEvan Bacon throw error; 2126ad19fcSEvan Bacon }); 2226ad19fcSEvan Bacon cache.set(path, promise); 2326ad19fcSEvan Bacon return promise; 2426ad19fcSEvan Bacon }; 2526ad19fcSEvan Bacon} 26*a5fb1ba8SEvan Baconexports.buildAsyncRequire = buildAsyncRequire; 2726ad19fcSEvan Bacon//# sourceMappingURL=buildAsyncRequire.js.map