expo-router 6.0.8-canary-20250919-7a31b96 → 6.1.0-canary-20250930-9dc59d3

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.
Files changed (58) hide show
  1. package/build/Route.d.ts +5 -2
  2. package/build/Route.d.ts.map +1 -1
  3. package/build/Route.js.map +1 -1
  4. package/build/exports.d.ts +1 -1
  5. package/build/exports.d.ts.map +1 -1
  6. package/build/exports.js +2 -1
  7. package/build/exports.js.map +1 -1
  8. package/build/getRoutesCore.d.ts.map +1 -1
  9. package/build/getRoutesCore.js +5 -0
  10. package/build/getRoutesCore.js.map +1 -1
  11. package/build/getServerManifest.d.ts.map +1 -1
  12. package/build/getServerManifest.js +5 -2
  13. package/build/getServerManifest.js.map +1 -1
  14. package/build/hooks.d.ts +22 -1
  15. package/build/hooks.d.ts.map +1 -1
  16. package/build/hooks.js +102 -4
  17. package/build/hooks.js.map +1 -1
  18. package/build/link/useLinkHooks.d.ts +1 -1
  19. package/build/loaders/ServerDataLoaderContext.d.ts +9 -0
  20. package/build/loaders/ServerDataLoaderContext.d.ts.map +1 -0
  21. package/build/loaders/ServerDataLoaderContext.js +13 -0
  22. package/build/loaders/ServerDataLoaderContext.js.map +1 -0
  23. package/build/loaders/utils.d.ts +9 -0
  24. package/build/loaders/utils.d.ts.map +1 -0
  25. package/build/loaders/utils.js +29 -0
  26. package/build/loaders/utils.js.map +1 -0
  27. package/build/native-tabs/NativeBottomTabs/types.d.ts +2 -0
  28. package/build/native-tabs/NativeBottomTabs/types.d.ts.map +1 -1
  29. package/build/native-tabs/NativeBottomTabs/types.js.map +1 -1
  30. package/build/static/html.d.ts +7 -0
  31. package/build/static/html.d.ts.map +1 -1
  32. package/build/static/html.js +14 -0
  33. package/build/static/html.js.map +1 -1
  34. package/build/static/renderStaticContent.d.ts +6 -1
  35. package/build/static/renderStaticContent.d.ts.map +1 -1
  36. package/build/static/renderStaticContent.js +11 -2
  37. package/build/static/renderStaticContent.js.map +1 -1
  38. package/build/testing-library/context-stubs.d.ts +3 -1
  39. package/build/testing-library/context-stubs.d.ts.map +1 -1
  40. package/build/testing-library/context-stubs.js.map +1 -1
  41. package/build/ts-declarations/expo-router-internal-globals.d.ts +4 -0
  42. package/build/ts-declarations/expo-router-internal-globals.d.ts.map +1 -1
  43. package/build/ts-declarations/expo-router-internal-globals.js.map +1 -1
  44. package/build/types.d.ts +8 -0
  45. package/build/types.d.ts.map +1 -1
  46. package/build/types.js.map +1 -1
  47. package/build/utils/html.d.ts +12 -0
  48. package/build/utils/html.d.ts.map +1 -0
  49. package/build/utils/html.js +29 -0
  50. package/build/utils/html.js.map +1 -0
  51. package/ios/LinkPreview/LinkPreviewNativeActionView.swift +9 -9
  52. package/ios/LinkPreview/LinkPreviewNativeModule.swift +5 -5
  53. package/package.json +8 -8
  54. package/plugin/build/index.d.ts +2 -0
  55. package/plugin/options.json +5 -0
  56. package/plugin/src/index.ts +2 -0
  57. package/server.d.ts +15 -4
  58. package/server.js +1 -3
@@ -1 +1 @@
1
- {"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,4CAoDC;AAtFD;;;;;GAKG;AACH,+BAA6B;AAE7B,qDAA+E;AAC/E,6DAA+C;AAC/C,kDAA0B;AAC1B,wEAAmD;AACnD,wFAAwF;AACxF,uDAA+C;AAE/C,yDAAsD;AACtD,qCAAiC;AACjC,0CAAuC;AACvC,kCAA+B;AAE/B,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,CAAC;AAElE,8BAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,mBAAQ,CAAC,CAAC;AAErD,SAAS,4BAA4B;IACnC,iDAAiD;IACjD,0JAA0J;IAE1J,8FAA8F;IAC9F,yJAAyJ;IACzJ,MAAM,QAAQ,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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 { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport * as Font from 'expo-font/build/server';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport { getRootComponent } from './getRootComponent';\nimport { ctx } from '../../_ctx';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { Head } from '../head';\n\nconst debug = require('debug')('expo:router:renderStaticContent');\n\nAppRegistry.registerComponent('App', () => ExpoRoot);\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 global[contexts] = new Map<string, React.Context<any>>();\n}\n\nexport async function getStaticContent(location: URL): Promise<string> {\n const headContext: { helmet?: any } = {};\n\n const ref = React.createRef<ServerContainerRef>();\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 } = AppRegistry.getApplication('App', {\n initialProps: {\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\n const Root = getRootComponent();\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 html = await ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <ServerContainer ref={ref}>{element}</ServerContainer>\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\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"]}
1
+ {"version":3,"file":"renderStaticContent.js","sourceRoot":"","sources":["../../src/static/renderStaticContent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,4CAkEC;AA5GD;;;;;GAKG;AACH,+BAA6B;AAE7B,qDAA+E;AAC/E,6DAA+C;AAC/C,kDAA0B;AAC1B,wEAAmD;AACnD,wFAAwF;AACxF,uDAA+C;AAE/C,yDAAsD;AACtD,qCAAiC;AACjC,0CAAuC;AACvC,kCAA+B;AAC/B,iCAA6C;AAC7C,gFAA6E;AAE7E,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,iCAAiC,CAAC,CAAC;AAElE,8BAAW,CAAC,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,mBAAQ,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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 { ServerContainer, ServerContainerRef } from '@react-navigation/native';\nimport * as Font from 'expo-font/build/server';\nimport React from 'react';\nimport ReactDOMServer from 'react-dom/server.node';\n// @ts-expect-error: TODO(@kitten): Define this type (seems to differ from react-native)\nimport { AppRegistry } from 'react-native-web';\n\nimport { getRootComponent } from './getRootComponent';\nimport { ctx } from '../../_ctx';\nimport { ExpoRoot } from '../ExpoRoot';\nimport { Head } from '../head';\nimport { PreloadedDataScript } from './html';\nimport { ServerDataLoaderContext } from '../loaders/ServerDataLoaderContext';\n\nconst debug = require('debug')('expo:router:renderStaticContent');\n\nAppRegistry.registerComponent('App', () => ExpoRoot);\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 global[contexts] = new Map<string, React.Context<any>>();\n}\n\ntype GetStaticContentOptions = {\n loader?: {\n data?: any;\n };\n};\n\nexport async function getStaticContent(\n location: URL,\n options?: GetStaticContentOptions\n): Promise<string> {\n const headContext: { helmet?: any } = {};\n\n const ref = React.createRef<ServerContainerRef>();\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 } = AppRegistry.getApplication('App', {\n initialProps: {\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\n const Root = getRootComponent();\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 = options?.loader?.data ? { [location.pathname]: options.loader.data } : null;\n\n const html = await ReactDOMServer.renderToString(\n <Head.Provider context={headContext}>\n <ServerDataLoaderContext value={loadedData}>\n <ServerContainer ref={ref}>{element}</ServerContainer>\n </ServerDataLoaderContext>\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\n if (loadedData) {\n const loaderDataScript = ReactDOMServer.renderToStaticMarkup(\n <PreloadedDataScript data={loadedData} />\n );\n output = output.replace('</head>', `${loaderDataScript}</head>`);\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"]}
@@ -1,10 +1,11 @@
1
1
  import requireContext from './require-context-ponyfill';
2
- import { NativeIntent } from '../types';
2
+ import { LoaderFunction, NativeIntent } from '../types';
3
3
  export type ReactComponent = () => React.ReactElement<any, any> | null;
4
4
  export type NativeIntentStub = NativeIntent;
5
5
  export type FileStub = (Record<string, unknown> & {
6
6
  default: ReactComponent;
7
7
  unstable_settings?: Record<string, any>;
8
+ loader?: LoaderFunction;
8
9
  }) | ReactComponent;
9
10
  export type MemoryContext = Record<string, FileStub | NativeIntentStub> & {
10
11
  '+native-intent'?: NativeIntentStub;
@@ -13,6 +14,7 @@ export { requireContext };
13
14
  export declare function inMemoryContext(context: MemoryContext): ((id: string) => NativeIntent | ReactComponent | (Record<string, unknown> & {
14
15
  default: ReactComponent;
15
16
  unstable_settings?: Record<string, any>;
17
+ loader?: LoaderFunction;
16
18
  }) | {
17
19
  default: NativeIntent | FileStub;
18
20
  }) & {
@@ -1 +1 @@
1
- {"version":3,"file":"context-stubs.d.ts","sourceRoot":"","sources":["../../src/testing-library/context-stubs.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,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CAAC,SAAS,CAAC,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG;QAC7B,EAAE,EAAE,GAAG;KACR,CACF,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport requireContext from './require-context-ponyfill';\nimport { NativeIntent } from '../types';\n\nexport type ReactComponent = () => React.ReactElement<any, any> | null;\nexport type NativeIntentStub = NativeIntent;\nexport type FileStub =\n | (Record<string, unknown> & {\n default: ReactComponent;\n unstable_settings?: Record<string, any>;\n })\n | ReactComponent;\n\nexport type MemoryContext = Record<string, FileStub | NativeIntentStub> & {\n '+native-intent'?: NativeIntentStub;\n};\n\nexport { requireContext };\n\nconst validExtensions = ['.js', '.jsx', '.ts', '.tsx'];\n\nexport function inMemoryContext(context: MemoryContext) {\n return Object.assign(\n function (id: string) {\n id = id.replace(/^\\.\\//, '').replace(/\\.\\w*$/, '');\n return typeof context[id] === 'function' ? { default: context[id] } : context[id];\n },\n {\n resolve: (key: string) => key,\n id: '0',\n keys: () =>\n Object.keys(context).map((key) => {\n const ext = path.extname(key);\n key = key.replace(/^\\.\\//, '');\n key = key.startsWith('/') ? key : `./${key}`;\n key = validExtensions.includes(ext) ? key : `${key}.js`;\n\n return key;\n }),\n }\n );\n}\n\nexport function requireContextWithOverrides(dir: string, overrides: MemoryContext) {\n const existingContext = requireContext(path.resolve(process.cwd(), dir));\n\n return Object.assign(\n function (id: string) {\n if (id in overrides) {\n const route = overrides[id];\n return typeof route === 'function' ? { default: route } : route;\n } else {\n return existingContext(id);\n }\n },\n {\n keys: () => [...Object.keys(overrides), ...existingContext.keys()],\n resolve: (key: string) => key,\n id: '0',\n }\n );\n}\n"]}
1
+ {"version":3,"file":"context-stubs.js","sourceRoot":"","sources":["../../src/testing-library/context-stubs.ts"],"names":[],"mappings":";;;;;;AAuBA,0CAoBC;AAED,kEAkBC;AA/DD,gDAAwB;AAExB,0FAAwD;AAiB/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,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IAEzE,OAAO,MAAM,CAAC,MAAM,CAClB,UAAU,EAAU;QAClB,IAAI,EAAE,IAAI,SAAS,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,SAAS,CAAC,EAAE,CAAC,CAAC;YAC5B,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAClE,CAAC;aAAM,CAAC;YACN,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,EACD;QACE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,eAAe,CAAC,IAAI,EAAE,CAAC;QAClE,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG;QAC7B,EAAE,EAAE,GAAG;KACR,CACF,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport requireContext from './require-context-ponyfill';\nimport { LoaderFunction, NativeIntent } from '../types';\n\nexport type ReactComponent = () => React.ReactElement<any, any> | null;\nexport type NativeIntentStub = NativeIntent;\nexport type FileStub =\n | (Record<string, unknown> & {\n default: ReactComponent;\n unstable_settings?: Record<string, any>;\n loader?: LoaderFunction;\n })\n | ReactComponent;\n\nexport type MemoryContext = Record<string, FileStub | NativeIntentStub> & {\n '+native-intent'?: NativeIntentStub;\n};\n\nexport { requireContext };\n\nconst validExtensions = ['.js', '.jsx', '.ts', '.tsx'];\n\nexport function inMemoryContext(context: MemoryContext) {\n return Object.assign(\n function (id: string) {\n id = id.replace(/^\\.\\//, '').replace(/\\.\\w*$/, '');\n return typeof context[id] === 'function' ? { default: context[id] } : context[id];\n },\n {\n resolve: (key: string) => key,\n id: '0',\n keys: () =>\n Object.keys(context).map((key) => {\n const ext = path.extname(key);\n key = key.replace(/^\\.\\//, '');\n key = key.startsWith('/') ? key : `./${key}`;\n key = validExtensions.includes(ext) ? key : `${key}.js`;\n\n return key;\n }),\n }\n );\n}\n\nexport function requireContextWithOverrides(dir: string, overrides: MemoryContext) {\n const existingContext = requireContext(path.resolve(process.cwd(), dir));\n\n return Object.assign(\n function (id: string) {\n if (id in overrides) {\n const route = overrides[id];\n return typeof route === 'function' ? { default: route } : route;\n } else {\n return existingContext(id);\n }\n },\n {\n keys: () => [...Object.keys(overrides), ...existingContext.keys()],\n resolve: (key: string) => key,\n id: '0',\n }\n );\n}\n"]}
@@ -4,6 +4,10 @@ declare global {
4
4
  var __EXPO_REFETCH_ROUTE__: undefined | (() => void);
5
5
  var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);
6
6
  var __expo_platform_header: undefined | string;
7
+ /**
8
+ * Data injected by a server data loader for the current route.
9
+ */
10
+ var __EXPO_ROUTER_LOADER_DATA__: Record<string, any> | undefined;
7
11
  }
8
12
  export {};
9
13
  //# sourceMappingURL=expo-router-internal-globals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expo-router-internal-globals.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,6BAA6B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC9D,IAAI,oBAAoB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACnD,IAAI,sBAAsB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrD,IAAI,+BAA+B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC9D,IAAI,sBAAsB,EAAE,SAAS,GAAG,MAAM,CAAC;CAChD"}
1
+ {"version":3,"file":"expo-router-internal-globals.d.ts","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,6BAA6B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;IAC9D,IAAI,oBAAoB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACnD,IAAI,sBAAsB,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IACrD,IAAI,+BAA+B,EAAE,SAAS,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC9D,IAAI,sBAAsB,EAAE,SAAS,GAAG,MAAM,CAAC;IAC/C;;OAEG;IACH,IAAI,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;CAClE"}
@@ -1 +1 @@
1
- {"version":3,"file":"expo-router-internal-globals.js","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":";AAAA,2BAA2B","sourcesContent":["/* eslint-disable no-var */\n\ndeclare global {\n var __EXPO_RSC_RELOAD_LISTENERS__: undefined | (() => void)[];\n var __EXPO_REFETCH_RSC__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);\n var __expo_platform_header: undefined | string;\n}\n"]}
1
+ {"version":3,"file":"expo-router-internal-globals.js","sourceRoot":"","sources":["../../src/ts-declarations/expo-router-internal-globals.ts"],"names":[],"mappings":";AAAA,2BAA2B","sourcesContent":["/* eslint-disable no-var */\n\ndeclare global {\n var __EXPO_RSC_RELOAD_LISTENERS__: undefined | (() => void)[];\n var __EXPO_REFETCH_RSC__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE__: undefined | (() => void);\n var __EXPO_REFETCH_ROUTE_NO_CACHE__: undefined | (() => void);\n var __expo_platform_header: undefined | string;\n /**\n * Data injected by a server data loader for the current route.\n */\n var __EXPO_ROUTER_LOADER_DATA__: Record<string, any> | undefined;\n}\n"]}
package/build/types.d.ts CHANGED
@@ -55,5 +55,13 @@ export type NativeIntent = {
55
55
  */
56
56
  legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);
57
57
  };
58
+ /**
59
+ * Function type for route loaders. Loaders are executed on the server during
60
+ * SSR/SSG to fetch data required by a route.
61
+ */
62
+ export type LoaderFunction<T = any> = (args: {
63
+ params: Record<string, string | string[]>;
64
+ request?: Request;
65
+ }) => Promise<T> | T;
58
66
  export type * from './typed-routes/types';
59
67
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,qEAAqE;IACrE,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjF;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC7F;;;;;;;;;;OAUG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,GAA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AE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErB,mBAAmB,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * It's return value should either be a `string` or a `Promise<string>`.\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: { path: string; initial: boolean }) => Promise<string> | string;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\nexport type * from './typed-routes/types';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["// TODO: Use the global type\n/**\n * @hidden\n */\nexport interface RequireContext {\n /** Return the keys that can be resolved. */\n keys(): string[];\n (id: string): any;\n <T>(id: string): T;\n /** **Unimplemented:** Return the module identifier for a user request. */\n resolve(id: string): string;\n /** **Unimplemented:** Readable identifier for the context module. */\n id: string;\n}\n\n/**\n * The list of input keys will become optional, everything else will remain the same.\n */\nexport type PickPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\n/**\n * Created by using a special file called `+native-intent.tsx` at the top-level of your\n * project's **app** directory. It exports `redirectSystemPath` or `legacy_subscribe` functions,\n * both methods designed to handle URL/path processing.\n *\n * Useful for re-writing URLs to correctly target a route when unique/referred URLs\n * are incoming from third-party providers or stale URLs from previous versions.\n *\n * @see For more information on how to use `NativeIntent`, see [Customizing links](/router/advanced/native-intent/).\n */\nexport type NativeIntent = {\n /**\n * A special method used to process URLs in native apps. When invoked, it receives an\n * `options` object with the following properties:\n * - **path**: represents the URL or path undergoing processing.\n * - **initial**: a boolean indicating whether the path is the app's initial URL.\n *\n * It's return value should either be a `string` or a `Promise<string>`.\n * Note that throwing errors within this method may result in app crashes. It's recommended to\n * wrap your code inside a `try/catch` block and utilize `.catch()` when appropriate.\n *\n * @see For usage information, see [Redirecting system paths](/router/advanced/native-intent/#redirectsystempath).\n */\n redirectSystemPath?: (event: { path: string; initial: boolean }) => Promise<string> | string;\n /**\n * > **warning** Experimentally available in SDK 52.\n *\n * Useful as an alternative API when a third-party provider doesn't support Expo Router\n * but has support for React Navigation via `Linking.subscribe()` for existing projects.\n *\n * Using this API is not recommended for newer projects or integrations since it is\n * incompatible with Server Side Routing and\n * [Static Rendering](/router/reference/static-rendering/), and can become challenging to manage while offline or in a low network environment.\n *\n */\n legacy_subscribe?: (listener: (url: string) => void) => undefined | void | (() => void);\n};\n\n/**\n * Function type for route loaders. Loaders are executed on the server during\n * SSR/SSG to fetch data required by a route.\n */\nexport type LoaderFunction<T = any> = (args: {\n params: Record<string, string | string[]>;\n request?: Request;\n}) => Promise<T> | T;\n\nexport type * from './typed-routes/types';\n"]}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright © 2023 650 Industries.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ /**
8
+ * Replaces unsafe characters in a string with their escaped equivalents. This is to safely
9
+ * embed data in an HTML context to prevent XSS.
10
+ */
11
+ export declare function escapeUnsafeCharacters(str: string): string;
12
+ //# sourceMappingURL=html.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /**
3
+ * Copyright © 2023 650 Industries.
4
+ *
5
+ * This source code is licensed under the MIT license found in the
6
+ * LICENSE file in the root directory of this source tree.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.escapeUnsafeCharacters = escapeUnsafeCharacters;
10
+ // See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10
11
+ // License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE
12
+ // This utility is based on https://github.com/zertosh/htmlescape
13
+ // License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
14
+ const UNSAFE_CHARACTERS_REGEX = /[&><\u2028\u2029]/g;
15
+ const ESCAPED_CHARACTERS = {
16
+ '&': '\\u0026',
17
+ '>': '\\u003e',
18
+ '<': '\\u003c',
19
+ '\u2028': '\\u2028',
20
+ '\u2029': '\\u2029',
21
+ };
22
+ /**
23
+ * Replaces unsafe characters in a string with their escaped equivalents. This is to safely
24
+ * embed data in an HTML context to prevent XSS.
25
+ */
26
+ function escapeUnsafeCharacters(str) {
27
+ return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);
28
+ }
29
+ //# sourceMappingURL=html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/utils/html.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAqBH,wDAEC;AArBD,mIAAmI;AACnI,sGAAsG;AAEtG,iEAAiE;AACjE,uGAAuG;AAEvG,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AACrD,MAAM,kBAAkB,GAAgC;IACtD,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE,SAAS;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,GAAG,CAAC,OAAO,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AACpF,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\n// See: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/packages/next-urql/src/htmlescape.ts#L10\n// License: https://github.com/urql-graphql/urql/blob/ad0276ae616b2b2f2cd01a527b4217ae35c3fa2d/LICENSE\n\n// This utility is based on https://github.com/zertosh/htmlescape\n// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE\n\nconst UNSAFE_CHARACTERS_REGEX = /[&><\\u2028\\u2029]/g;\nconst ESCAPED_CHARACTERS: { [match: string]: string } = {\n '&': '\\\\u0026',\n '>': '\\\\u003e',\n '<': '\\\\u003c',\n '\\u2028': '\\\\u2028',\n '\\u2029': '\\\\u2029',\n};\n\n/**\n * Replaces unsafe characters in a string with their escaped equivalents. This is to safely\n * embed data in an HTML context to prevent XSS.\n */\nexport function escapeUnsafeCharacters(str: string): string {\n return str.replace(UNSAFE_CHARACTERS_REGEX, (match) => ESCAPED_CHARACTERS[match]);\n}\n"]}
@@ -19,7 +19,7 @@ class LinkPreviewNativeActionView: ExpoView, LinkPreviewMenuUpdatable {
19
19
  }
20
20
  }
21
21
  }
22
- var destructive: Bool = false {
22
+ var destructive: Bool? {
23
23
  didSet {
24
24
  updateUiAction()
25
25
  if isMenuAction {
@@ -29,17 +29,17 @@ class LinkPreviewNativeActionView: ExpoView, LinkPreviewMenuUpdatable {
29
29
  }
30
30
 
31
31
  // MARK: - Action only props
32
- var disabled: Bool = false {
32
+ var disabled: Bool? {
33
33
  didSet {
34
34
  updateUiAction()
35
35
  }
36
36
  }
37
- var isOn: Bool = false {
37
+ var isOn: Bool? {
38
38
  didSet {
39
39
  updateUiAction()
40
40
  }
41
41
  }
42
- var keepPresented: Bool = false {
42
+ var keepPresented: Bool? {
43
43
  didSet {
44
44
  updateUiAction()
45
45
  }
@@ -114,7 +114,7 @@ class LinkPreviewNativeActionView: ExpoView, LinkPreviewMenuUpdatable {
114
114
  if displayInline {
115
115
  options.insert(.displayInline)
116
116
  }
117
- if destructive {
117
+ if destructive == true {
118
118
  options.insert(.destructive)
119
119
  }
120
120
 
@@ -130,17 +130,17 @@ class LinkPreviewNativeActionView: ExpoView, LinkPreviewMenuUpdatable {
130
130
 
131
131
  private func updateUiAction() {
132
132
  var attributes: UIMenuElement.Attributes = []
133
- if destructive { attributes.insert(.destructive) }
134
- if disabled { attributes.insert(.disabled) }
133
+ if destructive == true { attributes.insert(.destructive) }
134
+ if disabled == true { attributes.insert(.disabled) }
135
135
 
136
136
  if #available(iOS 16.0, *) {
137
- if keepPresented { attributes.insert(.keepsMenuPresented) }
137
+ if keepPresented == true { attributes.insert(.keepsMenuPresented) }
138
138
  }
139
139
 
140
140
  baseUiAction.title = title
141
141
  baseUiAction.image = icon.flatMap { UIImage(systemName: $0) }
142
142
  baseUiAction.attributes = attributes
143
- baseUiAction.state = isOn ? .on : .off
143
+ baseUiAction.state = isOn == true ? .on : .off
144
144
 
145
145
  parentMenuUpdatable?.updateMenu()
146
146
  }
@@ -48,13 +48,13 @@ public class LinkPreviewNativeModule: Module {
48
48
  Prop("title") { (view: LinkPreviewNativeActionView, title: String) in
49
49
  view.title = title
50
50
  }
51
- Prop("icon") { (view: LinkPreviewNativeActionView, icon: String) in
51
+ Prop("icon") { (view: LinkPreviewNativeActionView, icon: String?) in
52
52
  view.icon = icon
53
53
  }
54
- Prop("disabled") { (view: LinkPreviewNativeActionView, disabled: Bool) in
54
+ Prop("disabled") { (view: LinkPreviewNativeActionView, disabled: Bool?) in
55
55
  view.disabled = disabled
56
56
  }
57
- Prop("destructive") { (view: LinkPreviewNativeActionView, destructive: Bool) in
57
+ Prop("destructive") { (view: LinkPreviewNativeActionView, destructive: Bool?) in
58
58
  view.destructive = destructive
59
59
  }
60
60
  Prop("singleSelection") { (view: LinkPreviewNativeActionView, singleSelection: Bool) in
@@ -63,10 +63,10 @@ public class LinkPreviewNativeModule: Module {
63
63
  Prop("displayAsPalette") { (view: LinkPreviewNativeActionView, displayAsPalette: Bool) in
64
64
  view.displayAsPalette = displayAsPalette
65
65
  }
66
- Prop("isOn") { (view: LinkPreviewNativeActionView, isOn: Bool) in
66
+ Prop("isOn") { (view: LinkPreviewNativeActionView, isOn: Bool?) in
67
67
  view.isOn = isOn
68
68
  }
69
- Prop("keepPresented") { (view: LinkPreviewNativeActionView, keepPresented: Bool) in
69
+ Prop("keepPresented") { (view: LinkPreviewNativeActionView, keepPresented: Bool?) in
70
70
  view.keepPresented = keepPresented
71
71
  }
72
72
  Prop("displayInline") { (view: LinkPreviewNativeActionView, displayInline: Bool) in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-router",
3
- "version": "6.0.8-canary-20250919-7a31b96",
3
+ "version": "6.1.0-canary-20250930-9dc59d3",
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",
@@ -77,12 +77,12 @@
77
77
  "expo"
78
78
  ],
79
79
  "peerDependencies": {
80
- "@expo/metro-runtime": "6.1.3-canary-20250919-7a31b96",
80
+ "@expo/metro-runtime": "6.1.3-canary-20250930-9dc59d3",
81
81
  "@react-navigation/drawer": "^7.5.0",
82
82
  "@testing-library/react-native": ">= 12.0.0",
83
- "expo": "55.0.0-canary-20250919-7a31b96",
84
- "expo-constants": "18.0.10-canary-20250919-7a31b96",
85
- "expo-linking": "8.0.9-canary-20250919-7a31b96",
83
+ "expo": "55.0.0-canary-20250930-9dc59d3",
84
+ "expo-constants": "18.0.10-canary-20250930-9dc59d3",
85
+ "expo-linking": "8.0.9-canary-20250930-9dc59d3",
86
86
  "react": "*",
87
87
  "react-dom": "*",
88
88
  "react-native": "*",
@@ -128,9 +128,9 @@
128
128
  "tsd": "^0.28.1"
129
129
  },
130
130
  "dependencies": {
131
- "@expo/metro-runtime": "6.1.3-canary-20250919-7a31b96",
132
- "@expo/schema-utils": "0.1.8-canary-20250919-7a31b96",
133
- "@expo/server": "0.7.5-canary-20250919-7a31b96",
131
+ "@expo/metro-runtime": "6.1.3-canary-20250930-9dc59d3",
132
+ "@expo/schema-utils": "0.1.8-canary-20250930-9dc59d3",
133
+ "@expo/server": "1.0.0-canary-20250930-9dc59d3",
134
134
  "@radix-ui/react-slot": "1.2.0",
135
135
  "@radix-ui/react-tabs": "^1.1.12",
136
136
  "@react-navigation/bottom-tabs": "^7.4.0",
@@ -19,5 +19,7 @@ declare const withRouter: ConfigPlugin<{
19
19
  partialTypedGroups?: boolean;
20
20
  /** Enable experimental server middleware support with a `+middleware.ts` file. Requires `web.output: 'server'` to be set in app config. */
21
21
  unstable_useServerMiddleware?: boolean;
22
+ /** Enable experimental data loader support. Requires `web.output: 'static'` to be set in app config. */
23
+ unstable_useServerDataLoaders?: boolean;
22
24
  } | void>;
23
25
  export default withRouter;
@@ -140,6 +140,11 @@
140
140
  "description": "Enable experimental server middleware support with a `+middleware.ts` file. Requires `web.output: 'server'` to be set in app config.",
141
141
  "type": "boolean",
142
142
  "default": false
143
+ },
144
+ "unstable_useServerDataLoaders": {
145
+ "description": "Enable experimental data loader support. This is only supported for `web.output: 'static'` outputs at the moment.",
146
+ "type": "boolean",
147
+ "default": false
143
148
  }
144
149
  },
145
150
  "additionalProperties": false
@@ -39,6 +39,8 @@ const withRouter: ConfigPlugin<
39
39
  partialTypedGroups?: boolean;
40
40
  /** Enable experimental server middleware support with a `+middleware.ts` file. Requires `web.output: 'server'` to be set in app config. */
41
41
  unstable_useServerMiddleware?: boolean;
42
+ /** Enable experimental data loader support. Requires `web.output: 'static'` to be set in app config. */
43
+ unstable_useServerDataLoaders?: boolean;
42
44
  } | void
43
45
  > = (config, _props) => {
44
46
  const props = _props || {};
package/server.d.ts CHANGED
@@ -1,9 +1,20 @@
1
- import { type ExpoRequest, type ExpoResponse } from '@expo/server';
2
- export { type MiddlewareFunction } from '@expo/server';
1
+ export type { MiddlewareFunction } from '@expo/server';
2
+
3
+ /**
4
+ * @deprecated Use Fetch API `Request` instead.
5
+ *
6
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
7
+ */
8
+ export type ExpoRequest = Request;
9
+
10
+ /**
11
+ * @deprecated Use Fetch API `Response` instead.
12
+ *
13
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
14
+ */
15
+ export type ExpoResponse = Response;
3
16
 
4
17
  export type RequestHandler = (
5
18
  request: Request,
6
19
  params: Record<string, string>
7
20
  ) => Response | Promise<Response>;
8
-
9
- export { ExpoRequest, ExpoResponse };
package/server.js CHANGED
@@ -1,3 +1 @@
1
- // These should be installed on the global by the server runtime to ensure faster bundling and smaller bundles.
2
- module.exports.ExpoRequest = global.ExpoRequest;
3
- module.exports.ExpoResponse = global.ExpoResponse;
1
+ // Use `@expo/server` directly instead