expo-router 3.5.18 → 3.5.19

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 (57) hide show
  1. package/build/ExpoRoot.js +1 -1
  2. package/build/ExpoRoot.js.map +1 -1
  3. package/build/exports.d.ts +3 -2
  4. package/build/exports.d.ts.map +1 -1
  5. package/build/exports.js.map +1 -1
  6. package/build/fork/createMemoryHistory.d.ts +25 -0
  7. package/build/fork/createMemoryHistory.d.ts.map +1 -0
  8. package/build/fork/createMemoryHistory.js +180 -0
  9. package/build/fork/createMemoryHistory.js.map +1 -0
  10. package/build/fork/extractPathFromURL.js +1 -1
  11. package/build/fork/extractPathFromURL.js.map +1 -1
  12. package/build/fork/getPathFromState.js +1 -1
  13. package/build/fork/getPathFromState.js.map +1 -1
  14. package/build/fork/useLinking.js +1 -1
  15. package/build/fork/useLinking.js.map +1 -1
  16. package/build/global-state/routing.d.ts +4 -4
  17. package/build/global-state/routing.d.ts.map +1 -1
  18. package/build/global-state/routing.js.map +1 -1
  19. package/build/hooks.d.ts +10 -5
  20. package/build/hooks.d.ts.map +1 -1
  21. package/build/hooks.js +0 -16
  22. package/build/hooks.js.map +1 -1
  23. package/build/imperative-api.d.ts +22 -2
  24. package/build/imperative-api.d.ts.map +1 -1
  25. package/build/imperative-api.js.map +1 -1
  26. package/build/layouts/Tabs.d.ts +3 -3
  27. package/build/layouts/Tabs.d.ts.map +1 -1
  28. package/build/layouts/Tabs.js.map +1 -1
  29. package/build/link/Link.d.ts +70 -9
  30. package/build/link/Link.d.ts.map +1 -1
  31. package/build/link/Link.js.map +1 -1
  32. package/build/link/href.d.ts +2 -2
  33. package/build/link/href.d.ts.map +1 -1
  34. package/build/link/href.js.map +1 -1
  35. package/build/testing-library/index.d.ts +1 -1
  36. package/build/testing-library/index.d.ts.map +9 -1
  37. package/build/testing-library/index.js +9 -0
  38. package/build/testing-library/index.js.map +9 -1
  39. package/build/typed-routes/generate.d.ts.map +1 -1
  40. package/build/typed-routes/generate.js +17 -18
  41. package/build/typed-routes/generate.js.map +1 -1
  42. package/build/typed-routes/testSetup.d.ts +2 -0
  43. package/build/typed-routes/testSetup.d.ts.map +1 -0
  44. package/build/typed-routes/testSetup.js +29 -0
  45. package/build/typed-routes/testSetup.js.map +1 -0
  46. package/build/typed-routes/types.d.ts +142 -0
  47. package/build/typed-routes/types.d.ts.map +1 -0
  48. package/build/typed-routes/types.js +3 -0
  49. package/build/typed-routes/types.js.map +1 -0
  50. package/build/types.d.ts +1 -0
  51. package/build/types.d.ts.map +1 -1
  52. package/build/types.js.map +1 -1
  53. package/build/useScreens.d.ts +4 -1
  54. package/build/useScreens.d.ts.map +5 -1
  55. package/build/useScreens.js.map +5 -1
  56. package/package.json +3 -3
  57. package/types/expo-router.d.ts +0 -358
package/build/ExpoRoot.js CHANGED
@@ -76,7 +76,7 @@ function ContextNavigator({ context, location: initialLocation = initialUrl, wra
76
76
  if (initialLocation instanceof URL) {
77
77
  contextType = {
78
78
  location: {
79
- pathname: initialLocation.pathname,
79
+ pathname: initialLocation.pathname + initialLocation.hash,
80
80
  search: initialLocation.search,
81
81
  },
82
82
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoRoot.js","sourceRoot":"","sources":["../src/ExpoRoot.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,qDAA4C;AAC5C,+CAA6F;AAC7F,+CAAwC;AACxC,mFAAkE;AAElE,qFAAqE;AAErE,8DAAsE;AACtE,iFAAgF;AAEhF,iDAA8E;AAC9E,2CAA8C;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,EAA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7F;gBAED,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,KAAK,CAAC;YACX,KAAK,YAAY;gBACf,OAAO,IAAI,wCAAwC,CAAC;gBACpD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;SACT;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport { StatusBar } from 'expo-status-bar';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport UpstreamNavigationContainer from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport ServerContext, { ServerContextType } from './global-state/serverContext';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\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\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 = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {children}\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <StatusBar style=\"auto\" />}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\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,\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 = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\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 const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,qDAA4C;AAC5C,+CAA6F;AAC7F,+CAAwC;AACxC,mFAAkE;AAEl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,CAAC,EAAE,CAAC,CAAC,CAAC,EAChE,oCAAoC,CAAC;QAErC,QAAQ,MAAM,CAAC,IAAI,EAAE;YACnB,KAAK,UAAU,CAAC;YAChB,KAAK,MAAM,CAAC;YACZ,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,OAAO,EAAE,IAAI,EAAE;oBACjB,OAAO,IAAI,kCAAkC,OAAO,CAAC,IAAI,IAAI,CAAC;iBAC/D;qBAAM;oBACL,OAAO,IAAI,gFAAgF,CAAC;iBAC7F;gBAED,MAAM;YACR,KAAK,SAAS,CAAC;YACf,KAAK,KAAK,CAAC;YACX,KAAK,YAAY;gBACf,OAAO,IAAI,wCAAwC,CAAC;gBACpD,MAAM;YACR,KAAK,aAAa,CAAC;YACnB,KAAK,cAAc,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,IAAI,+CAA+C,CAAC;gBAC3D,MAAM;SACT;QAED,OAAO,IAAI,0EAA0E,CAAC;QAEtF,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;YACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC,CAAC;CACH;KAAM;IACL,iBAAiB,GAAG,cAAa,CAAC,CAAC;CACpC","sourcesContent":["'use client';\n\nimport { LinkingOptions, NavigationAction } from '@react-navigation/native';\nimport { StatusBar } from 'expo-status-bar';\nimport React, { type PropsWithChildren, Fragment, type ComponentType, useMemo } from 'react';\nimport { Platform } from 'react-native';\nimport { SafeAreaProvider } from 'react-native-safe-area-context';\n\nimport UpstreamNavigationContainer from './fork/NavigationContainer';\nimport { ExpoLinkingOptions } from './getLinkingConfig';\nimport { useInitializeExpoRouter } from './global-state/router-store';\nimport ServerContext, { ServerContextType } from './global-state/serverContext';\nimport { RequireContext } from './types';\nimport { hasViewControllerBasedStatusBarAppearance } from './utils/statusbar';\nimport { SplashScreen } from './views/Splash';\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\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 = ({ children }: PropsWithChildren) => {\n return (\n <ParentWrapper>\n <SafeAreaProvider\n // SSR support\n initialMetrics={INITIAL_METRICS}>\n {children}\n {/* Users can override this by adding another StatusBar element anywhere higher in the component tree. */}\n {!hasViewControllerBasedStatusBarAppearance && <StatusBar style=\"auto\" />}\n </SafeAreaProvider>\n </ParentWrapper>\n );\n };\n\n return <ContextNavigator {...props} wrapper={wrapper} />;\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 = useInitializeExpoRouter(context, {\n ...linking,\n serverUrl,\n });\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 const Component = store.rootComponent;\n\n return (\n <UpstreamNavigationContainer\n ref={store.navigationRef}\n initialState={store.initialState}\n linking={store.linking as LinkingOptions<any>}\n onUnhandledAction={onUnhandledAction}\n documentTitle={{\n enabled: false,\n }}>\n <ServerContext.Provider value={serverContext}>\n <WrapperComponent>\n <Component />\n </WrapperComponent>\n </ServerContext.Provider>\n </UpstreamNavigationContainer>\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,7 +1,7 @@
1
1
  import { Navigator, Slot } from './views/Navigator';
2
2
  export { useRouter, useUnstableGlobalHref, usePathname, useNavigationContainerRef, useGlobalSearchParams, useLocalSearchParams, useSegments, useRootNavigation, useRootNavigationState, } from './hooks';
3
- export { router } from './imperative-api';
4
- export { Link, Redirect } from './link/Link';
3
+ export { router, Router } from './imperative-api';
4
+ export { Link, Redirect, LinkProps } from './link/Link';
5
5
  export { withLayoutContext } from './layouts/withLayoutContext';
6
6
  export { Navigator, Slot };
7
7
  export { ExpoRoot } from './ExpoRoot';
@@ -11,4 +11,5 @@ export { ErrorBoundary } from './views/ErrorBoundary';
11
11
  export { SplashScreen } from './views/Splash';
12
12
  export { useNavigation } from './useNavigation';
13
13
  export { useFocusEffect } from './useFocusEffect';
14
+ export type * from './types';
14
15
  //# sourceMappingURL=exports.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAG3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,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1 @@
1
- {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAAI,OAmBA;AAjBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAA0C;AAAjC,wGAAA,MAAM,OAAA;AAEf,oCAA6C;AAApC,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,WAAW;AACX,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router } from './imperative-api';\n\nexport { Link, Redirect } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\n\n// Platform\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect } from './useFocusEffect';\n"]}
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../src/exports.ts"],"names":[],"mappings":";;;AAAA,kBAAkB;AAClB,iDAAoD;AAmB3C,0FAnBA,qBAAS,OAmBA;AAAE,qFAnBA,gBAAI,OAmBA;AAjBxB,iCAUiB;AATf,kGAAA,SAAS,OAAA;AACT,8GAAA,qBAAqB,OAAA;AACrB,oGAAA,WAAW,OAAA;AACX,kHAAA,yBAAyB,OAAA;AACzB,8GAAA,qBAAqB,OAAA;AACrB,6GAAA,oBAAoB,OAAA;AACpB,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,+GAAA,sBAAsB,OAAA;AAGxB,mDAAkD;AAAzC,wGAAA,MAAM,OAAA;AAEf,oCAAwD;AAA/C,4FAAA,IAAI,OAAA;AAAE,gGAAA,QAAQ,OAAA;AAEvB,iEAAgE;AAAvD,sHAAA,iBAAiB,OAAA;AAG1B,oBAAoB;AACpB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAElB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AAEtB,WAAW;AACX,yCAA8C;AAArC,sGAAA,YAAY,OAAA;AAErB,mBAAmB;AACnB,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA","sourcesContent":["// Expo Router API\nimport { Navigator, Slot } from './views/Navigator';\n\nexport {\n useRouter,\n useUnstableGlobalHref,\n usePathname,\n useNavigationContainerRef,\n useGlobalSearchParams,\n useLocalSearchParams,\n useSegments,\n useRootNavigation,\n useRootNavigationState,\n} from './hooks';\n\nexport { router, Router } from './imperative-api';\n\nexport { Link, Redirect, LinkProps } from './link/Link';\n\nexport { withLayoutContext } from './layouts/withLayoutContext';\nexport { Navigator, Slot };\n\n// Expo Router Views\nexport { ExpoRoot } from './ExpoRoot';\nexport { Unmatched } from './views/Unmatched';\nexport { ErrorBoundaryProps } from './views/Try';\nexport { ErrorBoundary } from './views/ErrorBoundary';\n\n// Platform\nexport { SplashScreen } from './views/Splash';\n\n// React Navigation\nexport { useNavigation } from './useNavigation';\nexport { useFocusEffect } from './useFocusEffect';\n\nexport type * from './types';\n"]}
@@ -0,0 +1,25 @@
1
+ import type { NavigationState } from '@react-navigation/core';
2
+ type HistoryRecord = {
3
+ id: string;
4
+ state: NavigationState;
5
+ path: string;
6
+ };
7
+ export default function createMemoryHistory(): {
8
+ readonly index: number;
9
+ get(index: number): HistoryRecord;
10
+ backIndex({ path }: {
11
+ path: string;
12
+ }): number;
13
+ push({ path, state }: {
14
+ path: string;
15
+ state: NavigationState;
16
+ }): void;
17
+ replace({ path, state }: {
18
+ path: string;
19
+ state: NavigationState;
20
+ }): void;
21
+ go(n: number): Promise<void> | undefined;
22
+ listen(listener: () => void): () => void;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=createMemoryHistory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMemoryHistory.d.ts","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAG9D,KAAK,aAAa,GAAG;IAEnB,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,eAAe,CAAC;IAEvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,mBAAmB;;eAiC5B,MAAM;;cAIW,MAAM;;;cAaJ,MAAM;eAAS,eAAe;;;cAmB3B,MAAM;eAAS,eAAe;;UAsCzD,MAAM;qBA2FK,MAAM,IAAI;EAiB9B"}
@@ -0,0 +1,180 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const non_secure_1 = require("nanoid/non-secure");
4
+ function createMemoryHistory() {
5
+ let index = 0;
6
+ let items = [];
7
+ // Pending callbacks for `history.go(n)`
8
+ // We might modify the callback stored if it was interrupted, so we have a ref to identify it
9
+ const pending = [];
10
+ const interrupt = () => {
11
+ // If another history operation was performed we need to interrupt existing ones
12
+ // This makes sure that calls such as `history.replace` after `history.go` don't happen
13
+ // Since otherwise it won't be correct if something else has changed
14
+ pending.forEach((it) => {
15
+ const cb = it.cb;
16
+ it.cb = () => cb(true);
17
+ });
18
+ };
19
+ const history = {
20
+ get index() {
21
+ // We store an id in the state instead of an index
22
+ // Index could get out of sync with in-memory values if page reloads
23
+ const id = window.history.state?.id;
24
+ if (id) {
25
+ const index = items.findIndex((item) => item.id === id);
26
+ return index > -1 ? index : 0;
27
+ }
28
+ return 0;
29
+ },
30
+ get(index) {
31
+ return items[index];
32
+ },
33
+ backIndex({ path }) {
34
+ // We need to find the index from the element before current to get closest path to go back to
35
+ for (let i = index - 1; i >= 0; i--) {
36
+ const item = items[i];
37
+ if (item.path === path) {
38
+ return i;
39
+ }
40
+ }
41
+ return -1;
42
+ },
43
+ push({ path, state }) {
44
+ interrupt();
45
+ const id = (0, non_secure_1.nanoid)();
46
+ // When a new entry is pushed, all the existing entries after index will be inaccessible
47
+ // So we remove any existing entries after the current index to clean them up
48
+ items = items.slice(0, index + 1);
49
+ items.push({ path, state, id });
50
+ index = items.length - 1;
51
+ // We pass empty string for title because it's ignored in all browsers except safari
52
+ // We don't store state object in history.state because:
53
+ // - browsers have limits on how big it can be, and we don't control the size
54
+ // - while not recommended, there could be non-serializable data in state
55
+ window.history.pushState({ id }, '', path);
56
+ },
57
+ replace({ path, state }) {
58
+ interrupt();
59
+ const id = window.history.state?.id ?? (0, non_secure_1.nanoid)();
60
+ // Need to keep the hash part of the path if there was no previous history entry
61
+ // or the previous history entry had the same path
62
+ const pathWithHash = path;
63
+ // ------- START OF FORK
64
+ // if (!items.length || items.findIndex((item) => item.id === id) < 0) {
65
+ // // There are two scenarios for creating an array with only one history record:
66
+ // // - When loaded id not found in the items array, this function by default will replace
67
+ // // the first item. We need to keep only the new updated object, otherwise it will break
68
+ // // the page when navigating forward in history.
69
+ // // - This is the first time any state modifications are done
70
+ // // So we need to push the entry as there's nothing to replace
71
+ // pathWithHash = pathWithHash + location.hash;
72
+ // items = [{ path: pathWithHash, state, id }];
73
+ // index = 0;
74
+ // } else {
75
+ // if (items[index].path === path) {
76
+ // pathWithHash = pathWithHash + location.hash;
77
+ // }
78
+ // items[index] = { path, state, id };
79
+ // }
80
+ // ------- END OF FORK
81
+ window.history.replaceState({ id }, '', pathWithHash);
82
+ },
83
+ // `history.go(n)` is asynchronous, there are couple of things to keep in mind:
84
+ // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.
85
+ // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.
86
+ // - the `popstate` event fires before the next frame after calling `history.go(n)`.
87
+ // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.
88
+ go(n) {
89
+ interrupt();
90
+ // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory
91
+ // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.
92
+ const nextIndex = index + n;
93
+ const lastItemIndex = items.length - 1;
94
+ if (n < 0 && !items[nextIndex]) {
95
+ // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.
96
+ n = -index;
97
+ index = 0;
98
+ }
99
+ else if (n > 0 && nextIndex > lastItemIndex) {
100
+ // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.
101
+ n = lastItemIndex - index;
102
+ index = lastItemIndex;
103
+ }
104
+ else {
105
+ index = nextIndex;
106
+ }
107
+ if (n === 0) {
108
+ return;
109
+ }
110
+ // When we call `history.go`, `popstate` will fire when there's history to go back to
111
+ // So we need to somehow handle following cases:
112
+ // - There's history to go back, `history.go` is called, and `popstate` fires
113
+ // - `history.go` is called multiple times, we need to resolve on respective `popstate`
114
+ // - No history to go back, but `history.go` was called, browser has no API to detect it
115
+ return new Promise((resolve, reject) => {
116
+ const done = (interrupted) => {
117
+ clearTimeout(timer);
118
+ if (interrupted) {
119
+ reject(new Error('History was changed during navigation.'));
120
+ return;
121
+ }
122
+ // There seems to be a bug in Chrome regarding updating the title
123
+ // If we set a title just before calling `history.go`, the title gets lost
124
+ // However the value of `document.title` is still what we set it to
125
+ // It's just not displayed in the tab bar
126
+ // To update the tab bar, we need to reset the title to something else first (e.g. '')
127
+ // And set the title to what it was before so it gets applied
128
+ // It won't work without setting it to empty string coz otherwise title isn't changing
129
+ // Which means that the browser won't do anything after setting the title
130
+ const { title } = window.document;
131
+ window.document.title = '';
132
+ window.document.title = title;
133
+ resolve();
134
+ };
135
+ pending.push({ ref: done, cb: done });
136
+ // If navigation didn't happen within 100ms, assume that it won't happen
137
+ // This may not be accurate, but hopefully it won't take so much time
138
+ // In Chrome, navigation seems to happen instantly in next microtask
139
+ // But on Firefox, it seems to take much longer, around 50ms from our testing
140
+ // We're using a hacky timeout since there doesn't seem to be way to know for sure
141
+ const timer = setTimeout(() => {
142
+ const index = pending.findIndex((it) => it.ref === done);
143
+ if (index > -1) {
144
+ pending[index].cb();
145
+ pending.splice(index, 1);
146
+ }
147
+ }, 100);
148
+ const onPopState = () => {
149
+ const id = window.history.state?.id;
150
+ const currentIndex = items.findIndex((item) => item.id === id);
151
+ // Fix createMemoryHistory.index variable's value
152
+ // as it may go out of sync when navigating in the browser.
153
+ index = Math.max(currentIndex, 0);
154
+ const last = pending.pop();
155
+ window.removeEventListener('popstate', onPopState);
156
+ last?.cb();
157
+ };
158
+ window.addEventListener('popstate', onPopState);
159
+ window.history.go(n);
160
+ });
161
+ },
162
+ // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`
163
+ // If we call `history.go(n)` ourselves, we don't want it to trigger the listener
164
+ // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener
165
+ listen(listener) {
166
+ const onPopState = () => {
167
+ if (pending.length) {
168
+ // This was triggered by `history.go(n)`, we shouldn't call the listener
169
+ return;
170
+ }
171
+ listener();
172
+ };
173
+ window.addEventListener('popstate', onPopState);
174
+ return () => window.removeEventListener('popstate', onPopState);
175
+ },
176
+ };
177
+ return history;
178
+ }
179
+ exports.default = createMemoryHistory;
180
+ //# sourceMappingURL=createMemoryHistory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createMemoryHistory.js","sourceRoot":"","sources":["../../src/fork/createMemoryHistory.ts"],"names":[],"mappings":";;AAMA,kDAA2C;AAW3C,SAAwB,mBAAmB;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,KAAK,GAAoB,EAAE,CAAC;IAEhC,wCAAwC;IACxC,6FAA6F;IAC7F,MAAM,OAAO,GAA4D,EAAE,CAAC;IAE5E,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,gFAAgF;QAChF,uFAAuF;QACvF,oEAAoE;QACpE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE;YACrB,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACjB,EAAE,CAAC,EAAE,GAAG,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,OAAO,GAAG;QACd,IAAI,KAAK;YACP,kDAAkD;YAClD,oEAAoE;YACpE,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC;YAEpC,IAAI,EAAE,EAAE;gBACN,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;gBAExD,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/B;YAED,OAAO,CAAC,CAAC;QACX,CAAC;QAED,GAAG,CAAC,KAAa;Y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;oBACjD,2DAA2D;oBAC3D,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;oBAElC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;oBAE3B,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;oBACnD,IAAI,EAAE,EAAE,EAAE,CAAC;gBACb,CAAC,CAAC;gBAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;gBAChD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACvB,CAAC,CAAC,CAAC;QACL,CAAC;QAED,gGAAgG;QAChG,iFAAiF;QACjF,4GAA4G;QAC5G,MAAM,CAAC,QAAoB;YACzB,MAAM,UAAU,GAAG,GAAG,EAAE;gBACtB,IAAI,OAAO,CAAC,MAAM,EAAE;oBAClB,wEAAwE;oBACxE,OAAO;iBACR;gBAED,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC;YAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAEhD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC;AAvND,sCAuNC","sourcesContent":["// Forked from React Navigation in order to use a custom `useLinking` function.\n// https://github.com/react-navigation/react-navigation/blob/6.x/packages/native/src/createMemoryHistory.tsx\n// Look for 'START OF FORK' comments\n// Forked behaviour:\n// - Remove custom management of the URL hash\nimport type { NavigationState } from '@react-navigation/core';\nimport { nanoid } from 'nanoid/non-secure';\n\ntype HistoryRecord = {\n // Unique identifier for this record to match it with window.history.state\n id: string;\n // Navigation state object for the history entry\n state: NavigationState;\n // Path of the history entry\n path: string;\n};\n\nexport default function createMemoryHistory() {\n let index = 0;\n let items: HistoryRecord[] = [];\n\n // Pending callbacks for `history.go(n)`\n // We might modify the callback stored if it was interrupted, so we have a ref to identify it\n const pending: { ref: unknown; cb: (interrupted?: boolean) => void }[] = [];\n\n const interrupt = () => {\n // If another history operation was performed we need to interrupt existing ones\n // This makes sure that calls such as `history.replace` after `history.go` don't happen\n // Since otherwise it won't be correct if something else has changed\n pending.forEach((it) => {\n const cb = it.cb;\n it.cb = () => cb(true);\n });\n };\n\n const history = {\n get index(): number {\n // We store an id in the state instead of an index\n // Index could get out of sync with in-memory values if page reloads\n const id = window.history.state?.id;\n\n if (id) {\n const index = items.findIndex((item) => item.id === id);\n\n return index > -1 ? index : 0;\n }\n\n return 0;\n },\n\n get(index: number) {\n return items[index];\n },\n\n backIndex({ path }: { path: string }) {\n // We need to find the index from the element before current to get closest path to go back to\n for (let i = index - 1; i >= 0; i--) {\n const item = items[i];\n\n if (item.path === path) {\n return i;\n }\n }\n\n return -1;\n },\n\n push({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = nanoid();\n\n // When a new entry is pushed, all the existing entries after index will be inaccessible\n // So we remove any existing entries after the current index to clean them up\n items = items.slice(0, index + 1);\n\n items.push({ path, state, id });\n index = items.length - 1;\n\n // We pass empty string for title because it's ignored in all browsers except safari\n // We don't store state object in history.state because:\n // - browsers have limits on how big it can be, and we don't control the size\n // - while not recommended, there could be non-serializable data in state\n window.history.pushState({ id }, '', path);\n },\n\n replace({ path, state }: { path: string; state: NavigationState }) {\n interrupt();\n\n const id = window.history.state?.id ?? nanoid();\n\n // Need to keep the hash part of the path if there was no previous history entry\n // or the previous history entry had the same path\n const pathWithHash = path;\n\n // ------- START OF FORK\n\n // if (!items.length || items.findIndex((item) => item.id === id) < 0) {\n // // There are two scenarios for creating an array with only one history record:\n // // - When loaded id not found in the items array, this function by default will replace\n // // the first item. We need to keep only the new updated object, otherwise it will break\n // // the page when navigating forward in history.\n // // - This is the first time any state modifications are done\n // // So we need to push the entry as there's nothing to replace\n // pathWithHash = pathWithHash + location.hash;\n // items = [{ path: pathWithHash, state, id }];\n // index = 0;\n // } else {\n // if (items[index].path === path) {\n // pathWithHash = pathWithHash + location.hash;\n // }\n // items[index] = { path, state, id };\n // }\n\n // ------- END OF FORK\n\n window.history.replaceState({ id }, '', pathWithHash);\n },\n\n // `history.go(n)` is asynchronous, there are couple of things to keep in mind:\n // - it won't do anything if we can't go `n` steps, the `popstate` event won't fire.\n // - each `history.go(n)` call will trigger a separate `popstate` event with correct location.\n // - the `popstate` event fires before the next frame after calling `history.go(n)`.\n // This method differs from `history.go(n)` in the sense that it'll go back as many steps it can.\n go(n: number) {\n interrupt();\n\n // To guard against unexpected navigation out of the app we will assume that browser history is only as deep as the length of our memory\n // history. If we don't have an item to navigate to then update our index and navigate as far as we can without taking the user out of the app.\n const nextIndex = index + n;\n const lastItemIndex = items.length - 1;\n if (n < 0 && !items[nextIndex]) {\n // Attempted to navigate beyond the first index. Negating the current index will align the browser history with the first item.\n n = -index;\n index = 0;\n } else if (n > 0 && nextIndex > lastItemIndex) {\n // Attempted to navigate past the last index. Calculate how many indices away from the last index and go there.\n n = lastItemIndex - index;\n index = lastItemIndex;\n } else {\n index = nextIndex;\n }\n\n if (n === 0) {\n return;\n }\n\n // When we call `history.go`, `popstate` will fire when there's history to go back to\n // So we need to somehow handle following cases:\n // - There's history to go back, `history.go` is called, and `popstate` fires\n // - `history.go` is called multiple times, we need to resolve on respective `popstate`\n // - No history to go back, but `history.go` was called, browser has no API to detect it\n return new Promise<void>((resolve, reject) => {\n const done = (interrupted?: boolean) => {\n clearTimeout(timer);\n\n if (interrupted) {\n reject(new Error('History was changed during navigation.'));\n return;\n }\n\n // There seems to be a bug in Chrome regarding updating the title\n // If we set a title just before calling `history.go`, the title gets lost\n // However the value of `document.title` is still what we set it to\n // It's just not displayed in the tab bar\n // To update the tab bar, we need to reset the title to something else first (e.g. '')\n // And set the title to what it was before so it gets applied\n // It won't work without setting it to empty string coz otherwise title isn't changing\n // Which means that the browser won't do anything after setting the title\n const { title } = window.document;\n\n window.document.title = '';\n window.document.title = title;\n\n resolve();\n };\n\n pending.push({ ref: done, cb: done });\n\n // If navigation didn't happen within 100ms, assume that it won't happen\n // This may not be accurate, but hopefully it won't take so much time\n // In Chrome, navigation seems to happen instantly in next microtask\n // But on Firefox, it seems to take much longer, around 50ms from our testing\n // We're using a hacky timeout since there doesn't seem to be way to know for sure\n const timer = setTimeout(() => {\n const index = pending.findIndex((it) => it.ref === done);\n\n if (index > -1) {\n pending[index].cb();\n pending.splice(index, 1);\n }\n }, 100);\n\n const onPopState = () => {\n const id = window.history.state?.id;\n const currentIndex = items.findIndex((item) => item.id === id);\n\n // Fix createMemoryHistory.index variable's value\n // as it may go out of sync when navigating in the browser.\n index = Math.max(currentIndex, 0);\n\n const last = pending.pop();\n\n window.removeEventListener('popstate', onPopState);\n last?.cb();\n };\n\n window.addEventListener('popstate', onPopState);\n window.history.go(n);\n });\n },\n\n // The `popstate` event is triggered when history changes, except `pushState` and `replaceState`\n // If we call `history.go(n)` ourselves, we don't want it to trigger the listener\n // Here we normalize it so that only external changes (e.g. user pressing back/forward) trigger the listener\n listen(listener: () => void) {\n const onPopState = () => {\n if (pending.length) {\n // This was triggered by `history.go(n)`, we shouldn't call the listener\n return;\n }\n\n listener();\n };\n\n window.addEventListener('popstate', onPopState);\n\n return () => window.removeEventListener('popstate', onPopState);\n },\n };\n\n return history;\n}\n"]}
@@ -5,7 +5,7 @@ function parsePathAndParamsFromExpoGoLink(url) {
5
5
  // If the URL is defined (default in Expo Go dev apps) and the URL has no path:
6
6
  // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`
7
7
  const href = parsePathFromExpoGoLink(url);
8
- const results = href.match(/(.*?)(\?.*)/);
8
+ const results = href.match(/([^?]*)(\?.*)?/);
9
9
  return {
10
10
  pathname: results?.[1] ?? '',
11
11
  queryString: results?.[2] ?? '',
@@ -1 +1 @@
1
- {"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathF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AC,GAAG,CAAC,MAAM;QACpB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,wEAAwE;YACxE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,IAAI,EAAE,EAAE;QACN,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;KACrB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,MAAc,EAAE;IACrD,OAAO,CACL,uBAAuB,CAAC,GAAG,CAAC;QAC1B,sEAAsE;SACrE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC;AACJ,CAAC;AAND,wDAMC","sourcesContent":["export function parsePathAndParamsFromExpoGoLink(url: string): {\n pathname: string;\n queryString: string;\n} {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n\n const href = parsePathFromExpoGoLink(url);\n const results = href.match(/(.*?)(\\?.*)/);\n return {\n pathname: results?.[1] ?? '',\n queryString: results?.[2] ?? '',\n };\n}\n\nexport function parsePathFromExpoGoLink(url: string): string {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n return url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1] ?? '';\n}\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href, hostname } = new URL(url);\n\n if (hostname === 'exp.host' || hostname === 'u.expo.dev') {\n // These are QR code generate deep-link that always like to the '/' path\n // TODO: In the future, QR code may link to a specific path and this logic will need to be udpated\n return '';\n }\n\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = parsePathFromExpoGoLink(url);\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n // Match the `?.*` segment of the URL.\n const queryParams = url.match(/exps?:\\/\\/.*\\?(.*)/)?.[1];\n if (queryParams) {\n return fromDeepLink('a://?' + queryParams);\n }\n\n return '';\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n return url;\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(url: string = '') {\n return (\n extractExactPathFromURL(url)\n // TODO: We should get rid of this, dropping specificities is not good\n .replace(/^\\//, '')\n );\n}\n"]}
1
+ {"version":3,"file":"extractPathFromURL.js","sourceRoot":"","sources":["../../src/fork/extractPathFromURL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C,GAAG,CAAC,MAAM;QACpB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,wEAAwE;YACxE,CAAC,GAAG,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/F,IAAI,EAAE,EAAE;QACN,OAAO,IAAI,GAAG,GAAG,EAAE,CAAC;KACrB;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,sBAAsB,CAAC,MAAc,EAAE;IACrD,OAAO,CACL,uBAAuB,CAAC,GAAG,CAAC;QAC1B,sEAAsE;SACrE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACtB,CAAC;AACJ,CAAC;AAND,wDAMC","sourcesContent":["export function parsePathAndParamsFromExpoGoLink(url: string): {\n pathname: string;\n queryString: string;\n} {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n\n const href = parsePathFromExpoGoLink(url);\n const results = href.match(/([^?]*)(\\?.*)?/);\n return {\n pathname: results?.[1] ?? '',\n queryString: results?.[2] ?? '',\n };\n}\n\nexport function parsePathFromExpoGoLink(url: string): string {\n // If the URL is defined (default in Expo Go dev apps) and the URL has no path:\n // `exp://192.168.87.39:19000/` then use the default `exp://192.168.87.39:19000/--/`\n return url.match(/exps?:\\/\\/.*?\\/--\\/(.*)/)?.[1] ?? '';\n}\n\n// This is only run on native.\nfunction extractExactPathFromURL(url: string): string {\n if (\n // If a universal link / app link / web URL is used, we should use the path\n // from the URL, while stripping the origin.\n url.match(/^https?:\\/\\//)\n ) {\n const { origin, href, hostname } = new URL(url);\n\n if (hostname === 'exp.host' || hostname === 'u.expo.dev') {\n // These are QR code generate deep-link that always like to the '/' path\n // TODO: In the future, QR code may link to a specific path and this logic will need to be udpated\n return '';\n }\n\n return href.replace(origin, '');\n }\n\n const isExpoGo = typeof expo !== 'undefined' && globalThis.expo?.modules?.ExpoGo;\n\n // Handle special URLs used in Expo Go: `/--/pathname` -> `pathname`\n if (\n isExpoGo &&\n // while not exhaustive, `exp` and `exps` are the only two schemes which\n // are passed through to other apps in Expo Go.\n url.match(/^exp(s)?:\\/\\//)\n ) {\n const pathname = parsePathFromExpoGoLink(url);\n if (pathname) {\n return fromDeepLink('a://' + pathname);\n }\n // Match the `?.*` segment of the URL.\n const queryParams = url.match(/exps?:\\/\\/.*\\?(.*)/)?.[1];\n if (queryParams) {\n return fromDeepLink('a://?' + queryParams);\n }\n\n return '';\n }\n\n // TODO: Support dev client URLs\n\n return fromDeepLink(url);\n}\n\n/** Major hack to support the makeshift expo-development-client system. */\nfunction isExpoDevelopmentClient(url: URL): boolean {\n return url.hostname === 'expo-development-client';\n}\n\nfunction fromDeepLink(url: string): string {\n let res: URL;\n try {\n // This is for all standard deep links, e.g. `foobar://` where everything\n // after the `://` is the path.\n res = new URL(url);\n } catch {\n return url;\n }\n\n if (isExpoDevelopmentClient(res)) {\n if (!res.searchParams.get('url')) {\n return '';\n }\n const incomingUrl = res.searchParams.get('url')!;\n return extractExactPathFromURL(decodeURI(incomingUrl));\n }\n\n let results = '';\n\n if (res.host) {\n results += res.host;\n }\n\n if (res.pathname) {\n results += res.pathname;\n }\n\n const qs = !res.search\n ? ''\n : // @ts-ignore: `entries` is not on `URLSearchParams` in some typechecks.\n [...res.searchParams.entries()].map(([k, v]) => `${k}=${decodeURIComponent(v)}`).join('&');\n\n if (qs) {\n results += '?' + qs;\n }\n\n return results;\n}\n\nexport function extractExpoPathFromURL(url: string = '') {\n return (\n extractExactPathFromURL(url)\n // TODO: We should get rid of this, dropping specificities is not good\n .replace(/^\\//, '')\n );\n}\n"]}
@@ -152,7 +152,7 @@ function walkConfigItems(route, focusedRoute, configs, { preserveDynamicRoutes,
152
152
  }
153
153
  pattern = inputPattern;
154
154
  if (route.params) {
155
- if (route.params['#']) {
155
+ if (route.params['#'] !== undefined) {
156
156
  hash = route.params['#'];
157
157
  delete route.params['#'];
158
158
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;AAAA,iDAAuF;AAGvF,0CAKqB;AAuBrB,MAAM,eAAe,GAA0B,EAAE,CAAC;AAElD,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACpC;IAED,IAAI,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QAC1C,OAAO,cAAc,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,MAAqB;IAC5C,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,EAAE;QACd,MAAM,EAAE;YACN;gBACE,GAAG,EAAE,SAAS;gBACd,IAAI,EAAE,MAAM,CAAC,MAAM;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAe;IA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ACpF,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QACtD,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;QACP,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,OAAgB,EACY,EAAE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CACjF,CAAC;AAEJ,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAA8B,OAAO,CAAC,GAAG,CAAC,aAAa;IAEvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QAC1C,IAAI,OAAO,EAAE;YACX,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;SACpE;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,sCAUC","sourcesContent":["import { PathConfig, PathConfigMap, validatePathConfig } from '@react-navigation/core';\nimport type { NavigationState, PartialState, Route } from '@react-navigation/routers';\n\nimport {\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n testNotFound,\n} from '../matchers';\n\ntype Options<ParamList extends object> = {\n initialRouteName?: string;\n screens: PathConfigMap<ParamList>;\n};\n\nexport type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;\n\ntype StringifyConfig = Record<string, (value: any) => string>;\n\ntype ConfigItem = {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record<string, ConfigItem>;\n // Used as fallback for groups\n initialRouteName?: string;\n};\n\ntype CustomRoute = Route<string> & {\n state?: State;\n};\n\nconst DEFAULT_SCREENS: PathConfigMap<object> = {};\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n if (route && isInvalidParams(route.params)) {\n return getActiveRoute(createFakeState(route.params));\n }\n\n return route;\n};\n\nfunction createFakeState(params: StateAsParams) {\n return {\n stale: false,\n type: 'UNKNOWN',\n key: 'UNKNOWN',\n index: 0,\n routeNames: [],\n routes: [\n {\n key: 'UNKNOWN',\n name: params.screen,\n params: params.params,\n path: params.path,\n },\n ],\n };\n}\n\nfunction segmentMatchesConvention(segment: string): boolean {\n return (\n segment === 'index' ||\n matchDynamicName(segment) != null ||\n matchGroupName(segment) != null ||\n matchDeepDynamicRouteName(segment) != null\n );\n}\n\nfunction encodeURIComponentPreservingBrackets(str: string) {\n return encodeURIComponent(str).replace(/%5B/g, '[').replace(/%5D/g, ']');\n}\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport default function getPathFromState<ParamList extends object>(\n state: State,\n _options?: Options<ParamList> & {\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n }\n): string {\n return getPathDataFromState(state, _options).path;\n}\n\nexport function getPathDataFromState<ParamList extends object>(\n state: State,\n _options: Options<ParamList> & {\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n } = { screens: DEFAULT_SCREENS }\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n const { preserveGroups, preserveDynamicRoutes, ...options } = _options;\n\n validatePathConfig(options);\n\n // Expo Router disallows usage without a linking config.\n if (Object.is(options.screens, DEFAULT_SCREENS)) {\n throw Error(\"You must pass a 'screens' object to 'getPathFromState' to generate a path.\");\n }\n\n return getPathFromResolvedState(\n JSON.parse(JSON.stringify(state)),\n // Create a normalized configs object which will be easier to use\n createNormalizedConfigs(options.screens),\n { preserveGroups, preserveDynamicRoutes }\n );\n}\n\nfunction processParamsWithUserSettings(configItem: ConfigItem, params: Record<string, any>) {\n const stringify = configItem?.stringify;\n\n return Object.fromEntries(\n Object.entries(params).map(([key, value]) => [\n key,\n // TODO: Strip nullish values here.\n stringify?.[key]\n ? stringify[key](value)\n : // Preserve rest params\n Array.isArray(value)\n ? value\n : String(value),\n ])\n );\n}\n\nexport function deepEqual(a: any, b: any) {\n if (a === b) {\n return true;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n if (typeof a === 'object' && typeof b === 'object') {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction walkConfigItems(\n route: CustomRoute,\n focusedRoute: {\n name: string;\n params?: object;\n },\n configs: Record<string, ConfigItem>,\n {\n preserveDynamicRoutes,\n }: {\n preserveDynamicRoutes?: boolean;\n }\n) {\n // NOTE(EvanBacon): Fill in current route using state that was passed as params.\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n let pattern: string | null = null;\n let focusedParams: Record<string, any> | undefined;\n let hash: string | undefined;\n\n const collectedParams: Record<string, any> = {};\n\n while (route.name in configs) {\n const configItem = configs[route.name];\n const inputPattern = configItem.pattern;\n\n if (inputPattern == null) {\n // This should never happen in Expo Router.\n throw new Error('Unexpected: No pattern found for route ' + route.name);\n }\n pattern = inputPattern;\n\n if (route.params) {\n if (route.params['#']) {\n hash = route.params['#'];\n delete route.params['#'];\n }\n\n const params = processParamsWithUserSettings(configItem, route.params);\n if (pattern !== undefined && pattern !== null) {\n Object.assign(collectedParams, params);\n }\n if (deepEqual(focusedRoute, route)) {\n if (preserveDynamicRoutes) {\n focusedParams = params;\n } else {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params,\n pattern,\n routeName: route.name,\n });\n }\n }\n }\n\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!configItem.screens || route.state === undefined) {\n if (\n configItem.initialRouteName &&\n configItem.screens &&\n configItem.initialRouteName in configItem.screens &&\n configItem.screens[configItem.initialRouteName]?.pattern\n ) {\n const initialRouteConfig = configItem.screens[configItem.initialRouteName];\n\n // NOTE(EvanBacon): Big hack to support initial route changes in tab bars.\n pattern = initialRouteConfig.pattern!;\n if (focusedParams) {\n if (!preserveDynamicRoutes) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params: focusedParams,\n pattern,\n routeName: route.name,\n });\n }\n }\n }\n break;\n }\n\n const index = route.state.index ?? route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedScreens = configItem.screens;\n\n // if there is config for next route name, we go deeper\n if (nestedScreens && nextRoute.name in nestedScreens) {\n route = nextRoute as CustomRoute;\n configs = nestedScreens;\n } else {\n // If not, there is no sense in going deeper in config\n break;\n }\n }\n\n if (pattern == null) {\n throw new Error(\n `No pattern found for route \"${route.name}\". Options are: ${Object.keys(configs).join(', ')}.`\n );\n }\n\n if (pattern && !focusedParams && focusedRoute.params) {\n if (preserveDynamicRoutes) {\n focusedParams = focusedRoute.params;\n } else {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params: focusedRoute.params,\n pattern,\n routeName: route.name,\n });\n }\n Object.assign(focusedParams, collectedParams);\n }\n\n return {\n pattern,\n nextRoute: route,\n focusedParams,\n hash,\n params: collectedParams,\n };\n}\n\nfunction getPathFromResolvedState(\n state: State,\n configs: Record<string, ConfigItem>,\n {\n preserveGroups,\n preserveDynamicRoutes,\n }: { preserveGroups?: boolean; preserveDynamicRoutes?: boolean }\n) {\n let path = '';\n let current: State = state;\n let hash: string | undefined;\n\n const allParams: Record<string, any> = {};\n\n while (current) {\n path += '/';\n\n // Make mutable copies to ensure we don't leak state outside of the function.\n const route = current.routes[current.index ?? 0] as CustomRoute;\n\n // NOTE(EvanBacon): Fill in current route using state that was passed as params.\n // if (isInvalidParams(route.params)) {\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n const {\n pattern,\n params,\n nextRoute,\n focusedParams,\n hash: $hash,\n } = walkConfigItems(route, getActiveRoute(current), { ...configs }, { preserveDynamicRoutes });\n\n if ($hash) {\n hash = $hash;\n }\n\n Object.assign(allParams, params);\n\n path += getPathWithConventionsCollapsed({\n pattern,\n routePath: nextRoute.path,\n params: allParams,\n initialRouteName: configs[nextRoute.name]?.initialRouteName,\n preserveGroups,\n preserveDynamicRoutes,\n });\n\n if (\n nextRoute.state &&\n // NOTE(EvanBacon): The upstream implementation allows for sending in synthetic states (states that weren't generated by `getStateFromPath`)\n // and any invalid routes will simply be ignored.\n // Because of this, we need to check if the next route is valid before continuing, otherwise our more strict\n // implementation will throw an error.\n configs[nextRoute.state.routes?.[nextRoute.state?.index ?? 0]?.name]\n ) {\n // Continue looping with the next state if available.\n current = nextRoute.state;\n } else {\n // Finished crawling state.\n\n // Check for query params before exiting.\n if (focusedParams) {\n for (const param in focusedParams) {\n // TODO: This is not good. We shouldn't squat strings named \"undefined\".\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n const query = new URLSearchParams(focusedParams).toString();\n if (query) {\n path += `?${query}`;\n }\n }\n break;\n }\n }\n\n if (hash) {\n allParams['#'] = hash;\n path += `#${hash}`;\n }\n\n const params = decodeParams(allParams);\n\n return { path: appendBaseUrl(basicSanitizePath(path)), params };\n}\n\nfunction decodeParams(params: Record<string, string>) {\n const parsed: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(params)) {\n try {\n if (Array.isArray(value)) {\n parsed[key] = value.map((v) => decodeURIComponent(v));\n } else {\n parsed[key] = decodeURIComponent(value);\n }\n } catch {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n\nfunction getPathWithConventionsCollapsed({\n pattern,\n routePath,\n params,\n preserveGroups,\n preserveDynamicRoutes,\n initialRouteName,\n}: {\n pattern: string;\n routePath?: string;\n params: Record<string, any>;\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n initialRouteName?: string;\n}) {\n const segments = pattern.split('/');\n return segments\n .map((p, i) => {\n const name = getParamName(p);\n\n // We don't know what to show for wildcard patterns\n // Showing the route name seems ok, though whatever we show here will be incorrect\n // Since the page doesn't actually exist\n if (p.startsWith('*')) {\n if (preserveDynamicRoutes) {\n if (name === 'not-found') {\n return '+not-found';\n }\n return `[...${name}]`;\n }\n if (params[name]) {\n if (Array.isArray(params[name])) {\n return params[name].join('/');\n }\n return params[name];\n }\n if (i === 0) {\n // This can occur when a wildcard matches all routes and the given path was `/`.\n return routePath;\n }\n // remove existing segments from route.path and return it\n // this is used for nested wildcard routes. Without this, the path would add\n // all nested segments to the beginning of the wildcard route.\n return routePath\n ?.split('/')\n .slice(i + 1)\n .join('/');\n }\n\n // If the path has a pattern for a param, put the param in the path\n if (p.startsWith(':')) {\n if (preserveDynamicRoutes) {\n return `[${name}]`;\n }\n // Optional params without value assigned in route.params should be ignored\n return params[name];\n }\n\n if (!preserveGroups && matchGroupName(p) != null) {\n // When the last part is a group it could be a shared URL\n // if the route has an initialRouteName defined, then we should\n // use that as the component path as we can assume it will be shown.\n if (segments.length - 1 === i) {\n if (initialRouteName) {\n // Return an empty string if the init route is ambiguous.\n if (segmentMatchesConvention(initialRouteName)) {\n return '';\n }\n return encodeURIComponentPreservingBrackets(initialRouteName);\n }\n }\n return '';\n }\n // Preserve dynamic syntax for rehydration\n return encodeURIComponentPreservingBrackets(p);\n })\n .map((v) => v ?? '')\n .join('/');\n}\n\n/** Given a set of query params and a pattern with possible conventions, collapse the conventions and return the remaining params. */\nfunction getParamsWithConventionsCollapsed({\n pattern,\n routeName,\n params,\n}: {\n pattern: string;\n /** Route name is required for matching the wildcard route. This is specific to Expo Router. */\n routeName: string;\n params: object;\n}): Record<string, string> {\n const processedParams: Record<string, string> = { ...params };\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n\n const segments = pattern.split('/');\n\n // Dynamic Routes\n segments\n .filter((segment) => segment.startsWith(':'))\n .forEach((segment) => {\n const name = getParamName(segment);\n delete processedParams[name];\n });\n\n // Deep Dynamic Routes\n if (segments.some((segment) => segment.startsWith('*'))) {\n // NOTE(EvanBacon): Drop the param name matching the wildcard route name -- this is specific to Expo Router.\n const name = testNotFound(routeName)\n ? 'not-found'\n : matchDeepDynamicRouteName(routeName) ?? routeName;\n delete processedParams[name];\n }\n\n return processedParams;\n}\n\n// Remove multiple as well as trailing slashes\nfunction basicSanitizePath(path: string) {\n // Remove duplicate slashes like `foo//bar` -> `foo/bar`\n const simplifiedPath = path.replace(/\\/+/g, '/');\n if (simplifiedPath.length <= 1) {\n return simplifiedPath;\n }\n // Remove trailing slash like `foo/bar/` -> `foo/bar`\n return simplifiedPath.replace(/\\/$/, '');\n}\n\ntype StateAsParams = {\n initial: boolean;\n path?: string;\n screen: string;\n params: Record<string, any>;\n};\n\n// TODO: Make StackRouter not do this...\n// Detect if the params came from StackRouter using `params` to pass around internal state.\nfunction isInvalidParams(params?: Record<string, any>): params is StateAsParams {\n if (!params) {\n return false;\n }\n\n if ('params' in params && typeof params.params === 'object' && !!params.params) {\n return true;\n }\n\n return (\n 'initial' in params &&\n typeof params.initial === 'boolean' &&\n // \"path\" in params &&\n 'screen' in params\n );\n}\n\nconst getParamName = (pattern: string) => pattern.replace(/^[:*]/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig<object> | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n initialRouteName: config.initialRouteName,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap<object>,\n pattern?: string\n): Record<string, ConfigItem> =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => [name, createConfigItem(c, pattern)])\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]}
1
+ {"version":3,"file":"getPathFromState.js","sourceRoot":"","sources":["../../src/fork/getPathFromState.ts"],"names":[],"mappings":";;;AAAA,iDAAuF;AAGvF,0CAKqB;AAuBrB,MAAM,eAAe,GAA0B,EAAE,CAAC;AAElD,MAAM,cAAc,GAAG,CAAC,KAAY,EAAqC,EAAE;IACzE,MAAM,KAAK,GACT,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ;QAC7B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QAC3B,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAE5C,IAAI,KAAK,CAAC,KAAK,EAAE;QACf,OAAO,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KACpC;IAED,IAAI,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;QAC1C,OAAO,cAAc,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;KACtD;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,MAAqB;IAC5C,OAAO;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,SAAS;QACf,GAAG,EAAE,SAAS;QACd,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,EAAE;QACd,MAAM,EAAE;YACN;gBACE,GAAG,EAAE,SAAS;gBACd,IAAI,EAAE,MAAM,CAAC,MAAM;gBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,IAAI,EAAE,MAAM,CAAC,IAAI;aAClB;SACF;KACF,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,OAAe;IAC/C,OAAO,CACL,OAAO,KAAK,OAAO;QACnB,IAAA,2BAAgB,EAAC,OAAO,CAAC,IAAI,IAAI;QACjC,IAAA,yBAAc,EAAC,OAAO,CAAC,IA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;QACtD,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,OAAO;QACP,gBAAgB,EAAE,MAAM,CAAC,gBAAgB;KAC1C,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAC9B,OAA8B,EAC9B,OAAgB,EACY,EAAE,CAC9B,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CACjF,CAAC;AAEJ,SAAgB,aAAa,CAC3B,IAAY,EACZ,UAA8B,OAAO,CAAC,GAAG,CAAC,aAAa;IAEvD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,EAAE;QAC1C,IAAI,OAAO,EAAE;YACX,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC;SACpE;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAVD,sCAUC","sourcesContent":["import { PathConfig, PathConfigMap, validatePathConfig } from '@react-navigation/core';\nimport type { NavigationState, PartialState, Route } from '@react-navigation/routers';\n\nimport {\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n testNotFound,\n} from '../matchers';\n\ntype Options<ParamList extends object> = {\n initialRouteName?: string;\n screens: PathConfigMap<ParamList>;\n};\n\nexport type State = NavigationState | Omit<PartialState<NavigationState>, 'stale'>;\n\ntype StringifyConfig = Record<string, (value: any) => string>;\n\ntype ConfigItem = {\n pattern?: string;\n stringify?: StringifyConfig;\n screens?: Record<string, ConfigItem>;\n // Used as fallback for groups\n initialRouteName?: string;\n};\n\ntype CustomRoute = Route<string> & {\n state?: State;\n};\n\nconst DEFAULT_SCREENS: PathConfigMap<object> = {};\n\nconst getActiveRoute = (state: State): { name: string; params?: object } => {\n const route =\n typeof state.index === 'number'\n ? state.routes[state.index]\n : state.routes[state.routes.length - 1];\n\n if (route.state) {\n return getActiveRoute(route.state);\n }\n\n if (route && isInvalidParams(route.params)) {\n return getActiveRoute(createFakeState(route.params));\n }\n\n return route;\n};\n\nfunction createFakeState(params: StateAsParams) {\n return {\n stale: false,\n type: 'UNKNOWN',\n key: 'UNKNOWN',\n index: 0,\n routeNames: [],\n routes: [\n {\n key: 'UNKNOWN',\n name: params.screen,\n params: params.params,\n path: params.path,\n },\n ],\n };\n}\n\nfunction segmentMatchesConvention(segment: string): boolean {\n return (\n segment === 'index' ||\n matchDynamicName(segment) != null ||\n matchGroupName(segment) != null ||\n matchDeepDynamicRouteName(segment) != null\n );\n}\n\nfunction encodeURIComponentPreservingBrackets(str: string) {\n return encodeURIComponent(str).replace(/%5B/g, '[').replace(/%5D/g, ']');\n}\n\n/**\n * Utility to serialize a navigation state object to a path string.\n *\n * @example\n * ```js\n * getPathFromState(\n * {\n * routes: [\n * {\n * name: 'Chat',\n * params: { author: 'Jane', id: 42 },\n * },\n * ],\n * },\n * {\n * screens: {\n * Chat: {\n * path: 'chat/:author/:id',\n * stringify: { author: author => author.toLowerCase() }\n * }\n * }\n * }\n * )\n * ```\n *\n * @param state Navigation state to serialize.\n * @param options Extra options to fine-tune how to serialize the path.\n * @returns Path representing the state, e.g. /foo/bar?count=42.\n */\nexport default function getPathFromState<ParamList extends object>(\n state: State,\n _options?: Options<ParamList> & {\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n }\n): string {\n return getPathDataFromState(state, _options).path;\n}\n\nexport function getPathDataFromState<ParamList extends object>(\n state: State,\n _options: Options<ParamList> & {\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n } = { screens: DEFAULT_SCREENS }\n) {\n if (state == null) {\n throw Error(\"Got 'undefined' for the navigation state. You must pass a valid state object.\");\n }\n\n const { preserveGroups, preserveDynamicRoutes, ...options } = _options;\n\n validatePathConfig(options);\n\n // Expo Router disallows usage without a linking config.\n if (Object.is(options.screens, DEFAULT_SCREENS)) {\n throw Error(\"You must pass a 'screens' object to 'getPathFromState' to generate a path.\");\n }\n\n return getPathFromResolvedState(\n JSON.parse(JSON.stringify(state)),\n // Create a normalized configs object which will be easier to use\n createNormalizedConfigs(options.screens),\n { preserveGroups, preserveDynamicRoutes }\n );\n}\n\nfunction processParamsWithUserSettings(configItem: ConfigItem, params: Record<string, any>) {\n const stringify = configItem?.stringify;\n\n return Object.fromEntries(\n Object.entries(params).map(([key, value]) => [\n key,\n // TODO: Strip nullish values here.\n stringify?.[key]\n ? stringify[key](value)\n : // Preserve rest params\n Array.isArray(value)\n ? value\n : String(value),\n ])\n );\n}\n\nexport function deepEqual(a: any, b: any) {\n if (a === b) {\n return true;\n }\n\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n\n return true;\n }\n\n if (typeof a === 'object' && typeof b === 'object') {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n for (const key of keysA) {\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n\n return true;\n }\n\n return false;\n}\n\nfunction walkConfigItems(\n route: CustomRoute,\n focusedRoute: {\n name: string;\n params?: object;\n },\n configs: Record<string, ConfigItem>,\n {\n preserveDynamicRoutes,\n }: {\n preserveDynamicRoutes?: boolean;\n }\n) {\n // NOTE(EvanBacon): Fill in current route using state that was passed as params.\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n let pattern: string | null = null;\n let focusedParams: Record<string, any> | undefined;\n let hash: string | undefined;\n\n const collectedParams: Record<string, any> = {};\n\n while (route.name in configs) {\n const configItem = configs[route.name];\n const inputPattern = configItem.pattern;\n\n if (inputPattern == null) {\n // This should never happen in Expo Router.\n throw new Error('Unexpected: No pattern found for route ' + route.name);\n }\n pattern = inputPattern;\n\n if (route.params) {\n if (route.params['#'] !== undefined) {\n hash = route.params['#'];\n delete route.params['#'];\n }\n\n const params = processParamsWithUserSettings(configItem, route.params);\n if (pattern !== undefined && pattern !== null) {\n Object.assign(collectedParams, params);\n }\n if (deepEqual(focusedRoute, route)) {\n if (preserveDynamicRoutes) {\n focusedParams = params;\n } else {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params,\n pattern,\n routeName: route.name,\n });\n }\n }\n }\n\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n // If there is no `screens` property or no nested state, we return pattern\n if (!configItem.screens || route.state === undefined) {\n if (\n configItem.initialRouteName &&\n configItem.screens &&\n configItem.initialRouteName in configItem.screens &&\n configItem.screens[configItem.initialRouteName]?.pattern\n ) {\n const initialRouteConfig = configItem.screens[configItem.initialRouteName];\n\n // NOTE(EvanBacon): Big hack to support initial route changes in tab bars.\n pattern = initialRouteConfig.pattern!;\n if (focusedParams) {\n if (!preserveDynamicRoutes) {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params: focusedParams,\n pattern,\n routeName: route.name,\n });\n }\n }\n }\n break;\n }\n\n const index = route.state.index ?? route.state.routes.length - 1;\n\n const nextRoute = route.state.routes[index];\n const nestedScreens = configItem.screens;\n\n // if there is config for next route name, we go deeper\n if (nestedScreens && nextRoute.name in nestedScreens) {\n route = nextRoute as CustomRoute;\n configs = nestedScreens;\n } else {\n // If not, there is no sense in going deeper in config\n break;\n }\n }\n\n if (pattern == null) {\n throw new Error(\n `No pattern found for route \"${route.name}\". Options are: ${Object.keys(configs).join(', ')}.`\n );\n }\n\n if (pattern && !focusedParams && focusedRoute.params) {\n if (preserveDynamicRoutes) {\n focusedParams = focusedRoute.params;\n } else {\n // If this is the focused route, keep the params for later use\n // We save it here since it's been stringified already\n focusedParams = getParamsWithConventionsCollapsed({\n params: focusedRoute.params,\n pattern,\n routeName: route.name,\n });\n }\n Object.assign(focusedParams, collectedParams);\n }\n\n return {\n pattern,\n nextRoute: route,\n focusedParams,\n hash,\n params: collectedParams,\n };\n}\n\nfunction getPathFromResolvedState(\n state: State,\n configs: Record<string, ConfigItem>,\n {\n preserveGroups,\n preserveDynamicRoutes,\n }: { preserveGroups?: boolean; preserveDynamicRoutes?: boolean }\n) {\n let path = '';\n let current: State = state;\n let hash: string | undefined;\n\n const allParams: Record<string, any> = {};\n\n while (current) {\n path += '/';\n\n // Make mutable copies to ensure we don't leak state outside of the function.\n const route = current.routes[current.index ?? 0] as CustomRoute;\n\n // NOTE(EvanBacon): Fill in current route using state that was passed as params.\n // if (isInvalidParams(route.params)) {\n if (!route.state && isInvalidParams(route.params)) {\n route.state = createFakeState(route.params);\n }\n\n const {\n pattern,\n params,\n nextRoute,\n focusedParams,\n hash: $hash,\n } = walkConfigItems(route, getActiveRoute(current), { ...configs }, { preserveDynamicRoutes });\n\n if ($hash) {\n hash = $hash;\n }\n\n Object.assign(allParams, params);\n\n path += getPathWithConventionsCollapsed({\n pattern,\n routePath: nextRoute.path,\n params: allParams,\n initialRouteName: configs[nextRoute.name]?.initialRouteName,\n preserveGroups,\n preserveDynamicRoutes,\n });\n\n if (\n nextRoute.state &&\n // NOTE(EvanBacon): The upstream implementation allows for sending in synthetic states (states that weren't generated by `getStateFromPath`)\n // and any invalid routes will simply be ignored.\n // Because of this, we need to check if the next route is valid before continuing, otherwise our more strict\n // implementation will throw an error.\n configs[nextRoute.state.routes?.[nextRoute.state?.index ?? 0]?.name]\n ) {\n // Continue looping with the next state if available.\n current = nextRoute.state;\n } else {\n // Finished crawling state.\n\n // Check for query params before exiting.\n if (focusedParams) {\n for (const param in focusedParams) {\n // TODO: This is not good. We shouldn't squat strings named \"undefined\".\n if (focusedParams[param] === 'undefined') {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete focusedParams[param];\n }\n }\n\n const query = new URLSearchParams(focusedParams).toString();\n if (query) {\n path += `?${query}`;\n }\n }\n break;\n }\n }\n\n if (hash) {\n allParams['#'] = hash;\n path += `#${hash}`;\n }\n\n const params = decodeParams(allParams);\n\n return { path: appendBaseUrl(basicSanitizePath(path)), params };\n}\n\nfunction decodeParams(params: Record<string, string>) {\n const parsed: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(params)) {\n try {\n if (Array.isArray(value)) {\n parsed[key] = value.map((v) => decodeURIComponent(v));\n } else {\n parsed[key] = decodeURIComponent(value);\n }\n } catch {\n parsed[key] = value;\n }\n }\n\n return parsed;\n}\n\nfunction getPathWithConventionsCollapsed({\n pattern,\n routePath,\n params,\n preserveGroups,\n preserveDynamicRoutes,\n initialRouteName,\n}: {\n pattern: string;\n routePath?: string;\n params: Record<string, any>;\n preserveGroups?: boolean;\n preserveDynamicRoutes?: boolean;\n initialRouteName?: string;\n}) {\n const segments = pattern.split('/');\n return segments\n .map((p, i) => {\n const name = getParamName(p);\n\n // We don't know what to show for wildcard patterns\n // Showing the route name seems ok, though whatever we show here will be incorrect\n // Since the page doesn't actually exist\n if (p.startsWith('*')) {\n if (preserveDynamicRoutes) {\n if (name === 'not-found') {\n return '+not-found';\n }\n return `[...${name}]`;\n }\n if (params[name]) {\n if (Array.isArray(params[name])) {\n return params[name].join('/');\n }\n return params[name];\n }\n if (i === 0) {\n // This can occur when a wildcard matches all routes and the given path was `/`.\n return routePath;\n }\n // remove existing segments from route.path and return it\n // this is used for nested wildcard routes. Without this, the path would add\n // all nested segments to the beginning of the wildcard route.\n return routePath\n ?.split('/')\n .slice(i + 1)\n .join('/');\n }\n\n // If the path has a pattern for a param, put the param in the path\n if (p.startsWith(':')) {\n if (preserveDynamicRoutes) {\n return `[${name}]`;\n }\n // Optional params without value assigned in route.params should be ignored\n return params[name];\n }\n\n if (!preserveGroups && matchGroupName(p) != null) {\n // When the last part is a group it could be a shared URL\n // if the route has an initialRouteName defined, then we should\n // use that as the component path as we can assume it will be shown.\n if (segments.length - 1 === i) {\n if (initialRouteName) {\n // Return an empty string if the init route is ambiguous.\n if (segmentMatchesConvention(initialRouteName)) {\n return '';\n }\n return encodeURIComponentPreservingBrackets(initialRouteName);\n }\n }\n return '';\n }\n // Preserve dynamic syntax for rehydration\n return encodeURIComponentPreservingBrackets(p);\n })\n .map((v) => v ?? '')\n .join('/');\n}\n\n/** Given a set of query params and a pattern with possible conventions, collapse the conventions and return the remaining params. */\nfunction getParamsWithConventionsCollapsed({\n pattern,\n routeName,\n params,\n}: {\n pattern: string;\n /** Route name is required for matching the wildcard route. This is specific to Expo Router. */\n routeName: string;\n params: object;\n}): Record<string, string> {\n const processedParams: Record<string, string> = { ...params };\n\n // Remove the params present in the pattern since we'll only use the rest for query string\n\n const segments = pattern.split('/');\n\n // Dynamic Routes\n segments\n .filter((segment) => segment.startsWith(':'))\n .forEach((segment) => {\n const name = getParamName(segment);\n delete processedParams[name];\n });\n\n // Deep Dynamic Routes\n if (segments.some((segment) => segment.startsWith('*'))) {\n // NOTE(EvanBacon): Drop the param name matching the wildcard route name -- this is specific to Expo Router.\n const name = testNotFound(routeName)\n ? 'not-found'\n : matchDeepDynamicRouteName(routeName) ?? routeName;\n delete processedParams[name];\n }\n\n return processedParams;\n}\n\n// Remove multiple as well as trailing slashes\nfunction basicSanitizePath(path: string) {\n // Remove duplicate slashes like `foo//bar` -> `foo/bar`\n const simplifiedPath = path.replace(/\\/+/g, '/');\n if (simplifiedPath.length <= 1) {\n return simplifiedPath;\n }\n // Remove trailing slash like `foo/bar/` -> `foo/bar`\n return simplifiedPath.replace(/\\/$/, '');\n}\n\ntype StateAsParams = {\n initial: boolean;\n path?: string;\n screen: string;\n params: Record<string, any>;\n};\n\n// TODO: Make StackRouter not do this...\n// Detect if the params came from StackRouter using `params` to pass around internal state.\nfunction isInvalidParams(params?: Record<string, any>): params is StateAsParams {\n if (!params) {\n return false;\n }\n\n if ('params' in params && typeof params.params === 'object' && !!params.params) {\n return true;\n }\n\n return (\n 'initial' in params &&\n typeof params.initial === 'boolean' &&\n // \"path\" in params &&\n 'screen' in params\n );\n}\n\nconst getParamName = (pattern: string) => pattern.replace(/^[:*]/, '').replace(/\\?$/, '');\n\nconst joinPaths = (...paths: string[]): string =>\n ([] as string[])\n .concat(...paths.map((p) => p.split('/')))\n .filter(Boolean)\n .join('/');\n\nconst createConfigItem = (\n config: PathConfig<object> | string,\n parentPattern?: string\n): ConfigItem => {\n if (typeof config === 'string') {\n // If a string is specified as the value of the key(e.g. Foo: '/path'), use it as the pattern\n const pattern = parentPattern ? joinPaths(parentPattern, config) : config;\n\n return { pattern };\n }\n\n if (config.exact && config.path === undefined) {\n throw new Error(\n \"A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.\"\n );\n }\n\n // If an object is specified as the value (e.g. Foo: { ... }),\n // It can have `path` property and `screens` prop which has nested configs\n const pattern =\n config.exact !== true ? joinPaths(parentPattern || '', config.path || '') : config.path || '';\n\n const screens = config.screens ? createNormalizedConfigs(config.screens, pattern) : undefined;\n\n return {\n // Normalize pattern to remove any leading, trailing slashes, duplicate slashes etc.\n pattern: pattern?.split('/').filter(Boolean).join('/'),\n stringify: config.stringify,\n screens,\n initialRouteName: config.initialRouteName,\n };\n};\n\nconst createNormalizedConfigs = (\n options: PathConfigMap<object>,\n pattern?: string\n): Record<string, ConfigItem> =>\n Object.fromEntries(\n Object.entries(options).map(([name, c]) => [name, createConfigItem(c, pattern)])\n );\n\nexport function appendBaseUrl(\n path: string,\n baseUrl: string | undefined = process.env.EXPO_BASE_URL\n) {\n if (process.env.NODE_ENV !== 'development') {\n if (baseUrl) {\n return `/${baseUrl.replace(/^\\/+/, '').replace(/\\/$/, '')}${path}`;\n }\n }\n return path;\n}\n"]}
@@ -35,7 +35,7 @@ const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
35
35
  const React = __importStar(require("react"));
36
36
  /* Start of fork. Source: https://github.com/react-navigation/react-navigation/blob/13d4aa270b301faf07960b4cd861ffc91e9b2c46/packages/native/src/useLinking.tsx#L13 */
37
37
  // createMemoryHistory is a self-contained module with no side effects any only depends on `nanoid` and `tiny-warning`
38
- const createMemoryHistory_1 = __importDefault(require("@react-navigation/native/lib/commonjs/createMemoryHistory"));
38
+ const createMemoryHistory_1 = __importDefault(require("./createMemoryHistory"));
39
39
  // import ServerContext from './ServerContext';
40
40
  const serverContext_1 = __importDefault(require("../global-state/serverContext"));
41
41
  const getPathFromState_1 = require("./getPathFromState");