first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export declare function getRootComponent(): any;
//# sourceMappingURL=getRootComponent.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getRootComponent.d.ts","sourceRoot":"","sources":["../../src/static/getRootComponent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wBAAgB,gBAAgB,QAe/B"}

View File

@@ -0,0 +1,25 @@
"use strict";
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRootComponent = getRootComponent;
const _ctx_html_1 = require("expo-router/_ctx-html");
function getRootComponent() {
const keys = _ctx_html_1.ctx.keys();
if (!keys.length) {
return require('./html').Html;
}
if (keys.length > 1) {
throw new Error(`Multiple components match the root HTML element: ${keys.join(', ')}`);
}
const exp = (0, _ctx_html_1.ctx)(keys[0]);
if (!exp.default) {
throw new Error(`The root HTML element "${keys[0]}" is missing the required default export.`);
}
return exp.default;
}
//# sourceMappingURL=getRootComponent.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getRootComponent.js","sourceRoot":"","sources":["../../src/static/getRootComponent.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAIH,4CAeC;AAjBD,qDAA2D;AAE3D,SAAgB,gBAAgB;IAC9B,MAAM,IAAI,GAAG,eAAW,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,OAAQ,OAAO,CAAC,QAAQ,CAA6B,CAAC,IAAI,CAAC;IAC7D,CAAC;IACD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oDAAoD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACzF,CAAC;IACD,MAAM,GAAG,GAAG,IAAA,eAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjC,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,CAAC,CAAC,CAAC,2CAA2C,CAAC,CAAC;IAChG,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACrB,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { ctx as rootContext } from 'expo-router/_ctx-html';\n\nexport function getRootComponent() {\n const keys = rootContext.keys();\n if (!keys.length) {\n return (require('./html') as typeof import('./html')).Html;\n }\n if (keys.length > 1) {\n throw new Error(`Multiple components match the root HTML element: ${keys.join(', ')}`);\n }\n const exp = rootContext(keys[0]);\n\n if (!exp.default) {\n throw new Error(`The root HTML element \"${keys[0]}\" is missing the required default export.`);\n }\n\n return exp.default;\n}\n"]}

View File

@@ -0,0 +1,22 @@
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import { type GetRoutesOptions } from 'expo-router/internal/routing';
import { type RoutesManifest } from 'expo-server/private';
/**
* Get the server manifest with all dynamic routes loaded with `generateStaticParams`.
* Unlike the `@expo/router-server/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which
* takes substantially longer and requires Metro bundling.
*
* This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.
*/
export declare function getBuildTimeServerManifestAsync(options?: GetRoutesOptions): Promise<RoutesManifest<string>>;
/** Get the linking manifest from a Node.js process. */
export declare function getManifest(options?: GetRoutesOptions): Promise<{
initialRouteName: undefined;
screens: Record<string, import("expo-router/build/getReactNavigationConfig").Screen>;
}>;
//# sourceMappingURL=getServerManifest.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getServerManifest.d.ts","sourceRoot":"","sources":["../../src/static/getServerManifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAK1D;;;;;;GAMG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAgBjC;AAED,uDAAuD;AACvD,wBAAsB,WAAW,CAAC,OAAO,GAAE,gBAAqB;;;GAgB/D"}

View File

@@ -0,0 +1,51 @@
"use strict";
/**
* Copyright © 2024 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBuildTimeServerManifestAsync = getBuildTimeServerManifestAsync;
exports.getManifest = getManifest;
const _ctx_1 = require("expo-router/_ctx");
const routing_1 = require("expo-router/internal/routing");
const getServerManifest_1 = require("../getServerManifest");
const loadStaticParamsAsync_1 = require("../loadStaticParamsAsync");
/**
* Get the server manifest with all dynamic routes loaded with `generateStaticParams`.
* Unlike the `@expo/router-server/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which
* takes substantially longer and requires Metro bundling.
*
* This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.
*/
async function getBuildTimeServerManifestAsync(options = {}) {
const routeTree = (0, routing_1.getRoutes)(_ctx_1.ctx, {
platform: 'web',
...options,
});
if (!routeTree) {
throw new Error('No routes found');
}
// Evaluate all static params; skip for SSR mode where routes are matched at runtime
if (!options.skipStaticParams) {
await (0, loadStaticParamsAsync_1.loadStaticParamsAsync)(routeTree);
}
return (0, getServerManifest_1.getServerManifest)(routeTree, options);
}
/** Get the linking manifest from a Node.js process. */
async function getManifest(options = {}) {
const routeTree = (0, routing_1.getRoutes)(_ctx_1.ctx, {
preserveApiRoutes: true,
preserveRedirectAndRewrites: true,
platform: 'web',
...options,
});
if (!routeTree) {
throw new Error('No routes found');
}
// Evaluate all static params
await (0, loadStaticParamsAsync_1.loadStaticParamsAsync)(routeTree);
return (0, routing_1.getReactNavigationConfig)(routeTree, false);
}
//# sourceMappingURL=getServerManifest.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../../src/static/getServerManifest.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAoBH,0EAkBC;AAGD,kCAgBC;AAvDD,2CAAuC;AACvC,0DAIsC;AAGtC,4DAAyD;AACzD,oEAAiE;AAEjE;;;;;;GAMG;AACI,KAAK,UAAU,+BAA+B,CACnD,UAA4B,EAAE;IAE9B,MAAM,SAAS,GAAG,IAAA,mBAAS,EAAC,UAAG,EAAE;QAC/B,QAAQ,EAAE,KAAK;QACf,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,oFAAoF;IACpF,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,IAAA,qCAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAC/C,CAAC;AAED,uDAAuD;AAChD,KAAK,UAAU,WAAW,CAAC,UAA4B,EAAE;IAC9D,MAAM,SAAS,GAAG,IAAA,mBAAS,EAAC,UAAG,EAAE;QAC/B,iBAAiB,EAAE,IAAI;QACvB,2BAA2B,EAAE,IAAI;QACjC,QAAQ,EAAE,KAAK;QACf,GAAG,OAAO;KACX,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,6BAA6B;IAC7B,MAAM,IAAA,6CAAqB,EAAC,SAAS,CAAC,CAAC;IAEvC,OAAO,IAAA,kCAAwB,EAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { ctx } from 'expo-router/_ctx';\nimport {\n getReactNavigationConfig,\n getRoutes,\n type GetRoutesOptions,\n} from 'expo-router/internal/routing';\nimport { type RoutesManifest } from 'expo-server/private';\n\nimport { getServerManifest } from '../getServerManifest';\nimport { loadStaticParamsAsync } from '../loadStaticParamsAsync';\n\n/**\n * Get the server manifest with all dynamic routes loaded with `generateStaticParams`.\n * Unlike the `@expo/router-server/src/routes-manifest.ts` method, this requires loading the entire app in-memory, which\n * takes substantially longer and requires Metro bundling.\n *\n * This is used for the production manifest where we pre-render certain pages and should no longer treat them as dynamic.\n */\nexport async function getBuildTimeServerManifestAsync(\n options: GetRoutesOptions = {}\n): Promise<RoutesManifest<string>> {\n const routeTree = getRoutes(ctx, {\n platform: 'web',\n ...options,\n });\n\n if (!routeTree) {\n throw new Error('No routes found');\n }\n\n // Evaluate all static params; skip for SSR mode where routes are matched at runtime\n if (!options.skipStaticParams) {\n await loadStaticParamsAsync(routeTree);\n }\n\n return getServerManifest(routeTree, options);\n}\n\n/** Get the linking manifest from a Node.js process. */\nexport async function getManifest(options: GetRoutesOptions = {}) {\n const routeTree = getRoutes(ctx, {\n preserveApiRoutes: true,\n preserveRedirectAndRewrites: true,\n platform: 'web',\n ...options,\n });\n\n if (!routeTree) {\n throw new Error('No routes found');\n }\n\n // Evaluate all static params\n await loadStaticParamsAsync(routeTree);\n\n return getReactNavigationConfig(routeTree, false);\n}\n"]}

View File

@@ -0,0 +1,10 @@
import React, { type PropsWithChildren } from 'react';
/**
* Injects loader data into the HTML as a script tag for client-side hydration.
* The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.
*/
export declare function PreloadedDataScript({ data }: {
data: Record<string, unknown>;
}): React.JSX.Element;
export declare function Html({ children }: PropsWithChildren): React.JSX.Element;
//# sourceMappingURL=html.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAItD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,qBAc9E;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAYnD"}

40
node_modules/@expo/router-server/build/static/html.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreloadedDataScript = PreloadedDataScript;
exports.Html = Html;
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const html_1 = require("expo-router/html");
const react_1 = __importDefault(require("react"));
const html_2 = require("../utils/html");
/**
* Injects loader data into the HTML as a script tag for client-side hydration.
* The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.
*/
function PreloadedDataScript({ data }) {
const safeJson = (0, html_2.escapeUnsafeCharacters)(JSON.stringify(data));
return (<script id="expo-router-data" type="module" dangerouslySetInnerHTML={{
// NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster
// client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json
__html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,
}}/>);
}
function Html({ children }) {
return (<html lang="en">
<head>
<meta charSet="utf-8"/>
<meta httpEquiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<html_1.ScrollViewStyleReset />
</head>
<body>{children}</body>
</html>);
}
//# sourceMappingURL=html.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/static/html.tsx"],"names":[],"mappings":";;;;;AAeA,kDAcC;AAED,oBAYC;AA3CD;;;;;GAKG;AACH,2CAAwD;AACxD,kDAAsD;AAEtD,wCAAuD;AAEvD;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAqC;IAC7E,MAAM,QAAQ,GAAG,IAAA,6BAAsB,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAE9D,OAAO,CACL,CAAC,MAAM,CACL,EAAE,CAAC,kBAAkB,CACrB,IAAI,CAAC,QAAQ,CACb,uBAAuB,CAAC,CAAC;YACvB,kHAAkH;YAClH,wGAAwG;YACxG,MAAM,EAAE,uDAAuD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI;SAC5F,CAAC,EACF,CACH,CAAC;AACJ,CAAC;AAED,SAAgB,IAAI,CAAC,EAAE,QAAQ,EAAqB;IAClD,OAAO,CACL,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACb;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,EACrB;QAAA,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,OAAO,CAAC,SAAS,EACnD;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,uDAAuD,EACrF;QAAA,CAAC,2BAAoB,CAAC,AAAD,EACvB;MAAA,EAAE,IAAI,CACN;MAAA,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CACxB;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { ScrollViewStyleReset } from 'expo-router/html';\nimport React, { type PropsWithChildren } from 'react';\n\nimport { escapeUnsafeCharacters } from '../utils/html';\n\n/**\n * Injects loader data into the HTML as a script tag for client-side hydration.\n * The data is serialized as JSON and made available on the `globalThis.__EXPO_ROUTER_LOADER_DATA__` global.\n */\nexport function PreloadedDataScript({ data }: { data: Record<string, unknown> }) {\n const safeJson = escapeUnsafeCharacters(JSON.stringify(data));\n\n return (\n <script\n id=\"expo-router-data\"\n type=\"module\"\n dangerouslySetInnerHTML={{\n // NOTE(@hassankhan): The double serialization used here isn't as much of a problem server-side, but allows faster\n // client-side parsing using native `JSON.parse()`. See https://v8.dev/blog/cost-of-javascript-2019#json\n __html: `globalThis.__EXPO_ROUTER_LOADER_DATA__ = JSON.parse(${JSON.stringify(safeJson)});`,\n }}\n />\n );\n}\n\nexport function Html({ children }: PropsWithChildren) {\n return (\n <html lang=\"en\">\n <head>\n <meta charSet=\"utf-8\" />\n <meta httpEquiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\" />\n <ScrollViewStyleReset />\n </head>\n <body>{children}</body>\n </html>\n );\n}\n"]}

View File

@@ -0,0 +1,23 @@
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import '@expo/metro-runtime';
export type GetStaticContentOptions = {
loader?: {
data?: any;
/** Unique key for the route. Derived from the route's contextKey */
key: string;
};
request?: Request;
/** Asset manifest for hydration bundles (JS/CSS). Used in SSR. */
assets?: {
css: string[];
js: string[];
};
};
export declare function getStaticContent(location: URL, options?: GetStaticContentOptions): Promise<string>;
export { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';
//# sourceMappingURL=renderStaticContent.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"renderStaticContent.d.ts","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,qBAAqB,CAAC;AA0B7B,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,oEAAoE;QACpE,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,kEAAkE;IAClE,MAAM,CAAC,EAAE;QACP,GAAG,EAAE,MAAM,EAAE,CAAC;QACd,EAAE,EAAE,MAAM,EAAE,CAAC;KACd,CAAC;CACH,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,MAAM,CAAC,CAuFjB;AAmBD,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}

View File

@@ -0,0 +1,151 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getManifest = exports.getBuildTimeServerManifestAsync = void 0;
exports.getStaticContent = getStaticContent;
/**
* Copyright © 2023 650 Industries.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
require("@expo/metro-runtime");
const Font = __importStar(require("expo-font/build/server"));
const expo_router_1 = require("expo-router");
const _ctx_1 = require("expo-router/_ctx");
const head_1 = __importDefault(require("expo-router/head"));
const static_1 = require("expo-router/internal/static");
const react_1 = __importDefault(require("react"));
const server_node_1 = __importDefault(require("react-dom/server.node"));
const getRootComponent_1 = require("./getRootComponent");
const html_1 = require("./html");
const debug_1 = require("../utils/debug");
const debug = (0, debug_1.createDebug)('expo:router:server:renderStaticContent');
function resetReactNavigationContexts() {
// https://github.com/expo/router/discussions/588
// https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1
// React Navigation is storing providers in a global, this is fine for the first static render
// but subsequent static renders of Stack or Tabs will cause React to throw a warning. To prevent this warning, we'll reset the globals before rendering.
const contexts = '__react_navigation__elements_contexts';
globalThis[contexts] = new Map();
}
async function getStaticContent(location, options) {
const headContext = {};
const Root = (0, getRootComponent_1.getRootComponent)();
const {
// NOTE: The `element` that's returned adds two extra Views and
// the seemingly unused `RootTagContext.Provider`.
element, getStyleElement, } = (0, static_1.registerStaticRootComponent)(expo_router_1.ExpoRoot, {
location,
context: _ctx_1.ctx,
wrapper: ({ children }) => (<Root>
<div id="root">{children}</div>
</Root>),
});
// Clear any existing static resources from the global scope to attempt to prevent leaking between pages.
// This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree
Font.resetServerContext();
// This MUST be run before `ReactDOMServer.renderToString` to prevent
// "Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."
resetReactNavigationContexts();
const loaderKey = options?.loader ? options.loader.key + location.search : null;
const loadedData = loaderKey
? {
[loaderKey]: options?.loader?.data ?? null,
}
: null;
const html = server_node_1.default.renderToString(<head_1.default.Provider context={headContext}>
<static_1.InnerRoot loadedData={loadedData}>{element}</static_1.InnerRoot>
</head_1.default.Provider>);
// Eval the CSS after the HTML is rendered so that the CSS is in the same order
const css = server_node_1.default.renderToStaticMarkup(getStyleElement());
let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);
output = output.replace('</head>', `${css}</head>`);
const fonts = Font.getServerResources();
debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);
// debug('Push static fonts:', fonts)
// Inject static fonts loaded with expo-font
output = output.replace('</head>', `${fonts.join('')}</head>`);
if (loadedData) {
const loaderDataScript = server_node_1.default.renderToStaticMarkup(<html_1.PreloadedDataScript data={loadedData}/>);
output = output.replace('</head>', `${loaderDataScript}</head>`);
}
// Inject hydration assets (JS/CSS bundles). Used in SSR mode
if (options?.assets) {
if (options.assets.css.length > 0) {
/**
* For each CSS file, inject two link elements; one for preloading and one as the actual
* stylesheet. This matches what we do for SSG
*
* @see @expo/cli/src/start/server/metro/serializeHtml.ts
*/
const injectedCSS = options.assets.css
.flatMap((href) => [
`<link rel="preload" href="${href}" as="style">`,
`<link rel="stylesheet" href="${href}">`,
])
.join('\n');
output = output.replace('</head>', `${injectedCSS}\n</head>`);
}
if (options.assets.js.length > 0) {
const injectedJS = options.assets.js
.map((src) => `<script src="${src}" defer></script>`)
.join('\n');
output = output.replace('</body>', `${injectedJS}\n</body>`);
}
}
return '<!DOCTYPE html>' + output;
}
function mixHeadComponentsWithStaticResults(helmet, html) {
// Head components
for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {
const result = helmet?.[key]?.toString();
if (result) {
html = html.replace('<head>', `<head>${result}`);
}
}
// attributes
html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);
html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);
return html;
}
// Re-export for use in server
var getServerManifest_1 = require("./getServerManifest");
Object.defineProperty(exports, "getBuildTimeServerManifestAsync", { enumerable: true, get: function () { return getServerManifest_1.getBuildTimeServerManifestAsync; } });
Object.defineProperty(exports, "getManifest", { enumerable: true, get: function () { return getServerManifest_1.getManifest; } });
//# sourceMappingURL=renderStaticContent.js.map

File diff suppressed because one or more lines are too long