expo-router 6.1.0-canary-20251008-6acbc1c → 6.1.0-canary-20251009-9919e08

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 (70) hide show
  1. package/_error.js +3 -36
  2. package/build/ExpoRoot.d.ts.map +1 -1
  3. package/build/ExpoRoot.js +1 -4
  4. package/build/ExpoRoot.js.map +1 -1
  5. package/build/getRoutesCore.d.ts +1 -0
  6. package/build/getRoutesCore.d.ts.map +1 -1
  7. package/build/getRoutesCore.js.map +1 -1
  8. package/build/getServerManifest.d.ts +9 -1
  9. package/build/getServerManifest.d.ts.map +1 -1
  10. package/build/getServerManifest.js +4 -1
  11. package/build/getServerManifest.js.map +1 -1
  12. package/build/modal/web/ModalStack.d.ts.map +1 -1
  13. package/build/modal/web/ModalStack.js +20 -2
  14. package/build/modal/web/ModalStack.js.map +1 -1
  15. package/build/modal/web/ModalStackRouteDrawer.d.ts +2 -1
  16. package/build/modal/web/ModalStackRouteDrawer.d.ts.map +1 -1
  17. package/build/modal/web/ModalStackRouteDrawer.js +2 -2
  18. package/build/modal/web/ModalStackRouteDrawer.js.map +1 -1
  19. package/build/modal/web/TransparentModalStackRouteDrawer.d.ts +2 -1
  20. package/build/modal/web/TransparentModalStackRouteDrawer.d.ts.map +1 -1
  21. package/build/modal/web/TransparentModalStackRouteDrawer.js +2 -2
  22. package/build/modal/web/TransparentModalStackRouteDrawer.js.map +1 -1
  23. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +1 -1
  24. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js +5 -0
  25. package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +1 -1
  26. package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +1 -1
  27. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +9 -13
  28. package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +1 -1
  29. package/build/native-tabs/common/elements.d.ts +59 -1
  30. package/build/native-tabs/common/elements.d.ts.map +1 -1
  31. package/build/native-tabs/common/elements.js.map +1 -1
  32. package/build/renderRootComponent.d.ts.map +1 -1
  33. package/build/renderRootComponent.js +7 -5
  34. package/build/renderRootComponent.js.map +1 -1
  35. package/build/routes-manifest.js +1 -1
  36. package/build/routes-manifest.js.map +1 -1
  37. package/build/views/ErrorBoundary.js +1 -1
  38. package/build/views/ErrorBoundary.js.map +1 -1
  39. package/package.json +8 -9
  40. package/plugin/build/index.d.ts +2 -0
  41. package/plugin/options.json +17 -0
  42. package/plugin/src/index.ts +2 -0
  43. package/build/modal/Modal.d.ts +0 -95
  44. package/build/modal/Modal.d.ts.map +0 -1
  45. package/build/modal/Modal.js +0 -116
  46. package/build/modal/Modal.js.map +0 -1
  47. package/build/modal/ModalComponent.d.ts +0 -7
  48. package/build/modal/ModalComponent.d.ts.map +0 -1
  49. package/build/modal/ModalComponent.js +0 -10
  50. package/build/modal/ModalComponent.js.map +0 -1
  51. package/build/modal/ModalContext.d.ts +0 -15
  52. package/build/modal/ModalContext.d.ts.map +0 -1
  53. package/build/modal/ModalContext.js +0 -90
  54. package/build/modal/ModalContext.js.map +0 -1
  55. package/build/modal/ModalsRenderer.d.ts +0 -3
  56. package/build/modal/ModalsRenderer.d.ts.map +0 -1
  57. package/build/modal/ModalsRenderer.js +0 -47
  58. package/build/modal/ModalsRenderer.js.map +0 -1
  59. package/build/modal/ModalsRenderer.web.d.ts +0 -3
  60. package/build/modal/ModalsRenderer.web.d.ts.map +0 -1
  61. package/build/modal/ModalsRenderer.web.js +0 -37
  62. package/build/modal/ModalsRenderer.web.js.map +0 -1
  63. package/build/modal/types.d.ts +0 -19
  64. package/build/modal/types.d.ts.map +0 -1
  65. package/build/modal/types.js +0 -3
  66. package/build/modal/types.js.map +0 -1
  67. package/build/modal/utils.d.ts +0 -7
  68. package/build/modal/utils.d.ts.map +0 -1
  69. package/build/modal/utils.js +0 -60
  70. package/build/modal/utils.js.map +0 -1
package/_error.js CHANGED
@@ -1,37 +1,4 @@
1
- import LogBoxInspectorContainer from '@expo/log-box/src/logbox-web-polyfill';
2
- import { AppRegistry, Platform } from 'react-native';
1
+ import { LogBoxInspectorContainer } from '@expo/metro-runtime/src/error-overlay/ErrorOverlay';
2
+ import { registerRootComponent } from 'expo';
3
3
 
4
- registerRootComponentInShadowDOM(LogBoxInspectorContainer);
5
-
6
- function registerRootComponentInShadowDOM(component) {
7
- AppRegistry.registerComponent('main', () => component);
8
-
9
- if (Platform.OS !== 'web' || !window) {
10
- console.error('expo-router/_error can be rendered only on Web.');
11
- return;
12
- }
13
-
14
- const host = window.document.getElementById('root');
15
- if (!host) {
16
- throw new Error('Required HTML element with id "root" was not found in the document HTML.');
17
- }
18
-
19
- const shadow = host.attachShadow({ mode: 'open' });
20
- const rootTag = window.document.createElement('div');
21
- rootTag.id = 'shadow-root';
22
- shadow.appendChild(rootTag);
23
-
24
- AppRegistry.runApplication('main', {
25
- rootTag,
26
- });
27
-
28
- // NOTE(@krystofwoldrich): Same as `react-native-stylesheet`
29
- // I would expect the loaded css to be attached to the shadow host (not document head)
30
- // For now we need to copy the styles manually
31
- window.document.querySelectorAll('style').forEach((styleEl) => {
32
- const isHmrLoadedCss = !!styleEl.getAttribute('data-expo-css-hmr');
33
- if (isHmrLoadedCss) {
34
- shadow.appendChild(styleEl.cloneNode(true));
35
- }
36
- });
37
- }
4
+ registerRootComponent(LogBoxInspectorContainer);
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.d.ts","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAY,KAAK,aAAa,EAAW,MAAM,OAAO,CAAC;AAO7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQxD,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAMzC,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,cAAc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O,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtE,CAAC;AAgBF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAwB,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,qBA2BtF"}
package/build/ExpoRoot.js CHANGED
@@ -47,7 +47,6 @@ const serverLocationContext_1 = require("./global-state/serverLocationContext");
47
47
  const storeContext_1 = require("./global-state/storeContext");
48
48
  const utils_1 = require("./global-state/utils");
49
49
  const LinkPreviewContext_1 = require("./link/preview/LinkPreviewContext");
50
- const ModalContext_1 = require("./modal/ModalContext");
51
50
  const primitives_1 = require("./primitives");
52
51
  const statusbar_1 = require("./utils/statusbar");
53
52
  const Sitemap_1 = require("./views/Sitemap");
@@ -145,9 +144,7 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
145
144
  <NavigationContainer_1.NavigationContainer ref={store.navigationRef} initialState={store.state} linking={store.linking} onUnhandledAction={onUnhandledAction} documentTitle={documentTitle} onReady={store.onReady}>
146
145
  <serverLocationContext_1.ServerContext.Provider value={serverContext}>
147
146
  <WrapperComponent>
148
- <ModalContext_1.ModalContextProvider>
149
- <Content />
150
- </ModalContext_1.ModalContextProvider>
147
+ <Content />
151
148
  </WrapperComponent>
152
149
  </serverLocationContext_1.ServerContext.Provider>
153
150
  </NavigationContainer_1.NavigationContainer>
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4Db,4BA2BC;AArFD,qDAKkC;AAClC,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,2CAA2F;AAC3F,yFAAsF;AACtF,oEAAgG;AAEhG,8DAA8D;AAC9D,gFAAwF;AACxF,8DAA2D;AAC3D,gDAAiF;AACjF,0EA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uilder,\n} from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { shouldAppendNotFound, shouldAppendSitemap } from './global-state/utils';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { ModalContextProvider } from './modal/ModalContext';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport { Sitemap } from './views/Sitemap';\nimport * as SplashScreen from './views/Splash';\nimport { Unmatched } from './views/Unmatched';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = useMemo(\n () =>\n ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <LinkPreviewContextProvider>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {canOverrideStatusBarBehavior && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </LinkPreviewContextProvider>\n </ParentWrapper>\n );\n },\n [ParentWrapper]\n );\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n return (\n <StoreContext.Provider value={store}>\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.state}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <ModalContextProvider>\n <Content />\n </ModalContextProvider>\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n </StoreContext.Provider>\n );\n}\n\nfunction Content() {\n const children = [<Screen name={INTERNAL_SLOT_NAME} component={store.rootComponent} />];\n if (shouldAppendNotFound()) {\n children.push(<Screen name={NOT_FOUND_ROUTE_NAME} component={Unmatched} />);\n }\n if (shouldAppendSitemap()) {\n children.push(<Screen name={SITEMAP_ROUTE_NAME} component={Sitemap} />);\n }\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children,\n id: INTERNAL_SLOT_NAME,\n });\n\n return (\n <NavigationContent>{descriptors[state.routes[state.index].key].render()}</NavigationContent>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
1
+ {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2Db,4BA2BC;AApFD,qDAKkC;AAClC,+CAA6F;AAC7F,+CAAmE;AACnE,mFAAkE;AAElE,2CAA2F;AAC3F,yFAAsF;AACtF,oEAAgG;AAEhG,8DAA8D;AAC9D,gFAAwF;AACxF,8DAA2D;AAC3D,gDAAiF;AACjF,0EAA+E;AAC/E,6CAAsC;AAEtC,iDAAiE;AACjE,6CAA0C;AAC1C,6DAA+C;AAC/C,iDAA8C;AAgB9C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAAC;AAElD,MAAM,eAAe,GACnB,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,SAAS;IAChC,CAAC,CAAC;QACE,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QAC1C,MAAM,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;KACjD;IACH,CAAC,CAAC,SAAS,CAAC;AAEhB,MAAM,aAAa,GAAG;IACpB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF;;GAEG;AACH,SAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,aAAa,GAAG,gBAAQ,EAAE,GAAG,KAAK,EAAiB;IACrF;;;;OAIG;IACH,MAAM,OAAO,GAAG,IAAA,eAAO,EACrB,GAAG,E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,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;QACV,CAAC;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;YACpC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;AACJ,CAAC;KAAM,CAAC;IACN,iBAAiB,GAAG,cAAa,CAAC,CAAC;AACrC,CAAC","sourcesContent":["'use client';\n\nimport {\n LinkingOptions,\n NavigationAction,\n StackRouter,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { StatusBar, useColorScheme, Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport { INTERNAL_SLOT_NAME, NOT_FOUND_ROUTE_NAME, SITEMAP_ROUTE_NAME } from './constants';\nimport { useDomComponentNavigation } from './domComponents/useDomComponentNavigation';\nimport { NavigationContainer as UpstreamNavigationContainer } from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { store, useStore } from './global-state/router-store';\nimport { ServerContext, ServerContextType } from './global-state/serverLocationContext';\nimport { StoreContext } from './global-state/storeContext';\nimport { shouldAppendNotFound, shouldAppendSitemap } from './global-state/utils';\nimport { LinkPreviewContextProvider } from './link/preview/LinkPreviewContext';\nimport { Screen } from './primitives';\nimport { RequireContext } from './types';\nimport { canOverrideStatusBarBehavior } from './utils/statusbar';\nimport { Sitemap } from './views/Sitemap';\nimport * as SplashScreen from './views/Splash';\nimport { Unmatched } from './views/Unmatched';\n\nexport type ExpoRootProps = {\n context: RequireContext;\n location?: URL | string;\n wrapper?: ComponentType<PropsWithChildren>;\n linking?: Partial<ExpoLinkingOptions>;\n};\n\nexport type NativeIntent = {\n redirectSystemPath?: (event: {\n path: string | null;\n initial: boolean;\n }) => Promise<string | null | undefined> | string | null | undefined;\n};\n\nconst isTestEnv = process.env.NODE_ENV === 'test';\n\nconst INITIAL_METRICS =\n Platform.OS === 'web' || isTestEnv\n ? {\n frame: { x: 0, y: 0, width: 0, height: 0 },\n insets: { top: 0, left: 0, right: 0, bottom: 0 },\n }\n : undefined;\n\nconst documentTitle = {\n enabled: false,\n};\n\n/**\n * @hidden\n */\nexport function ExpoRoot({ wrapper: ParentWrapper = Fragment, ...props }: ExpoRootProps) {\n /*\n * Due to static rendering we need to wrap these top level views in second wrapper\n * View's like <SafeAreaProvider /> generate a <div> so if the parent wrapper\n * is a HTML document, we need to ensure its inside the <body>\n */\n const wrapper = useMemo(\n () =>\n ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <LinkPreviewContextProvider>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {canOverrideStatusBarBehavior && <AutoStatusBar />}\n {children}\n </SafeAreaProvider>\n </LinkPreviewContextProvider>\n </ParentWrapper>\n );\n },\n [ParentWrapper]\n );\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\n}\n\nfunction AutoStatusBar() {\n return <StatusBar barStyle={useColorScheme() === 'light' ? 'dark-content' : 'light-content'} />;\n}\n\nconst initialUrl =\n Platform.OS === 'web' && typeof window !== 'undefined'\n ? new URL(window.location.href)\n : undefined;\n\nfunction ContextNavigator({\n context,\n location: initialLocation = initialUrl,\n wrapper: WrapperComponent = Fragment,\n linking = {},\n}: ExpoRootProps) {\n // location and linking.getInitialURL are both used to initialize the router state\n // - location is used on web and during static rendering\n // - linking.getInitialURL is used on native\n const serverContext = useMemo(() => {\n let contextType: ServerContextType = {};\n\n if (initialLocation instanceof URL) {\n contextType = {\n location: {\n pathname: initialLocation.pathname + initialLocation.hash,\n search: initialLocation.search,\n },\n };\n } else if (typeof initialLocation === 'string') {\n // The initial location is a string, so we need to parse it into a URL.\n const url = new URL(initialLocation, 'http://placeholder.base');\n contextType = {\n location: {\n pathname: url.pathname,\n search: url.search,\n },\n };\n }\n\n return contextType;\n }, []);\n\n /*\n * The serverUrl is an initial URL used in server rendering environments.\n * e.g Static renders, units tests, etc\n */\n const serverUrl = serverContext.location\n ? `${serverContext.location.pathname}${serverContext.location.search}`\n : undefined;\n\n const store = useStore(context, linking, serverUrl);\n\n useDomComponentNavigation();\n\n if (store.shouldShowTutorial()) {\n SplashScreen.hideAsync();\n if (process.env.NODE_ENV === 'development') {\n const Tutorial = require('./onboard/Tutorial').Tutorial;\n return (\n <WrapperComponent>\n <Tutorial />\n </WrapperComponent>\n );\n } else {\n // Ensure tutorial styles are stripped in production.\n return null;\n }\n }\n\n return (\n <StoreContext.Provider value={store}>\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.state}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={documentTitle}\n onReady={store.onReady}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Content />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\n </StoreContext.Provider>\n );\n}\n\nfunction Content() {\n const children = [<Screen name={INTERNAL_SLOT_NAME} component={store.rootComponent} />];\n if (shouldAppendNotFound()) {\n children.push(<Screen name={NOT_FOUND_ROUTE_NAME} component={Unmatched} />);\n }\n if (shouldAppendSitemap()) {\n children.push(<Screen name={SITEMAP_ROUTE_NAME} component={Sitemap} />);\n }\n const { state, descriptors, NavigationContent } = useNavigationBuilder(StackRouter, {\n children,\n id: INTERNAL_SLOT_NAME,\n });\n\n return (\n <NavigationContent>{descriptors[state.routes[state.index].key].render()}</NavigationContent>\n );\n}\n\nlet onUnhandledAction: (action: NavigationAction) => void;\n\nif (process.env.NODE_ENV !== 'production') {\n onUnhandledAction = (action: NavigationAction) => {\n const payload: Record<string, any> | undefined = action.payload;\n\n let message = `The action '${action.type}'${\n payload ? ` with payload ${JSON.stringify(action.payload)}` : ''\n } was not handled by any navigator.`;\n\n switch (action.type) {\n case 'NAVIGATE':\n case 'PUSH':\n case 'REPLACE':\n case 'JUMP_TO':\n if (payload?.name) {\n message += `\\n\\nDo you have a route named '${payload.name}'?`;\n } else {\n message += `\\n\\nYou need to pass the name of the screen to navigate to. This may be a bug.`;\n }\n\n break;\n case 'GO_BACK':\n case 'POP':\n case 'POP_TO_TOP':\n message += `\\n\\nIs there any screen to go back to?`;\n break;\n case 'OPEN_DRAWER':\n case 'CLOSE_DRAWER':\n case 'TOGGLE_DRAWER':\n message += `\\n\\nIs your screen inside a Drawer navigator?`;\n break;\n }\n\n message += `\\n\\nThis is a development-only warning and won't be shown in production.`;\n\n if (process.env.NODE_ENV === 'test') {\n throw new Error(message);\n }\n console.error(message);\n };\n} else {\n onUnhandledAction = function () {};\n}\n"]}
@@ -15,6 +15,7 @@ export type Options = {
15
15
  platform?: string;
16
16
  redirects?: RedirectConfig[];
17
17
  rewrites?: RewriteConfig[];
18
+ headers?: Record<string, string | string[]>;
18
19
  preserveRedirectAndRewrites?: boolean;
19
20
  /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */
20
21
  getSystemRoute: (route: Pick<RouteNode, 'route' | 'type'> & {
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesCore.d.ts","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAkB,SAAS,EAAE,MAAM,SAAS,CAAC;AAW5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC,aAAa,CAAC,EAAE,OA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nG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, MiddlewareNode, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n /* Enable experimental server middleware support */\n unstable_useServerMiddleware?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (\n route: Pick<RouteNode, 'route' | 'type'> & {\n defaults?: RouteNode;\n redirectConfig?: RedirectConfig;\n rewriteConfig?: RewriteConfig;\n }\n ) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const middleware = getMiddleware(contextModule, options);\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (middleware) {\n rootNode.middleware = middleware;\n }\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Given a RequireContext, return the middleware node if one is found. If more than one middleware file is found, an error is thrown.\n */\nfunction getMiddleware(contextModule: RequireContext, options: Options): MiddlewareNode | null {\n const allMiddlewareFiles = contextModule.keys().filter((key) => key.includes('+middleware'));\n\n // Check if middleware is enabled via plugin config\n if (!options.unstable_useServerMiddleware) {\n if (allMiddlewareFiles.length > 0) {\n console.warn(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.\\n\\n' +\n JSON.stringify(\n {\n expo: {\n plugins: [['expo-router', { unstable_useServerMiddleware: true }]],\n },\n },\n null,\n 2\n )\n );\n }\n return null;\n }\n\n const isValidMiddleware = (key: string) => /^\\.\\/\\+middleware\\.[tj]sx?$/.test(key);\n\n const rootMiddlewareFiles = allMiddlewareFiles.filter(isValidMiddleware);\n\n const nonRootMiddleware = allMiddlewareFiles.filter(\n (file) => !rootMiddlewareFiles.includes(file)\n );\n if (nonRootMiddleware.length > 0) {\n throw new Error(\n `The middleware file can only be placed at the root level. Remove the following files: ${nonRootMiddleware.join(', ')}`\n );\n }\n\n if (rootMiddlewareFiles.length === 0) {\n return null;\n }\n\n // In development, throw an error if there are multiple root-level middleware files\n if (rootMiddlewareFiles.length > 1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${rootMiddlewareFiles.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n const middlewareFilePath = rootMiddlewareFiles[0];\n\n const middleware: MiddlewareNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(middlewareFilePath);\n } catch {\n return {};\n }\n } else {\n return contextModule(middlewareFilePath);\n }\n },\n contextKey: middlewareFilePath,\n };\n\n if (options.internal_stripLoadRoute) {\n delete (middleware as any).loadRoute;\n }\n\n return middleware;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n // Always ignore middleware files in regular route processing\n ignoreList.push(/\\+middleware$/, /\\+middleware\\.[tj]sx?$/);\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: { contextKey: string; nameWithoutInvisible: string }[] | undefined;\n\n const getValidDestinations = () => {\n // Loop over contexts once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return {\n contextKey: key,\n nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath(\n removeSupportedExtensions(key)\n ),\n };\n });\n return validRedirectDestinations;\n };\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);\n const sourceName = getNameFromRedirectPath(redirect.source);\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestinationName = isExternalRedirect\n ? redirect.destination\n : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = isExternalRedirect\n ? undefined\n : getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = isExternalRedirect\n ? targetDestinationName\n : validDestination?.nameWithoutInvisible;\n const destinationContextKey = isExternalRedirect\n ? targetDestinationName\n : validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n redirects[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);\n const sourceName = getNameFromRedirectPath(rewrite.source);\n\n // We check to see if the context key is already known so that we don't create a rewrite for\n // a route that already exists on disk\n const isSourceContextKeyAlreadyKnown = contextKeys.includes(sourceContextKey);\n const targetDestinationName = isSourceContextKeyAlreadyKnown\n ? getNameFromRedirectPath(rewrite.destination)\n : getNameWithoutInvisibleSegmentsFromRedirectPath(rewrite.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = validDestination?.nameWithoutInvisible;\n const destinationContextKey = validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Rewrite destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n rewrites[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n methods: rewrite.methods,\n };\n }\n }\n }\n\n const processedRedirectsRewrites = new Set<string>();\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n\n // Validate loader export in development\n const loaderExport = routeModule?.loader;\n if (loaderExport && typeof loaderExport !== 'function') {\n throw new Error(`Route \"${filePath}\" exports a loader that is not a function.`);\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const redirect = redirects[meta.route];\n node.destinationContextKey = redirect.destinationContextKey;\n node.permanent = redirect.permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'redirect',\n route: redirect.destination,\n defaults: node,\n redirectConfig: redirect,\n });\n }\n if (redirect.methods) {\n node.methods = redirect.methods;\n }\n node.type = 'redirect';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (meta.isRewrite) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const rewrite = rewrites[meta.route];\n node.destinationContextKey = rewrite.destinationContextKey;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'rewrite',\n route: rewrite.destination,\n defaults: node,\n rewriteConfig: rewrite,\n });\n }\n if (rewrite.methods) {\n node.methods = rewrite.methods;\n }\n node.type = 'rewrite';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\nfunction getNameFromRedirectPath(path: string): string {\n // Removing only the filesystem extensions, to be able to handle +api, +html\n return (\n removeFileSystemExtensions(removeFileSystemDots(path))\n // Remove the leading `/`\n .replace(/^\\//, '')\n );\n}\n\nfunction getNameWithoutInvisibleSegmentsFromRedirectPath(path: string): string {\n return stripInvisibleSegmentsFromPath(getNameFromRedirectPath(path));\n}\n\n// Creates fake context key for redirects and rewrites\nfunction getSourceContextKeyFromRedirectSource(source: string): string {\n const name = getNameFromRedirectPath(source);\n const prefix = './';\n const suffix = /\\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension\n return `${prefix}${name}${suffix}`;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RewriteConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
1
+ {"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAmFA,8BAoBC;AA4oBD,8CAwBC;AAED,0CAgBC;AA5xBD,yCASoB;AAEpB,qCAAmD;AAyDnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/D,yBAAyB;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,UAAU,EAAE,CAAC;QACf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AAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,KAAK,GAAG,CAAC;qBAClC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAEd,IAAI,SAAS,EAAE,CAAC;oBACd,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,iBAAiB,SAAS,0BAA0B,iBAAiB,EAAE,CAC/H,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,yBAAyB,iBAAiB,EAAE,CACpG,CAAC;gBACJ,CAAC;YACH,CAAC;YAED,2GAA2G;YAC3G,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC;YAC/B,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,wCAAwC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, MiddlewareNode, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n /* Enable experimental server middleware support */\n unstable_useServerMiddleware?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n headers?: Record<string, string | string[]>;\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (\n route: Pick<RouteNode, 'route' | 'type'> & {\n defaults?: RouteNode;\n redirectConfig?: RedirectConfig;\n rewriteConfig?: RewriteConfig;\n }\n ) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n destinationContextKey: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const middleware = getMiddleware(contextModule, options);\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (middleware) {\n rootNode.middleware = middleware;\n }\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Given a RequireContext, return the middleware node if one is found. If more than one middleware file is found, an error is thrown.\n */\nfunction getMiddleware(contextModule: RequireContext, options: Options): MiddlewareNode | null {\n const allMiddlewareFiles = contextModule.keys().filter((key) => key.includes('+middleware'));\n\n // Check if middleware is enabled via plugin config\n if (!options.unstable_useServerMiddleware) {\n if (allMiddlewareFiles.length > 0) {\n console.warn(\n 'Server middleware is not enabled. Add unstable_useServerMiddleware: true to your `expo-router` plugin config.\\n\\n' +\n JSON.stringify(\n {\n expo: {\n plugins: [['expo-router', { unstable_useServerMiddleware: true }]],\n },\n },\n null,\n 2\n )\n );\n }\n return null;\n }\n\n const isValidMiddleware = (key: string) => /^\\.\\/\\+middleware\\.[tj]sx?$/.test(key);\n\n const rootMiddlewareFiles = allMiddlewareFiles.filter(isValidMiddleware);\n\n const nonRootMiddleware = allMiddlewareFiles.filter(\n (file) => !rootMiddlewareFiles.includes(file)\n );\n if (nonRootMiddleware.length > 0) {\n throw new Error(\n `The middleware file can only be placed at the root level. Remove the following files: ${nonRootMiddleware.join(', ')}`\n );\n }\n\n if (rootMiddlewareFiles.length === 0) {\n return null;\n }\n\n // In development, throw an error if there are multiple root-level middleware files\n if (rootMiddlewareFiles.length > 1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `Only one middleware file is allowed. Keep one of the conflicting files: ${rootMiddlewareFiles.map((p) => `\"${p}\"`).join(' or ')}`\n );\n }\n }\n\n const middlewareFilePath = rootMiddlewareFiles[0];\n\n const middleware: MiddlewareNode = {\n loadRoute() {\n if (options.ignoreRequireErrors) {\n try {\n return contextModule(middlewareFilePath);\n } catch {\n return {};\n }\n } else {\n return contextModule(middlewareFilePath);\n }\n },\n contextKey: middlewareFilePath,\n };\n\n if (options.internal_stripLoadRoute) {\n delete (middleware as any).loadRoute;\n }\n\n return middleware;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n // Always ignore middleware files in regular route processing\n ignoreList.push(/\\+middleware$/, /\\+middleware\\.[tj]sx?$/);\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: { contextKey: string; nameWithoutInvisible: string }[] | undefined;\n\n const getValidDestinations = () => {\n // Loop over contexts once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return {\n contextKey: key,\n nameWithoutInvisible: getNameWithoutInvisibleSegmentsFromRedirectPath(\n removeSupportedExtensions(key)\n ),\n };\n });\n return validRedirectDestinations;\n };\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(redirect.source);\n const sourceName = getNameFromRedirectPath(redirect.source);\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestinationName = isExternalRedirect\n ? redirect.destination\n : getNameWithoutInvisibleSegmentsFromRedirectPath(redirect.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = isExternalRedirect\n ? undefined\n : getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = isExternalRedirect\n ? targetDestinationName\n : validDestination?.nameWithoutInvisible;\n const destinationContextKey = isExternalRedirect\n ? targetDestinationName\n : validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n redirects[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n const sourceContextKey = getSourceContextKeyFromRedirectSource(rewrite.source);\n const sourceName = getNameFromRedirectPath(rewrite.source);\n\n // We check to see if the context key is already known so that we don't create a rewrite for\n // a route that already exists on disk\n const isSourceContextKeyAlreadyKnown = contextKeys.includes(sourceContextKey);\n const targetDestinationName = isSourceContextKeyAlreadyKnown\n ? getNameFromRedirectPath(rewrite.destination)\n : getNameWithoutInvisibleSegmentsFromRedirectPath(rewrite.destination);\n\n if (ignoreList.some((regex) => regex.test(sourceContextKey))) {\n continue;\n }\n\n const validDestination = getValidDestinations().find(\n (key) => key.nameWithoutInvisible === targetDestinationName\n );\n const destination = validDestination?.nameWithoutInvisible;\n const destinationContextKey = validDestination?.contextKey;\n\n if (!destinationContextKey || destination === undefined) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Rewrite destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n contextKeys.push(sourceContextKey);\n rewrites[sourceName] = {\n source: sourceName,\n destination,\n destinationContextKey,\n methods: rewrite.methods,\n };\n }\n }\n }\n\n const processedRedirectsRewrites = new Set<string>();\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n\n // Validate loader export in development\n const loaderExport = routeModule?.loader;\n if (loaderExport && typeof loaderExport !== 'function') {\n throw new Error(`Route \"${filePath}\" exports a loader that is not a function.`);\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const redirect = redirects[meta.route];\n node.destinationContextKey = redirect.destinationContextKey;\n node.permanent = redirect.permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'redirect',\n route: redirect.destination,\n defaults: node,\n redirectConfig: redirect,\n });\n }\n if (redirect.methods) {\n node.methods = redirect.methods;\n }\n node.type = 'redirect';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (meta.isRewrite) {\n if (processedRedirectsRewrites.has(meta.route)) {\n continue;\n }\n\n const rewrite = rewrites[meta.route];\n node.destinationContextKey = rewrite.destinationContextKey;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute({\n type: 'rewrite',\n route: rewrite.destination,\n defaults: node,\n rewriteConfig: rewrite,\n });\n }\n if (rewrite.methods) {\n node.methods = rewrite.methods;\n }\n node.type = 'rewrite';\n processedRedirectsRewrites.add(meta.route);\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\nfunction getNameFromRedirectPath(path: string): string {\n // Removing only the filesystem extensions, to be able to handle +api, +html\n return (\n removeFileSystemExtensions(removeFileSystemDots(path))\n // Remove the leading `/`\n .replace(/^\\//, '')\n );\n}\n\nfunction getNameWithoutInvisibleSegmentsFromRedirectPath(path: string): string {\n return stripInvisibleSegmentsFromPath(getNameFromRedirectPath(path));\n}\n\n// Creates fake context key for redirects and rewrites\nfunction getSourceContextKeyFromRedirectSource(source: string): string {\n const name = getNameFromRedirectPath(source);\n const prefix = './';\n const suffix = /\\.[tj]sx?$/.test(name) ? '' : '.js'; // Ensure it has a file extension\n return `${prefix}${name}${suffix}`;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RewriteConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Rename it to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `API routes cannot have platform extensions. Remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n return matchDynamicName(part) ?? null;\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
@@ -42,6 +42,10 @@ export type ExpoRouterServerManifestV1<TRegex = string> = {
42
42
  * Only allowed at the root level and requires web.output: "server".
43
43
  */
44
44
  middleware?: ExpoRouterServerManifestV1Middleware;
45
+ /**
46
+ * Headers to be applied to all responses from the server.
47
+ */
48
+ headers?: Record<string, string | string[]>;
45
49
  /**
46
50
  * Rewrites. After middleware has processed and regular routing resumes, these occur first.
47
51
  */
@@ -71,10 +75,14 @@ export interface RouteRegex {
71
75
  groups: Record<string, Group>;
72
76
  re: RegExp;
73
77
  }
74
- export declare function getServerManifest(route: RouteNode): ExpoRouterServerManifestV1;
78
+ type GetServerManifestOptions = {
79
+ headers?: Record<string, string | string[]>;
80
+ };
81
+ export declare function getServerManifest(route: RouteNode, options?: GetServerManifestOptions): ExpoRouterServerManifestV1;
75
82
  export declare function parseParameter(param: string): {
76
83
  name: string;
77
84
  repeat: boolean;
78
85
  optional: boolean;
79
86
  };
87
+ export {};
80
88
  //# sourceMappingURL=getServerManifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getServerManifest.d.ts","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMzC,MAAM,MAAM,+BAA+B,CAAC,MAAM,GAAG,MAAM,IAAI;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC,MAAM,EAA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IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC9B,EAAE,EAAE,MAAM,CAAC;CACZ;AAqBD,KAAK,wBAAwB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;CAC7C,CAAC;AAGF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,EAChB,OAAO,CAAC,EAAE,wBAAwB,GACjC,0BAA0B,CA8F5B;AA6JD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM;;;;EAgB3C"}
@@ -20,7 +20,7 @@ function uniqueBy(arr, key) {
20
20
  });
21
21
  }
22
22
  // Given a nested route tree, return a flattened array of all routes that can be matched.
23
- function getServerManifest(route) {
23
+ function getServerManifest(route, options) {
24
24
  function getFlatNodes(route, parentRoute = '') {
25
25
  // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.
26
26
  const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');
@@ -83,6 +83,9 @@ function getServerManifest(route) {
83
83
  file: route.middleware.contextKey,
84
84
  };
85
85
  }
86
+ if (options?.headers) {
87
+ manifest.headers = options.headers;
88
+ }
86
89
  return manifest;
87
90
  }
88
91
  function getMatchableManifestForPaths(paths) {
@@ -1 +1 @@
1
- {"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":";;AAuGA,8CA0FC;AA6JD,wCAgBC;AApWD,yCAA2D;AAC3D,6CAA0C;AAC1C,qCAAmD;AAuEnD,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAI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AgB,cAAc,CAAC,KAAa;IAC1C,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC1B,QAAQ,GAAG,IAAI,CAAC;QAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,uBAAuB,CAAC,UAAkB;IACjD,OAAO,IAAA,wBAAa,EAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;AAClE,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright © 2023 Vercel, Inc.\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 * Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts\n */\nimport type { RouteNode } from './Route';\nimport { getContextKey, matchGroupName } from './matchers';\nimport { sortRoutes } from './sortRoutes';\nimport { shouldLinkExternally } from './utils/url';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n /**\n * Keys are route param names that have been normalized for a regex named-matcher, values are the original route param names.\n */\n routeKeys: Record<string, string>;\n /**\n * Regex for matching a path against the route.\n * The regex is normalized for named matchers so keys must be looked up against the `routeKeys` object to collect the original route param names.\n * Regex matching alone cannot accurately route to a file, the order in which routes are matched is equally important to ensure correct priority.\n */\n namedRegex: TRegex;\n /** Indicates that the route was generated and does not map to any file in the project's routes directory. */\n generated?: boolean;\n /** Indicates that this is a redirect that should use 301 instead of 307 */\n permanent?: boolean;\n /** If a redirect, which methods are allowed. Undefined represents all methods */\n methods?: string[];\n};\n\nexport type ExpoRouterServerManifestV1Middleware = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n /**\n * Middleware function that runs before any route matching.\n * Only allowed at the root level and requires web.output: \"server\".\n */\n middleware?: ExpoRouterServerManifestV1Middleware;\n /**\n * Rewrites. After middleware has processed and regular routing resumes, these occur first.\n */\n rewrites: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * List of routes that match second. Returns 301 and redirects to another path.\n */\n redirects: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that return static HTML files for a given path.\n * These are only matched against requests with method `GET` and `HEAD`.\n */\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that are matched after HTML routes and invoke WinterCG-compliant functions.\n */\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /** List of routes that are matched last and return with status code 404. */\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nexport interface Group {\n pos: number;\n repeat: boolean;\n optional: boolean;\n}\n\nexport interface RouteRegex {\n groups: Record<string, Group>;\n re: RegExp;\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\nfunction uniqueBy<T>(arr: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return arr.filter((item) => {\n const id = key(item);\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n}\n\n// TODO(@hassankhan): ENG-16575\ntype FlatNodeTuple = [contextKey: string, absoluteRoute: string, node: RouteNode];\n\n// Given a nested route tree, return a flattened array of all routes that can be matched.\nexport function getServerManifest(route: RouteNode): ExpoRouterServerManifestV1 {\n function getFlatNodes(route: RouteNode, parentRoute: string = ''): FlatNodeTuple[] {\n // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.\n const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');\n\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child, absoluteRoute)).flat();\n }\n\n // API Routes are handled differently to HTML routes because they have no nested behavior.\n // An HTML route can be different based on parent segments due to layout routes, therefore multiple\n // copies should be rendered. However, an API route is always the same regardless of parent segments.\n let key: string;\n if (route.type.includes('api')) {\n key = getNormalizedContextKey(route.contextKey);\n } else {\n key = getNormalizedContextKey(absoluteRoute);\n }\n return [[key, '/' + absoluteRoute, route]];\n }\n\n // Remove duplicates from the runtime manifest which expands array syntax.\n const flat = getFlatNodes(route)\n .sort(([, , a], [, , b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = uniqueBy(\n flat.filter(([, , route]) => route.type === 'api'),\n ([path]) => path\n );\n\n const otherRoutes = uniqueBy(\n flat.filter(\n ([, , route]) =>\n route.type === 'route' ||\n (route.type === 'rewrite' && (route.methods === undefined || route.methods.includes('GET')))\n ),\n ([path]) => path\n );\n\n const redirects = uniqueBy(\n flat.filter(([, , route]) => route.type === 'redirect'),\n ([path]) => path\n )\n .map((redirect) => {\n // TODO(@hassankhan): ENG-16577\n // For external redirects, use `destinationContextKey` as the destination URL\n if (shouldLinkExternally(redirect[2].destinationContextKey!)) {\n redirect[1] = redirect[2].destinationContextKey!;\n } else {\n redirect[1] =\n flat.find(([, , route]) => route.contextKey === redirect[2].destinationContextKey)?.[0] ??\n '/';\n }\n\n return redirect;\n })\n .reverse();\n\n const rewrites = uniqueBy(\n flat.filter(([, , route]) => route.type === 'rewrite'),\n ([path]) => path\n )\n .map((rewrite) => {\n rewrite[1] =\n flat.find(([, , route]) => route.contextKey === rewrite[2].destinationContextKey)?.[0] ??\n '/';\n\n return rewrite;\n })\n .reverse();\n\n const standardRoutes = otherRoutes.filter(([, , route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, , route]) => isNotFoundRoute(route));\n\n const manifest: ExpoRouterServerManifestV1 = {\n apiRoutes: getMatchableManifestForPaths(apiRoutes),\n htmlRoutes: getMatchableManifestForPaths(standardRoutes),\n notFoundRoutes: getMatchableManifestForPaths(notFoundRoutes),\n redirects: getMatchableManifestForPaths(redirects),\n rewrites: getMatchableManifestForPaths(rewrites),\n };\n\n if (route.middleware) {\n manifest.middleware = {\n file: route.middleware.contextKey,\n };\n }\n\n return manifest;\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {\n const matcher: ExpoRouterServerManifestV1Route = getNamedRouteRegex(\n normalizedRoutePath,\n absoluteRoute,\n node.contextKey\n );\n\n if (node.generated) {\n matcher.generated = true;\n }\n\n if (node.permanent) {\n matcher.permanent = true;\n }\n\n if (node.methods) {\n matcher.methods = node.methods;\n }\n\n return matcher;\n });\n}\n\nfunction getNamedRouteRegex(\n normalizedRoute: string,\n page: string,\n file: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file,\n page,\n namedRegex: `^${result.namedParameterizedRoute}(?:/)?$`,\n routeKeys: result.routeKeys,\n };\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let currentCharCode = 96; // Starting one before 'a' to make the increment logic simpler\n let currentLength = 1;\n\n return () => {\n let result = '';\n let incrementNext = true;\n\n // Iterate from right to left to build the key\n for (let i = 0; i < currentLength; i++) {\n if (incrementNext) {\n currentCharCode++;\n if (currentCharCode > 122) {\n currentCharCode = 97; // Reset to 'a'\n incrementNext = true; // Continue to increment the next character\n } else {\n incrementNext = false;\n }\n }\n result = String.fromCharCode(currentCharCode) + result;\n }\n\n // If all characters are 'z', increase the length of the key\n if (incrementNext) {\n currentLength++;\n currentCharCode = 96; // This will make the next key start with 'a'\n }\n\n return result;\n };\n}\n\nfunction removeTrailingSlash(route: string): string {\n return route.replace(/\\/$/, '') || '/';\n}\n\nfunction getNamedParametrizedRoute(route: string) {\n const segments = removeTrailingSlash(route).slice(1).split('/');\n const getSafeRouteKey = buildGetSafeRouteKey();\n const routeKeys: Record<string, string> = {};\n return {\n namedParameterizedRoute: segments\n .map((segment, index) => {\n if (segment === '+not-found' && index === segments.length - 1) {\n segment = '[...not-found]';\n }\n if (/^\\[.*\\]$/.test(segment)) {\n const { name, optional, repeat } = parseParameter(segment);\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = name.replace(/\\W/g, '');\n let invalidKey = false;\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true;\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1), 10))) {\n invalidKey = true;\n }\n\n // Prevent duplicates after sanitizing the key\n if (cleanedKey in routeKeys) {\n invalidKey = true;\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey();\n }\n\n routeKeys[cleanedKey] = name;\n return repeat\n ? optional\n ? `(?:/(?<${cleanedKey}>.+?))?`\n : `/(?<${cleanedKey}>.+?)`\n : `/(?<${cleanedKey}>[^/]+?)`;\n } else if (/^\\(.*\\)$/.test(segment)) {\n const groupName = matchGroupName(segment)!\n .split(',')\n .map((group) => group.trim())\n .filter(Boolean);\n if (groupName.length > 1) {\n const optionalSegment = `\\\\((?:${groupName.map(escapeStringRegexp).join('|')})\\\\)`;\n // Make section optional\n return `(?:/${optionalSegment})?`;\n } else {\n // Use simpler regex for single groups\n return `(?:/${escapeStringRegexp(segment)})?`;\n }\n } else {\n return `/${escapeStringRegexp(segment)}`;\n }\n })\n .join(''),\n routeKeys,\n };\n}\n\n// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/;\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g;\n\nfunction escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&');\n }\n return str;\n}\n\nexport function parseParameter(param: string) {\n let repeat = false;\n let optional = false;\n let name = param;\n\n if (/^\\[.*\\]$/.test(name)) {\n optional = true;\n name = name.slice(1, -1);\n }\n\n if (/^\\.\\.\\./.test(name)) {\n repeat = true;\n name = name.slice(3);\n }\n\n return { name, repeat, optional };\n}\n\nfunction getNormalizedContextKey(contextKey: string): string {\n return getContextKey(contextKey).replace(/\\/index$/, '') ?? '/';\n}\n"]}
1
+ {"version":3,"file":"getServerManifest.js","sourceRoot":"","sources":["../src/getServerManifest.ts"],"names":[],"mappings":";;AA+GA,8CAiGC;AA6JD,wCAgBC;AAnXD,yCAA2D;AAC3D,6CAA0C;AAC1C,qCAAmD;AA2EnD,SAAS,eAAe,CAAC,KAAgB;IACvC,OAAO,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAI,GAAQ,EAAE,GAAwB;IACrD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACzB,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;YACjB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,OAAO,IAAI,CAAC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QAChB,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,CAAC;QACd,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,uBAAuB,CAAC,UAAkB;IACjD,OAAO,IAAA,wBAAa,EAAC,UAAU,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;AAClE,CAAC","sourcesContent":["/**\n * Copyright © 2023 650 Industries.\n * Copyright © 2023 Vercel, Inc.\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 * Based on https://github.com/vercel/next.js/blob/1df2686bc9964f1a86c444701fa5cbf178669833/packages/next/src/shared/lib/router/utils/route-regex.ts\n */\nimport type { RouteNode } from './Route';\nimport { getContextKey, matchGroupName } from './matchers';\nimport { sortRoutes } from './sortRoutes';\nimport { shouldLinkExternally } from './utils/url';\n\n// TODO: Share these types across cli, server, router, etc.\nexport type ExpoRouterServerManifestV1Route<TRegex = string> = {\n file: string;\n page: string;\n /**\n * Keys are route param names that have been normalized for a regex named-matcher, values are the original route param names.\n */\n routeKeys: Record<string, string>;\n /**\n * Regex for matching a path against the route.\n * The regex is normalized for named matchers so keys must be looked up against the `routeKeys` object to collect the original route param names.\n * Regex matching alone cannot accurately route to a file, the order in which routes are matched is equally important to ensure correct priority.\n */\n namedRegex: TRegex;\n /** Indicates that the route was generated and does not map to any file in the project's routes directory. */\n generated?: boolean;\n /** Indicates that this is a redirect that should use 301 instead of 307 */\n permanent?: boolean;\n /** If a redirect, which methods are allowed. Undefined represents all methods */\n methods?: string[];\n};\n\nexport type ExpoRouterServerManifestV1Middleware = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRouterServerManifestV1<TRegex = string> = {\n /**\n * Middleware function that runs before any route matching.\n * Only allowed at the root level and requires web.output: \"server\".\n */\n middleware?: ExpoRouterServerManifestV1Middleware;\n /**\n * Headers to be applied to all responses from the server.\n */\n headers?: Record<string, string | string[]>;\n /**\n * Rewrites. After middleware has processed and regular routing resumes, these occur first.\n */\n rewrites: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * List of routes that match second. Returns 301 and redirects to another path.\n */\n redirects: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that return static HTML files for a given path.\n * These are only matched against requests with method `GET` and `HEAD`.\n */\n htmlRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /**\n * Routes that are matched after HTML routes and invoke WinterCG-compliant functions.\n */\n apiRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n /** List of routes that are matched last and return with status code 404. */\n notFoundRoutes: ExpoRouterServerManifestV1Route<TRegex>[];\n};\n\nexport interface Group {\n pos: number;\n repeat: boolean;\n optional: boolean;\n}\n\nexport interface RouteRegex {\n groups: Record<string, Group>;\n re: RegExp;\n}\n\nfunction isNotFoundRoute(route: RouteNode) {\n return route.dynamic && route.dynamic[route.dynamic.length - 1].notFound;\n}\n\nfunction uniqueBy<T>(arr: T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return arr.filter((item) => {\n const id = key(item);\n if (seen.has(id)) {\n return false;\n }\n seen.add(id);\n return true;\n });\n}\n\n// TODO(@hassankhan): ENG-16575\ntype FlatNodeTuple = [contextKey: string, absoluteRoute: string, node: RouteNode];\n\ntype GetServerManifestOptions = {\n headers?: Record<string, string | string[]>;\n};\n\n// Given a nested route tree, return a flattened array of all routes that can be matched.\nexport function getServerManifest(\n route: RouteNode,\n options?: GetServerManifestOptions\n): ExpoRouterServerManifestV1 {\n function getFlatNodes(route: RouteNode, parentRoute: string = ''): FlatNodeTuple[] {\n // Use a recreated route instead of contextKey because we duplicate nodes to support array syntax.\n const absoluteRoute = [parentRoute, route.route].filter(Boolean).join('/');\n\n if (route.children.length) {\n return route.children.map((child) => getFlatNodes(child, absoluteRoute)).flat();\n }\n\n // API Routes are handled differently to HTML routes because they have no nested behavior.\n // An HTML route can be different based on parent segments due to layout routes, therefore multiple\n // copies should be rendered. However, an API route is always the same regardless of parent segments.\n let key: string;\n if (route.type.includes('api')) {\n key = getNormalizedContextKey(route.contextKey);\n } else {\n key = getNormalizedContextKey(absoluteRoute);\n }\n return [[key, '/' + absoluteRoute, route]];\n }\n\n // Remove duplicates from the runtime manifest which expands array syntax.\n const flat = getFlatNodes(route)\n .sort(([, , a], [, , b]) => sortRoutes(b, a))\n .reverse();\n\n const apiRoutes = uniqueBy(\n flat.filter(([, , route]) => route.type === 'api'),\n ([path]) => path\n );\n\n const otherRoutes = uniqueBy(\n flat.filter(\n ([, , route]) =>\n route.type === 'route' ||\n (route.type === 'rewrite' && (route.methods === undefined || route.methods.includes('GET')))\n ),\n ([path]) => path\n );\n\n const redirects = uniqueBy(\n flat.filter(([, , route]) => route.type === 'redirect'),\n ([path]) => path\n )\n .map((redirect) => {\n // TODO(@hassankhan): ENG-16577\n // For external redirects, use `destinationContextKey` as the destination URL\n if (shouldLinkExternally(redirect[2].destinationContextKey!)) {\n redirect[1] = redirect[2].destinationContextKey!;\n } else {\n redirect[1] =\n flat.find(([, , route]) => route.contextKey === redirect[2].destinationContextKey)?.[0] ??\n '/';\n }\n\n return redirect;\n })\n .reverse();\n\n const rewrites = uniqueBy(\n flat.filter(([, , route]) => route.type === 'rewrite'),\n ([path]) => path\n )\n .map((rewrite) => {\n rewrite[1] =\n flat.find(([, , route]) => route.contextKey === rewrite[2].destinationContextKey)?.[0] ??\n '/';\n\n return rewrite;\n })\n .reverse();\n\n const standardRoutes = otherRoutes.filter(([, , route]) => !isNotFoundRoute(route));\n const notFoundRoutes = otherRoutes.filter(([, , route]) => isNotFoundRoute(route));\n\n const manifest: ExpoRouterServerManifestV1 = {\n apiRoutes: getMatchableManifestForPaths(apiRoutes),\n htmlRoutes: getMatchableManifestForPaths(standardRoutes),\n notFoundRoutes: getMatchableManifestForPaths(notFoundRoutes),\n redirects: getMatchableManifestForPaths(redirects),\n rewrites: getMatchableManifestForPaths(rewrites),\n };\n\n if (route.middleware) {\n manifest.middleware = {\n file: route.middleware.contextKey,\n };\n }\n\n if (options?.headers) {\n manifest.headers = options.headers;\n }\n\n return manifest;\n}\n\nfunction getMatchableManifestForPaths(\n paths: [string, string, RouteNode][]\n): ExpoRouterServerManifestV1Route[] {\n return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {\n const matcher: ExpoRouterServerManifestV1Route = getNamedRouteRegex(\n normalizedRoutePath,\n absoluteRoute,\n node.contextKey\n );\n\n if (node.generated) {\n matcher.generated = true;\n }\n\n if (node.permanent) {\n matcher.permanent = true;\n }\n\n if (node.methods) {\n matcher.methods = node.methods;\n }\n\n return matcher;\n });\n}\n\nfunction getNamedRouteRegex(\n normalizedRoute: string,\n page: string,\n file: string\n): ExpoRouterServerManifestV1Route {\n const result = getNamedParametrizedRoute(normalizedRoute);\n return {\n file,\n page,\n namedRegex: `^${result.namedParameterizedRoute}(?:/)?$`,\n routeKeys: result.routeKeys,\n };\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let currentCharCode = 96; // Starting one before 'a' to make the increment logic simpler\n let currentLength = 1;\n\n return () => {\n let result = '';\n let incrementNext = true;\n\n // Iterate from right to left to build the key\n for (let i = 0; i < currentLength; i++) {\n if (incrementNext) {\n currentCharCode++;\n if (currentCharCode > 122) {\n currentCharCode = 97; // Reset to 'a'\n incrementNext = true; // Continue to increment the next character\n } else {\n incrementNext = false;\n }\n }\n result = String.fromCharCode(currentCharCode) + result;\n }\n\n // If all characters are 'z', increase the length of the key\n if (incrementNext) {\n currentLength++;\n currentCharCode = 96; // This will make the next key start with 'a'\n }\n\n return result;\n };\n}\n\nfunction removeTrailingSlash(route: string): string {\n return route.replace(/\\/$/, '') || '/';\n}\n\nfunction getNamedParametrizedRoute(route: string) {\n const segments = removeTrailingSlash(route).slice(1).split('/');\n const getSafeRouteKey = buildGetSafeRouteKey();\n const routeKeys: Record<string, string> = {};\n return {\n namedParameterizedRoute: segments\n .map((segment, index) => {\n if (segment === '+not-found' && index === segments.length - 1) {\n segment = '[...not-found]';\n }\n if (/^\\[.*\\]$/.test(segment)) {\n const { name, optional, repeat } = parseParameter(segment);\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = name.replace(/\\W/g, '');\n let invalidKey = false;\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true;\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1), 10))) {\n invalidKey = true;\n }\n\n // Prevent duplicates after sanitizing the key\n if (cleanedKey in routeKeys) {\n invalidKey = true;\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey();\n }\n\n routeKeys[cleanedKey] = name;\n return repeat\n ? optional\n ? `(?:/(?<${cleanedKey}>.+?))?`\n : `/(?<${cleanedKey}>.+?)`\n : `/(?<${cleanedKey}>[^/]+?)`;\n } else if (/^\\(.*\\)$/.test(segment)) {\n const groupName = matchGroupName(segment)!\n .split(',')\n .map((group) => group.trim())\n .filter(Boolean);\n if (groupName.length > 1) {\n const optionalSegment = `\\\\((?:${groupName.map(escapeStringRegexp).join('|')})\\\\)`;\n // Make section optional\n return `(?:/${optionalSegment})?`;\n } else {\n // Use simpler regex for single groups\n return `(?:/${escapeStringRegexp(segment)})?`;\n }\n } else {\n return `/${escapeStringRegexp(segment)}`;\n }\n })\n .join(''),\n routeKeys,\n };\n}\n\n// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/;\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g;\n\nfunction escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&');\n }\n return str;\n}\n\nexport function parseParameter(param: string) {\n let repeat = false;\n let optional = false;\n let name = param;\n\n if (/^\\[.*\\]$/.test(name)) {\n optional = true;\n name = name.slice(1, -1);\n }\n\n if (/^\\.\\.\\./.test(name)) {\n repeat = true;\n name = name.slice(3);\n }\n\n return { name, repeat, optional };\n}\n\nfunction getNormalizedContextKey(contextKey: string): string {\n return getContextKey(contextKey).replace(/\\/index$/, '') ?? '/';\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,aAAa,EAOd,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAsB,MAAM,OAAO,CAAC;AAgG3C,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;6DAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"ModalStack.d.ts","sourceRoot":"","sources":["../../../src/modal/web/ModalStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,aAAa,EASd,MAAM,0BAA0B,CAAC;AAMlC,OAAO,KAAiC,MAAM,OAAO,CAAC;AAwHtD,QAAA,MAAM,WAAW;;;;;;;;;;;CAAkD,CAAC;AACpE,QAAA,MAAM,iBAAiB;;;;;;;;6DAAqB,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC"}