@bacons/expo-metro-runtime
Version:
Tools for making experimental Metro bundler features work
25 lines • 1.2 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildUrlForBundle = void 0;
const qs_1 = __importDefault(require("qs"));
const getDevServer_1 = __importDefault(require("../getDevServer"));
function buildUrlForBundle(bundlePath, params = {}) {
const { fullBundleUrl, url: serverUrl, bundleLoadedFromServer, } = (0, getDevServer_1.default)();
if (!bundleLoadedFromServer) {
throw new Error("This bundle was compiled with 'transformer.experimentalImportBundleSupport' in the 'metro.config.js' and can only be used when connected to a Metro server.");
}
let query = {};
if (fullBundleUrl != null) {
const queryStart = fullBundleUrl.indexOf("?");
if (queryStart !== -1) {
query = qs_1.default.parse(fullBundleUrl.substring(queryStart + 1));
}
}
Object.assign(query, params);
return serverUrl + bundlePath + ".bundle?" + qs_1.default.stringify(query);
}
exports.buildUrlForBundle = buildUrlForBundle;
//# sourceMappingURL=buildUrlForBundle.native.js.map