UNPKG

@tanstack/router-core

Version:

Modern and scalable routing for React applications

43 lines (42 loc) 1.33 kB
const require_load_client = require("../load-client.cjs"); //#region src/ssr/bodyScripts.ts function getSsrBodyScriptParts(matches, manifest, nonce, routeScriptAttrs) { const assetMatches = require_load_client._getAssetMatches(matches); const routeScripts = []; const manifestScripts = []; for (const match of assetMatches) for (const script of Array.isArray(match.scripts) ? match.scripts : []) { if (!script) continue; const { children, ...attrs } = script; routeScripts.push({ tag: "script", attrs: { ...attrs, ...routeScriptAttrs, nonce }, children }); } if (manifest) for (const match of assetMatches) for (const asset of manifest.routes[match.routeId]?.scripts ?? []) manifestScripts.push({ tag: "script", attrs: { ...asset.attrs, nonce }, children: asset.children }); return [routeScripts, manifestScripts]; } function composeSsrBodyScripts([routeScripts, manifestScripts], initialHydrationScripts) { if (!initialHydrationScripts) return [...routeScripts, ...manifestScripts]; return [ ...initialHydrationScripts.before, ...routeScripts, ...manifestScripts, initialHydrationScripts.boundary ]; } //#endregion exports.composeSsrBodyScripts = composeSsrBodyScripts; exports.getSsrBodyScriptParts = getSsrBodyScriptParts; //# sourceMappingURL=bodyScripts.cjs.map