@expo/router-server 55.0.0 → 55.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
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;KACZ,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,
|
|
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;KACZ,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,CAsFjB;AAmBD,OAAO,EAAE,+BAA+B,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -85,7 +85,7 @@ async function getStaticContent(location, options) {
|
|
|
85
85
|
resetReactNavigationContexts();
|
|
86
86
|
const loadedData = options?.loader !== undefined
|
|
87
87
|
? {
|
|
88
|
-
[location.pathname + location.search]: options.loader.data
|
|
88
|
+
[location.pathname + location.search]: options.loader.data ?? null,
|
|
89
89
|
}
|
|
90
90
|
: null;
|
|
91
91
|
const html = server_node_1.default.renderToString(<head_1.default.Provider context={headContext}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,
|
|
1
|
+
{"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,4CAyFC;AArID;;;;;GAKG;AACH,+BAA6B;AAE7B,6DAA+C;AAC/C,6CAAuC;AACvC,2CAAuC;AACvC,4DAAoC;AACpC,wDAAqF;AACrF,kDAA0B;AAC1B,wEAAmD;AAEnD,yDAAsD;AACtD,iCAA6C;AAC7C,0CAA6C;AAE7C,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,wCAAwC,CAAC,CAAC;AAEpE,SAAS,4BAA4B;IACnC,iDAAiD;IACjD,0JAA0J;IAE1J,8FAA8F;IAC9F,yJAAyJ;IACzJ,MAAM,QAAQ,GAAG,uCAAuC,CAAC;IACxD,UAAkB,CAAC,QAAQ,CAAC,GAAG,IAAI,GAAG,EAA8B,CAAC;AACxE,CAAC;AAcM,KAAK,UAAU,gBAAgB,CACpC,QAAa,EACb,OAAiC;IAEjC,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAEhC,MAAM;IACJ,+DAA+D;IAC/D,kDAAkD;IAClD,OAA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AAG,UAAU,WAAW,CAAC,CAAC;QAC/D,CAAC;IACH,CAAC;IAED,OAAO,iBAAiB,GAAG,MAAM,CAAC;AACpC,CAAC;AAED,SAAS,kCAAkC,CAAC,MAAW,EAAE,IAAY;IACnE,kBAAkB;IAClB,KAAK,MAAM,GAAG,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QACrF,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC;QACzC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,aAAa;IACb,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7E,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,cAAc,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8BAA8B;AAC9B,yDAAmF;AAA1E,oIAAA,+BAA+B,OAAA;AAAE,gHAAA,WAAW,OAAA","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 '@expo/metro-runtime';\n\nimport * as Font from 'expo-font/build/server';\nimport { ExpoRoot } from 'expo-router';\nimport { ctx } from 'expo-router/_ctx';\nimport Head from 'expo-router/head';\nimport { InnerRoot, registerStaticRootComponent } from 'expo-router/internal/static';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n\nimport { getRootComponent } from './getRootComponent';\nimport { PreloadedDataScript } from './html';\nimport { createDebug } from '../utils/debug';\n\nconst debug = createDebug('expo:router:server:renderStaticContent');\n\nfunction resetReactNavigationContexts() {\n // https://github.com/expo/router/discussions/588\n // https://github.com/react-navigation/react-navigation/blob/9fe34b445fcb86e5666f61e144007d7540f014fa/packages/elements/src/getNamedContext.tsx#LL3C1-L4C1\n\n // React Navigation is storing providers in a global, this is fine for the first static render\n // 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.\n const contexts = '__react_navigation__elements_contexts';\n (globalThis as any)[contexts] = new Map<string, React.Context<any>>();\n}\n\nexport type GetStaticContentOptions = {\n loader?: {\n data?: any;\n };\n request?: Request;\n /** Asset manifest for hydration bundles (JS/CSS). Used in SSR. */\n assets?: {\n css: string[];\n js: string[];\n };\n};\n\nexport async function getStaticContent(\n location: URL,\n options?: GetStaticContentOptions\n): Promise<string> {\n const headContext: { helmet?: any } = {};\n const Root = getRootComponent();\n\n const {\n // NOTE: The `element` that's returned adds two extra Views and\n // the seemingly unused `RootTagContext.Provider`.\n element,\n getStyleElement,\n } = registerStaticRootComponent(ExpoRoot, {\n location,\n context: ctx,\n wrapper: ({ children }: React.ComponentProps<any>) => (\n <Root>\n <div id=\"root\">{children}</div>\n </Root>\n ),\n });\n\n // Clear any existing static resources from the global scope to attempt to prevent leaking between pages.\n // This could break if pages are rendered in parallel or if fonts are loaded outside of the React tree\n Font.resetServerContext();\n\n // This MUST be run before `ReactDOMServer.renderToString` to prevent\n // \"Warning: Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported.\"\n resetReactNavigationContexts();\n\n const loadedData =\n options?.loader !== undefined\n ? {\n [location.pathname + location.search]: options.loader.data ?? null,\n }\n : null;\n\n const html = ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <InnerRoot loadedData={loadedData}>{element}</InnerRoot>\n </Head.Provider>\n );\n\n // Eval the CSS after the HTML is rendered so that the CSS is in the same order\n const css = ReactDOMServer.renderToStaticMarkup(getStyleElement());\n\n let output = mixHeadComponentsWithStaticResults(headContext.helmet, html);\n\n output = output.replace('</head>', `${css}</head>`);\n\n const fonts = Font.getServerResources();\n debug(`Pushing static fonts: (count: ${fonts.length})`, fonts);\n // debug('Push static fonts:', fonts)\n // Inject static fonts loaded with expo-font\n output = output.replace('</head>', `${fonts.join('')}</head>`);\n if (loadedData) {\n const loaderDataScript = ReactDOMServer.renderToStaticMarkup(\n <PreloadedDataScript data={loadedData} />\n );\n output = output.replace('</head>', `${loaderDataScript}</head>`);\n }\n\n // Inject hydration assets (JS/CSS bundles). Used in SSR mode\n if (options?.assets) {\n if (options.assets.css.length > 0) {\n /**\n * For each CSS file, inject two link elements; one for preloading and one as the actual\n * stylesheet. This matches what we do for SSG\n *\n * @see @expo/cli/src/start/server/metro/serializeHtml.ts\n */\n const injectedCSS = options.assets.css\n .flatMap((href) => [\n `<link rel=\"preload\" href=\"${href}\" as=\"style\">`,\n `<link rel=\"stylesheet\" href=\"${href}\">`,\n ])\n .join('\\n');\n output = output.replace('</head>', `${injectedCSS}\\n</head>`);\n }\n\n if (options.assets.js.length > 0) {\n const injectedJS = options.assets.js\n .map((src) => `<script src=\"${src}\" defer></script>`)\n .join('\\n');\n output = output.replace('</body>', `${injectedJS}\\n</body>`);\n }\n }\n\n return '<!DOCTYPE html>' + output;\n}\n\nfunction mixHeadComponentsWithStaticResults(helmet: any, html: string) {\n // Head components\n for (const key of ['title', 'priority', 'meta', 'link', 'script', 'style'].reverse()) {\n const result = helmet?.[key]?.toString();\n if (result) {\n html = html.replace('<head>', `<head>${result}`);\n }\n }\n\n // attributes\n html = html.replace('<html ', `<html ${helmet?.htmlAttributes.toString()} `);\n html = html.replace('<body ', `<body ${helmet?.bodyAttributes.toString()} `);\n\n return html;\n}\n\n// Re-export for use in server\nexport { getBuildTimeServerManifestAsync, getManifest } from './getServerManifest';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/router-server",
|
|
3
|
-
"version": "55.0.
|
|
3
|
+
"version": "55.0.2",
|
|
4
4
|
"description": "Expo Router is a file-based router for React Native and web applications.",
|
|
5
5
|
"author": "650 Industries, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"expo"
|
|
35
35
|
],
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@expo/metro-runtime": "^55.0.
|
|
37
|
+
"@expo/metro-runtime": "^55.0.1",
|
|
38
38
|
"react": "*",
|
|
39
39
|
"react-dom": "*",
|
|
40
40
|
"expo": "*",
|
|
41
|
-
"expo-constants": "^55.0.
|
|
41
|
+
"expo-constants": "^55.0.1",
|
|
42
42
|
"expo-font": "*",
|
|
43
43
|
"expo-router": "*",
|
|
44
44
|
"expo-server": "*",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "326a6b473b3d2a90f3f96e9eea8f995bb2677f30"
|
|
69
69
|
}
|