1*26ad19fcSEvan Bacon/**
2*26ad19fcSEvan Bacon * Copyright © 2022 650 Industries.
3*26ad19fcSEvan Bacon *
4*26ad19fcSEvan Bacon * This source code is licensed under the MIT license found in the
5*26ad19fcSEvan Bacon * LICENSE file in the root directory of this source tree.
6*26ad19fcSEvan Bacon */
7*26ad19fcSEvan Bacon
8*26ad19fcSEvan Bacon/**
9*26ad19fcSEvan Bacon * Given a path and some optional additional query parameters, create the dev server bundle URL.
10*26ad19fcSEvan Bacon * @param bundlePath like `/foobar`
11*26ad19fcSEvan Bacon * @param params like `{ platform: "web" }`
12*26ad19fcSEvan Bacon * @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
13*26ad19fcSEvan Bacon */
14*26ad19fcSEvan Baconexport function buildUrlForBundle(bundlePath: string): string {
15*26ad19fcSEvan Bacon  // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).
16*26ad19fcSEvan Bacon  // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.
17*26ad19fcSEvan Bacon  return '/' + bundlePath.replace(/^\/+/, '');
18*26ad19fcSEvan Bacon}
19