expo-router 5.0.1-preview.1 → 5.0.2-preview.1
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.
- package/build/ExpoRoot.js +18 -9
- package/build/ExpoRoot.js.map +1 -1
- package/build/LocationProvider.js +2 -3
- package/build/LocationProvider.js.map +1 -1
- package/build/Route.js +4 -4
- package/build/Route.js.map +1 -1
- package/build/doctor/index.js +1 -2
- package/build/doctor/index.js.map +1 -1
- package/build/exports.js +17 -7
- package/build/exports.js.map +1 -1
- package/build/fast-refresh.js.map +1 -1
- package/build/fork/NavigationContainer.d.ts +2 -7
- package/build/fork/NavigationContainer.d.ts.map +1 -1
- package/build/fork/NavigationContainer.js.map +1 -1
- package/build/fork/createMemoryHistory.d.ts.map +1 -1
- package/build/fork/createMemoryHistory.js +1 -2
- package/build/fork/createMemoryHistory.js.map +1 -1
- package/build/fork/extractPathFromURL.js +3 -4
- package/build/fork/extractPathFromURL.js.map +1 -1
- package/build/fork/findFocusedRoute.d.ts +1 -11
- package/build/fork/findFocusedRoute.d.ts.map +1 -1
- package/build/fork/findFocusedRoute.js +1 -2
- package/build/fork/findFocusedRoute.js.map +1 -1
- package/build/fork/getPathFromState-forks.d.ts.map +1 -1
- package/build/fork/getPathFromState-forks.js +24 -14
- package/build/fork/getPathFromState-forks.js.map +1 -1
- package/build/fork/getPathFromState.js +20 -11
- package/build/fork/getPathFromState.js.map +1 -1
- package/build/fork/getStateFromPath-forks.d.ts +4 -4
- package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
- package/build/fork/getStateFromPath-forks.js +18 -19
- package/build/fork/getStateFromPath-forks.js.map +1 -1
- package/build/fork/getStateFromPath.js +18 -9
- package/build/fork/getStateFromPath.js.map +1 -1
- package/build/fork/native-stack/NativeStackView.js +1 -2
- package/build/fork/native-stack/NativeStackView.js.map +1 -1
- package/build/fork/native-stack/createNativeStackNavigator.js +18 -9
- package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
- package/build/fork/useBackButton.d.ts +0 -1
- package/build/fork/useBackButton.d.ts.map +1 -1
- package/build/fork/useBackButton.js +1 -2
- package/build/fork/useBackButton.js.map +1 -1
- package/build/fork/useBackButton.native.js +18 -9
- package/build/fork/useBackButton.native.js.map +1 -1
- package/build/fork/useDocumentTitle.js +18 -9
- package/build/fork/useDocumentTitle.js.map +1 -1
- package/build/fork/useDocumentTitle.native.js +1 -2
- package/build/fork/useDocumentTitle.native.js.map +1 -1
- package/build/fork/useLinking.d.ts +3 -26
- package/build/fork/useLinking.d.ts.map +1 -1
- package/build/fork/useLinking.js +20 -10
- package/build/fork/useLinking.js.map +1 -1
- package/build/fork/useLinking.native.d.ts +6 -6
- package/build/fork/useLinking.native.js +19 -10
- package/build/fork/useLinking.native.js.map +1 -1
- package/build/fork/useThenable.js +18 -9
- package/build/fork/useThenable.js.map +1 -1
- package/build/fork/validatePathConfig.js +1 -1
- package/build/fork/validatePathConfig.js.map +1 -1
- package/build/getDevServer/index.js.map +1 -1
- package/build/getLinkingConfig.js +3 -3
- package/build/getLinkingConfig.js.map +1 -1
- package/build/getReactNavigationConfig.js +3 -4
- package/build/getReactNavigationConfig.js.map +1 -1
- package/build/getRoutes.js +3 -3
- package/build/getRoutes.js.map +1 -1
- package/build/getRoutesCore.js +6 -7
- package/build/getRoutesCore.js.map +1 -1
- package/build/getRoutesRedirects.d.ts +0 -1
- package/build/getRoutesRedirects.d.ts.map +1 -1
- package/build/getRoutesRedirects.js +3 -4
- package/build/getRoutesRedirects.js.map +1 -1
- package/build/getRoutesSSR.js +3 -3
- package/build/getRoutesSSR.js.map +1 -1
- package/build/getServerManifest.js +2 -3
- package/build/getServerManifest.js.map +1 -1
- package/build/global-state/routeInfo.js +18 -9
- package/build/global-state/routeInfo.js.map +1 -1
- package/build/global-state/router-store.d.ts +6 -6
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +22 -12
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.js +29 -20
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/serverLocationContext.d.ts +0 -1
- package/build/global-state/serverLocationContext.d.ts.map +1 -1
- package/build/global-state/sort-routes.js +1 -2
- package/build/global-state/sort-routes.js.map +1 -1
- package/build/head/ExpoHead.android.d.ts +1 -1
- package/build/head/ExpoHead.android.js +1 -2
- package/build/head/ExpoHead.android.js.map +1 -1
- package/build/head/ExpoHead.ios.js.map +1 -1
- package/build/head/ExpoHeadModule.js.map +1 -1
- package/build/head/url.js +2 -3
- package/build/head/url.js.map +1 -1
- package/build/hooks.js +11 -12
- package/build/hooks.js.map +1 -1
- package/build/layouts/DrawerClient.d.ts +16 -17
- package/build/layouts/DrawerClient.d.ts.map +1 -1
- package/build/layouts/RootModal.d.ts +1 -2
- package/build/layouts/RootModal.d.ts.map +1 -1
- package/build/layouts/RootModal.js +2 -2
- package/build/layouts/RootModal.js.map +1 -1
- package/build/layouts/StackClient.d.ts +16 -16
- package/build/layouts/StackClient.d.ts.map +1 -1
- package/build/layouts/StackClient.js.map +1 -1
- package/build/layouts/TabsClient.d.ts +12 -12
- package/build/layouts/TabsClient.js.map +1 -1
- package/build/layouts/withLayoutContext.d.ts +2 -2
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +19 -10
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/link/Link.d.ts.map +1 -1
- package/build/link/Link.js +2 -2
- package/build/link/Link.js.map +1 -1
- package/build/link/href.d.ts.map +1 -1
- package/build/link/href.js +2 -2
- package/build/link/href.js.map +1 -1
- package/build/link/linking.d.ts.map +1 -1
- package/build/link/linking.js +21 -11
- package/build/link/linking.js.map +1 -1
- package/build/link/useDomComponentNavigation.js +6 -7
- package/build/link/useDomComponentNavigation.js.map +1 -1
- package/build/link/useLinkHooks.d.ts.map +1 -1
- package/build/link/useLinkHooks.js +2 -2
- package/build/link/useLinkHooks.js.map +1 -1
- package/build/link/useLinkToPathProps.d.ts.map +1 -1
- package/build/link/useLinkToPathProps.js +2 -3
- package/build/link/useLinkToPathProps.js.map +1 -1
- package/build/link/useLoadedNavigation.d.ts.map +1 -1
- package/build/link/useLoadedNavigation.js +2 -3
- package/build/link/useLoadedNavigation.js.map +1 -1
- package/build/loadStaticParamsAsync.js +3 -4
- package/build/loadStaticParamsAsync.js.map +1 -1
- package/build/matchers.js +14 -15
- package/build/matchers.js.map +1 -1
- package/build/onboard/Tutorial.js +1 -2
- package/build/onboard/Tutorial.js.map +1 -1
- package/build/onboard/createEntryFile.js +2 -3
- package/build/onboard/createEntryFile.js.map +1 -1
- package/build/qualified-entry.js +1 -2
- package/build/qualified-entry.js.map +1 -1
- package/build/renderRootComponent.js +18 -9
- package/build/renderRootComponent.js.map +1 -1
- package/build/routes-manifest.js +1 -2
- package/build/routes-manifest.js.map +1 -1
- package/build/rsc/entry.js +1 -2
- package/build/rsc/entry.js.map +1 -1
- package/build/rsc/exports.d.ts +0 -1
- package/build/rsc/exports.d.ts.map +1 -1
- package/build/rsc/exports.js +18 -18
- package/build/rsc/exports.js.map +1 -1
- package/build/rsc/middleware.js +2 -3
- package/build/rsc/middleware.js.map +1 -1
- package/build/rsc/path.d.ts.map +1 -1
- package/build/rsc/path.js.map +1 -1
- package/build/rsc/router/client.d.ts +7 -7
- package/build/rsc/router/client.d.ts.map +1 -1
- package/build/rsc/router/client.js +4 -4
- package/build/rsc/router/client.js.map +1 -1
- package/build/rsc/router/common.js +4 -4
- package/build/rsc/router/common.js.map +1 -1
- package/build/rsc/router/create-expo-pages.d.ts.map +1 -1
- package/build/rsc/router/create-expo-pages.js +1 -2
- package/build/rsc/router/create-expo-pages.js.map +1 -1
- package/build/rsc/router/create-pages.d.ts +1 -3
- package/build/rsc/router/create-pages.d.ts.map +1 -1
- package/build/rsc/router/create-pages.js +1 -2
- package/build/rsc/router/create-pages.js.map +1 -1
- package/build/rsc/router/defineRouter.js +2 -3
- package/build/rsc/router/defineRouter.js.map +1 -1
- package/build/rsc/router/errors.js.map +1 -1
- package/build/rsc/router/expo-definedRouter.d.ts +1 -1
- package/build/rsc/router/expo-definedRouter.js.map +1 -1
- package/build/rsc/router/fetch.js +1 -2
- package/build/rsc/router/fetch.js.map +1 -1
- package/build/rsc/router/host.d.ts +3 -3
- package/build/rsc/router/host.d.ts.map +1 -1
- package/build/rsc/router/host.js.map +1 -1
- package/build/rsc/router/noopRouter.d.ts +1 -1
- package/build/rsc/router/utils.d.ts.map +1 -1
- package/build/rsc/router/utils.js.map +1 -1
- package/build/rsc/rsc-renderer.js +1 -2
- package/build/rsc/rsc-renderer.js.map +1 -1
- package/build/rsc/server.d.ts.map +1 -1
- package/build/rsc/server.js +5 -5
- package/build/rsc/server.js.map +1 -1
- package/build/sortRoutes.d.ts.map +1 -1
- package/build/sortRoutes.js +2 -3
- package/build/sortRoutes.js.map +1 -1
- package/build/static/getRootComponent.js +1 -2
- package/build/static/getRootComponent.js.map +1 -1
- package/build/static/getServerManifest.js +2 -3
- package/build/static/getServerManifest.js.map +1 -1
- package/build/static/html.js +2 -3
- package/build/static/html.js.map +1 -1
- package/build/static/renderStaticContent.js +19 -9
- package/build/static/renderStaticContent.js.map +1 -1
- package/build/testing-library/context-stubs.d.ts +1 -2
- package/build/testing-library/context-stubs.d.ts.map +1 -1
- package/build/testing-library/context-stubs.js +3 -3
- package/build/testing-library/context-stubs.js.map +1 -1
- package/build/testing-library/index.d.ts.map +1 -1
- package/build/testing-library/index.js +2 -2
- package/build/testing-library/index.js.map +1 -1
- package/build/testing-library/mock-config.js +2 -3
- package/build/testing-library/mock-config.js.map +1 -1
- package/build/testing-library/mocks.js.map +1 -1
- package/build/testing-library/require-context-ponyfill.js +1 -1
- package/build/testing-library/require-context-ponyfill.js.map +1 -1
- package/build/typed-routes/generate.js +4 -5
- package/build/typed-routes/generate.js.map +1 -1
- package/build/typed-routes/index.d.ts.map +1 -1
- package/build/typed-routes/index.js +2 -2
- package/build/typed-routes/index.js.map +1 -1
- package/build/ui/Slot.d.ts +0 -1
- package/build/ui/Slot.d.ts.map +1 -1
- package/build/ui/TabContext.d.ts +47 -55
- package/build/ui/TabContext.d.ts.map +1 -1
- package/build/ui/TabList.js +2 -3
- package/build/ui/TabList.js.map +1 -1
- package/build/ui/TabRouter.d.ts +27 -27
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/TabRouter.js +18 -9
- package/build/ui/TabRouter.js.map +1 -1
- package/build/ui/TabSlot.js +4 -5
- package/build/ui/TabSlot.js.map +1 -1
- package/build/ui/TabTrigger.js +3 -4
- package/build/ui/TabTrigger.js.map +1 -1
- package/build/ui/Tabs.d.ts +73 -78
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js +3 -4
- package/build/ui/Tabs.js.map +1 -1
- package/build/ui/common.d.ts +2 -3
- package/build/ui/common.d.ts.map +1 -1
- package/build/ui/common.js +3 -3
- package/build/ui/common.js.map +1 -1
- package/build/ui/useComponent.d.ts.map +1 -1
- package/build/ui/useComponent.js +1 -2
- package/build/ui/useComponent.js.map +1 -1
- package/build/useDeprecated.js +2 -3
- package/build/useDeprecated.js.map +1 -1
- package/build/useFocusEffect.js +18 -9
- package/build/useFocusEffect.js.map +1 -1
- package/build/useNavigation.js +1 -2
- package/build/useNavigation.js.map +1 -1
- package/build/useScreens.js +5 -6
- package/build/useScreens.js.map +1 -1
- package/build/utils/splash.js +5 -6
- package/build/utils/splash.js.map +1 -1
- package/build/utils/url.js +3 -4
- package/build/utils/url.js.map +1 -1
- package/build/views/EmptyRoute.js +1 -2
- package/build/views/EmptyRoute.js.map +1 -1
- package/build/views/ErrorBoundary.d.ts +0 -1
- package/build/views/ErrorBoundary.d.ts.map +1 -1
- package/build/views/ErrorBoundary.js +1 -2
- package/build/views/ErrorBoundary.js.map +1 -1
- package/build/views/Navigator.js +22 -12
- package/build/views/Navigator.js.map +1 -1
- package/build/views/Pressable.d.ts.map +1 -1
- package/build/views/Screen.js +1 -2
- package/build/views/Screen.js.map +1 -1
- package/build/views/Sitemap.js +2 -3
- package/build/views/Sitemap.js.map +1 -1
- package/build/views/SuspenseFallback.js +1 -2
- package/build/views/SuspenseFallback.js.map +1 -1
- package/build/views/Toast.js +3 -3
- package/build/views/Toast.js.map +1 -1
- package/build/views/Try.js +17 -7
- package/build/views/Try.js.map +1 -1
- package/build/views/Unmatched.js +1 -2
- package/build/views/Unmatched.js.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-config.js","sourceRoot":"","sources":["../../src/testing-library/mock-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mock-config.js","sourceRoot":"","sources":["../../src/testing-library/mock-config.ts"],"names":[],"mappings":";;;;;AAsBA,sCAEC;AAED,wCAcC;AAxCD,gDAAwB;AAExB,mDAKyB;AACzB,0DAA0D;AAC1D,4CAA8C;AAa9C,SAAgB,aAAa,CAAC,OAA0B,EAAE,WAAoB,IAAI;IAChF,OAAO,IAAA,sCAAmB,EAAC,IAAA,0BAAc,EAAC,cAAc,CAAC,OAAO,CAAC,CAAE,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC;AAED,SAAgB,cAAc,CAAC,OAA0B;IACvD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,IAAA,8BAAc,EAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;IAC9D,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,IAAA,+BAAe,EACpB,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACnF,CAAC;IACJ,CAAC;SAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,IAAA,+BAAe,EAAC,OAAO,CAAC,CAAC;IAClC,CAAC;SAAM,IAAI,QAAQ,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;QACrE,OAAO,IAAA,2CAA2B,EAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,SAA0B,CAAC,CAAC;IACzF,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;AACH,CAAC","sourcesContent":["import path from 'path';\n\nimport {\n MemoryContext,\n inMemoryContext,\n requireContext,\n requireContextWithOverrides,\n} from './context-stubs';\nimport { getNavigationConfig } from '../getLinkingConfig';\nimport { getExactRoutes } from '../getRoutes';\n\nexport type MockContextConfig =\n | string // Pathname to a directory\n | string[] // Array of filenames to mock as empty components, e.g () => null\n | MemoryContext // Map of filenames and their exports\n | {\n // Directory to load as context\n appDir: string;\n // Map of filenames and their exports. Will override contents of files loaded in `appDir\n overrides: MemoryContext;\n };\n\nexport function getMockConfig(context: MockContextConfig, metaOnly: boolean = true) {\n return getNavigationConfig(getExactRoutes(getMockContext(context))!, metaOnly);\n}\n\nexport function getMockContext(context: MockContextConfig) {\n if (typeof context === 'string') {\n return requireContext(path.resolve(process.cwd(), context));\n } else if (Array.isArray(context)) {\n return inMemoryContext(\n Object.fromEntries(context.map((filename) => [filename, { default: () => null }]))\n );\n } else if (!('appDir' in context)) {\n return inMemoryContext(context);\n } else if ('appDir' in context && typeof context.appDir === 'string') {\n return requireContextWithOverrides(context.appDir, context.overrides as MemoryContext);\n } else {\n throw new Error('Invalid context');\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,IAAI;
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../src/testing-library/mocks.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,IAAI,CAAC;IACH,OAAO,CAAC,4CAA4C,CAAC,CAAC;AACxD,CAAC;AAAC,MAAM,CAAC,CAAA,CAAC;AAEV,IAAI,CAAC;IACH,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACpD,CAAC;AAAC,MAAM,CAAC,CAAA,CAAC;AAEV,IAAI,CAAC;IACH,OAAO,CAAC,yBAAyB,CAAC,CAAC;IACnC,IAAI,CAAC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACxC,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;YAC3D,UAAU,CAAC,OAAO,CAAC,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC,yCAAyC;YAC7E,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAAC,MAAM,CAAC,CAAA,CAAC;AAEV,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;IAC7B,MAAM,MAAM,GAAkC;QAC5C,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC;QACrC,SAAS,CAAC,IAAY;YACpB,OAAO,eAAe,GAAG,IAAI,CAAC;QAChC,CAAC;QACD,aAAa;YACX,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,gBAAgB;YACd,OAAO,EAAE,MAAM,KAAI,CAAC,EAAS,CAAC;QAChC,CAAC;KACF,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC","sourcesContent":["/*\n * Optionally enable @testing-library/jest-native/extend-expect. We use this internally for the `toBeOnTheScreen` matcher()\n */\ntry {\n require('@testing-library/jest-native/extend-expect');\n} catch {}\n\ntry {\n require('react-native-gesture-handler/jestSetup');\n} catch {}\n\ntry {\n require('react-native-reanimated');\n jest.mock('react-native-reanimated', () => {\n try {\n const Reanimated = require('react-native-reanimated/mock');\n Reanimated.default.call = () => {}; // Override `call` with a no-op if needed\n return Reanimated;\n } catch {\n return {};\n }\n });\n} catch {}\n\njest.mock('expo-linking', () => {\n const module: typeof import('expo-linking') = {\n ...jest.requireActual('expo-linking'),\n createURL(path: string) {\n return 'yourscheme://' + path;\n },\n resolveScheme() {\n return 'yourscheme';\n },\n addEventListener() {\n return { remove() {} } as any;\n },\n };\n\n return module;\n});\n"]}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = requireContext;
|
|
6
7
|
// @ts-ignore: types node
|
|
7
8
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
9
|
// @ts-ignore: types node
|
|
@@ -40,5 +41,4 @@ function requireContext(base = '.', scanSubDirectories = true, regularExpression
|
|
|
40
41
|
});
|
|
41
42
|
return context;
|
|
42
43
|
}
|
|
43
|
-
exports.default = requireContext;
|
|
44
44
|
//# sourceMappingURL=require-context-ponyfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-context-ponyfill.js","sourceRoot":"","sources":["../../src/testing-library/require-context-ponyfill.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"require-context-ponyfill.js","sourceRoot":"","sources":["../../src/testing-library/require-context-ponyfill.ts"],"names":[],"mappings":";;;;;AAYA,iCA6CC;AAzDD,yBAAyB;AACzB,sDAAyB;AACzB,yBAAyB;AACzB,0DAA6B;AAS7B,SAAwB,cAAc,CACpC,IAAI,GAAG,GAAG,EACV,kBAAkB,GAAG,IAAI,EACzB,iBAAiB,GAAG,YAAY,EAChC,QAAiC,EAAE;IAEnC,SAAS,aAAa,CAAC,SAAiB;QACtC,iBAAE,CAAC,WAAW,CAAC,SAAS,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AEF,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["// @ts-ignore: types node\nimport fs from 'node:fs';\n// @ts-ignore: types node\nimport path from 'node:path';\n\nimport type { RequireContext } from '../types';\n\nexport interface RequireContextPonyFill extends RequireContext {\n __add(file: string): void;\n __delete(file: string): void;\n}\n\nexport default function requireContext(\n base = '.',\n scanSubDirectories = true,\n regularExpression = /\\.[tj]sx?$/,\n files: Record<string, unknown> = {}\n) {\n function readDirectory(directory: string) {\n fs.readdirSync(directory).forEach((file: string) => {\n const fullPath = path.resolve(directory, file);\n const relativePath = `./${path.relative(base, fullPath).split(path.sep).join('/')}`;\n\n if (fs.statSync(fullPath).isDirectory()) {\n if (scanSubDirectories) readDirectory(fullPath);\n\n return;\n }\n\n if (!regularExpression.test(relativePath)) return;\n\n files[relativePath] = true;\n });\n }\n\n if (fs.existsSync(base)) {\n readDirectory(base);\n }\n\n const context: RequireContextPonyFill = Object.assign(\n function Module(file: string) {\n return require(path.join(base, file));\n },\n {\n keys: () => Object.keys(files),\n resolve: (key: string) => key,\n id: '0',\n __add(file: string) {\n files[file] = true;\n },\n __delete(file: string) {\n delete files[file];\n },\n }\n );\n\n return context;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTypedRoutesDeclarationFile =
|
|
3
|
+
exports.getTypedRoutesDeclarationFile = getTypedRoutesDeclarationFile;
|
|
4
4
|
const getRoutes_1 = require("../getRoutes");
|
|
5
5
|
const matchers_1 = require("../matchers");
|
|
6
6
|
// /[...param1]/ - Match [...param1]
|
|
@@ -14,9 +14,9 @@ function getTypedRoutesDeclarationFile(ctx, { partialTypedGroups = false, testIg
|
|
|
14
14
|
let routeNode = null;
|
|
15
15
|
try {
|
|
16
16
|
routeNode = (0, getRoutes_1.getRoutes)(ctx, {
|
|
17
|
-
ignore: [/_layout\.[tj]sx?$/],
|
|
18
|
-
platformRoutes: false,
|
|
19
|
-
notFound: false,
|
|
17
|
+
ignore: [/_layout\.[tj]sx?$/], // Skip layout files
|
|
18
|
+
platformRoutes: false, // We don't need to generate platform specific routes
|
|
19
|
+
notFound: false, // We don't need +not-found routes either
|
|
20
20
|
ignoreEntryPoints: true,
|
|
21
21
|
ignoreRequireErrors: true,
|
|
22
22
|
importMode: 'async', // Don't load the file
|
|
@@ -92,7 +92,6 @@ declare module 'expo-router' {
|
|
|
92
92
|
}
|
|
93
93
|
`;
|
|
94
94
|
}
|
|
95
|
-
exports.getTypedRoutesDeclarationFile = getTypedRoutesDeclarationFile;
|
|
96
95
|
function groupRouteNodes(routeNode, groupedContextKeys = {
|
|
97
96
|
static: new Set(),
|
|
98
97
|
dynamic: new Map(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/typed-routes/generate.ts"],"names":[],"mappings":";;;AACA,4CAAyC;AACzC,0CAAwD;AAGxD,oCAAoC;AACpC,MAAM,SAAS,GAAG,gBAAgB,CAAC;AACnC,6BAA6B;AAC7B,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,2DAA2D;AAC3D,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAEjC,MAAM,SAAS,GAAG,qCAAqC,CAAC;AAOxD,SAAgB,6BAA6B,CAC3C,GAAmB,EACnB,EACE,kBAAkB,GAAG,KAAK,EAC1B,kBAAkB,GAAG,KAAK,MACc,EAAE;IAE5C,IAAI,SAAS,GAAqB,IAAI,CAAC;IAEvC,IAAI;QACF,SAAS,GAAG,IAAA,qBAAS,EAAC,GAAG,EAAE;YACzB,MAAM,EAAE,CAAC,mBAAmB,CAAC;YAC7B,cAAc,EAAE,KAAK;YACrB,QAAQ,EAAE,KAAK;YACf,iBAAiB,EAAE,IAAI;YACvB,mBAAmB,EAAE,IAAI;YACzB,UAAU,EAAE,OAAO,EAAE,sBAAsB;SAC5C,CAAC,CAAC;KACJ;IAAC,MAAM;QACN,g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,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;YACvE,4CAA4C;YAC5C,IAAI,kBAAkB,EAAE;gBACtB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aACzB;YACD,gCAAgC;YAChC,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SAC1C;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IAEhE;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC3C,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;KAC7C;IAED,OAAO,KAAK,cAAc,UAAU,iBAAiB,IAAI,CAAC;AAC5D,CAAC","sourcesContent":["import { RouteNode } from '../Route';\nimport { getRoutes } from '../getRoutes';\nimport { removeSupportedExtensions } from '../matchers';\nimport { RequireContext } from '../types';\n\n// /[...param1]/ - Match [...param1]\nconst CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nconst SLUG = /\\[.+?\\]/g;\n// /(group)/path/(group2)/route - Match [(group), (group2)]\nconst GROUP = /(?:^|\\/)\\(.*?\\)/g;\n\nconst urlParams = \"${`?${string}` | `#${string}` | ''}\";\n\nexport type GetTypedRoutesDeclarationFileOptions = {\n partialTypedGroups?: boolean;\n testIgnoreComments?: boolean;\n};\n\nexport function getTypedRoutesDeclarationFile(\n ctx: RequireContext,\n {\n partialTypedGroups = false,\n testIgnoreComments = false,\n }: GetTypedRoutesDeclarationFileOptions = {}\n) {\n let routeNode: RouteNode | null = null;\n\n try {\n routeNode = getRoutes(ctx, {\n ignore: [/_layout\\.[tj]sx?$/], // Skip layout files\n platformRoutes: false, // We don't need to generate platform specific routes\n notFound: false, // We don't need +not-found routes either\n ignoreEntryPoints: true,\n ignoreRequireErrors: true,\n importMode: 'async', // Don't load the file\n });\n } catch {\n // Ignore errors from `getRoutes`. This is also called inside the app, which has\n // a nicer UX for showing error messages\n }\n\n const groupedNodes = groupRouteNodes(routeNode);\n const staticRoutesStrings: string[] = ['Router.RelativePathString', 'Router.ExternalPathString'];\n const staticRouteInputObjects: string[] = [\n '{ pathname: Router.RelativePathString, params?: Router.UnknownInputParams }',\n '{ pathname: Router.ExternalPathString, params?: Router.UnknownInputParams }',\n ];\n const staticRouteOutputObjects: string[] = [\n '{ pathname: Router.RelativePathString, params?: Router.UnknownOutputParams }',\n '{ pathname: Router.ExternalPathString, params?: Router.UnknownOutputParams }',\n ];\n\n for (const type of groupedNodes.static) {\n staticRoutesStrings.push(contextKeyToType(type + urlParams, partialTypedGroups));\n staticRouteInputObjects.push(\n `{ pathname: ${contextKeyToType(type, partialTypedGroups)}; params?: Router.UnknownInputParams; }`\n );\n staticRouteOutputObjects.push(\n `{ pathname: ${contextKeyToType(type, partialTypedGroups)}; params?: Router.UnknownOutputParams; }`\n );\n }\n\n const dynamicRouteStrings: string[] = [];\n const dynamicRouteInputObjects: string[] = [];\n const dynamicRouteOutputObjects: string[] = [];\n\n for (const [dynamicRouteTemplate, paramsNames] of groupedNodes.dynamic) {\n const inputParams = paramsNames\n .map((param) => {\n const key = param.startsWith('...') ? param.slice(3) : param;\n const value = param.startsWith('...') ? '(string | number)[]' : 'string | number';\n return `${key}: ${value};`;\n })\n .join('');\n\n const outputParams = paramsNames\n .map((param) => {\n const key = param.startsWith('...') ? param.slice(3) : param;\n const value = param.startsWith('...') ? 'string[]' : 'string';\n return `${key}: ${value};`;\n })\n .join('');\n\n dynamicRouteStrings.push(\n contextKeyToType(\n dynamicRouteTemplate\n .replaceAll(CATCH_ALL, '${string}')\n .replaceAll(SLUG, '${Router.SingleRoutePart<T>}'),\n partialTypedGroups\n )\n );\n\n dynamicRouteInputObjects.push(\n `{ pathname: ${contextKeyToType(dynamicRouteTemplate, partialTypedGroups)}, params: Router.UnknownInputParams & { ${inputParams} } }`\n );\n dynamicRouteOutputObjects.push(\n `{ pathname: ${contextKeyToType(dynamicRouteTemplate, partialTypedGroups)}, params: Router.UnknownOutputParams & { ${outputParams} } }`\n );\n }\n\n const href = [\n ...staticRoutesStrings,\n ...staticRouteInputObjects,\n ...dynamicRouteStrings,\n ...dynamicRouteInputObjects,\n ].join(' | ');\n\n const hrefInputParams = [...staticRouteInputObjects, ...dynamicRouteInputObjects].join(' | ');\n const hrefOutputParams = [...staticRouteOutputObjects, ...dynamicRouteOutputObjects].join(' | ');\n\n const tsExpectError = testIgnoreComments\n ? '// @ts-ignore-error -- During tests we need to ignore the \"duplicate\" declaration error, as multiple fixture declare types \\n '\n : '';\n\n return `/* eslint-disable */\nimport * as Router from 'expo-router';\n\nexport * from 'expo-router';\n\ndeclare module 'expo-router' {\n export namespace ExpoRouter {\n export interface __routes<T extends string | object = string> {\n ${tsExpectError}hrefInputParams: ${hrefInputParams};\n ${tsExpectError}hrefOutputParams: ${hrefOutputParams};\n ${tsExpectError}href: ${href};\n }\n }\n}\n`;\n}\n\nfunction groupRouteNodes(\n routeNode: RouteNode | null,\n groupedContextKeys = {\n static: new Set<string>(),\n dynamic: new Map<string, string[]>(),\n }\n) {\n if (!routeNode) {\n return groupedContextKeys;\n }\n\n // Skip non-route files\n if (routeNode.type !== 'route') {\n // Except the root layout\n if (routeNode.route === '') {\n for (const child of routeNode.children) {\n groupRouteNodes(child, groupedContextKeys);\n }\n return groupedContextKeys;\n }\n\n return groupedContextKeys;\n }\n\n let routeKey: string;\n\n if (routeNode.generated) {\n // Some routes like the root _layout, _sitemap, +not-found are generated.\n // We cannot use the contextKey, as their context key does not specify a route\n routeKey = routeNode.route;\n } else {\n routeKey = removeSupportedExtensions(routeNode.contextKey)\n .replace(/\\/index$/, '') // Remove any trailing /index\n .replace(/^\\./, ''); // Remove any leading .\n }\n\n routeKey ||= '/'; // A routeKey may be empty for contextKey '' or './index.js'\n\n if (!routeKey.startsWith('/')) {\n // Not all generated files will have the `/` prefix\n routeKey = `/${routeKey}`;\n }\n\n routeKey = routeKey.replace(/\\\\/g, '/');\n\n if (routeNode.dynamic) {\n groupedContextKeys.dynamic.set(\n routeKey,\n routeKey\n .split('/')\n .filter((segment) => {\n return segment.startsWith('[') && segment.endsWith(']');\n })\n .map((segment) => {\n return segment.slice(1, -1);\n })\n );\n } else {\n groupedContextKeys.static.add(routeKey);\n }\n\n for (const child of routeNode.children) {\n groupRouteNodes(child, groupedContextKeys);\n }\n\n return groupedContextKeys;\n}\n\nfunction contextKeyToType(contextKey: string, partialTypedGroups: boolean) {\n if (contextKey.match(GROUP) === null) {\n return `\\`${contextKey}\\``;\n }\n\n // If the route has groups, turn them into template strings\n const typeWithGroups = contextKey.replaceAll(GROUP, (match) => {\n const groups = match.slice(2, -1); // Remove the leading ( and the trailing )\n // When `partialRoutes` is enabled, we always change a group to a template\n if (groups.length > 1 || partialTypedGroups) {\n // Ensure each group has the trailing slash\n const groupsAsType = groups.split(',').map((group) => `'/(${group})'`);\n // `partialRoutes` allow you to skip a group\n if (partialTypedGroups) {\n groupsAsType.push(\"''\");\n }\n // Combine together into a union\n return `\\${${groupsAsType.join(' | ')}}`;\n } else {\n return match;\n }\n });\n\n let typeWithoutGroups = contextKey.replaceAll(GROUP, '') || '/';\n\n /**\n * When getting the static routes, they include a urlParams string at the end.\n * If we have a route like `/(group)/(group2)`, this would normally be collapsed to `/`.\n * But because of the urlParams, it becomes `${urlParams}` and we need to add a `/` to the start.\n */\n if (typeWithoutGroups.startsWith(urlParams)) {\n typeWithoutGroups = `/${typeWithoutGroups}`;\n }\n\n return `\\`${typeWithGroups}\\` | \\`${typeWithoutGroups}\\``;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../../src/typed-routes/generate.ts"],"names":[],"mappings":";;AA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,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,iBAAiB,GAAG,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC;IAEhE;;;;OAIG;IACH,IAAI,iBAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5C,iBAAiB,GAAG,IAAI,iBAAiB,EAAE,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,cAAc,UAAU,iBAAiB,IAAI,CAAC;AAC5D,CAAC","sourcesContent":["import { RouteNode } from '../Route';\nimport { getRoutes } from '../getRoutes';\nimport { removeSupportedExtensions } from '../matchers';\nimport { RequireContext } from '../types';\n\n// /[...param1]/ - Match [...param1]\nconst CATCH_ALL = /\\[\\.\\.\\..+?\\]/g;\n// /[param1] - Match [param1]\nconst SLUG = /\\[.+?\\]/g;\n// /(group)/path/(group2)/route - Match [(group), (group2)]\nconst GROUP = /(?:^|\\/)\\(.*?\\)/g;\n\nconst urlParams = \"${`?${string}` | `#${string}` | ''}\";\n\nexport type GetTypedRoutesDeclarationFileOptions = {\n partialTypedGroups?: boolean;\n testIgnoreComments?: boolean;\n};\n\nexport function getTypedRoutesDeclarationFile(\n ctx: RequireContext,\n {\n partialTypedGroups = false,\n testIgnoreComments = false,\n }: GetTypedRoutesDeclarationFileOptions = {}\n) {\n let routeNode: RouteNode | null = null;\n\n try {\n routeNode = getRoutes(ctx, {\n ignore: [/_layout\\.[tj]sx?$/], // Skip layout files\n platformRoutes: false, // We don't need to generate platform specific routes\n notFound: false, // We don't need +not-found routes either\n ignoreEntryPoints: true,\n ignoreRequireErrors: true,\n importMode: 'async', // Don't load the file\n });\n } catch {\n // Ignore errors from `getRoutes`. This is also called inside the app, which has\n // a nicer UX for showing error messages\n }\n\n const groupedNodes = groupRouteNodes(routeNode);\n const staticRoutesStrings: string[] = ['Router.RelativePathString', 'Router.ExternalPathString'];\n const staticRouteInputObjects: string[] = [\n '{ pathname: Router.RelativePathString, params?: Router.UnknownInputParams }',\n '{ pathname: Router.ExternalPathString, params?: Router.UnknownInputParams }',\n ];\n const staticRouteOutputObjects: string[] = [\n '{ pathname: Router.RelativePathString, params?: Router.UnknownOutputParams }',\n '{ pathname: Router.ExternalPathString, params?: Router.UnknownOutputParams }',\n ];\n\n for (const type of groupedNodes.static) {\n staticRoutesStrings.push(contextKeyToType(type + urlParams, partialTypedGroups));\n staticRouteInputObjects.push(\n `{ pathname: ${contextKeyToType(type, partialTypedGroups)}; params?: Router.UnknownInputParams; }`\n );\n staticRouteOutputObjects.push(\n `{ pathname: ${contextKeyToType(type, partialTypedGroups)}; params?: Router.UnknownOutputParams; }`\n );\n }\n\n const dynamicRouteStrings: string[] = [];\n const dynamicRouteInputObjects: string[] = [];\n const dynamicRouteOutputObjects: string[] = [];\n\n for (const [dynamicRouteTemplate, paramsNames] of groupedNodes.dynamic) {\n const inputParams = paramsNames\n .map((param) => {\n const key = param.startsWith('...') ? param.slice(3) : param;\n const value = param.startsWith('...') ? '(string | number)[]' : 'string | number';\n return `${key}: ${value};`;\n })\n .join('');\n\n const outputParams = paramsNames\n .map((param) => {\n const key = param.startsWith('...') ? param.slice(3) : param;\n const value = param.startsWith('...') ? 'string[]' : 'string';\n return `${key}: ${value};`;\n })\n .join('');\n\n dynamicRouteStrings.push(\n contextKeyToType(\n dynamicRouteTemplate\n .replaceAll(CATCH_ALL, '${string}')\n .replaceAll(SLUG, '${Router.SingleRoutePart<T>}'),\n partialTypedGroups\n )\n );\n\n dynamicRouteInputObjects.push(\n `{ pathname: ${contextKeyToType(dynamicRouteTemplate, partialTypedGroups)}, params: Router.UnknownInputParams & { ${inputParams} } }`\n );\n dynamicRouteOutputObjects.push(\n `{ pathname: ${contextKeyToType(dynamicRouteTemplate, partialTypedGroups)}, params: Router.UnknownOutputParams & { ${outputParams} } }`\n );\n }\n\n const href = [\n ...staticRoutesStrings,\n ...staticRouteInputObjects,\n ...dynamicRouteStrings,\n ...dynamicRouteInputObjects,\n ].join(' | ');\n\n const hrefInputParams = [...staticRouteInputObjects, ...dynamicRouteInputObjects].join(' | ');\n const hrefOutputParams = [...staticRouteOutputObjects, ...dynamicRouteOutputObjects].join(' | ');\n\n const tsExpectError = testIgnoreComments\n ? '// @ts-ignore-error -- During tests we need to ignore the \"duplicate\" declaration error, as multiple fixture declare types \\n '\n : '';\n\n return `/* eslint-disable */\nimport * as Router from 'expo-router';\n\nexport * from 'expo-router';\n\ndeclare module 'expo-router' {\n export namespace ExpoRouter {\n export interface __routes<T extends string | object = string> {\n ${tsExpectError}hrefInputParams: ${hrefInputParams};\n ${tsExpectError}hrefOutputParams: ${hrefOutputParams};\n ${tsExpectError}href: ${href};\n }\n }\n}\n`;\n}\n\nfunction groupRouteNodes(\n routeNode: RouteNode | null,\n groupedContextKeys = {\n static: new Set<string>(),\n dynamic: new Map<string, string[]>(),\n }\n) {\n if (!routeNode) {\n return groupedContextKeys;\n }\n\n // Skip non-route files\n if (routeNode.type !== 'route') {\n // Except the root layout\n if (routeNode.route === '') {\n for (const child of routeNode.children) {\n groupRouteNodes(child, groupedContextKeys);\n }\n return groupedContextKeys;\n }\n\n return groupedContextKeys;\n }\n\n let routeKey: string;\n\n if (routeNode.generated) {\n // Some routes like the root _layout, _sitemap, +not-found are generated.\n // We cannot use the contextKey, as their context key does not specify a route\n routeKey = routeNode.route;\n } else {\n routeKey = removeSupportedExtensions(routeNode.contextKey)\n .replace(/\\/index$/, '') // Remove any trailing /index\n .replace(/^\\./, ''); // Remove any leading .\n }\n\n routeKey ||= '/'; // A routeKey may be empty for contextKey '' or './index.js'\n\n if (!routeKey.startsWith('/')) {\n // Not all generated files will have the `/` prefix\n routeKey = `/${routeKey}`;\n }\n\n routeKey = routeKey.replace(/\\\\/g, '/');\n\n if (routeNode.dynamic) {\n groupedContextKeys.dynamic.set(\n routeKey,\n routeKey\n .split('/')\n .filter((segment) => {\n return segment.startsWith('[') && segment.endsWith(']');\n })\n .map((segment) => {\n return segment.slice(1, -1);\n })\n );\n } else {\n groupedContextKeys.static.add(routeKey);\n }\n\n for (const child of routeNode.children) {\n groupRouteNodes(child, groupedContextKeys);\n }\n\n return groupedContextKeys;\n}\n\nfunction contextKeyToType(contextKey: string, partialTypedGroups: boolean) {\n if (contextKey.match(GROUP) === null) {\n return `\\`${contextKey}\\``;\n }\n\n // If the route has groups, turn them into template strings\n const typeWithGroups = contextKey.replaceAll(GROUP, (match) => {\n const groups = match.slice(2, -1); // Remove the leading ( and the trailing )\n // When `partialRoutes` is enabled, we always change a group to a template\n if (groups.length > 1 || partialTypedGroups) {\n // Ensure each group has the trailing slash\n const groupsAsType = groups.split(',').map((group) => `'/(${group})'`);\n // `partialRoutes` allow you to skip a group\n if (partialTypedGroups) {\n groupsAsType.push(\"''\");\n }\n // Combine together into a union\n return `\\${${groupsAsType.join(' | ')}}`;\n } else {\n return match;\n }\n });\n\n let typeWithoutGroups = contextKey.replaceAll(GROUP, '') || '/';\n\n /**\n * When getting the static routes, they include a urlParams string at the end.\n * If we have a route like `/(group)/(group2)`, this would normally be collapsed to `/`.\n * But because of the urlParams, it becomes `${urlParams}` and we need to add a `/` to the start.\n */\n if (typeWithoutGroups.startsWith(urlParams)) {\n typeWithoutGroups = `/${typeWithoutGroups}`;\n }\n\n return `\\`${typeWithGroups}\\` | \\`${typeWithoutGroups}\\``;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":"AAMA,OAAuB,EACrB,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAIrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAE1F;;;GAGG;AACH,eAAO,MAAM,OAAO,KAAK,CAAC;AAE1B;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,EAAE,GAAgB,EAAE,YAAqC,EAAE;;;CAAK;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":"AAMA,OAAuB,EACrB,sBAAsB,EACvB,MAAM,6CAA6C,CAAC;AAIrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AAE1F;;;GAGG;AACH,eAAO,MAAM,OAAO,KAAK,CAAC;AAE1B;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,EAAE,GAAgB,EAAE,YAAqC,EAAE;;;CAAK,IAIjC,oBAAoB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,mBAkCtF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,0BAelC,CAAC"}
|
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.regenerateDeclarations = exports.
|
|
6
|
+
exports.regenerateDeclarations = exports.version = void 0;
|
|
7
|
+
exports.getWatchHandler = getWatchHandler;
|
|
7
8
|
const _ctx_shared_1 = require("expo-router/_ctx-shared");
|
|
8
9
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
10
|
const node_path_1 = __importDefault(require("node:path"));
|
|
@@ -56,7 +57,6 @@ function getWatchHandler(outputDir, { ctx = defaultCtx, regenerateFn = exports.r
|
|
|
56
57
|
}
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
|
-
exports.getWatchHandler = getWatchHandler;
|
|
60
60
|
/**
|
|
61
61
|
* Regenerate the declaration file.
|
|
62
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/typed-routes/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":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C;IACV,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE;QACjB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QACd,CAAC,EAAE,OAAO,CAAC,CAAC;IACd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { EXPO_ROUTER_CTX_IGNORE } from 'expo-router/_ctx-shared';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nimport { getTypedRoutesDeclarationFile } from './generate';\nimport { isTypedRoute } from '../matchers';\nimport requireContext, {\n RequireContextPonyFill,\n} from '../testing-library/require-context-ponyfill';\n\nconst defaultCtx = requireContext(process.env.EXPO_ROUTER_APP_ROOT, true, EXPO_ROUTER_CTX_IGNORE);\n\nexport type { RequireContextPonyFill } from '../testing-library/require-context-ponyfill';\n\n/**\n * This file is imported via `@expo/cli`. While users should be using the same SDK version of `expo-router` as `@expo/cli`,\n * this export allows us to ensure that the version of the `expo-router` package is compatible with the version of `@expo/cli`.\n */\nexport const version = 52;\n\n/**\n * Generate a Metro watch handler that regenerates the typed routes declaration file\n */\nexport function getWatchHandler(\n outputDir: string,\n { ctx = defaultCtx, regenerateFn = regenerateDeclarations } = {} // Exposed for testing\n) {\n const routeFiles = new Set(ctx.keys().filter((key) => isTypedRoute(key)));\n\n return async function callback({ filePath, type }: { filePath: string; type: string }) {\n // Sanity check that we are in an Expo Router project\n if (!process.env.EXPO_ROUTER_APP_ROOT) return;\n\n let shouldRegenerate = false;\n let relativePath = path.relative(process.env.EXPO_ROUTER_APP_ROOT, filePath);\n const isInsideAppRoot = !relativePath.startsWith('../');\n const basename = path.basename(relativePath);\n\n if (!isInsideAppRoot) return;\n\n // require.context paths always start with './' when relative to the root\n relativePath = `./${relativePath}`;\n\n if (type === 'delete') {\n ctx.__delete(relativePath);\n if (routeFiles.has(relativePath)) {\n routeFiles.delete(relativePath);\n shouldRegenerate = true;\n }\n } else if (type === 'add') {\n ctx.__add(relativePath);\n if (isTypedRoute(basename)) {\n routeFiles.add(relativePath);\n shouldRegenerate = true;\n }\n } else {\n shouldRegenerate = routeFiles.has(relativePath);\n }\n\n if (shouldRegenerate) {\n regenerateFn(outputDir, ctx);\n }\n };\n}\n\n/**\n * Regenerate the declaration file.\n *\n * This function needs to be debounced due to Metro's handling of renaming folders.\n * For example, if you have the file /(tabs)/route.tsx and you rename the folder to /(tabs,test)/route.tsx\n *\n * Metro will fire 2 filesystem events:\n * - ADD /(tabs,test)/router.tsx\n * - DELETE /(tabs)/router.tsx\n *\n * If you process the types after the ADD, then they will crash as you will have conflicting routes\n */\nexport const regenerateDeclarations = debounce(\n (\n outputDir: string,\n options: { partialTypedGroups?: boolean } = {},\n ctx: RequireContextPonyFill = defaultCtx\n ) => {\n // Don't crash the process, just log the error. The user will most likely fix it and continue\n try {\n const file = getTypedRoutesDeclarationFile(ctx, options);\n if (!file) return;\n fs.writeFileSync(path.resolve(outputDir, './router.d.ts'), file);\n } catch (error) {\n console.error(error);\n }\n }\n);\n\n/**\n * Debounce a function to only run once after a period of inactivity\n * If called while waiting, it will reset the timer\n */\nfunction debounce<T extends (...args: any[]) => any>(fn: T, timeout: number = 1000) {\n let timer;\n return (...args) => {\n clearTimeout(timer);\n timer = setTimeout(() => {\n fn(...args);\n }, timeout);\n };\n}\n"]}
|
package/build/ui/Slot.d.ts
CHANGED
package/build/ui/Slot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Slot.d.ts","sourceRoot":"","sources":["../../src/ui/Slot.tsx"],"names":[],"mappings":"AAwBA,eAAO,MAAM,IAAI,kIAAkC,CAAC"}
|
package/build/ui/TabContext.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
|
|
3
2
|
import { DefaultNavigatorOptions, NavigationAction, NavigationProp, ParamListBase, TabActionHelpers, TabNavigationState, TabRouterOptions, useNavigationBuilder } from '@react-navigation/native';
|
|
4
3
|
import { TriggerMap } from './common';
|
|
@@ -49,51 +48,51 @@ export declare const TabTriggerMapContext: import("react").Context<TriggerMap>;
|
|
|
49
48
|
export declare const TabsDescriptorsContext: import("react").Context<Record<string, import("@react-navigation/native").Descriptor<ExpoTabsNavigatorScreenOptions, Omit<{
|
|
50
49
|
dispatch(action: Readonly<{
|
|
51
50
|
type: string;
|
|
52
|
-
payload?: object
|
|
53
|
-
source?: string
|
|
54
|
-
target?: string
|
|
51
|
+
payload?: object;
|
|
52
|
+
source?: string;
|
|
53
|
+
target?: string;
|
|
55
54
|
}> | ((state: Readonly<TabNavigationState<any>>) => Readonly<{
|
|
56
55
|
type: string;
|
|
57
|
-
payload?: object
|
|
58
|
-
source?: string
|
|
59
|
-
target?: string
|
|
56
|
+
payload?: object;
|
|
57
|
+
source?: string;
|
|
58
|
+
target?: string;
|
|
60
59
|
}>)): void;
|
|
61
60
|
navigate<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined, options?: {
|
|
62
|
-
merge?: boolean
|
|
63
|
-
pop?: boolean
|
|
61
|
+
merge?: boolean;
|
|
62
|
+
pop?: boolean;
|
|
64
63
|
} | undefined] : never): void;
|
|
65
|
-
navigate<
|
|
66
|
-
name:
|
|
64
|
+
navigate<RouteName extends string>(options: RouteName extends unknown ? {
|
|
65
|
+
name: RouteName;
|
|
67
66
|
params: object | undefined;
|
|
68
|
-
path?: string
|
|
69
|
-
merge?: boolean
|
|
70
|
-
pop?: boolean
|
|
67
|
+
path?: string;
|
|
68
|
+
merge?: boolean;
|
|
69
|
+
pop?: boolean;
|
|
71
70
|
} : never): void;
|
|
72
|
-
navigateDeprecated<
|
|
73
|
-
navigateDeprecated<
|
|
74
|
-
name:
|
|
71
|
+
navigateDeprecated<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined] : never): void;
|
|
72
|
+
navigateDeprecated<RouteName extends string>(options: RouteName extends unknown ? {
|
|
73
|
+
name: RouteName;
|
|
75
74
|
params: object | undefined;
|
|
76
|
-
merge?: boolean
|
|
75
|
+
merge?: boolean;
|
|
77
76
|
} : never): void;
|
|
78
|
-
preload<
|
|
77
|
+
preload<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined] : never): void;
|
|
79
78
|
reset(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
|
|
80
79
|
goBack(): void;
|
|
81
80
|
isFocused(): boolean;
|
|
82
81
|
canGoBack(): boolean;
|
|
83
82
|
getId(): string | undefined;
|
|
84
|
-
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string
|
|
83
|
+
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string): T;
|
|
85
84
|
getState(): TabNavigationState<any>;
|
|
86
85
|
setStateForNextRouteNamesChange(state: TabNavigationState<any> | import("@react-navigation/native").PartialState<TabNavigationState<any>>): void;
|
|
87
86
|
} & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]>, "getParent"> & {
|
|
88
|
-
getParent<
|
|
87
|
+
getParent<T = NavigationProp<ParamListBase, string, undefined, Readonly<{
|
|
89
88
|
key: string;
|
|
90
89
|
index: number;
|
|
91
90
|
routeNames: string[];
|
|
92
|
-
history?: unknown[]
|
|
91
|
+
history?: unknown[];
|
|
93
92
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
94
93
|
type: string;
|
|
95
94
|
stale: false;
|
|
96
|
-
}>, {}, {}> | undefined>(id?: string | undefined):
|
|
95
|
+
}>, {}, {}> | undefined>(id?: string | undefined): T;
|
|
97
96
|
setParams(params: Partial<object | undefined>): void;
|
|
98
97
|
setOptions(options: Partial<ExpoTabsNavigatorScreenOptions>): void;
|
|
99
98
|
} & import("@react-navigation/native").EventConsumer<TabNavigationEventMap & import("@react-navigation/native").EventMapCore<TabNavigationState<any>>> & import("@react-navigation/native").PrivateValueStore<[ParamListBase, string, TabNavigationEventMap]> & TabActionHelpers<ParamListBase>, import("@react-navigation/native").RouteProp<ParamListBase, string>>>>;
|
|
@@ -103,48 +102,41 @@ export declare const TabsDescriptorsContext: import("react").Context<Record<stri
|
|
|
103
102
|
export declare const TabsNavigatorContext: import("react").Context<({
|
|
104
103
|
dispatch(action: Readonly<{
|
|
105
104
|
type: string;
|
|
106
|
-
payload?: object
|
|
107
|
-
source?: string
|
|
108
|
-
target?: string
|
|
105
|
+
payload?: object;
|
|
106
|
+
source?: string;
|
|
107
|
+
target?: string;
|
|
109
108
|
}> | ((state: Readonly<Readonly<{
|
|
110
109
|
key: string;
|
|
111
110
|
index: number;
|
|
112
111
|
routeNames: string[];
|
|
113
|
-
history?: unknown[]
|
|
112
|
+
history?: unknown[];
|
|
114
113
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
115
|
-
type: string; /**
|
|
116
|
-
* Event which fires on tapping on the tab in the tab bar.
|
|
117
|
-
*/
|
|
118
|
-
stale: false;
|
|
119
|
-
}>>) => Readonly<{
|
|
120
114
|
type: string;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
target?: string | undefined;
|
|
124
|
-
}>)): void;
|
|
115
|
+
stale: false;
|
|
116
|
+
}>>) => NavigationAction)): void;
|
|
125
117
|
navigate<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined, options?: {
|
|
126
|
-
merge?: boolean
|
|
127
|
-
pop?: boolean
|
|
118
|
+
merge?: boolean;
|
|
119
|
+
pop?: boolean;
|
|
128
120
|
} | undefined] : never): void;
|
|
129
|
-
navigate<
|
|
130
|
-
name:
|
|
121
|
+
navigate<RouteName extends string>(options: RouteName extends unknown ? {
|
|
122
|
+
name: RouteName;
|
|
131
123
|
params: object | undefined;
|
|
132
|
-
path?: string
|
|
133
|
-
merge?: boolean
|
|
134
|
-
pop?: boolean
|
|
124
|
+
path?: string;
|
|
125
|
+
merge?: boolean;
|
|
126
|
+
pop?: boolean;
|
|
135
127
|
} : never): void;
|
|
136
|
-
navigateDeprecated<
|
|
137
|
-
navigateDeprecated<
|
|
138
|
-
name:
|
|
128
|
+
navigateDeprecated<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined] : never): void;
|
|
129
|
+
navigateDeprecated<RouteName extends string>(options: RouteName extends unknown ? {
|
|
130
|
+
name: RouteName;
|
|
139
131
|
params: object | undefined;
|
|
140
|
-
merge?: boolean
|
|
132
|
+
merge?: boolean;
|
|
141
133
|
} : never): void;
|
|
142
|
-
preload<
|
|
134
|
+
preload<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined] : never): void;
|
|
143
135
|
reset(state: Readonly<{
|
|
144
136
|
key: string;
|
|
145
137
|
index: number;
|
|
146
138
|
routeNames: string[];
|
|
147
|
-
history?: unknown[]
|
|
139
|
+
history?: unknown[];
|
|
148
140
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
149
141
|
type: string;
|
|
150
142
|
stale: false;
|
|
@@ -152,7 +144,7 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
152
144
|
key: string;
|
|
153
145
|
index: number;
|
|
154
146
|
routeNames: string[];
|
|
155
|
-
history?: unknown[]
|
|
147
|
+
history?: unknown[];
|
|
156
148
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
157
149
|
type: string;
|
|
158
150
|
stale: false;
|
|
@@ -161,12 +153,12 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
161
153
|
isFocused(): boolean;
|
|
162
154
|
canGoBack(): boolean;
|
|
163
155
|
getId(): string | undefined;
|
|
164
|
-
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string
|
|
156
|
+
getParent<T = import("@react-navigation/native").NavigationHelpers<ParamListBase, {}> | undefined>(id?: string): T;
|
|
165
157
|
getState(): Readonly<{
|
|
166
158
|
key: string;
|
|
167
159
|
index: number;
|
|
168
160
|
routeNames: string[];
|
|
169
|
-
history?: unknown[]
|
|
161
|
+
history?: unknown[];
|
|
170
162
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
171
163
|
type: string;
|
|
172
164
|
stale: false;
|
|
@@ -175,7 +167,7 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
175
167
|
key: string;
|
|
176
168
|
index: number;
|
|
177
169
|
routeNames: string[];
|
|
178
|
-
history?: unknown[]
|
|
170
|
+
history?: unknown[];
|
|
179
171
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
180
172
|
type: string;
|
|
181
173
|
stale: false;
|
|
@@ -183,13 +175,13 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
183
175
|
key: string;
|
|
184
176
|
index: number;
|
|
185
177
|
routeNames: string[];
|
|
186
|
-
history?: unknown[]
|
|
178
|
+
history?: unknown[];
|
|
187
179
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
188
180
|
type: string;
|
|
189
181
|
stale: false;
|
|
190
182
|
}>>): void;
|
|
191
183
|
} & import("@react-navigation/native").PrivateValueStore<[ParamListBase, unknown, unknown]> & import("@react-navigation/native").EventEmitter<TabNavigationEventMap> & {
|
|
192
|
-
setParams<
|
|
184
|
+
setParams<RouteName extends string>(params: Partial<object | undefined>): void;
|
|
193
185
|
} & TabActionHelpers<ParamListBase>) | null>;
|
|
194
186
|
/**
|
|
195
187
|
* @hidden
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabContext.d.ts","sourceRoot":"","sources":["../../src/ui/TabContext.tsx"],"names":[],"mappings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C;AAEH,MAAM,MAAM,KAAK,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
package/build/ui/TabList.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.TabList = TabList;
|
|
4
|
+
exports.isTabList = isTabList;
|
|
4
5
|
const react_native_1 = require("react-native");
|
|
5
6
|
const common_1 = require("./common");
|
|
6
7
|
/**
|
|
@@ -20,14 +21,12 @@ function TabList({ asChild, style, ...props }) {
|
|
|
20
21
|
const Comp = asChild ? common_1.ViewSlot : react_native_1.View;
|
|
21
22
|
return <Comp style={[styles.tabList, style]} {...props}/>;
|
|
22
23
|
}
|
|
23
|
-
exports.TabList = TabList;
|
|
24
24
|
/**
|
|
25
25
|
* @hidden
|
|
26
26
|
*/
|
|
27
27
|
function isTabList(child) {
|
|
28
28
|
return child.type === TabList;
|
|
29
29
|
}
|
|
30
|
-
exports.isTabList = isTabList;
|
|
31
30
|
const styles = react_native_1.StyleSheet.create({
|
|
32
31
|
tabList: {
|
|
33
32
|
flexDirection: 'row',
|
package/build/ui/TabList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabList.js","sourceRoot":"","sources":["../../src/ui/TabList.tsx"],"names":[],"mappings":";;AAuBA,0BAGC;AAKD,8BAIC;AAlCD,+CAA2D;AAE3D,qCAAoC;AAOpC;;;;;;;;;;;;GAYG;AACH,SAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,KAAK,EAAgB;IAChE,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,iBAAQ,CAAC,CAAC,CAAC,mBAAI,CAAC;IACvC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAG,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,SAAgB,SAAS,CACvB,KAAwB;IAExB,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE;QACP,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;IACD,UAAU,EAAE;QACV,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,eAAe;KAChC;CACF,CAAC,CAAC","sourcesContent":["import { ReactElement, ComponentProps } from 'react';\nimport { View, StyleSheet, ViewProps } from 'react-native';\n\nimport { ViewSlot } from './common';\n\nexport type TabListProps = ViewProps & {\n /** Forward props to child component and removes the extra `<View>`. Useful for custom wrappers. */\n asChild?: boolean;\n};\n\n/**\n * Wrapper component for `TabTriggers`. `TabTriggers` within the `TabList` define the tabs.\n *\n * @example\n * ```tsx\n * <Tabs>\n * <TabSlot />\n * <TabList>\n * <TabTrigger name=\"home\" href=\"/\" />\n * </TabList>\n * </Tabs>\n * ```\n */\nexport function TabList({ asChild, style, ...props }: TabListProps) {\n const Comp = asChild ? ViewSlot : View;\n return <Comp style={[styles.tabList, style]} {...props} />;\n}\n\n/**\n * @hidden\n */\nexport function isTabList(\n child: ReactElement<any>\n): child is ReactElement<ComponentProps<typeof TabList>> {\n return child.type === TabList;\n}\n\nconst styles = StyleSheet.create({\n tabList: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n tabTrigger: {\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n});\n"]}
|
package/build/ui/TabRouter.d.ts
CHANGED
|
@@ -16,35 +16,35 @@ export type ExpoTabActionType = RNTabActionType | CommonNavigationAction | {
|
|
|
16
16
|
};
|
|
17
17
|
export declare function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterOptions): Router<TabNavigationState<ParamListBase>, {
|
|
18
18
|
type: "GO_BACK";
|
|
19
|
-
source?: string
|
|
20
|
-
target?: string
|
|
19
|
+
source?: string;
|
|
20
|
+
target?: string;
|
|
21
21
|
} | {
|
|
22
22
|
type: "NAVIGATE";
|
|
23
23
|
payload: {
|
|
24
24
|
name: string;
|
|
25
|
-
params?: object
|
|
26
|
-
path?: string
|
|
27
|
-
merge?: boolean
|
|
28
|
-
pop?: boolean
|
|
25
|
+
params?: object;
|
|
26
|
+
path?: string;
|
|
27
|
+
merge?: boolean;
|
|
28
|
+
pop?: boolean;
|
|
29
29
|
};
|
|
30
|
-
source?: string
|
|
31
|
-
target?: string
|
|
30
|
+
source?: string;
|
|
31
|
+
target?: string;
|
|
32
32
|
} | {
|
|
33
33
|
type: "NAVIGATE_DEPRECATED";
|
|
34
34
|
payload: {
|
|
35
35
|
name: string;
|
|
36
|
-
params?: object
|
|
37
|
-
merge?: boolean
|
|
36
|
+
params?: object;
|
|
37
|
+
merge?: boolean;
|
|
38
38
|
};
|
|
39
|
-
source?: string
|
|
40
|
-
target?: string
|
|
39
|
+
source?: string;
|
|
40
|
+
target?: string;
|
|
41
41
|
} | {
|
|
42
42
|
type: "RESET";
|
|
43
43
|
payload: (Readonly<{
|
|
44
44
|
key: string;
|
|
45
45
|
index: number;
|
|
46
46
|
routeNames: string[];
|
|
47
|
-
history?: unknown[]
|
|
47
|
+
history?: unknown[];
|
|
48
48
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
49
49
|
type: string;
|
|
50
50
|
stale: false;
|
|
@@ -52,7 +52,7 @@ export declare function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterO
|
|
|
52
52
|
key: string;
|
|
53
53
|
index: number;
|
|
54
54
|
routeNames: string[];
|
|
55
|
-
history?: unknown[]
|
|
55
|
+
history?: unknown[];
|
|
56
56
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
57
57
|
type: string;
|
|
58
58
|
stale: false;
|
|
@@ -60,38 +60,38 @@ export declare function ExpoTabRouter({ triggerMap, ...options }: ExpoTabRouterO
|
|
|
60
60
|
key: string;
|
|
61
61
|
index: number;
|
|
62
62
|
routeNames: string[];
|
|
63
|
-
history?: unknown[]
|
|
63
|
+
history?: unknown[];
|
|
64
64
|
routes: import("@react-navigation/native").NavigationRoute<ParamListBase, string>[];
|
|
65
65
|
type: string;
|
|
66
66
|
stale: false;
|
|
67
67
|
}>, "routes"> & {
|
|
68
68
|
routes: Omit<import("@react-navigation/native").Route<string>, "key">[];
|
|
69
69
|
})) | undefined;
|
|
70
|
-
source?: string
|
|
71
|
-
target?: string
|
|
70
|
+
source?: string;
|
|
71
|
+
target?: string;
|
|
72
72
|
} | {
|
|
73
73
|
type: "SET_PARAMS";
|
|
74
74
|
payload: {
|
|
75
|
-
params?: object
|
|
75
|
+
params?: object;
|
|
76
76
|
};
|
|
77
|
-
source?: string
|
|
78
|
-
target?: string
|
|
77
|
+
source?: string;
|
|
78
|
+
target?: string;
|
|
79
79
|
} | {
|
|
80
80
|
type: "PRELOAD";
|
|
81
81
|
payload: {
|
|
82
82
|
name: string;
|
|
83
|
-
params?: object
|
|
83
|
+
params?: object;
|
|
84
84
|
};
|
|
85
|
-
source?: string
|
|
86
|
-
target?: string
|
|
85
|
+
source?: string;
|
|
86
|
+
target?: string;
|
|
87
87
|
} | RNTabActionType | {
|
|
88
88
|
type: "JUMP_TO";
|
|
89
|
-
source?: string
|
|
90
|
-
target?: string
|
|
89
|
+
source?: string;
|
|
90
|
+
target?: string;
|
|
91
91
|
payload: {
|
|
92
92
|
name: string;
|
|
93
|
-
reset?: ExpoTabsResetValue
|
|
94
|
-
params?: object
|
|
93
|
+
reset?: ExpoTabsResetValue;
|
|
94
|
+
params?: object;
|
|
95
95
|
};
|
|
96
96
|
}>;
|
|
97
97
|
//# sourceMappingURL=TabRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../src/ui/TabRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,MAAM,EACN,aAAa,IAAI,eAAe,EAChC,kBAAkB,EAClB,gBAAgB,IAAI,kBAAkB,EACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG;IACtD,UAAU,EAAE,UAAU,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAEhE,MAAM,MAAM,iBAAiB,GACzB,eAAe,GACf,sBAAsB,GACtB;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,kBAAkB,CAAC;QAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC;AAEN,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,EAAE,oBAAoB
|
|
1
|
+
{"version":3,"file":"TabRouter.d.ts","sourceRoot":"","sources":["../../src/ui/TabRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,aAAa,EAEb,MAAM,EACN,aAAa,IAAI,eAAe,EAChC,kBAAkB,EAClB,gBAAgB,IAAI,kBAAkB,EACvC,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG;IACtD,UAAU,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