expo-router 6.1.0-canary-20251015-a6a1272 → 7.0.0-canary-20251031-b135dff
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/_error.js +36 -3
- package/build/ExpoRoot.js +1 -1
- package/build/ExpoRoot.js.map +1 -1
- package/build/global-state/router-store.d.ts +2 -0
- package/build/global-state/router-store.d.ts.map +1 -1
- package/build/global-state/router-store.js +16 -12
- package/build/global-state/router-store.js.map +1 -1
- package/build/global-state/routing.d.ts +12 -4
- package/build/global-state/routing.d.ts.map +1 -1
- package/build/global-state/routing.js +35 -10
- package/build/global-state/routing.js.map +1 -1
- package/build/global-state/storeContext.d.ts +2 -0
- package/build/global-state/storeContext.d.ts.map +1 -1
- package/build/internal/routing.d.ts +7 -0
- package/build/internal/routing.d.ts.map +1 -0
- package/build/internal/routing.js +21 -0
- package/build/internal/routing.js.map +1 -0
- package/build/internal/rsc.d.ts +5 -0
- package/build/internal/rsc.d.ts.map +1 -0
- package/build/internal/rsc.js +18 -0
- package/build/internal/rsc.js.map +1 -0
- package/build/internal/static.d.ts +3 -0
- package/build/internal/static.d.ts.map +1 -0
- package/build/internal/static.js +8 -0
- package/build/internal/static.js.map +1 -0
- package/build/internal/testing.d.ts +3 -0
- package/build/internal/testing.d.ts.map +1 -0
- package/build/internal/testing.js +11 -0
- package/build/internal/testing.js.map +1 -0
- package/build/internal/utils.d.ts +2 -0
- package/build/internal/utils.d.ts.map +1 -0
- package/build/internal/utils.js +6 -0
- package/build/internal/utils.js.map +1 -0
- package/build/layouts/BaseStack.d.ts +3 -0
- package/build/layouts/BaseStack.d.ts.map +1 -0
- package/build/layouts/BaseStack.js +8 -0
- package/build/layouts/BaseStack.js.map +1 -0
- package/build/layouts/ExperimentalModalStack.d.ts +9 -0
- package/build/layouts/ExperimentalModalStack.d.ts.map +1 -0
- package/build/layouts/ExperimentalModalStack.js +15 -0
- package/build/layouts/ExperimentalModalStack.js.map +1 -0
- package/build/layouts/IsWithinLayoutContext.d.ts +2 -0
- package/build/layouts/IsWithinLayoutContext.d.ts.map +1 -0
- package/build/layouts/IsWithinLayoutContext.js +7 -0
- package/build/layouts/IsWithinLayoutContext.js.map +1 -0
- package/build/layouts/Stack.web.d.ts +1 -14
- package/build/layouts/Stack.web.d.ts.map +1 -1
- package/build/layouts/Stack.web.js +10 -13
- package/build/layouts/Stack.web.js.map +1 -1
- package/build/layouts/_web-modal.d.ts +3 -0
- package/build/layouts/_web-modal.d.ts.map +1 -0
- package/build/layouts/_web-modal.js +8 -0
- package/build/layouts/_web-modal.js.map +1 -0
- package/build/layouts/withLayoutContext.d.ts.map +1 -1
- package/build/layouts/withLayoutContext.js +5 -2
- package/build/layouts/withLayoutContext.js.map +1 -1
- package/build/loaders/ServerDataLoaderContext.d.ts +2 -1
- package/build/loaders/ServerDataLoaderContext.d.ts.map +1 -1
- package/build/loaders/ServerDataLoaderContext.js.map +1 -1
- package/build/modal/web/ModalStack.d.ts.map +1 -1
- package/build/modal/web/ModalStack.js +7 -2
- package/build/modal/web/ModalStack.js.map +1 -1
- package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.d.ts → NativeBottomTabsNavigator.d.ts} +3 -3
- package/build/native-tabs/NativeBottomTabsNavigator.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsNavigator.js → NativeBottomTabsNavigator.js} +49 -14
- package/build/native-tabs/NativeBottomTabsNavigator.js.map +1 -0
- package/build/native-tabs/NativeBottomTabsRouter.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.js → NativeBottomTabsRouter.js} +1 -1
- package/build/native-tabs/NativeBottomTabsRouter.js.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.d.ts → NativeTabTrigger.d.ts} +1 -1
- package/build/native-tabs/NativeTabTrigger.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeTabTrigger.js → NativeTabTrigger.js} +9 -5
- package/build/native-tabs/NativeTabTrigger.js.map +1 -0
- package/build/native-tabs/NativeTabs.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeTabs.js → NativeTabs.js} +2 -0
- package/build/native-tabs/NativeTabs.js.map +1 -0
- package/build/native-tabs/NativeTabsTriggerTabBar.d.ts.map +1 -0
- package/build/native-tabs/NativeTabsTriggerTabBar.js.map +1 -0
- package/build/native-tabs/NativeTabsView.d.ts.map +1 -0
- package/build/native-tabs/NativeTabsView.js +103 -0
- package/build/native-tabs/NativeTabsView.js.map +1 -0
- package/build/native-tabs/NativeTabsView.web.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.js → NativeTabsView.web.js} +18 -57
- package/build/native-tabs/NativeTabsView.web.js.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/appearance.d.ts → appearance.d.ts} +2 -2
- package/build/native-tabs/appearance.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/appearance.js → appearance.js} +18 -6
- package/build/native-tabs/appearance.js.map +1 -0
- package/build/native-tabs/common/elements.d.ts +1 -1
- package/build/native-tabs/common/elements.d.ts.map +1 -1
- package/build/native-tabs/common/elements.js.map +1 -1
- package/build/native-tabs/index.d.ts +4 -4
- package/build/native-tabs/index.d.ts.map +1 -1
- package/build/native-tabs/index.js +3 -3
- package/build/native-tabs/index.js.map +1 -1
- package/build/native-tabs/{NativeBottomTabs/types.d.ts → types.d.ts} +19 -6
- package/build/native-tabs/types.d.ts.map +1 -0
- package/build/native-tabs/types.js.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/utils.d.ts → utils/children.d.ts} +1 -3
- package/build/native-tabs/utils/children.d.ts.map +1 -0
- package/build/native-tabs/{NativeBottomTabs/utils.js → utils/children.js} +1 -7
- package/build/native-tabs/utils/children.js.map +1 -0
- package/build/native-tabs/utils/icon.d.ts +25 -0
- package/build/native-tabs/utils/icon.d.ts.map +1 -0
- package/build/native-tabs/utils/icon.js +68 -0
- package/build/native-tabs/utils/icon.js.map +1 -0
- package/build/native-tabs/utils/index.d.ts +4 -0
- package/build/native-tabs/utils/index.d.ts.map +1 -0
- package/build/native-tabs/utils/index.js +11 -0
- package/build/native-tabs/utils/index.js.map +1 -0
- package/build/native-tabs/utils/label.d.ts +6 -0
- package/build/native-tabs/utils/label.d.ts.map +1 -0
- package/build/native-tabs/utils/label.js +15 -0
- package/build/native-tabs/utils/label.js.map +1 -0
- package/build/renderRootComponent.d.ts.map +1 -1
- package/build/renderRootComponent.js +4 -7
- package/build/renderRootComponent.js.map +1 -1
- package/build/split-view/elements.d.ts +10 -0
- package/build/split-view/elements.d.ts.map +1 -0
- package/build/split-view/elements.js +15 -0
- package/build/split-view/elements.js.map +1 -0
- package/build/split-view/index.d.ts +2 -0
- package/build/split-view/index.d.ts.map +1 -0
- package/build/split-view/index.js +6 -0
- package/build/split-view/index.js.map +1 -0
- package/build/split-view/split-view.d.ts +13 -0
- package/build/split-view/split-view.d.ts.map +1 -0
- package/build/split-view/split-view.js +93 -0
- package/build/split-view/split-view.js.map +1 -0
- package/build/static/html.d.ts +5 -15
- package/build/static/html.d.ts.map +1 -1
- package/build/static/html.js +9 -25
- package/build/static/html.js.map +1 -1
- package/build/static/registerRootComponent.d.ts +11 -0
- package/build/static/registerRootComponent.d.ts.map +1 -0
- package/build/static/registerRootComponent.js +11 -0
- package/build/static/registerRootComponent.js.map +1 -0
- package/build/types.d.ts +4 -2
- package/build/types.d.ts.map +1 -1
- package/build/types.js.map +1 -1
- package/build/ui/TabRouter.d.ts +3 -4
- package/build/ui/TabRouter.d.ts.map +1 -1
- package/build/ui/TabRouter.js +14 -67
- package/build/ui/TabRouter.js.map +1 -1
- package/build/ui/TabTrigger.d.ts +4 -5
- package/build/ui/TabTrigger.d.ts.map +1 -1
- package/build/ui/TabTrigger.js +9 -8
- package/build/ui/TabTrigger.js.map +1 -1
- package/build/ui/Tabs.d.ts +0 -1
- package/build/ui/Tabs.d.ts.map +1 -1
- package/build/ui/Tabs.js.map +1 -1
- package/html.js +1 -1
- package/internal/routing.d.ts +1 -0
- package/internal/routing.js +1 -0
- package/internal/rsc.d.ts +1 -0
- package/internal/rsc.js +1 -0
- package/internal/static.d.ts +1 -0
- package/internal/static.js +1 -0
- package/internal/testing.d.ts +1 -0
- package/internal/testing.js +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/package.json +13 -11
- package/plugin/build/index.js +10 -0
- package/plugin/options.json +5 -0
- package/plugin/src/index.ts +17 -1
- package/rsc/headers.d.ts +1 -1
- package/rsc/headers.js +1 -1
- package/unstable-split-view.d.ts +1 -0
- package/unstable-split-view.js +1 -0
- package/build/getRoutesSSR.d.ts +0 -20
- package/build/getRoutesSSR.d.ts.map +0 -1
- package/build/getRoutesSSR.js +0 -97
- package/build/getRoutesSSR.js.map +0 -1
- package/build/getServerManifest.d.ts +0 -88
- package/build/getServerManifest.d.ts.map +0 -1
- package/build/getServerManifest.js +0 -238
- package/build/getServerManifest.js.map +0 -1
- package/build/loadStaticParamsAsync.d.ts +0 -9
- package/build/loadStaticParamsAsync.d.ts.map +0 -1
- package/build/loadStaticParamsAsync.js +0 -163
- package/build/loadStaticParamsAsync.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsNavigator.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeBottomTabsRouter.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabTrigger.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabs.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabs.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsTriggerTabBar.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js +0 -187
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/NativeTabsView.web.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/appearance.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/appearance.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/types.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/types.js.map +0 -1
- package/build/native-tabs/NativeBottomTabs/utils.d.ts.map +0 -1
- package/build/native-tabs/NativeBottomTabs/utils.js.map +0 -1
- package/build/routes-manifest.d.ts +0 -28
- package/build/routes-manifest.d.ts.map +0 -1
- package/build/routes-manifest.js +0 -30
- package/build/routes-manifest.js.map +0 -1
- package/build/rsc/middleware.d.ts +0 -8
- package/build/rsc/middleware.d.ts.map +0 -1
- package/build/rsc/middleware.js +0 -105
- package/build/rsc/middleware.js.map +0 -1
- package/build/rsc/path.d.ts +0 -34
- package/build/rsc/path.d.ts.map +0 -1
- package/build/rsc/path.js +0 -174
- package/build/rsc/path.js.map +0 -1
- package/build/rsc/router/create-expo-pages.d.ts +0 -20
- package/build/rsc/router/create-expo-pages.d.ts.map +0 -1
- package/build/rsc/router/create-expo-pages.js +0 -21
- package/build/rsc/router/create-expo-pages.js.map +0 -1
- package/build/rsc/router/create-pages.d.ts +0 -80
- package/build/rsc/router/create-pages.d.ts.map +0 -1
- package/build/rsc/router/create-pages.js +0 -232
- package/build/rsc/router/create-pages.js.map +0 -1
- package/build/rsc/router/defineRouter.d.ts +0 -30
- package/build/rsc/router/defineRouter.d.ts.map +0 -1
- package/build/rsc/router/defineRouter.js +0 -171
- package/build/rsc/router/defineRouter.js.map +0 -1
- package/build/rsc/router/expo-definedRouter.d.ts +0 -3
- package/build/rsc/router/expo-definedRouter.d.ts.map +0 -1
- package/build/rsc/router/expo-definedRouter.js +0 -112
- package/build/rsc/router/expo-definedRouter.js.map +0 -1
- package/build/rsc/router/noopRouter.d.ts +0 -3
- package/build/rsc/router/noopRouter.d.ts.map +0 -1
- package/build/rsc/router/noopRouter.js +0 -7
- package/build/rsc/router/noopRouter.js.map +0 -1
- package/build/rsc/rsc-renderer.d.ts +0 -44
- package/build/rsc/rsc-renderer.d.ts.map +0 -1
- package/build/rsc/rsc-renderer.js +0 -200
- package/build/rsc/rsc-renderer.js.map +0 -1
- package/build/rsc/server.d.ts +0 -65
- package/build/rsc/server.d.ts.map +0 -1
- package/build/rsc/server.js +0 -89
- package/build/rsc/server.js.map +0 -1
- package/build/static/getRootComponent.d.ts +0 -2
- package/build/static/getRootComponent.d.ts.map +0 -1
- package/build/static/getRootComponent.js +0 -25
- package/build/static/getRootComponent.js.map +0 -1
- package/build/static/getServerManifest.d.ts +0 -22
- package/build/static/getServerManifest.d.ts.map +0 -1
- package/build/static/getServerManifest.js +0 -50
- package/build/static/getServerManifest.js.map +0 -1
- package/build/static/renderStaticContent.d.ts +0 -15
- package/build/static/renderStaticContent.d.ts.map +0 -1
- package/build/static/renderStaticContent.js +0 -130
- package/build/static/renderStaticContent.js.map +0 -1
- package/build/typed-routes/generate.d.ts +0 -8
- package/build/typed-routes/generate.d.ts.map +0 -1
- package/build/typed-routes/generate.js +0 -186
- package/build/typed-routes/generate.js.map +0 -1
- package/build/typed-routes/index.d.ts +0 -35
- package/build/typed-routes/index.d.ts.map +0 -1
- package/build/typed-routes/index.js +0 -99
- package/build/typed-routes/index.js.map +0 -1
- package/build/typed-routes/testSetup.d.ts +0 -2
- package/build/typed-routes/testSetup.d.ts.map +0 -1
- package/build/typed-routes/testSetup.js +0 -42
- package/build/typed-routes/testSetup.js.map +0 -1
- package/build/utils/html.d.ts +0 -12
- package/build/utils/html.d.ts.map +0 -1
- package/build/utils/html.js +0 -29
- package/build/utils/html.js.map +0 -1
- package/node/render.js +0 -3
- /package/build/native-tabs/{NativeBottomTabs/NativeBottomTabsRouter.d.ts → NativeBottomTabsRouter.d.ts} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/NativeTabs.d.ts → NativeTabs.d.ts} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.d.ts → NativeTabsTriggerTabBar.d.ts} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/NativeTabsTriggerTabBar.js → NativeTabsTriggerTabBar.js} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.d.ts → NativeTabsView.d.ts} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/NativeTabsView.web.d.ts → NativeTabsView.web.d.ts} +0 -0
- /package/build/native-tabs/{NativeBottomTabs/types.js → types.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTabsView.web.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/NativeTabsView.web.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,wCAwDC;AA/DD,qDAAgF;AAChF,+CAAuC;AAGvC,mCAA6C;AAC7C,oGAAsE;AAEtE,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IACnD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,cAAc,GAAG,IAAA,eAAO,EAC5B,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,IAAI,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAC9D,EAAE,CACH,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,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ChG,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,4CAA4C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,iBAAiB,EAAE,eAAe,EAAE,CAAC;QACvC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC1F,CAAC;SAAM,IAAI,KAAK,CAAC,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC9E,CAAC;IACD,IAAI,iBAAiB,EAAE,oBAAoB,EAAE,CAAC;QAC5C,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CACxD,iBAAiB,CAAC,oBAAoB,CACvC,CAAC;IACJ,CAAC;SAAM,IAAI,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACtC,IAAI,CAAC,2CAA2C,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACzF,CAAC;IACD,IAAI,iBAAiB,EAAE,cAAc,EAAE,CAAC;QACtC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;IACzF,CAAC;SAAM,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAChC,IAAI,CAAC,qCAAqC,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { Tabs, TabsContent, TabsList, TabsTrigger } from '@radix-ui/react-tabs';\nimport React, { useMemo } from 'react';\n\nimport type { NativeTabOptions, NativeTabsViewProps } from './types';\nimport { shouldTabBeVisible } from './utils';\nimport nativeTabsStyles from '../../../assets/native-tabs.module.css';\n\nexport function NativeTabsView(props: NativeTabsViewProps) {\n const { builder, focusedIndex } = props;\n const { state, descriptors, navigation } = builder;\n const { routes } = state;\n const defaultTabName = useMemo(\n () => state.routes[focusedIndex]?.name ?? state.routes[0].name,\n []\n );\n const value = state.routes[focusedIndex]?.name ?? state.routes[0].name;\n const currentTabKey = state.routes[focusedIndex]?.key ?? state.routes[0].key;\n\n const items = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => (\n <TabItem\n key={route.key}\n route={route}\n title={descriptors[route.key].options.title ?? route.name}\n badgeValue={descriptors[route.key].options.badgeValue}\n />\n ));\n const children = routes\n .filter(({ key }) => shouldTabBeVisible(descriptors[key].options))\n .map((route) => {\n return (\n <TabsContent\n key={route.name}\n value={route.name}\n className={nativeTabsStyles.tabContent}\n forceMount>\n {descriptors[route.key].render()}\n </TabsContent>\n );\n });\n\n return (\n <Tabs\n className={nativeTabsStyles.nativeTabsContainer}\n defaultValue={defaultTabName}\n value={value}\n onValueChange={(value) => {\n navigation.dispatch({\n type: 'JUMP_TO',\n target: state.key,\n payload: {\n name: value,\n },\n });\n }}\n style={convertNativeTabsPropsToStyleVars(props, descriptors[currentTabKey]?.options)}>\n <TabsList aria-label=\"Main\" className={nativeTabsStyles.navigationMenuRoot}>\n {items}\n </TabsList>\n {children}\n </Tabs>\n );\n}\n\ninterface TabItemProps {\n title: string;\n badgeValue?: string;\n route: { name: string };\n}\n\nfunction TabItem(props: TabItemProps) {\n const { title, badgeValue, route } = props;\n const isBadgeEmpty = badgeValue === ' ';\n\n return (\n <TabsTrigger value={route.name} className={nativeTabsStyles.navigationMenuTrigger}>\n <span className={nativeTabsStyles.tabText}>{title}</span>\n {badgeValue && (\n <div\n className={`${nativeTabsStyles.tabBadge} ${isBadgeEmpty ? nativeTabsStyles.emptyTabBadge : ''}`}>\n {badgeValue}\n </div>\n )}\n </TabsTrigger>\n );\n}\n\nfunction convertNativeTabsPropsToStyleVars(\n props: NativeTabsViewProps | undefined,\n currentTabOptions: NativeTabOptions | undefined\n): Record<string, string | undefined> {\n const vars: Record<`--expo-router-tabs-${string}`, string | undefined> = {};\n if (!props) {\n return vars;\n }\n const { labelStyle } = props;\n const optionsLabelStyle = currentTabOptions?.labelStyle;\n if (optionsLabelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(optionsLabelStyle.fontFamily);\n } else if (labelStyle?.fontFamily) {\n vars['--expo-router-tabs-font-family'] = String(labelStyle.fontFamily);\n }\n if (optionsLabelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(optionsLabelStyle.fontSize);\n } else if (labelStyle?.fontSize) {\n vars['--expo-router-tabs-font-size'] = String(labelStyle.fontSize);\n }\n if (optionsLabelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(optionsLabelStyle.fontWeight);\n } else if (labelStyle?.fontWeight) {\n vars['--expo-router-tabs-font-weight'] = String(labelStyle.fontWeight);\n }\n if (optionsLabelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(optionsLabelStyle.fontStyle);\n } else if (labelStyle?.fontStyle) {\n vars['--expo-router-tabs-font-style'] = String(labelStyle.fontStyle);\n }\n if (optionsLabelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(optionsLabelStyle.color);\n } else if (labelStyle?.color) {\n vars['--expo-router-tabs-text-color'] = String(labelStyle.color);\n }\n if (currentTabOptions?.selectedLabelStyle?.color) {\n vars['--expo-router-tabs-active-text-color'] = String(\n currentTabOptions.selectedLabelStyle.color\n );\n } else if (props.tintColor) {\n vars['--expo-router-tabs-active-text-color'] = String(props.tintColor);\n }\n if (currentTabOptions?.selectedLabelStyle?.fontSize) {\n vars['--expo-router-tabs-active-font-size'] = String(\n currentTabOptions.selectedLabelStyle.fontSize\n );\n }\n if (currentTabOptions?.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(currentTabOptions.indicatorColor);\n } else if (props.indicatorColor) {\n vars['--expo-router-tabs-active-background-color'] = String(props.indicatorColor);\n }\n if (currentTabOptions?.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(currentTabOptions.backgroundColor);\n } else if (props.backgroundColor) {\n vars['--expo-router-tabs-background-color'] = String(props.backgroundColor);\n }\n if (currentTabOptions?.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(\n currentTabOptions.badgeBackgroundColor\n );\n } else if (props.badgeBackgroundColor) {\n vars['--expo-router-tabs-badge-background-color'] = String(props.badgeBackgroundColor);\n }\n if (currentTabOptions?.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(currentTabOptions.badgeTextColor);\n } else if (props.badgeTextColor) {\n vars['--expo-router-tabs-badge-text-color'] = String(props.badgeTextColor);\n }\n return vars;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appearance.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/appearance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAE1B,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AAEjB,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,gBAAgB,EACzB,sBAAsB,EAAE,0BAA0B,GACjD,0BAA0B,CAuB5B;AAED,wBAAgB,qCAAqC,CACnD,OAAO,EAAE,gBAAgB,EACzB,wBAAwB,EAAE,0BAA0B,GACnD,0BAA0B,CAuB5B;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACpC,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,uBAAuB,CAAC,EAAE;QACxB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,aAAa,EAAE,eAAe,EAC9B,UAAU,EAAE,0BAA0B,GACrC,0BAA0B,CAE5B;AASD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,0BAA0B,EACtC,MAAM,EAAE,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,EAAE,GACzD,0BAA0B,CA8B5B;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,0BAA0B,CAmB5B;AAED,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,eAAe,GAAG,SAAS,GACjC,mCAAmC,CAyBrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"appearance.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/appearance.ts"],"names":[],"mappings":";;AAaA,kFA0BC;AAED,sFA0BC;AAcD,0EAKC;AASD,0DAkCC;AAED,4DAqBC;AAED,8EA2BC;AAxKD,SAAgB,mCAAmC,CACjD,OAAyB,EACzB,sBAAkD;IAElD,MAAM,UAAU,GAAG,uBAAuB,CACxC;QACE,GAAG,OAAO,CAAC,UAAU;QACrB,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,oBAAoB,EAAE,OAAO,CAAC,oBAAoB;QAClD,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,EACD,sBAAsB,EACtB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,CAClC,CAAC;IACF,OAAO,+BAA+B,CACpC;QACE,GAAG,CAAC,OAAO,CAAC,kBAAkB,IA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e,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColorValue } from 'react-native';\nimport type {\n BottomTabsScreenAppearance,\n BottomTabsScreenItemAppearance,\n BottomTabsScreenItemStateAppearance,\n} from 'react-native-screens';\n\nimport {\n type NativeTabOptions,\n type NativeTabsBlurEffect,\n type NativeTabsLabelStyle,\n} from './types';\n\nexport function createStandardAppearanceFromOptions(\n options: NativeTabOptions,\n baseStandardAppearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n backgroundColor: options.backgroundColor,\n blurEffect: options.blurEffect,\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n shadowColor: options.shadowColor,\n },\n baseStandardAppearance,\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport function createScrollEdgeAppearanceFromOptions(\n options: NativeTabOptions,\n baseScrollEdgeAppearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n const appearance = appendStyleToAppearance(\n {\n ...options.labelStyle,\n iconColor: options.iconColor,\n blurEffect: options.disableTransparentOnScrollEdge ? options.blurEffect : 'none',\n backgroundColor: options.disableTransparentOnScrollEdge ? options.backgroundColor : null,\n shadowColor: options.disableTransparentOnScrollEdge ? options.shadowColor : 'transparent',\n badgeBackgroundColor: options.badgeBackgroundColor,\n titlePositionAdjustment: options.titlePositionAdjustment,\n },\n baseScrollEdgeAppearance,\n ['normal', 'focused', 'selected']\n );\n return appendSelectedStyleToAppearance(\n {\n ...(options.selectedLabelStyle ?? {}),\n iconColor: options.selectedIconColor,\n badgeBackgroundColor: options.selectedBadgeBackgroundColor,\n titlePositionAdjustment: options.selectedTitlePositionAdjustment,\n },\n appearance\n );\n}\n\nexport interface AppearanceStyle extends NativeTabsLabelStyle {\n iconColor?: ColorValue;\n backgroundColor?: ColorValue | null;\n blurEffect?: NativeTabsBlurEffect;\n badgeBackgroundColor?: ColorValue;\n shadowColor?: ColorValue;\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n}\n\nexport function appendSelectedStyleToAppearance(\n selectedStyle: AppearanceStyle,\n appearance: BottomTabsScreenAppearance\n): BottomTabsScreenAppearance {\n return appendStyleToAppearance(selectedStyle, appearance, ['selected', 'focused']);\n}\n\nconst EMPTY_APPEARANCE_ITEM: BottomTabsScreenItemAppearance = {\n normal: {},\n selected: {},\n focused: {},\n disabled: {},\n};\n\nexport function appendStyleToAppearance(\n style: AppearanceStyle,\n appearance: BottomTabsScreenAppearance,\n states: ('selected' | 'focused' | 'disabled' | 'normal')[]\n): BottomTabsScreenAppearance {\n const baseItemAppearance =\n appearance.stacked || appearance.inline || appearance.compactInline || {};\n\n const styleAppearance = convertStyleToAppearance(style);\n const newAppearances = states.map((state) => ({\n key: state,\n appearance: {\n ...baseItemAppearance.normal,\n ...baseItemAppearance[state],\n ...styleAppearance.stacked?.normal,\n },\n }));\n\n const itemAppearance: BottomTabsScreenItemAppearance = {\n ...EMPTY_APPEARANCE_ITEM,\n ...baseItemAppearance,\n ...Object.fromEntries(newAppearances.map(({ key, appearance }) => [key, appearance])),\n };\n return {\n stacked: itemAppearance,\n inline: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor:\n style.backgroundColor === null\n ? undefined\n : (style.backgroundColor ?? appearance.tabBarBackgroundColor),\n tabBarBlurEffect: styleAppearance.tabBarBlurEffect ?? appearance.tabBarBlurEffect,\n tabBarShadowColor: styleAppearance.tabBarShadowColor ?? appearance.tabBarShadowColor,\n };\n}\n\nexport function convertStyleToAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance = convertStyleToItemStateAppearance(style);\n const itemAppearance: BottomTabsScreenItemAppearance = {\n normal: stateAppearance,\n selected: stateAppearance,\n focused: stateAppearance,\n disabled: {},\n };\n return {\n inline: itemAppearance,\n stacked: itemAppearance,\n compactInline: itemAppearance,\n tabBarBackgroundColor: style?.backgroundColor ?? undefined,\n tabBarBlurEffect: style?.blurEffect,\n tabBarShadowColor: style?.shadowColor,\n };\n}\n\nexport function convertStyleToItemStateAppearance(\n style: AppearanceStyle | undefined\n): BottomTabsScreenItemStateAppearance {\n if (!style) {\n return {};\n }\n const stateAppearance: BottomTabsScreenItemStateAppearance = {\n tabBarItemBadgeBackgroundColor: style.badgeBackgroundColor,\n tabBarItemTitlePositionAdjustment: style.titlePositionAdjustment,\n tabBarItemIconColor: style.iconColor,\n tabBarItemTitleFontFamily: style.fontFamily,\n tabBarItemTitleFontSize: style.fontSize,\n // Only string values are accepted by rn-screens\n tabBarItemTitleFontWeight: style?.fontWeight\n ? (String(style.fontWeight) as `${NonNullable<(typeof style)['fontWeight']>}`)\n : undefined,\n tabBarItemTitleFontStyle: style.fontStyle,\n tabBarItemTitleFontColor: style.color,\n };\n\n (Object.keys(stateAppearance) as (keyof BottomTabsScreenItemStateAppearance)[]).forEach((key) => {\n if (stateAppearance[key] === undefined) {\n delete stateAppearance[key];\n }\n });\n\n return stateAppearance;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,E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AC,EAAE,UAAU,CAAC;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC;;;;OAIG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB;;;;OAIG;IACH,8BAA8B,CAAC,EAAE,OAAO,CAAC;IACzC;;;;OAIG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,UAAU,CAAC;CAC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/types.ts"],"names":[],"mappings":";;;AAkMa,QAAA,sBAAsB,GAAG;IACpC,MAAM;IACN,eAAe;IACf,YAAY;IACZ,OAAO;IACP,MAAM;IACN,SAAS;IACT,WAAW;IACX,yBAAyB;IACzB,oBAAoB;IACpB,gBAAgB;IAChB,qBAAqB;IACrB,sBAAsB;IACtB,8BAA8B;IAC9B,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;IAC1B,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,oBAAoB;IACpB,yBAAyB;IACzB,0BAA0B;CAClB,CAAC;AAuKE,QAAA,6CAA6C,GAAG;IAC3D,MAAM;IACN,UAAU;IACV,SAAS;IACT,WAAW;CACH,CAAC;AAUE,QAAA,oCAAoC,GAAG;IAClD,WAAW;IACX,OAAO;IACP,cAAc;IACd,YAAY;CACJ,CAAC;AAiEX,MAAM,4BAA4B,GAAG;IACnC,WAAW;IACX,UAAU;IACV,WAAW;IACX,WAAW;IACX,UAAU;IACV,SAAS;IACT,MAAM;IACN,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,QAAQ;IACR,UAAU;CACF,CAAC","sourcesContent":["import type {\n DefaultRouterOptions,\n ParamListBase,\n TabNavigationState,\n TabRouterOptions,\n useNavigationBuilder,\n} from '@react-navigation/native';\nimport type { PropsWithChildren } from 'react';\nimport type { ColorValue, ImageSourcePropType, TextStyle } from 'react-native';\nimport type { BottomTabsScreenProps } from 'react-native-screens';\nimport type { SFSymbol } from 'sf-symbols-typescript';\n\nexport interface NativeTabOptions extends DefaultRouterOptions {\n /**\n * The icon to display in the tab bar.\n * @platform android\n * @platform iOS\n */\n icon?: SymbolOrImageSource;\n /**\n * The icon to display when the tab is selected.\n * @platform iOS\n */\n selectedIcon?: SymbolOrImageSource;\n /**\n * Title of the tab screen, displayed in the tab bar item.\n *\n * @platform android\n * @platform iOS\n */\n title?: string;\n /**\n * Specifies content of tab bar item badge.\n *\n * On Android, the value is interpreted in the following order:\n * - If the string can be parsed to integer, displays the value as a number\n * - Otherwise if the string is empty, displays \"small dot\" badge\n * - Otherwise, displays the value as a text\n *\n * On iOS, badge is displayed as regular string.\n *\n * @platform android\n * @platform ios\n */\n badgeValue?: string;\n /**\n * The style of the tab label when the tab is selected.\n */\n selectedLabelStyle?: NativeTabsLabelStyle;\n /**\n * The style of all the tab labels, when the tab is selected\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. If you override the `title`,\n * `icon`, or `selectedIcon`, note that this is not officially supported\n * by Apple and may lead to unexpected results.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n /**\n * The color of the icon when the tab is selected.\n */\n selectedIconColor?: ColorValue;\n /**\n * The color of the badge when the tab is selected.\n */\n selectedBadgeBackgroundColor?: ColorValue;\n /**\n * The color of all the badges when the tab is selected.\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the background when the tab is selected.\n */\n backgroundColor?: ColorValue;\n /**\n * The blur effect to apply when the tab is selected.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * The color of the icon when the tab is selected.\n *\n * On iOS 26+ you can change the icon color in the scroll edge state.\n */\n iconColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The position adjustment for all the labels when the tab is selected.\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The position adjustment for the label when the tab is selected.\n *\n * @platform iOS\n */\n selectedTitlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport type SymbolOrImageSource =\n | {\n /**\n * The name of the SF Symbol to use as an icon.\n * @platform iOS\n */\n sf?: SFSymbol;\n /**\n * The name of the drawable resource to use as an icon.\n * @platform android\n */\n drawable?: string;\n }\n | {\n /**\n * The image source to use as an icon.\n */\n src?: ImageSourcePropType | Promise<ImageSourcePropType | null>;\n };\n\nexport interface ExtendedNativeTabOptions extends NativeTabOptions {\n /**\n * If true, the tab will be hidden from the tab bar.\n */\n hidden?: boolean;\n specialEffects?: BottomTabsScreenProps['specialEffects'];\n}\n\ntype NumericFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;\n\nexport interface NativeTabsLabelStyle {\n /**\n * The font family of the tab label.\n */\n fontFamily?: TextStyle['fontFamily'];\n /**\n * The font size of the tab label.\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * The font weight of the tab label.\n */\n fontWeight?: NumericFontWeight | `${NumericFontWeight}`;\n /**\n * The font style of the tab label.\n */\n fontStyle?: TextStyle['fontStyle'];\n /**\n * The color of the tab label.\n */\n color?: TextStyle['color'];\n}\n\nexport const SUPPORTED_BLUR_EFFECTS = [\n 'none',\n 'systemDefault',\n 'extraLight',\n 'light',\n 'dark',\n 'regular',\n 'prominent',\n 'systemUltraThinMaterial',\n 'systemThinMaterial',\n 'systemMaterial',\n 'systemThickMaterial',\n 'systemChromeMaterial',\n 'systemUltraThinMaterialLight',\n 'systemThinMaterialLight',\n 'systemMaterialLight',\n 'systemThickMaterialLight',\n 'systemChromeMaterialLight',\n 'systemUltraThinMaterialDark',\n 'systemThinMaterialDark',\n 'systemMaterialDark',\n 'systemThickMaterialDark',\n 'systemChromeMaterialDark',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uiblureffect/style)\n */\nexport type NativeTabsBlurEffect = (typeof SUPPORTED_BLUR_EFFECTS)[number];\n\n/**\n * @platform android\n * @platform web\n */\nexport interface NativeTabsActiveStyleType {\n /**\n * @platform android\n * @platform web\n */\n color?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n fontSize?: TextStyle['fontSize'];\n /**\n * @platform android\n */\n iconColor?: ColorValue;\n /**\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n\nexport interface NativeTabsProps extends PropsWithChildren {\n // #region common props\n /**\n * The style of the every tab label in the tab bar.\n */\n labelStyle?: NativeTabsLabelStyle;\n // disabledLabelStyle?: NativeTabsLabelStyle;\n /**\n * The color of every tab icon in the tab bar.\n */\n iconColor?: ColorValue;\n /**\n * The tint color of the tab icon.\n *\n * Can be overridden by icon color and label color for each tab individually.\n */\n tintColor?: ColorValue;\n /**\n * The background color of the tab bar.\n */\n backgroundColor?: ColorValue | null;\n /**\n * The background color of every badge in the tab bar.\n */\n badgeBackgroundColor?: ColorValue;\n // #endregion common props\n // #region iOS props\n /**\n * Specifies the minimize behavior for the tab bar.\n *\n * Available starting from iOS 26.\n *\n * The following values are currently supported:\n *\n * - `automatic` - resolves to the system default minimize behavior\n * - `never` - the tab bar does not minimize\n * - `onScrollDown` - the tab bar minimizes when scrolling down and\n * expands when scrolling back up\n * - `onScrollUp` - the tab bar minimizes when scrolling up and expands\n * when scrolling back down\n *\n * @see The supported values correspond to the official [UIKit documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior).\n *\n * @default automatic\n *\n * @platform iOS 26+\n */\n minimizeBehavior?: NativeTabsTabBarMinimizeBehavior;\n /**\n * The blur effect applied to the tab bar.\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbaritem/titlepositionadjustment)\n *\n * @platform iOS\n */\n titlePositionAdjustment?: {\n horizontal?: number;\n vertical?: number;\n };\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n // #endregion iOS props\n // #region android props\n /**\n * Disables the active indicator for the tab bar.\n *\n * @platform android\n */\n disableIndicator?: boolean;\n /**\n * The behavior when navigating back with the back button.\n *\n * @platform android\n */\n backBehavior?: 'none' | 'initialRoute' | 'history';\n /**\n * The visibility mode of the tab item label.\n *\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\n labelVisibilityMode?: NativeTabsTabBarItemLabelVisibilityMode;\n /**\n * The color of the ripple effect when the tab is pressed.\n *\n * @platform android\n */\n rippleColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform android\n * @platform web\n */\n indicatorColor?: ColorValue;\n /**\n * The color of the badge text.\n *\n * @platform android\n * @platform web\n */\n badgeTextColor?: ColorValue;\n // #endregion android props\n}\nexport interface NativeTabsViewProps extends NativeTabsProps {\n focusedIndex: number;\n builder: ReturnType<\n typeof useNavigationBuilder<\n TabNavigationState<ParamListBase>,\n TabRouterOptions,\n Record<string, (...args: any) => void>,\n NativeTabOptions,\n Record<string, any>\n >\n >;\n}\n\nexport const SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES = [\n 'auto',\n 'selected',\n 'labeled',\n 'unlabeled',\n] as const;\n\n/**\n * @see [Material Components documentation](https://github.com/material-components/material-components-android/blob/master/docs/components/BottomNavigation.md#making-navigation-bar-accessible)\n *\n * @platform android\n */\nexport type NativeTabsTabBarItemLabelVisibilityMode =\n (typeof SUPPORTED_TAB_BAR_ITEM_LABEL_VISIBILITY_MODES)[number];\n\nexport const SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS = [\n 'automatic',\n 'never',\n 'onScrollDown',\n 'onScrollUp',\n] as const;\n\n/**\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uitabbarcontroller/minimizebehavior)\n *\n * @platform iOS 26\n */\nexport type NativeTabsTabBarMinimizeBehavior =\n (typeof SUPPORTED_TAB_BAR_MINIMIZE_BEHAVIORS)[number];\n\nexport interface NativeTabTriggerProps {\n /**\n * The name of the route.\n *\n * This is required when used inside a Layout component.\n *\n * When used in a route it has no effect.\n */\n name?: string;\n /**\n * If true, the tab will be hidden from the tab bar.\n *\n * > **Note**: Marking a tab as `hidden` means it cannot be navigated to in any way.\n */\n hidden?: boolean;\n /**\n * The options for the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components as children to customize the tab, rather then raw options.\n */\n options?: NativeTabOptions;\n /**\n * If true, the tab will not pop stack to the root when selected again.\n *\n * @default false\n * @platform iOS\n */\n disablePopToTop?: boolean;\n /**\n * If true, the tab will not scroll to the top when selected again.\n * @default false\n *\n * @platform iOS\n */\n disableScrollToTop?: boolean;\n /**\n * The children of the trigger.\n *\n * Use `Icon`, `Label`, and `Badge` components to customize the tab.\n */\n children?: React.ReactNode;\n /**\n * System-provided tab bar item with predefined icon and title\n *\n * Uses Apple's built-in tab bar items (e.g., bookmarks, contacts, downloads) with\n * standard iOS styling and localized titles. Custom `icon` or `selectedIcon`\n * properties will override the system icon, but the system-defined title cannot\n * be customized.\n *\n * @see {@link https://developer.apple.com/documentation/uikit/uitabbaritem/systemitem|UITabBarItem.SystemItem}\n * @platform ios\n */\n role?: NativeTabsTabBarItemRole;\n}\n\nconst SUPPORTED_TAB_BAR_ITEM_ROLES = [\n 'bookmarks',\n 'contacts',\n 'downloads',\n 'favorites',\n 'featured',\n 'history',\n 'more',\n 'mostRecent',\n 'mostViewed',\n 'recents',\n 'search',\n 'topRated',\n] as const;\n\nexport type NativeTabsTabBarItemRole = (typeof SUPPORTED_TAB_BAR_ITEM_ROLES)[number];\n\nexport interface NativeTabsTriggerTabBarProps {\n /**\n * The style of the every tab label in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n labelStyle?: NativeTabsLabelStyle;\n /**\n * The background color of the tab bar, when the tab is selected\n */\n backgroundColor?: ColorValue;\n /**\n * The color of every tab icon, when the tab is selected\n *\n * @platform iOS\n */\n iconColor?: ColorValue;\n /**\n * The background color of every badge in the tab bar.\n *\n * @platform iOS\n * @platform web\n */\n badgeBackgroundColor?: ColorValue;\n /**\n * The blur effect applied to the tab bar, when the tab is selected\n *\n * @platform iOS\n */\n blurEffect?: NativeTabsBlurEffect;\n /**\n * The color of the shadow when the tab is selected.\n *\n * @see [Apple documentation](https://developer.apple.com/documentation/uikit/uibarappearance/shadowcolor)\n *\n * @platform iOS\n */\n shadowColor?: ColorValue;\n /**\n * When set to `true`, the tab bar will not become transparent when scrolled to the edge.\n *\n * @platform iOS\n */\n disableTransparentOnScrollEdge?: boolean;\n /**\n * The color of the badge text.\n *\n * @platform web\n */\n badgeTextColor?: ColorValue;\n /**\n * The color of the tab indicator.\n *\n * @platform web\n */\n indicatorColor?: ColorValue;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,wBAAgB,6BAA6B,CAAC,UAAU,SAAS,qBAAqB,CAAC,GAAG,CAAC,EAAE,EAC3F,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,EACjC,UAAU,EAAE,UAAU,GACrB,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAOpF;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,qBAAqB,CAAC,GAAG,CAAC,EAChE,KAAK,EAAE,SAAS,EAChB,IAAI,EAAE,CAAC,GACN,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAEzD;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAI7E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/native-tabs/NativeBottomTabs/utils.ts"],"names":[],"mappings":";;;;;AAKA,sEAUC;AAED,sCAKC;AAED,gDAIC;AA3BD,kDAA0B;AAI1B,SAAgB,6BAA6B,CAC3C,QAAiC,EACjC,UAAsB;IAEtB,OAAO,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAC5C,CACE,KAAK,EACsF,EAAE,CAC7F,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAiC,CAAC,CAC9F,CAAC;AACJ,CAAC;AAED,SAAgB,aAAa,CAC3B,KAAgB,EAChB,IAAO;IAEP,OAAO,eAAK,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;AAC5D,CAAC;AAED,SAAgB,kBAAkB,CAAC,OAAiC;IAClE,yEAAyE;IACzE,+EAA+E;IAC/E,OAAO,OAAO,CAAC,MAAM,KAAK,KAAK,CAAC;AAClC,CAAC","sourcesContent":["import type { JSXElementConstructor, ReactNode } from 'react';\nimport React from 'react';\n\nimport type { ExtendedNativeTabOptions } from './types';\n\nexport function filterAllowedChildrenElements<Components extends JSXElementConstructor<any>[]>(\n children: ReactNode | ReactNode[],\n components: Components\n): React.ReactElement<React.ComponentProps<Components[number]>, Components[number]>[] {\n return React.Children.toArray(children).filter(\n (\n child\n ): child is React.ReactElement<React.ComponentProps<Components[number]>, Components[number]> =>\n React.isValidElement(child) && components.includes(child.type as (props: any) => ReactNode)\n );\n}\n\nexport function isChildOfType<T extends JSXElementConstructor<any>>(\n child: ReactNode,\n type: T\n): child is React.ReactElement<React.ComponentProps<T>, T> {\n return React.isValidElement(child) && child.type === type;\n}\n\nexport function shouldTabBeVisible(options: ExtendedNativeTabOptions): boolean {\n // The <NativeTab.Trigger> always sets `hidden` to defined boolean value.\n // If it is not defined, then it was not specified, and we should hide the tab.\n return options.hidden === false;\n}\n"]}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Options } from './getRoutesSSR';
|
|
2
|
-
export { Options };
|
|
3
|
-
export type RouteInfo<TRegex = string> = {
|
|
4
|
-
file: string;
|
|
5
|
-
page: string;
|
|
6
|
-
namedRegex: TRegex;
|
|
7
|
-
routeKeys: Record<string, string>;
|
|
8
|
-
permanent?: boolean;
|
|
9
|
-
methods?: string[];
|
|
10
|
-
};
|
|
11
|
-
export type MiddlewareInfo = {
|
|
12
|
-
/**
|
|
13
|
-
* Path to the module that contains the middleware function as a default export.
|
|
14
|
-
*
|
|
15
|
-
* @example _expo/functions/+middleware.js
|
|
16
|
-
*/
|
|
17
|
-
file: string;
|
|
18
|
-
};
|
|
19
|
-
export type ExpoRoutesManifestV1<TRegex = string> = {
|
|
20
|
-
middleware?: MiddlewareInfo;
|
|
21
|
-
apiRoutes: RouteInfo<TRegex>[];
|
|
22
|
-
htmlRoutes: RouteInfo<TRegex>[];
|
|
23
|
-
notFoundRoutes: RouteInfo<TRegex>[];
|
|
24
|
-
redirects: RouteInfo<TRegex>[];
|
|
25
|
-
rewrites: RouteInfo<TRegex>[];
|
|
26
|
-
};
|
|
27
|
-
export declare function createRoutesManifest(paths: string[], options: Options): ExpoRoutesManifestV1 | null;
|
|
28
|
-
//# sourceMappingURL=routes-manifest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.d.ts","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAIzD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B;;;;OAIG;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,MAAM,GAAG,MAAM,IAAI;IAClD,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAChC,cAAc,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IACpC,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;CAC/B,CAAC;AAYF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,OAAO,GACf,oBAAoB,GAAG,IAAI,CAe7B"}
|
package/build/routes-manifest.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createRoutesManifest = createRoutesManifest;
|
|
4
|
-
// This file runs in Node.js environments.
|
|
5
|
-
// no relative imports
|
|
6
|
-
const getRoutesSSR_1 = require("./getRoutesSSR");
|
|
7
|
-
const getServerManifest_1 = require("./getServerManifest");
|
|
8
|
-
function createMockContextModule(map = []) {
|
|
9
|
-
const contextModule = (_key) => ({ default() { } });
|
|
10
|
-
Object.defineProperty(contextModule, 'keys', {
|
|
11
|
-
value: () => map,
|
|
12
|
-
});
|
|
13
|
-
return contextModule;
|
|
14
|
-
}
|
|
15
|
-
function createRoutesManifest(paths, options) {
|
|
16
|
-
// TODO: Drop this part for Node.js
|
|
17
|
-
const routeTree = (0, getRoutesSSR_1.getRoutes)(createMockContextModule(paths), {
|
|
18
|
-
...options,
|
|
19
|
-
preserveApiRoutes: true,
|
|
20
|
-
preserveRedirectAndRewrites: true,
|
|
21
|
-
ignoreRequireErrors: true,
|
|
22
|
-
ignoreEntryPoints: true,
|
|
23
|
-
platform: 'web',
|
|
24
|
-
});
|
|
25
|
-
if (!routeTree) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return (0, getServerManifest_1.getServerManifest)(routeTree, { headers: options.headers });
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=routes-manifest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routes-manifest.js","sourceRoot":"","sources":["../src/routes-manifest.ts"],"names":[],"mappings":";;AA6CA,oDAkBC;AA/DD,0CAA0C;AAC1C,sBAAsB;AACtB,iDAAyD;AACzD,2DAAwD;AAgCxD,SAAS,uBAAuB,CAAC,MAAgB,EAAE;IACjD,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAI,CAAC,EAAE,CAAC,CAAC;IAE3D,MAAM,CAAC,cAAc,CAAC,aAAa,EAAE,MAAM,EAAE;QAC3C,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO,aAA+B,CAAC;AACzC,CAAC;AAED,SAAgB,oBAAoB,CAClC,KAAe,EACf,OAAgB;IAEhB,mCAAmC;IACnC,MAAM,SAAS,GAAG,IAAA,wBAAS,EAAC,uBAAuB,CAAC,KAAK,CAAC,EAAE;QAC1D,GAAG,OAAO;QACV,iBAAiB,EAAE,IAAI;QACvB,2BAA2B,EAAE,IAAI;QACjC,mBAAmB,EAAE,IAAI;QACzB,iBAAiB,EAAE,IAAI;QACvB,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAA,qCAAiB,EAAC,SAAS,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["// This file runs in Node.js environments.\n// no relative imports\nimport { type Options, getRoutes } from './getRoutesSSR';\nimport { getServerManifest } from './getServerManifest';\nimport { type RequireContext } from './types';\n\nexport { Options };\n\nexport type RouteInfo<TRegex = string> = {\n file: string;\n page: string;\n namedRegex: TRegex;\n routeKeys: Record<string, string>;\n permanent?: boolean;\n methods?: string[];\n};\n\nexport type MiddlewareInfo = {\n /**\n * Path to the module that contains the middleware function as a default export.\n *\n * @example _expo/functions/+middleware.js\n */\n file: string;\n};\n\nexport type ExpoRoutesManifestV1<TRegex = string> = {\n middleware?: MiddlewareInfo;\n apiRoutes: RouteInfo<TRegex>[];\n htmlRoutes: RouteInfo<TRegex>[];\n notFoundRoutes: RouteInfo<TRegex>[];\n redirects: RouteInfo<TRegex>[];\n rewrites: RouteInfo<TRegex>[];\n};\n\nfunction createMockContextModule(map: string[] = []) {\n const contextModule = (_key: string) => ({ default() {} });\n\n Object.defineProperty(contextModule, 'keys', {\n value: () => map,\n });\n\n return contextModule as RequireContext;\n}\n\nexport function createRoutesManifest(\n paths: string[],\n options: Options\n): ExpoRoutesManifestV1 | null {\n // TODO: Drop this part for Node.js\n const routeTree = getRoutes(createMockContextModule(paths), {\n ...options,\n preserveApiRoutes: true,\n preserveRedirectAndRewrites: true,\n ignoreRequireErrors: true,\n ignoreEntryPoints: true,\n platform: 'web',\n });\n\n if (!routeTree) {\n return null;\n }\n return getServerManifest(routeTree, { headers: options.headers });\n}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { RenderRscArgs } from 'expo-server/private';
|
|
2
|
-
type ImportMap = {
|
|
3
|
-
router: () => Promise<typeof import('./router/expo-definedRouter')>;
|
|
4
|
-
};
|
|
5
|
-
export declare function renderRscWithImportsAsync(distFolder: string, imports: ImportMap, { body, platform, searchParams, config, method, input, contentType, headers }: RenderRscArgs): Promise<ReadableStream<any>>;
|
|
6
|
-
export declare function renderRscAsync(distFolder: string, args: RenderRscArgs): Promise<ReadableStream<any>>;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=middleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/rsc/middleware.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiEzD,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,MAAM,OAAO,CAAC,cAAc,6BAA6B,CAAC,CAAC,CAAC;CACrE,CAAC;AAEF,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,SAAS,EAClB,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,aAAa,GAC3F,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAiE9B;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAY9B"}
|
package/build/rsc/middleware.js
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.renderRscWithImportsAsync = renderRscWithImportsAsync;
|
|
7
|
-
exports.renderRscAsync = renderRscAsync;
|
|
8
|
-
/**
|
|
9
|
-
* Copyright © 2024 650 Industries.
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the MIT license found in the
|
|
12
|
-
* LICENSE file in the root directory of this source tree.
|
|
13
|
-
*
|
|
14
|
-
*/
|
|
15
|
-
// This module is bundled with Metro in web/react-server mode and redirects to platform specific renderers.
|
|
16
|
-
const expo_constants_1 = __importDefault(require("expo-constants"));
|
|
17
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
18
|
-
const rsc_renderer_1 = require("./rsc-renderer");
|
|
19
|
-
const debug = require('debug')('expo:server:rsc-renderer');
|
|
20
|
-
// Tracking the implementation in expo/cli's MetroBundlerDevServer
|
|
21
|
-
const rscRenderContext = new Map();
|
|
22
|
-
function serverRequire(...targetOutputModulePath) {
|
|
23
|
-
// NOTE(@kitten): This `__dirname` will be located in the output file system, e.g. `dist/server/*`
|
|
24
|
-
const filePath = node_path_1.default.join(__dirname, ...targetOutputModulePath);
|
|
25
|
-
return $$require_external(filePath);
|
|
26
|
-
}
|
|
27
|
-
function getRscRenderContext(platform) {
|
|
28
|
-
// NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.
|
|
29
|
-
if (rscRenderContext.has(platform)) {
|
|
30
|
-
return rscRenderContext.get(platform);
|
|
31
|
-
}
|
|
32
|
-
const context = {};
|
|
33
|
-
rscRenderContext.set(platform, context);
|
|
34
|
-
return context;
|
|
35
|
-
}
|
|
36
|
-
function getServerActionManifest(_distFolder, platform) {
|
|
37
|
-
const filePath = `../../rsc/${platform}/action-manifest.js`;
|
|
38
|
-
return serverRequire(filePath);
|
|
39
|
-
}
|
|
40
|
-
function getSSRManifest(_distFolder, platform) {
|
|
41
|
-
const filePath = `../../rsc/${platform}/ssr-manifest.js`;
|
|
42
|
-
return serverRequire(filePath);
|
|
43
|
-
}
|
|
44
|
-
async function renderRscWithImportsAsync(distFolder, imports, { body, platform, searchParams, config, method, input, contentType, headers }) {
|
|
45
|
-
globalThis.__expo_platform_header = platform;
|
|
46
|
-
if (method === 'POST' && !body) {
|
|
47
|
-
throw new Error('Server request must be provided when method is POST (server actions)');
|
|
48
|
-
}
|
|
49
|
-
const context = getRscRenderContext(platform);
|
|
50
|
-
context['__expo_requestHeaders'] = headers;
|
|
51
|
-
const router = await imports.router();
|
|
52
|
-
const entries = router.default({
|
|
53
|
-
redirects: expo_constants_1.default.expoConfig?.extra?.router?.redirects,
|
|
54
|
-
rewrites: expo_constants_1.default.expoConfig?.extra?.router?.rewrites,
|
|
55
|
-
});
|
|
56
|
-
const ssrManifest = getSSRManifest(distFolder, platform);
|
|
57
|
-
const actionManifest = getServerActionManifest(distFolder, platform);
|
|
58
|
-
return (0, rsc_renderer_1.renderRsc)({
|
|
59
|
-
body: body ?? undefined,
|
|
60
|
-
context,
|
|
61
|
-
config,
|
|
62
|
-
input,
|
|
63
|
-
contentType,
|
|
64
|
-
decodedBody: searchParams.get('x-expo-params'),
|
|
65
|
-
}, {
|
|
66
|
-
isExporting: true,
|
|
67
|
-
resolveClientEntry(file, isServer) {
|
|
68
|
-
debug('resolveClientEntry', file, { isServer });
|
|
69
|
-
if (isServer) {
|
|
70
|
-
if (!(file in actionManifest)) {
|
|
71
|
-
throw new Error(`Could not find file in server action manifest: ${file}. ${JSON.stringify(actionManifest)}`);
|
|
72
|
-
}
|
|
73
|
-
const [id, chunk] = actionManifest[file];
|
|
74
|
-
return {
|
|
75
|
-
id,
|
|
76
|
-
chunks: chunk ? [chunk] : [],
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
if (!(file in ssrManifest)) {
|
|
80
|
-
throw new Error(`Could not find file in SSR manifest: ${file}`);
|
|
81
|
-
}
|
|
82
|
-
const [id, chunk] = ssrManifest[file];
|
|
83
|
-
return {
|
|
84
|
-
id,
|
|
85
|
-
chunks: chunk ? [chunk] : [],
|
|
86
|
-
};
|
|
87
|
-
},
|
|
88
|
-
async loadServerModuleRsc(file) {
|
|
89
|
-
debug('loadServerModuleRsc', file);
|
|
90
|
-
// NOTE(@kitten): [WORKAROUND] Assumes __dirname is at `dist/server/_expo/functions/_flight`
|
|
91
|
-
return serverRequire('../../../', file);
|
|
92
|
-
},
|
|
93
|
-
entries: entries,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
async function renderRscAsync(distFolder, args) {
|
|
97
|
-
const platform = args.platform;
|
|
98
|
-
return renderRscWithImportsAsync(distFolder, {
|
|
99
|
-
router: () => {
|
|
100
|
-
// NOTE(@kitten): [WORKAROUND] Assumes __dirname is at `dist/server/_expo/functions/_flight`
|
|
101
|
-
return serverRequire(`../../rsc/${platform}/router.js`);
|
|
102
|
-
},
|
|
103
|
-
}, args);
|
|
104
|
-
}
|
|
105
|
-
//# sourceMappingURL=middleware.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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I,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAC5F,CAAC;gBACJ,CAAC;gBAED,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;gBACzC,OAAO;oBACL,EAAE;oBACF,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;iBAC7B,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,CAAC,IAAI,IAAI,WAAW,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;YAClE,CAAC;YAED,MAAM,CAAC,EAAE,EAAE,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YACtC,OAAO;gBACL,EAAE;gBACF,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE;aAC7B,CAAC;QACJ,CAAC;QACD,KAAK,CAAC,mBAAmB,CAAC,IAAI;YAC5B,KAAK,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;YACnC,4FAA4F;YAC5F,OAAO,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC;QAED,OAAO,EAAE,OAAQ;KAClB,CACF,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,UAAkB,EAClB,IAAmB;IAEnB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC/B,OAAO,yBAAyB,CAC9B,UAAU,EACV;QACE,MAAM,EAAE,GAAG,EAAE;YACX,4FAA4F;YAC5F,OAAO,aAAa,CAAC,aAAa,QAAQ,YAAY,CAAC,CAAC;QAC1D,CAAC;KACF,EACD,IAAI,CACL,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n// This module is bundled with Metro in web/react-server mode and redirects to platform specific renderers.\nimport Constants from 'expo-constants';\nimport type { RenderRscArgs } from 'expo-server/private';\nimport path from 'node:path';\n\nimport { renderRsc } from './rsc-renderer';\n\ndeclare const $$require_external: typeof require;\n\nconst debug = require('debug')('expo:server:rsc-renderer');\n\n// Tracking the implementation in expo/cli's MetroBundlerDevServer\nconst rscRenderContext = new Map<string, any>();\n\nfunction serverRequire<T = any>(...targetOutputModulePath: string[]): T {\n // NOTE(@kitten): This `__dirname` will be located in the output file system, e.g. `dist/server/*`\n const filePath = path.join(__dirname, ...targetOutputModulePath);\n return $$require_external(filePath);\n}\n\nfunction getRscRenderContext(platform: string) {\n // NOTE(EvanBacon): We memoize this now that there's a persistent server storage cache for Server Actions.\n if (rscRenderContext.has(platform)) {\n return rscRenderContext.get(platform)!;\n }\n\n const context = {};\n\n rscRenderContext.set(platform, context);\n return context;\n}\n\nfunction getServerActionManifest(\n _distFolder: string,\n platform: string\n): Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n> {\n const filePath = `../../rsc/${platform}/action-manifest.js`;\n return serverRequire(filePath);\n}\n\nfunction getSSRManifest(\n _distFolder: string,\n platform: string\n): Record<\n // Input ID\n string,\n [\n // Metro ID\n string,\n // Chunk location.\n string,\n ]\n> {\n const filePath = `../../rsc/${platform}/ssr-manifest.js`;\n return serverRequire(filePath);\n}\n\n// The import map allows us to use external modules from different bundling contexts.\ntype ImportMap = {\n router: () => Promise<typeof import('./router/expo-definedRouter')>;\n};\n\nexport async function renderRscWithImportsAsync(\n distFolder: string,\n imports: ImportMap,\n { body, platform, searchParams, config, method, input, contentType, headers }: RenderRscArgs\n): Promise<ReadableStream<any>> {\n globalThis.__expo_platform_header = platform;\n if (method === 'POST' && !body) {\n throw new Error('Server request must be provided when method is POST (server actions)');\n }\n\n const context = getRscRenderContext(platform);\n context['__expo_requestHeaders'] = headers;\n\n const router = await imports.router();\n const entries = router.default({\n redirects: Constants.expoConfig?.extra?.router?.redirects,\n rewrites: Constants.expoConfig?.extra?.router?.rewrites,\n });\n\n const ssrManifest = getSSRManifest(distFolder, platform);\n const actionManifest = getServerActionManifest(distFolder, platform);\n return renderRsc(\n {\n body: body ?? undefined,\n context,\n config,\n input,\n contentType,\n decodedBody: searchParams.get('x-expo-params'),\n },\n {\n isExporting: true,\n\n resolveClientEntry(file: string, isServer: boolean) {\n debug('resolveClientEntry', file, { isServer });\n\n if (isServer) {\n if (!(file in actionManifest)) {\n throw new Error(\n `Could not find file in server action manifest: ${file}. ${JSON.stringify(actionManifest)}`\n );\n }\n\n const [id, chunk] = actionManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n }\n\n if (!(file in ssrManifest)) {\n throw new Error(`Could not find file in SSR manifest: ${file}`);\n }\n\n const [id, chunk] = ssrManifest[file];\n return {\n id,\n chunks: chunk ? [chunk] : [],\n };\n },\n async loadServerModuleRsc(file) {\n debug('loadServerModuleRsc', file);\n // NOTE(@kitten): [WORKAROUND] Assumes __dirname is at `dist/server/_expo/functions/_flight`\n return serverRequire('../../../', file);\n },\n\n entries: entries!,\n }\n );\n}\n\nexport async function renderRscAsync(\n distFolder: string,\n args: RenderRscArgs\n): Promise<ReadableStream<any>> {\n const platform = args.platform;\n return renderRscWithImportsAsync(\n distFolder,\n {\n router: () => {\n // NOTE(@kitten): [WORKAROUND] Assumes __dirname is at `dist/server/_expo/functions/_flight`\n return serverRequire(`../../rsc/${platform}/router.js`);\n },\n },\n args\n );\n}\n"]}
|
package/build/rsc/path.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright © 2024 650 Industries.
|
|
3
|
-
* Copyright © 2024 2023 Daishi Kato
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the MIT license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree.
|
|
7
|
-
*
|
|
8
|
-
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/utils/path.ts#L1
|
|
9
|
-
*/
|
|
10
|
-
export declare const encodeFilePathToAbsolute: (filePath: string) => string;
|
|
11
|
-
export declare const decodeFilePathFromAbsolute: (filePath: string) => string;
|
|
12
|
-
export declare const filePathToFileURL: (filePath: string) => string;
|
|
13
|
-
/** Return the original "osPath" based on the file URL */
|
|
14
|
-
export declare const fileURLToFilePath: (fileURL: string) => string;
|
|
15
|
-
export declare const joinPath: (...paths: string[]) => string;
|
|
16
|
-
export declare const extname: (filePath: string) => string;
|
|
17
|
-
export type PathSpecItem = {
|
|
18
|
-
type: 'literal';
|
|
19
|
-
name: string;
|
|
20
|
-
} | {
|
|
21
|
-
type: 'group';
|
|
22
|
-
name?: string;
|
|
23
|
-
} | {
|
|
24
|
-
type: 'wildcard';
|
|
25
|
-
name?: string;
|
|
26
|
-
};
|
|
27
|
-
export type PathSpec = readonly PathSpecItem[];
|
|
28
|
-
export declare const parsePathWithSlug: (path: string) => PathSpec;
|
|
29
|
-
export declare const getPathMapping: (pathSpec: PathSpec, pathname: string) => Record<string, string | string[]> | null;
|
|
30
|
-
/**
|
|
31
|
-
* Transform a path spec to a regular expression.
|
|
32
|
-
*/
|
|
33
|
-
export declare const path2regexp: (path: PathSpec) => string;
|
|
34
|
-
//# sourceMappingURL=path.d.ts.map
|
package/build/rsc/path.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,WAQxD,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,UAAU,MAAM,WAK1D,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,WAAoC,CAAC;AAEvF,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,WAahD,CAAC;AAGF,eAAO,MAAM,QAAQ,GAAI,GAAG,OAAO,MAAM,EAAE,WAmB1C,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,WAGvC,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,MAAM,MAAM,QAAQ,GAAG,SAAS,YAAY,EAAE,CAAC;AAE/C,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,QAiB3C,CAAC;AAEP,eAAO,MAAM,cAAc,GACzB,UAAU,QAAQ,EAClB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,IAgDtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,QAAQ,WAWzC,CAAC"}
|
package/build/rsc/path.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright © 2024 650 Industries.
|
|
4
|
-
* Copyright © 2024 2023 Daishi Kato
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*
|
|
9
|
-
* https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/utils/path.ts#L1
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.path2regexp = exports.getPathMapping = exports.parsePathWithSlug = exports.extname = exports.joinPath = exports.fileURLToFilePath = exports.filePathToFileURL = exports.decodeFilePathFromAbsolute = exports.encodeFilePathToAbsolute = void 0;
|
|
13
|
-
// Terminology:
|
|
14
|
-
// - filePath: posix-like file path, e.g. `/foo/bar.js` or `c:/foo/bar.js`
|
|
15
|
-
// This is used by Vite.
|
|
16
|
-
// - fileURL: file URL, e.g. `file:///foo/bar.js` or `file:///c:/foo/bar.js`
|
|
17
|
-
// This is used by import().
|
|
18
|
-
// - osPath: os dependent path, e.g. `/foo/bar.js` or `c:\foo\bar.js`
|
|
19
|
-
// This is used by node:fs.
|
|
20
|
-
const ABSOLUTE_WIN32_PATH_REGEXP = /^\/[a-zA-Z]:\//;
|
|
21
|
-
const encodeFilePathToAbsolute = (filePath) => {
|
|
22
|
-
if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {
|
|
23
|
-
throw new Error('Unsupported absolute file path');
|
|
24
|
-
}
|
|
25
|
-
if (filePath.startsWith('/')) {
|
|
26
|
-
return filePath;
|
|
27
|
-
}
|
|
28
|
-
return '/' + filePath;
|
|
29
|
-
};
|
|
30
|
-
exports.encodeFilePathToAbsolute = encodeFilePathToAbsolute;
|
|
31
|
-
const decodeFilePathFromAbsolute = (filePath) => {
|
|
32
|
-
if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {
|
|
33
|
-
return filePath.slice(1);
|
|
34
|
-
}
|
|
35
|
-
return filePath;
|
|
36
|
-
};
|
|
37
|
-
exports.decodeFilePathFromAbsolute = decodeFilePathFromAbsolute;
|
|
38
|
-
const filePathToFileURL = (filePath) => 'file://' + encodeURI(filePath);
|
|
39
|
-
exports.filePathToFileURL = filePathToFileURL;
|
|
40
|
-
/** Return the original "osPath" based on the file URL */
|
|
41
|
-
const fileURLToFilePath = (fileURL) => {
|
|
42
|
-
if (!fileURL.startsWith('file://')) {
|
|
43
|
-
throw new Error('Not a file URL');
|
|
44
|
-
}
|
|
45
|
-
const filePath = decodeURI(fileURL.slice('file://'.length));
|
|
46
|
-
// File URLs are always formatted in POSIX, using a leading `/` (URL pathname) separator.
|
|
47
|
-
// On POSIX systems, this leading `/` is the root directory, which is valid for absolute file paths.
|
|
48
|
-
// On UNIX systems, this leading `/` needs to be stripped, and the actual UNIX formatted path is returned - to match Metro's behavior
|
|
49
|
-
return ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)
|
|
50
|
-
? filePath.slice(1).replace(/\//g, '\\')
|
|
51
|
-
: filePath;
|
|
52
|
-
};
|
|
53
|
-
exports.fileURLToFilePath = fileURLToFilePath;
|
|
54
|
-
// for filePath
|
|
55
|
-
const joinPath = (...paths) => {
|
|
56
|
-
const isAbsolute = paths[0]?.startsWith('/');
|
|
57
|
-
const items = [].concat(...paths.map((path) => path.split('/')));
|
|
58
|
-
let i = 0;
|
|
59
|
-
while (i < items.length) {
|
|
60
|
-
if (items[i] === '.' || items[i] === '') {
|
|
61
|
-
items.splice(i, 1);
|
|
62
|
-
}
|
|
63
|
-
else if (items[i] === '..') {
|
|
64
|
-
if (i > 0) {
|
|
65
|
-
items.splice(i - 1, 2);
|
|
66
|
-
--i;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
items.splice(i, 1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
++i;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return (isAbsolute ? '/' : '') + items.join('/') || '.';
|
|
77
|
-
};
|
|
78
|
-
exports.joinPath = joinPath;
|
|
79
|
-
const extname = (filePath) => {
|
|
80
|
-
const index = filePath.lastIndexOf('.');
|
|
81
|
-
return index > 0 ? filePath.slice(index) : '';
|
|
82
|
-
};
|
|
83
|
-
exports.extname = extname;
|
|
84
|
-
const parsePathWithSlug = (path) => path
|
|
85
|
-
.split('/')
|
|
86
|
-
.filter(Boolean)
|
|
87
|
-
.map((name) => {
|
|
88
|
-
let type = 'literal';
|
|
89
|
-
const isSlug = name.startsWith('[') && name.endsWith(']');
|
|
90
|
-
if (isSlug) {
|
|
91
|
-
type = 'group';
|
|
92
|
-
name = name.slice(1, -1);
|
|
93
|
-
}
|
|
94
|
-
const isWildcard = name.startsWith('...');
|
|
95
|
-
if (isWildcard) {
|
|
96
|
-
type = 'wildcard';
|
|
97
|
-
name = name.slice(3);
|
|
98
|
-
}
|
|
99
|
-
return { type, name };
|
|
100
|
-
});
|
|
101
|
-
exports.parsePathWithSlug = parsePathWithSlug;
|
|
102
|
-
const getPathMapping = (pathSpec, pathname) => {
|
|
103
|
-
const actual = pathname.split('/').filter(Boolean);
|
|
104
|
-
if (pathSpec.length > actual.length) {
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
const mapping = {};
|
|
108
|
-
let wildcardStartIndex = -1;
|
|
109
|
-
for (let i = 0; i < pathSpec.length; i++) {
|
|
110
|
-
const { type, name } = pathSpec[i];
|
|
111
|
-
if (type === 'literal') {
|
|
112
|
-
if (name !== actual[i]) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
else if (type === 'wildcard') {
|
|
117
|
-
wildcardStartIndex = i;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
else if (name) {
|
|
121
|
-
mapping[name] = actual[i];
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (wildcardStartIndex === -1) {
|
|
125
|
-
if (pathSpec.length !== actual.length) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
return mapping;
|
|
129
|
-
}
|
|
130
|
-
let wildcardEndIndex = -1;
|
|
131
|
-
for (let i = 0; i < pathSpec.length; i++) {
|
|
132
|
-
const { type, name } = pathSpec[pathSpec.length - i - 1];
|
|
133
|
-
if (type === 'literal') {
|
|
134
|
-
if (name !== actual[actual.length - i - 1]) {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (type === 'wildcard') {
|
|
139
|
-
wildcardEndIndex = actual.length - i - 1;
|
|
140
|
-
break;
|
|
141
|
-
}
|
|
142
|
-
else if (name) {
|
|
143
|
-
mapping[name] = actual[actual.length - i - 1];
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
if (wildcardStartIndex === -1 || wildcardEndIndex === -1) {
|
|
147
|
-
throw new Error('Invalid wildcard path');
|
|
148
|
-
}
|
|
149
|
-
const wildcardName = pathSpec[wildcardStartIndex].name;
|
|
150
|
-
if (wildcardName) {
|
|
151
|
-
mapping[wildcardName] = actual.slice(wildcardStartIndex, wildcardEndIndex + 1);
|
|
152
|
-
}
|
|
153
|
-
return mapping;
|
|
154
|
-
};
|
|
155
|
-
exports.getPathMapping = getPathMapping;
|
|
156
|
-
/**
|
|
157
|
-
* Transform a path spec to a regular expression.
|
|
158
|
-
*/
|
|
159
|
-
const path2regexp = (path) => {
|
|
160
|
-
const parts = path.map(({ type, name }) => {
|
|
161
|
-
if (type === 'literal') {
|
|
162
|
-
return name;
|
|
163
|
-
}
|
|
164
|
-
else if (type === 'group') {
|
|
165
|
-
return `([^/]+)`;
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
return `(.*)`;
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
return `^/${parts.join('/')}$`;
|
|
172
|
-
};
|
|
173
|
-
exports.path2regexp = path2regexp;
|
|
174
|
-
//# sourceMappingURL=path.js.map
|
package/build/rsc/path.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../src/rsc/path.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,eAAe;AACf,0EAA0E;AAC1E,0BAA0B;AAC1B,4EAA4E;AAC5E,8BAA8B;AAC9B,qEAAqE;AACrE,6BAA6B;AAE7B,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAE7C,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC3D,IAAI,0BAA0B,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC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C,GAAG,CAAC,CAAC;YACzC,MAAM;QACR,CAAC;aAAM,IAAI,IAAI,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC;QACjD,CAAC;IACH,CAAC;IACD,IAAI,kBAAkB,KAAK,CAAC,CAAC,IAAI,gBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,YAAY,GAAG,QAAQ,CAAC,kBAAkB,CAAE,CAAC,IAAI,CAAC;IACxD,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,CAAC,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAnDW,QAAA,cAAc,kBAmDzB;AAEF;;GAEG;AACI,MAAM,WAAW,GAAG,CAAC,IAAc,EAAE,EAAE;IAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QACxC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,OAAO,SAAS,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACjC,CAAC,CAAC;AAXW,QAAA,WAAW,eAWtB","sourcesContent":["/**\n * Copyright © 2024 650 Industries.\n * Copyright © 2024 2023 Daishi Kato\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * https://github.com/dai-shi/waku/blob/32d52242c1450b5f5965860e671ff73c42da8bd0/packages/waku/src/lib/utils/path.ts#L1\n */\n\n// Terminology:\n// - filePath: posix-like file path, e.g. `/foo/bar.js` or `c:/foo/bar.js`\n// This is used by Vite.\n// - fileURL: file URL, e.g. `file:///foo/bar.js` or `file:///c:/foo/bar.js`\n// This is used by import().\n// - osPath: os dependent path, e.g. `/foo/bar.js` or `c:\\foo\\bar.js`\n// This is used by node:fs.\n\nconst ABSOLUTE_WIN32_PATH_REGEXP = /^\\/[a-zA-Z]:\\//;\n\nexport const encodeFilePathToAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n throw new Error('Unsupported absolute file path');\n }\n if (filePath.startsWith('/')) {\n return filePath;\n }\n return '/' + filePath;\n};\n\nexport const decodeFilePathFromAbsolute = (filePath: string) => {\n if (ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)) {\n return filePath.slice(1);\n }\n return filePath;\n};\n\nexport const filePathToFileURL = (filePath: string) => 'file://' + encodeURI(filePath);\n\n/** Return the original \"osPath\" based on the file URL */\nexport const fileURLToFilePath = (fileURL: string) => {\n if (!fileURL.startsWith('file://')) {\n throw new Error('Not a file URL');\n }\n\n const filePath = decodeURI(fileURL.slice('file://'.length));\n\n // File URLs are always formatted in POSIX, using a leading `/` (URL pathname) separator.\n // On POSIX systems, this leading `/` is the root directory, which is valid for absolute file paths.\n // On UNIX systems, this leading `/` needs to be stripped, and the actual UNIX formatted path is returned - to match Metro's behavior\n return ABSOLUTE_WIN32_PATH_REGEXP.test(filePath)\n ? filePath.slice(1).replace(/\\//g, '\\\\')\n : filePath;\n};\n\n// for filePath\nexport const joinPath = (...paths: string[]) => {\n const isAbsolute = paths[0]?.startsWith('/');\n const items = ([] as string[]).concat(...paths.map((path) => path.split('/')));\n let i = 0;\n while (i < items.length) {\n if (items[i] === '.' || items[i] === '') {\n items.splice(i, 1);\n } else if (items[i] === '..') {\n if (i > 0) {\n items.splice(i - 1, 2);\n --i;\n } else {\n items.splice(i, 1);\n }\n } else {\n ++i;\n }\n }\n return (isAbsolute ? '/' : '') + items.join('/') || '.';\n};\n\nexport const extname = (filePath: string) => {\n const index = filePath.lastIndexOf('.');\n return index > 0 ? filePath.slice(index) : '';\n};\n\nexport type PathSpecItem =\n | { type: 'literal'; name: string }\n | { type: 'group'; name?: string }\n | { type: 'wildcard'; name?: string };\nexport type PathSpec = readonly PathSpecItem[];\n\nexport const parsePathWithSlug = (path: string): PathSpec =>\n path\n .split('/')\n .filter(Boolean)\n .map((name) => {\n let type: 'literal' | 'group' | 'wildcard' = 'literal';\n const isSlug = name.startsWith('[') && name.endsWith(']');\n if (isSlug) {\n type = 'group';\n name = name.slice(1, -1);\n }\n const isWildcard = name.startsWith('...');\n if (isWildcard) {\n type = 'wildcard';\n name = name.slice(3);\n }\n return { type, name };\n });\n\nexport const getPathMapping = (\n pathSpec: PathSpec,\n pathname: string\n): Record<string, string | string[]> | null => {\n const actual = pathname.split('/').filter(Boolean);\n if (pathSpec.length > actual.length) {\n return null;\n }\n const mapping: Record<string, string | string[]> = {};\n let wildcardStartIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[i]!;\n if (type === 'literal') {\n if (name !== actual[i]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardStartIndex = i;\n break;\n } else if (name) {\n mapping[name] = actual[i]!;\n }\n }\n if (wildcardStartIndex === -1) {\n if (pathSpec.length !== actual.length) {\n return null;\n }\n return mapping;\n }\n let wildcardEndIndex = -1;\n for (let i = 0; i < pathSpec.length; i++) {\n const { type, name } = pathSpec[pathSpec.length - i - 1]!;\n if (type === 'literal') {\n if (name !== actual[actual.length - i - 1]) {\n return null;\n }\n } else if (type === 'wildcard') {\n wildcardEndIndex = actual.length - i - 1;\n break;\n } else if (name) {\n mapping[name] = actual[actual.length - i - 1]!;\n }\n }\n if (wildcardStartIndex === -1 || wildcardEndIndex === -1) {\n throw new Error('Invalid wildcard path');\n }\n const wildcardName = pathSpec[wildcardStartIndex]!.name;\n if (wildcardName) {\n mapping[wildcardName] = actual.slice(wildcardStartIndex, wildcardEndIndex + 1);\n }\n return mapping;\n};\n\n/**\n * Transform a path spec to a regular expression.\n */\nexport const path2regexp = (path: PathSpec) => {\n const parts = path.map(({ type, name }) => {\n if (type === 'literal') {\n return name;\n } else if (type === 'group') {\n return `([^/]+)`;\n } else {\n return `(.*)`;\n }\n });\n return `^/${parts.join('/')}$`;\n};\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { createPages } from './create-pages';
|
|
2
|
-
import { Options as GetRoutesOptions } from '../../getRoutes';
|
|
3
|
-
import { EntriesDev } from '../server';
|
|
4
|
-
type CreatePagesFn = Parameters<typeof createPages>[0];
|
|
5
|
-
type CreatePagesFns = Parameters<CreatePagesFn>[0];
|
|
6
|
-
type CreatePagesOptions = Parameters<CreatePagesFn>[1] & {
|
|
7
|
-
getRouteOptions?: GetRoutesOptions;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Wrapper around `createPages` to pass data from the server to the fn
|
|
11
|
-
*
|
|
12
|
-
* This is separated from the `createPages` function allowing us to keep the createPages
|
|
13
|
-
* in sync with the original Waku implementation.
|
|
14
|
-
*
|
|
15
|
-
* @param fn
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
export declare function createExpoPages(fn: (fn: CreatePagesFns, options: CreatePagesOptions) => ReturnType<CreatePagesFn>): (getRouteOptions?: GetRoutesOptions) => EntriesDev;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=create-expo-pages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-expo-pages.d.ts","sourceRoot":"","sources":["../../../src/rsc/router/create-expo-pages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,KAAK,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,KAAK,kBAAkB,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG;IACvD,eAAe,CAAC,EAAE,gBAAgB,CAAC;CACpC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,CAAC,EAAE,EAAE,cAAc,EAAE,OAAO,EAAE,kBAAkB,KAAK,UAAU,CAAC,aAAa,CAAC,IAE1E,kBAAkB,gBAAgB,KAAG,UAAU,CAKxD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createExpoPages = createExpoPages;
|
|
4
|
-
const create_pages_1 = require("./create-pages");
|
|
5
|
-
/**
|
|
6
|
-
* Wrapper around `createPages` to pass data from the server to the fn
|
|
7
|
-
*
|
|
8
|
-
* This is separated from the `createPages` function allowing us to keep the createPages
|
|
9
|
-
* in sync with the original Waku implementation.
|
|
10
|
-
*
|
|
11
|
-
* @param fn
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
function createExpoPages(fn) {
|
|
15
|
-
return (getRouteOptions) => {
|
|
16
|
-
return {
|
|
17
|
-
default: (0, create_pages_1.createPages)((a, b) => fn(a, { ...b, getRouteOptions })),
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=create-expo-pages.js.map
|