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 */
7
8/**
9 * Given a path and some optional additional query parameters, create the dev server bundle URL.
10 * @param bundlePath like `/foobar`
11 * @param params like `{ platform: "web" }`
12 * @returns a URL like "/foobar.bundle?platform=android&modulesOnly=true&runModule=false&runtimeBytecodeVersion=null"
13 */
14export function buildUrlForBundle(bundlePath: string): string {
15  // NOTE(EvanBacon): This must come from the window origin (at least in dev mode).
16  // Otherwise Metro will crash from attempting to load a bundle that doesn't exist.
17  return '/' + bundlePath.replace(/^\/+/, '');
18}
19