@expo/router-server 57.0.9 → 57.0.10
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":"renderStreamingContent.d.ts","sourceRoot":"","sources":["../../src/server/renderStreamingContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"renderStreamingContent.d.ts","sourceRoot":"","sources":["../../src/server/renderStreamingContent.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA4BzC,MAAM,MAAM,0BAA0B,GAAG;IACvC,MAAM,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,oEAAoE;QACpE,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,SAAS,EAAE,CAAC;KACxB,GAAG,IAAI,CAAC;IACT,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,MAAM,CAAC,EAAE;QACP,GAAG,EAAE,MAAM,EAAE,CAAC;QACd;;;WAGG;QACH,WAAW,CAAC,EAAE;YACZ,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;QACJ,4EAA4E;QAC5E,SAAS,CAAC,EAAE;YACV,MAAM,EAAE,MAAM,CAAC;YACf,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,EAAE,CAAC;QACJ,EAAE,EAAE,MAAM,EAAE,CAAC;QACb,+EAA+E;QAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH,CAAC;AAgDF;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,GAAG,EACb,OAAO,CAAC,EAAE,0BAA0B,GACnC,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,CA4DrC;AAED,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -112,6 +112,7 @@ async function getStreamingContent(location, options) {
|
|
|
112
112
|
const faviconNode = options?.assets?.favicon
|
|
113
113
|
? (0, react_1.createFaviconAsNode)(options?.assets?.favicon)
|
|
114
114
|
: undefined;
|
|
115
|
+
const { headNodes: headJsNodes, bodyNodes: bodyJsNodes } = (0, react_1.createInjectedScriptAsNodes)(options?.assets?.js ?? []);
|
|
115
116
|
const serverDocumentData = {
|
|
116
117
|
headNodes: [
|
|
117
118
|
...(options?.metadata?.headNodes ?? []),
|
|
@@ -120,15 +121,17 @@ async function getStreamingContent(location, options) {
|
|
|
120
121
|
...(headCssNodes ?? []),
|
|
121
122
|
...(externalCssNodes ?? []),
|
|
122
123
|
...(inlineCssNodes ?? []),
|
|
124
|
+
...(headJsNodes ?? []),
|
|
123
125
|
].filter(Boolean),
|
|
124
|
-
|
|
126
|
+
// NOTE(@hassankhan): React's bootstrapScripts emits async scripts, but Metro chunks must
|
|
127
|
+
// execute in asset order so the runtime initializes before dependent chunks.
|
|
128
|
+
bodyNodes: [(0, jsx_runtime_1.jsx)(FontResources, {}, "font-resources"), ...(bodyJsNodes ?? [])],
|
|
125
129
|
};
|
|
126
130
|
return server_2.default.renderToReadableStream((0, jsx_runtime_1.jsx)(server_1.ServerDocument, { data: serverDocumentData, children: (0, jsx_runtime_1.jsx)(head_1.default.Provider, { context: headContext, children: (0, jsx_runtime_1.jsx)(static_1.InnerRoot, { loadedData: loadedData, children: element }) }) }), {
|
|
127
131
|
// TODO(@hassankhan): Experiment and see if we can calculate a better default
|
|
128
132
|
// We're doubling the default here so non-JavaScript renders show some content
|
|
129
133
|
progressiveChunkSize: 12800 * 2,
|
|
130
134
|
bootstrapScriptContent: (0, react_1.getBootstrapContents)({ hydrate: true, loadedData }),
|
|
131
|
-
bootstrapScripts: options?.assets?.js,
|
|
132
135
|
signal: options?.request?.signal,
|
|
133
136
|
onError(error) {
|
|
134
137
|
if (options?.request?.signal.aborted) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderStreamingContent.js","sourceRoot":"","sources":["../../src/server/renderStreamingContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HA,kDAyDC;;AArLD;;;;;GAKG;AACH,kEAAkE;AAClE,gCAAgC;AAEhC,6DAA+C;AAC/C,6CAAuC;AACvC,2CAAuC;AACvC,4DAAoC;AACpC,wDAA6D;AAC7D,wDAAqF;AAErF,8DAA8C;AAE9C,iEAA8D;AAC9D,0CAA6C;AAC7C,0CAOwB;AAExB,MAAM,KAAK,GAAG,IAAA,mBAAW,EAAC,2CAA2C,CAAC,CAAC;AAEvE,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;AAmCD;;;GAGG;AACH,SAAS,oBAAoB,CAAC,QAAa,EAAE,OAAoC;IAC/E,MAAM,WAAW,GAAqB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,IAAA,mCAAgB,GAAE,CAAC;IAEhC,MAAM;IACJ,+DAA+D;IAC/D,kDAAkD;IAClD,OAAO,EACP,eAAe,GAChB,GAAG,IAAA,oCAA2B,EAAC,sBAAQ,EAAE;QACxC,QAAQ;QACR,OAAO,EAAE,UAAG;QACZ,OAAO,EAAE,CAAC,EAAE,QAAQ,EAA6B,EAAE,EAAE,CAAC,CACpD,uBAAC,IAAI,cACH,gCAAK,EAAE,EAAC,MAAM,YAAE,QAAQ,GAAO,GAC1B,CACR;KACF,CAAC,CAAC;IAEH,qEAAqE;IACrE,0HAA0H;IAC1H,4BAA4B,EAAE,CAAC;IAE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,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uCAA6C;AAApC,2GAAA,eAAe,OAAA","sourcesContent":["/**\n * Copyright © 2026 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// NOTE(@hassankhan): disable when this file is its own entrypoint\n// import '@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 { ServerDocument } from 'expo-router/internal/server';\nimport { InnerRoot, registerStaticRootComponent } from 'expo-router/internal/static';\nimport React, { ReactNode } from 'react';\nimport ReactDOMServer from 'react-dom/server';\n\nimport { getRootComponent } from '../static/getRootComponent';\nimport { createDebug } from '../utils/debug';\nimport {\n createFaviconAsNode,\n createInjectedCssAsNodes,\n createInjectedExternalCssAsNodes,\n createInjectedFontsAsNodes,\n createInjectedInlineCssAsNodes,\n getBootstrapContents,\n} from '../utils/react';\n\nconst debug = createDebug('expo:router:server:renderStreamingContent');\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\n// NOTE(@hassankhan): Keep in sync with `expo-server/src/manifest.ts`\nexport type GetStreamingContentOptions = {\n loader?: {\n data?: any;\n /** Unique key for the route. Derived from the route's contextKey */\n key: string;\n };\n metadata?: {\n headNodes: ReactNode[];\n } | null;\n request?: Request;\n /** Assets for hydration bundles and development-only inline CSS. */\n assets?: {\n css: string[];\n /**\n * External stylesheets (`@import url(https://…)`) extracted from the bundled CSS, rendered\n * verbatim as `<link rel=\"stylesheet\">` so attributes like `media` survive.\n */\n externalCss?: {\n href: string;\n media?: string;\n }[];\n /** CSS source to inline into the document head, used by development SSR. */\n inlineCss?: {\n source: string;\n hmrId?: string;\n }[];\n js: string[];\n /** Public href of a favicon generated from `web.favicon` in the app config. */\n favicon?: string;\n };\n};\n\n/**\n * Shared setup for both `getStaticContent()` and `getStreamingContent()`. Creates the React element\n * tree, resets server contexts, and computes loader data.\n */\nfunction prepareRenderContext(location: URL, options?: GetStreamingContentOptions) {\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 // 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 loaderKey = options?.loader ? options.loader.key + location.search : null;\n\n const loadedData = loaderKey\n ? {\n [loaderKey]: options?.loader?.data ?? null,\n }\n : null;\n\n return { headContext, element, getStyleElement, loadedData };\n}\n\nfunction FontResources() {\n // NOTE(@hassankhan): runs once during the shell pass; fonts loaded inside late-resolving\n // Suspense boundaries register after this and won't be emitted.\n const descriptors = Font.getServerResourceDescriptors();\n debug(`Pushing fonts: (count: ${descriptors.length})`, descriptors);\n return createInjectedFontsAsNodes(descriptors);\n}\n\n/**\n * Streaming SSR renderer using `renderToReadableStream`. Returns a web `ReadableStream`\n * that emits the full HTML document with head injections applied.\n */\nexport async function getStreamingContent(\n location: URL,\n options?: GetStreamingContentOptions\n): Promise<ReadableStream<Uint8Array>> {\n return Font.withServerContext(() => {\n const { headContext, element, getStyleElement, loadedData } = prepareRenderContext(\n location,\n options\n );\n\n const { headNodes: headCssNodes } = createInjectedCssAsNodes(options?.assets?.css ?? []);\n const { headNodes: externalCssNodes } = createInjectedExternalCssAsNodes(\n options?.assets?.externalCss\n );\n const { headNodes: inlineCssNodes } = createInjectedInlineCssAsNodes(\n options?.assets?.inlineCss\n );\n const faviconNode = options?.assets?.favicon\n ? createFaviconAsNode(options?.assets?.favicon)\n : undefined;\n\n const serverDocumentData = {\n headNodes: [\n ...(options?.metadata?.headNodes ?? []),\n faviconNode,\n getStyleElement({ key: 'rnw-style-element' }),\n ...(headCssNodes ?? []),\n ...(externalCssNodes ?? []),\n ...(inlineCssNodes ?? []),\n ].filter(Boolean),\n bodyNodes: [<FontResources key=\"font-resources\" />],\n };\n\n return ReactDOMServer.renderToReadableStream(\n <ServerDocument data={serverDocumentData}>\n {/* TODO(@hassankhan): Remove `<Head.Provider>` when `unstable_useServerRendering` is stabilized */}\n <Head.Provider context={headContext}>\n <InnerRoot loadedData={loadedData}>{element}</InnerRoot>\n </Head.Provider>\n </ServerDocument>,\n {\n // TODO(@hassankhan): Experiment and see if we can calculate a better default\n // We're doubling the default here so non-JavaScript renders show some content\n progressiveChunkSize: 12800 * 2,\n bootstrapScriptContent: getBootstrapContents({ hydrate: true, loadedData }),\n bootstrapScripts: options?.assets?.js,\n signal: options?.request?.signal,\n onError(error) {\n if (options?.request?.signal.aborted) {\n return;\n }\n\n console.error('SSR streaming render error:', error);\n },\n }\n );\n });\n}\n\nexport { resolveMetadata } from './metadata';\n"]}
|
|
1
|
+
{"version":3,"file":"renderStreamingContent.js","sourceRoot":"","sources":["../../src/server/renderStreamingContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,kDA+DC;;AA5LD;;;;;GAKG;AACH,kEAAkE;AAClE,gCAAgC;AAEhC,6DAA+C;AAC/C,6CAAuC;AACvC,2CAAuC;AACvC,4DAAoC;AACpC,wDAA6D;AAC7D,wDAAqF;AAErF,8DAA8C;AAE9C,iEAA8D;AAC9D,0CAA6C;AA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E,mBAAmB,EAAE,CAAC;gBAC7C,GAAG,CAAC,YAAY,IAAI,EAAE,CAAC;gBACvB,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;gBAC3B,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;gBACzB,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC;aACvB,CAAC,MAAM,CAAC,OAAO,CAAC;YACjB,yFAAyF;YACzF,6EAA6E;YAC7E,SAAS,EAAE,CAAC,uBAAC,aAAa,MAAK,gBAAgB,CAAG,EAAE,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;SAC5E,CAAC;QAEF,OAAO,gBAAc,CAAC,sBAAsB,CAC1C,uBAAC,uBAAc,IAAC,IAAI,EAAE,kBAAkB,YAEtC,uBAAC,cAAI,CAAC,QAAQ,IAAC,OAAO,EAAE,WAAW,YACjC,uBAAC,kBAAS,IAAC,UAAU,EAAE,UAAU,YAAG,OAAO,GAAa,GAC1C,GACD,EACjB;YACE,6EAA6E;YAC7E,8EAA8E;YAC9E,oBAAoB,EAAE,KAAK,GAAG,CAAC;YAC/B,sBAAsB,EAAE,IAAA,4BAAoB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;YAC3E,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM;YAChC,OAAO,CAAC,KAAK;gBACX,IAAI,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;oBACrC,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;YACtD,CAAC;SACF,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,uCAA6C;AAApC,2GAAA,eAAe,OAAA","sourcesContent":["/**\n * Copyright © 2026 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// NOTE(@hassankhan): disable when this file is its own entrypoint\n// import '@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 { ServerDocument } from 'expo-router/internal/server';\nimport { InnerRoot, registerStaticRootComponent } from 'expo-router/internal/static';\nimport React, { ReactNode } from 'react';\nimport ReactDOMServer from 'react-dom/server';\n\nimport { getRootComponent } from '../static/getRootComponent';\nimport { createDebug } from '../utils/debug';\nimport {\n createFaviconAsNode,\n createInjectedCssAsNodes,\n createInjectedExternalCssAsNodes,\n createInjectedFontsAsNodes,\n createInjectedInlineCssAsNodes,\n createInjectedScriptAsNodes,\n getBootstrapContents,\n} from '../utils/react';\n\nconst debug = createDebug('expo:router:server:renderStreamingContent');\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\n// NOTE(@hassankhan): Keep in sync with `expo-server/src/manifest.ts`\nexport type GetStreamingContentOptions = {\n loader?: {\n data?: any;\n /** Unique key for the route. Derived from the route's contextKey */\n key: string;\n };\n metadata?: {\n headNodes: ReactNode[];\n } | null;\n request?: Request;\n /** Assets for hydration bundles and development-only inline CSS. */\n assets?: {\n css: string[];\n /**\n * External stylesheets (`@import url(https://…)`) extracted from the bundled CSS, rendered\n * verbatim as `<link rel=\"stylesheet\">` so attributes like `media` survive.\n */\n externalCss?: {\n href: string;\n media?: string;\n }[];\n /** CSS source to inline into the document head, used by development SSR. */\n inlineCss?: {\n source: string;\n hmrId?: string;\n }[];\n js: string[];\n /** Public href of a favicon generated from `web.favicon` in the app config. */\n favicon?: string;\n };\n};\n\n/**\n * Shared setup for both `getStaticContent()` and `getStreamingContent()`. Creates the React element\n * tree, resets server contexts, and computes loader data.\n */\nfunction prepareRenderContext(location: URL, options?: GetStreamingContentOptions) {\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 // 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 loaderKey = options?.loader ? options.loader.key + location.search : null;\n\n const loadedData = loaderKey\n ? {\n [loaderKey]: options?.loader?.data ?? null,\n }\n : null;\n\n return { headContext, element, getStyleElement, loadedData };\n}\n\nfunction FontResources() {\n // NOTE(@hassankhan): runs once during the shell pass; fonts loaded inside late-resolving\n // Suspense boundaries register after this and won't be emitted.\n const descriptors = Font.getServerResourceDescriptors();\n debug(`Pushing fonts: (count: ${descriptors.length})`, descriptors);\n return createInjectedFontsAsNodes(descriptors);\n}\n\n/**\n * Streaming SSR renderer using `renderToReadableStream`. Returns a web `ReadableStream`\n * that emits the full HTML document with head injections applied.\n */\nexport async function getStreamingContent(\n location: URL,\n options?: GetStreamingContentOptions\n): Promise<ReadableStream<Uint8Array>> {\n return Font.withServerContext(() => {\n const { headContext, element, getStyleElement, loadedData } = prepareRenderContext(\n location,\n options\n );\n\n const { headNodes: headCssNodes } = createInjectedCssAsNodes(options?.assets?.css ?? []);\n const { headNodes: externalCssNodes } = createInjectedExternalCssAsNodes(\n options?.assets?.externalCss\n );\n const { headNodes: inlineCssNodes } = createInjectedInlineCssAsNodes(\n options?.assets?.inlineCss\n );\n const faviconNode = options?.assets?.favicon\n ? createFaviconAsNode(options?.assets?.favicon)\n : undefined;\n\n const { headNodes: headJsNodes, bodyNodes: bodyJsNodes } = createInjectedScriptAsNodes(\n options?.assets?.js ?? []\n );\n\n const serverDocumentData = {\n headNodes: [\n ...(options?.metadata?.headNodes ?? []),\n faviconNode,\n getStyleElement({ key: 'rnw-style-element' }),\n ...(headCssNodes ?? []),\n ...(externalCssNodes ?? []),\n ...(inlineCssNodes ?? []),\n ...(headJsNodes ?? []),\n ].filter(Boolean),\n // NOTE(@hassankhan): React's bootstrapScripts emits async scripts, but Metro chunks must\n // execute in asset order so the runtime initializes before dependent chunks.\n bodyNodes: [<FontResources key=\"font-resources\" />, ...(bodyJsNodes ?? [])],\n };\n\n return ReactDOMServer.renderToReadableStream(\n <ServerDocument data={serverDocumentData}>\n {/* TODO(@hassankhan): Remove `<Head.Provider>` when `unstable_useServerRendering` is stabilized */}\n <Head.Provider context={headContext}>\n <InnerRoot loadedData={loadedData}>{element}</InnerRoot>\n </Head.Provider>\n </ServerDocument>,\n {\n // TODO(@hassankhan): Experiment and see if we can calculate a better default\n // We're doubling the default here so non-JavaScript renders show some content\n progressiveChunkSize: 12800 * 2,\n bootstrapScriptContent: getBootstrapContents({ hydrate: true, loadedData }),\n signal: options?.request?.signal,\n onError(error) {\n if (options?.request?.signal.aborted) {\n return;\n }\n\n console.error('SSR streaming render error:', error);\n },\n }\n );\n });\n}\n\nexport { resolveMetadata } from './metadata';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@expo/router-server",
|
|
3
|
-
"version": "57.0.
|
|
3
|
+
"version": "57.0.10",
|
|
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",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@expo/metro-runtime": "^57.0.15",
|
|
28
28
|
"expo": "*",
|
|
29
|
-
"expo-constants": "^57.0.
|
|
30
|
-
"expo-font": "^57.0.
|
|
29
|
+
"expo-constants": "^57.0.18",
|
|
30
|
+
"expo-font": "^57.0.4",
|
|
31
31
|
"expo-router": "*",
|
|
32
32
|
"expo-server": "^57.0.3",
|
|
33
33
|
"react": "*",
|
|
@@ -56,11 +56,12 @@
|
|
|
56
56
|
"@types/react": "~19.2.0",
|
|
57
57
|
"@types/react-dom": "^19.1.7",
|
|
58
58
|
"jest-runner-tsd": "^6.0.0",
|
|
59
|
+
"node-html-parser": "^6.1.5",
|
|
59
60
|
"react-server-dom-webpack": "~19.0.6",
|
|
60
61
|
"tsd": "^0.33.0",
|
|
61
62
|
"tsd-lite": "^0.9.0",
|
|
62
|
-
"expo
|
|
63
|
-
"expo": "57.0.
|
|
63
|
+
"expo": "57.0.23",
|
|
64
|
+
"expo-router": "57.0.21"
|
|
64
65
|
},
|
|
65
66
|
"dependencies": {
|
|
66
67
|
"debug": "^4.3.4"
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"publishConfig": {
|
|
69
70
|
"access": "public"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "f6f5af06b95cb7d511b52641885b2fb5adad525d",
|
|
72
73
|
"scripts": {
|
|
73
74
|
"build": "expo-module build",
|
|
74
75
|
"clean": "expo-module clean",
|