UNPKG

851 BJavaScriptView Raw
1/**
2 * react-router v8.0.0
3 *
4 * Copyright (c) Remix Software Inc.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE.md file in the root directory of this source tree.
8 *
9 * @license MIT
10 */
11//#region lib/server-runtime/dev.ts
12const globalDevServerHooksKey = "__reactRouterDevServerHooks";
13function setDevServerHooks(devServerHooks) {
14 globalThis[globalDevServerHooksKey] = devServerHooks;
15}
16function getDevServerHooks() {
17 return globalThis[globalDevServerHooksKey];
18}
19function getBuildTimeHeader(request, headerName) {
20 if (typeof process !== "undefined") try {
21 if (process.env.hasOwnProperty("IS_RR_BUILD_REQUEST") && process.env.IS_RR_BUILD_REQUEST === "yes") return request.headers.get(headerName);
22 } catch (e) {}
23 return null;
24}
25//#endregion
26export { getBuildTimeHeader, getDevServerHooks, setDevServerHooks };