one 1.1.484 → 1.1.486
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/dist/cjs/createHandleRequest.cjs +2 -1
- package/dist/cjs/createHandleRequest.js +2 -1
- package/dist/cjs/createHandleRequest.js.map +1 -1
- package/dist/cjs/createHandleRequest.native.js +4 -2
- package/dist/cjs/createHandleRequest.native.js.map +1 -1
- package/dist/cjs/hooks.cjs +8 -5
- package/dist/cjs/hooks.js +7 -6
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/hooks.native.js +7 -6
- package/dist/cjs/hooks.native.js.map +2 -2
- package/dist/cjs/router/Route.cjs +4 -1
- package/dist/cjs/router/Route.js +2 -2
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js +4 -2
- package/dist/cjs/router/Route.native.js.map +2 -2
- package/dist/cjs/router/RouteInfoContext.cjs +61 -0
- package/dist/cjs/router/RouteInfoContext.js +51 -0
- package/dist/cjs/router/RouteInfoContext.js.map +6 -0
- package/dist/cjs/router/RouteInfoContext.native.js +50 -0
- package/dist/cjs/router/RouteInfoContext.native.js.map +6 -0
- package/dist/cjs/server/oneServe.cjs +8 -13
- package/dist/cjs/server/oneServe.js +11 -14
- package/dist/cjs/server/oneServe.js.map +1 -1
- package/dist/cjs/server/oneServe.native.js +20 -23
- package/dist/cjs/server/oneServe.native.js.map +2 -2
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +3 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +2 -2
- package/dist/esm/createHandleRequest.js +2 -1
- package/dist/esm/createHandleRequest.js.map +1 -1
- package/dist/esm/createHandleRequest.mjs +1 -1
- package/dist/esm/createHandleRequest.mjs.map +1 -1
- package/dist/esm/createHandleRequest.native.js +1 -1
- package/dist/esm/createHandleRequest.native.js.map +1 -1
- package/dist/esm/hooks.js +9 -7
- package/dist/esm/hooks.js.map +1 -1
- package/dist/esm/hooks.mjs +10 -7
- package/dist/esm/hooks.mjs.map +1 -1
- package/dist/esm/hooks.native.js +11 -7
- package/dist/esm/hooks.native.js.map +1 -1
- package/dist/esm/router/Route.js +2 -1
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs +4 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js +4 -1
- package/dist/esm/router/Route.native.js.map +1 -1
- package/dist/esm/router/RouteInfoContext.js +38 -0
- package/dist/esm/router/RouteInfoContext.js.map +6 -0
- package/dist/esm/router/RouteInfoContext.mjs +37 -0
- package/dist/esm/router/RouteInfoContext.mjs.map +1 -0
- package/dist/esm/router/RouteInfoContext.native.js +39 -0
- package/dist/esm/router/RouteInfoContext.native.js.map +1 -0
- package/dist/esm/server/oneServe.js +17 -15
- package/dist/esm/server/oneServe.js.map +1 -1
- package/dist/esm/server/oneServe.mjs +9 -14
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js +21 -24
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +2 -2
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +2 -2
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +4 -2
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/package.json +15 -15
- package/src/createHandleRequest.ts +1 -1
- package/src/hooks.tsx +29 -8
- package/src/router/Route.tsx +7 -2
- package/src/router/RouteInfoContext.tsx +94 -0
- package/src/server/oneServe.ts +23 -18
- package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +9 -2
- package/types/createHandleRequest.d.ts +1 -0
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/hooks.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +14 -4
- package/types/layouts/Drawer.d.ts.map +1 -1
- package/types/layouts/Stack.d.ts +14 -4
- package/types/layouts/Stack.d.ts.map +1 -1
- package/types/layouts/Tabs.d.ts +14 -4
- package/types/layouts/Tabs.d.ts.map +1 -1
- package/types/router/Route.d.ts.map +1 -1
- package/types/router/RouteInfoContext.d.ts +27 -0
- package/types/router/RouteInfoContext.d.ts.map +1 -0
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/views/Navigator.d.ts +2 -2
- package/types/views/Navigator.d.ts.map +1 -1
- package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "one",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.486",
|
4
4
|
"license": "BSD-3-Clause",
|
5
5
|
"sideEffects": [
|
6
6
|
"setup.mjs",
|
@@ -87,24 +87,24 @@
|
|
87
87
|
"@babel/types": "^7.26.10",
|
88
88
|
"@radix-ui/react-slot": "^1.0.2",
|
89
89
|
"@react-native-masked-view/masked-view": "^0.3.1",
|
90
|
-
"@react-navigation/bottom-tabs": "~7",
|
91
|
-
"@react-navigation/core": "~7",
|
92
|
-
"@react-navigation/drawer": "~7",
|
93
|
-
"@react-navigation/elements": "~2",
|
94
|
-
"@react-navigation/native": "~7",
|
95
|
-
"@react-navigation/native-stack": "~7",
|
96
|
-
"@react-navigation/routers": "~7",
|
90
|
+
"@react-navigation/bottom-tabs": "~7.3.4",
|
91
|
+
"@react-navigation/core": "~7.8.0",
|
92
|
+
"@react-navigation/drawer": "~7.3.3",
|
93
|
+
"@react-navigation/elements": "~2.3.2",
|
94
|
+
"@react-navigation/native": "~7.1.0",
|
95
|
+
"@react-navigation/native-stack": "~7.3.4",
|
96
|
+
"@react-navigation/routers": "~7.3.2",
|
97
97
|
"@swc/core": "^1.10.4",
|
98
98
|
"@ungap/structured-clone": "^1.2.0",
|
99
|
-
"@vxrn/compiler": "1.1.
|
100
|
-
"@vxrn/resolve": "1.1.
|
101
|
-
"@vxrn/tslib-lite": "1.1.
|
102
|
-
"@vxrn/universal-color-scheme": "1.1.
|
103
|
-
"@vxrn/use-isomorphic-layout-effect": "1.1.
|
99
|
+
"@vxrn/compiler": "1.1.486",
|
100
|
+
"@vxrn/resolve": "1.1.486",
|
101
|
+
"@vxrn/tslib-lite": "1.1.486",
|
102
|
+
"@vxrn/universal-color-scheme": "1.1.486",
|
103
|
+
"@vxrn/use-isomorphic-layout-effect": "1.1.486",
|
104
104
|
"babel-dead-code-elimination": "^1.0.9",
|
105
105
|
"citty": "^0.1.6",
|
106
106
|
"core-js": "^3.38.1",
|
107
|
-
"create-vxrn": "1.1.
|
107
|
+
"create-vxrn": "1.1.486",
|
108
108
|
"escape-string-regexp": "^5.0.0",
|
109
109
|
"expo-linking": "~6.3.1",
|
110
110
|
"expo-modules-core": "2.1.2",
|
@@ -130,7 +130,7 @@
|
|
130
130
|
"vite": "^6.1.0",
|
131
131
|
"vite-plugin-barrel": "^0.4.1",
|
132
132
|
"vite-tsconfig-paths": "^5.0.1",
|
133
|
-
"vxrn": "1.1.
|
133
|
+
"vxrn": "1.1.486",
|
134
134
|
"ws": "^8.18.0",
|
135
135
|
"xxhashjs": "^0.2.2"
|
136
136
|
},
|
@@ -25,7 +25,7 @@ type RequestHandlerProps<RouteExtraProps extends Object = {}> = {
|
|
25
25
|
|
26
26
|
type RequestHandlerResponse = null | string | Response
|
27
27
|
|
28
|
-
async function runMiddlewares(
|
28
|
+
export async function runMiddlewares(
|
29
29
|
handlers: RequestHandlers,
|
30
30
|
request: Request,
|
31
31
|
route: RouteInfo,
|
package/src/hooks.tsx
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
-
import React, { createContext, type ReactNode } from 'react'
|
1
|
+
import React, { createContext, useContext, type ReactNode } from 'react'
|
2
2
|
import type { OneRouter } from './interfaces/router'
|
3
3
|
import { router } from './router/imperative-api'
|
4
|
-
import { RouteParamsContext } from './router/Route'
|
4
|
+
import { RouteParamsContext, useRouteNode } from './router/Route'
|
5
5
|
import { navigationRef, useStoreRootState, useStoreRouteInfo } from './router/router'
|
6
|
+
import { RouteInfoContext } from './router/RouteInfoContext'
|
6
7
|
|
7
8
|
type SearchParams = OneRouter.SearchParams
|
8
9
|
|
@@ -11,7 +12,25 @@ export function useRootNavigationState() {
|
|
11
12
|
}
|
12
13
|
|
13
14
|
export function useRouteInfo() {
|
14
|
-
|
15
|
+
// This uses the `useStateForPath` hook under the hood, which will be always correct
|
16
|
+
// when used in a page, but will not be correct when used in a layout.
|
17
|
+
// See the comment in `RouteInfoContext` for more details.
|
18
|
+
const routeInfoFromContext = useContext(RouteInfoContext)
|
19
|
+
|
20
|
+
// This uses `navigationRef.getRootState()` under the hood, which has the
|
21
|
+
// issue of returning an incomplete state during the first render of nested navigators.
|
22
|
+
// See: https://github.com/react-navigation/react-navigation/pull/12521#issue-2958644406
|
23
|
+
const routeInfoFromRootState = useStoreRouteInfo()
|
24
|
+
|
25
|
+
const routeNode = useRouteNode()
|
26
|
+
|
27
|
+
if (routeNode?.type === 'layout') {
|
28
|
+
// We are in a layout, do not consider using `RouteInfoContextProvider`.
|
29
|
+
return routeInfoFromRootState
|
30
|
+
}
|
31
|
+
|
32
|
+
// We are in a page, prioritize `routeInfoFromContext` over `routeInfoFromRootState` because it is more accurate.
|
33
|
+
return routeInfoFromContext || routeInfoFromRootState
|
15
34
|
}
|
16
35
|
|
17
36
|
/** @return the root `<NavigationContainer />` ref for the app. The `ref.current` may be `null` if the `<NavigationContainer />` hasn't mounted yet. */
|
@@ -57,7 +76,7 @@ export function useRouter(): OneRouter.Router {
|
|
57
76
|
* @returns the current global pathname with query params attached. This may change in the future to include the hostname from a predefined universal link, i.e. `/foobar?hey=world` becomes `https://acme.dev/foobar?hey=world`
|
58
77
|
*/
|
59
78
|
export function useUnstableGlobalHref(): string {
|
60
|
-
return
|
79
|
+
return useRouteInfo().unstable_globalHref
|
61
80
|
}
|
62
81
|
|
63
82
|
/**
|
@@ -80,12 +99,12 @@ export function useUnstableGlobalHref(): string {
|
|
80
99
|
* ```
|
81
100
|
*/
|
82
101
|
export function useSegments<TSegments extends string[] = string[]>(): TSegments {
|
83
|
-
return
|
102
|
+
return useRouteInfo().segments as TSegments
|
84
103
|
}
|
85
104
|
|
86
105
|
/** @returns global selected pathname without query parameters. */
|
87
106
|
export function usePathname(): string {
|
88
|
-
return
|
107
|
+
return useRouteInfo().pathname
|
89
108
|
}
|
90
109
|
|
91
110
|
/**
|
@@ -97,8 +116,10 @@ export function usePathname(): string {
|
|
97
116
|
*
|
98
117
|
* @see `useParams`
|
99
118
|
*/
|
100
|
-
export function useActiveParams<
|
101
|
-
|
119
|
+
export function useActiveParams<
|
120
|
+
TParams extends Object = SearchParams
|
121
|
+
>(): Partial<TParams> {
|
122
|
+
return useRouteInfo().params as Partial<TParams>
|
102
123
|
}
|
103
124
|
|
104
125
|
/** @deprecated @see `useParams` */
|
package/src/router/Route.tsx
CHANGED
@@ -2,6 +2,7 @@ import React, { createContext, useContext, type ReactNode } from 'react'
|
|
2
2
|
import type { ErrorBoundaryProps } from '../views/Try'
|
3
3
|
import type { One } from '../vite/types'
|
4
4
|
import { getContextKey } from './matchers'
|
5
|
+
import { RouteInfoContextProvider } from './RouteInfoContext'
|
5
6
|
|
6
7
|
export type DynamicConvention = { name: string; deep: boolean; notFound?: boolean }
|
7
8
|
|
@@ -45,7 +46,9 @@ export type RouteNode = {
|
|
45
46
|
middlewares?: RouteNode[]
|
46
47
|
}
|
47
48
|
|
48
|
-
export const RouteParamsContext = createContext<
|
49
|
+
export const RouteParamsContext = createContext<
|
50
|
+
Record<string, string | undefined> | undefined
|
51
|
+
>({})
|
49
52
|
|
50
53
|
const CurrentRouteContext = React.createContext<RouteNode | null>(null)
|
51
54
|
|
@@ -78,7 +81,9 @@ export function Route({
|
|
78
81
|
}) {
|
79
82
|
return (
|
80
83
|
<RouteParamsContext.Provider value={route?.params}>
|
81
|
-
<CurrentRouteContext.Provider value={node}>
|
84
|
+
<CurrentRouteContext.Provider value={node}>
|
85
|
+
<RouteInfoContextProvider>{children}</RouteInfoContextProvider>
|
86
|
+
</CurrentRouteContext.Provider>
|
82
87
|
</RouteParamsContext.Provider>
|
83
88
|
)
|
84
89
|
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import type React from 'react'
|
2
|
+
import { createContext, useRef } from 'react'
|
3
|
+
import type { UrlObject } from './getNormalizedStatePath'
|
4
|
+
import { useStateForPath } from '@react-navigation/core'
|
5
|
+
import { getRouteInfo } from './router'
|
6
|
+
|
7
|
+
export const RouteInfoContext = createContext<UrlObject | undefined>(undefined)
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Provides the route info (a `UrlObject`) through a context for child page.
|
11
|
+
* Such context can be used to implement hooks such as `usePathname`.
|
12
|
+
*
|
13
|
+
* **IMPORTANT**: The current implementation uses `useStateForPath` - which will not return the a complete state if it isn't being called from a component under a leaf route node.
|
14
|
+
* In other words, the provided route info may not be correct when used in a `_layout`. For example, if the user is on a page `/blog/123`:
|
15
|
+
*
|
16
|
+
* ```
|
17
|
+
* app
|
18
|
+
* ├── _layout.tsx
|
19
|
+
* ├── index.tsx
|
20
|
+
* └── blog
|
21
|
+
* ├── _layout.tsx - in BlogLayout, pathname will be "/blog"
|
22
|
+
* └── [id].tsx - in BlogPage, pathname will be "/blog/123"
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* The returned value is lazily calculated and cached, so we won't waste CPU cycles to calculate it if no one is asking for it.
|
26
|
+
*
|
27
|
+
* This is implemented with the `useStateForPath` hook provided by React Navigation, which is known to be safe for not returning a stale or incomplete state when used in pages. See: https://github.com/react-navigation/react-navigation/pull/12521
|
28
|
+
*/
|
29
|
+
export function RouteInfoContextProvider({ children }: { children: React.ReactNode }) {
|
30
|
+
const currentState = useStateForPath()
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Ref to hold the current state. Do not update it immediately, because we also
|
34
|
+
* rely on this ref to make `lazilyCalculatedRouteInfo` a new object when the
|
35
|
+
* state changes.
|
36
|
+
*/
|
37
|
+
const currentStateRef = useRef<typeof currentState>(undefined)
|
38
|
+
|
39
|
+
/**
|
40
|
+
* This is used by the lazilyCalculatedRouteInfo to determine if it should
|
41
|
+
* update the cached route info. After doing so, lazilyCalculatedRouteInfo
|
42
|
+
* should update it to the current state.
|
43
|
+
*/
|
44
|
+
const lastStateRef = useRef<typeof currentState>(undefined)
|
45
|
+
const cachedRouteInfoValueRef = useRef<UrlObject | undefined>(undefined)
|
46
|
+
|
47
|
+
const lazilyCalculatedRouteInfo = useRef<UrlObject | undefined>()
|
48
|
+
|
49
|
+
if (currentState && currentStateRef.current !== currentState) {
|
50
|
+
lazilyCalculatedRouteInfo.current = makeLazilyCalculatedRouteInfo({
|
51
|
+
currentStateRef,
|
52
|
+
lastStateRef,
|
53
|
+
cachedRouteInfoValueRef,
|
54
|
+
})
|
55
|
+
}
|
56
|
+
currentStateRef.current = currentState
|
57
|
+
|
58
|
+
return (
|
59
|
+
<RouteInfoContext.Provider
|
60
|
+
value={currentState ? lazilyCalculatedRouteInfo.current : undefined}
|
61
|
+
>
|
62
|
+
{children}
|
63
|
+
</RouteInfoContext.Provider>
|
64
|
+
)
|
65
|
+
}
|
66
|
+
|
67
|
+
function makeLazilyCalculatedRouteInfo({
|
68
|
+
currentStateRef,
|
69
|
+
lastStateRef,
|
70
|
+
cachedRouteInfoValueRef,
|
71
|
+
}: {
|
72
|
+
currentStateRef: React.MutableRefObject<ReturnType<typeof useStateForPath> | undefined>
|
73
|
+
lastStateRef: React.MutableRefObject<ReturnType<typeof useStateForPath> | undefined>
|
74
|
+
cachedRouteInfoValueRef: React.MutableRefObject<UrlObject | undefined>
|
75
|
+
}) {
|
76
|
+
return new Proxy({} as any, {
|
77
|
+
get(_, p: keyof UrlObject) {
|
78
|
+
const state = currentStateRef.current
|
79
|
+
if (!state) {
|
80
|
+
// This should not happen because in the `RouteInfoContext.Provider` we
|
81
|
+
// should only provide lazilyCalculatedRouteInfo if state is not undefined.
|
82
|
+
throw new Error('[lazilyCalculatedRouteInfo] cannot get state')
|
83
|
+
}
|
84
|
+
|
85
|
+
// Update the cached route info if it's outdated
|
86
|
+
if (!cachedRouteInfoValueRef.current || lastStateRef.current !== state) {
|
87
|
+
cachedRouteInfoValueRef.current = getRouteInfo(state)
|
88
|
+
lastStateRef.current = state
|
89
|
+
}
|
90
|
+
|
91
|
+
return cachedRouteInfoValueRef.current![p]
|
92
|
+
},
|
93
|
+
})
|
94
|
+
}
|
package/src/server/oneServe.ts
CHANGED
@@ -4,12 +4,18 @@ import type { BlankEnv } from 'hono/types'
|
|
4
4
|
import { extname, join } from 'node:path'
|
5
5
|
import { getServerEntry, serveStatic } from 'vxrn/serve'
|
6
6
|
import { LOADER_JS_POSTFIX_UNCACHED, PRELOAD_JS_POSTFIX } from '../constants'
|
7
|
-
import {
|
7
|
+
import {
|
8
|
+
compileManifest,
|
9
|
+
getURLfromRequestURL,
|
10
|
+
runMiddlewares,
|
11
|
+
type RequestHandlers,
|
12
|
+
} from '../createHandleRequest'
|
8
13
|
import type { RenderAppProps } from '../types'
|
9
14
|
import { getPathFromLoaderPath } from '../utils/cleanUrl'
|
10
15
|
import { toAbsolute } from '../utils/toAbsolute'
|
11
16
|
import type { One } from '../vite/types'
|
12
17
|
import type { RouteInfoCompiled } from './createRoutesManifest'
|
18
|
+
import { serveStaticAssets } from 'vxrn'
|
13
19
|
|
14
20
|
export async function oneServe(oneOptions: One.PluginOptions, buildInfo: One.BuildInfo, app: Hono) {
|
15
21
|
const { resolveAPIRoute, resolveLoaderRoute, resolvePageRoute } = await import(
|
@@ -135,26 +141,25 @@ url: ${url}`)
|
|
135
141
|
|
136
142
|
function createHonoHandler(route: RouteInfoCompiled): MiddlewareHandler<BlankEnv, never, {}> {
|
137
143
|
return async (context, next) => {
|
138
|
-
if (route.page.endsWith('/+not-found')) {
|
139
|
-
let didCallNext = false
|
140
|
-
|
141
|
-
const response = await serveStatic({
|
142
|
-
root: './dist/client',
|
143
|
-
onFound: (_path, c) => {
|
144
|
-
c.header('Cache-Control', `public, immutable, max-age=31536000`)
|
145
|
-
},
|
146
|
-
})(context, async () => {
|
147
|
-
didCallNext = true
|
148
|
-
})
|
149
|
-
|
150
|
-
if (response && !didCallNext) {
|
151
|
-
return response
|
152
|
-
}
|
153
|
-
}
|
154
|
-
|
155
144
|
try {
|
156
145
|
const request = context.req.raw
|
157
146
|
|
147
|
+
if (route.page.endsWith('/+not-found') || Reflect.ownKeys(route.routeKeys).length > 0) {
|
148
|
+
// Static assets should have the highest priority - which is the behavior of the dev server.
|
149
|
+
// But if we handle every matching static asset here, it seems to break some of the static routes.
|
150
|
+
// So we only handle it if there's a matching not-found or dynamic route, to prevent One from taking over the static asset.
|
151
|
+
// If there's no matching not-found or dynamic route, it's very likely that One won't handle it and will fallback to VxRN serving the static asset so it will also work.
|
152
|
+
const staticAssetResponse = await serveStaticAssets({ context })
|
153
|
+
if (staticAssetResponse) {
|
154
|
+
return await runMiddlewares(
|
155
|
+
requestHandlers,
|
156
|
+
request,
|
157
|
+
route,
|
158
|
+
async () => staticAssetResponse
|
159
|
+
)
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
158
163
|
// for js we want to serve our js files directly, as they can match a route on accident
|
159
164
|
// middleware my want to handle this eventually as well but for now this is a fine balance
|
160
165
|
if (extname(request.url) === '.js' || extname(request.url) === '.css') {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { join } from 'node:path'
|
1
|
+
import { dirname, join } from 'node:path'
|
2
2
|
import { debounce } from 'perfect-debounce'
|
3
3
|
import type { Plugin } from 'vite'
|
4
4
|
import type { One } from '../types'
|
@@ -13,7 +13,14 @@ export function generateFileSystemRouteTypesPlugin(options: One.PluginOptions):
|
|
13
13
|
|
14
14
|
configureServer(server) {
|
15
15
|
const appDir = join(process.cwd(), getRouterRootFromOneOptions(options))
|
16
|
-
const outFile =
|
16
|
+
const outFile = (() => {
|
17
|
+
if (dirname(appDir) !== process.cwd()) {
|
18
|
+
console.warn('Seems that the router root has been customized and is in a nested folder. For now we will generate the routes.d.ts file beside the app folder. This behavior might be changed in the future.')
|
19
|
+
return join(dirname(appDir), 'routes.d.ts')
|
20
|
+
}
|
21
|
+
|
22
|
+
return join(process.cwd(), 'routes.d.ts')
|
23
|
+
})()
|
17
24
|
|
18
25
|
const routerRoot = getRouterRootFromOneOptions(options)
|
19
26
|
|
@@ -15,6 +15,7 @@ type RequestHandlerProps<RouteExtraProps extends Object = {}> = {
|
|
15
15
|
loaderProps?: LoaderProps;
|
16
16
|
};
|
17
17
|
type RequestHandlerResponse = null | string | Response;
|
18
|
+
export declare function runMiddlewares(handlers: RequestHandlers, request: Request, route: RouteInfo, getResponse: () => Promise<Response>): Promise<Response>;
|
18
19
|
export declare function resolveAPIRoute(handlers: RequestHandlers, request: Request, url: URL, route: RouteInfoCompiled): Promise<Response>;
|
19
20
|
export declare function resolveLoaderRoute(handlers: RequestHandlers, request: Request, url: URL, route: RouteInfoCompiled): Promise<Response>;
|
20
21
|
export declare function resolvePageRoute(handlers: RequestHandlers, request: Request, url: URL, route: RouteInfoCompiled): Promise<Response>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAK1C,OAAO,KAAK,EAAE,SAAS,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,EAAE,iBAAiB,EAAE,CAAA;IAC/B,SAAS,EAAE,iBAAiB,EAAE,CAAA;CAC/B,CAKA;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE;;uBASlD,OAAO,KAAG,OAAO,CAAC,sBAAsB,CAAC;EAqE3F"}
|
package/types/hooks.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAMpD,KAAK,YAAY,GAAG,SAAS,CAAC,YAAY,CAAA;AAE1C,wBAAgB,sBAAsB,0BAErC;AAED,wBAAgB,YAAY,wDAoB3B;AAED,uJAAuJ;AACvJ,wBAAgB,yBAAyB,4BAExC;AAID,wBAAgB,MAAM,CAAC,EAAE,EAAU,EAAE,QAAQ,EAAE,EAAE;IAAE,EAAE,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,sHAyBrF;AAED,wBAAgB,SAAS,IAAI,SAAS,CAAC,MAAM,CAE5C;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,SAAS,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,KAAK,SAAS,CAE9E;AAED,kEAAkE;AAClE,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,GAAG,YAAY,KAClC,OAAO,CAAC,OAAO,CAAC,CAEpB;AAED,mCAAmC;AACnC,eAAO,MAAM,oBAAoB,kBAAY,CAAA;AAE7C,yCAAyC;AACzC,eAAO,MAAM,qBAAqB,wBAAkB,CAAA;AAEpD;;;;;GAKG;AAEH,wBAAgB,SAAS,CAAC,OAAO,SAAS,MAAM,GAAG,YAAY,KAAK,OAAO,CAAC,OAAO,CAAC,CAwBnF"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type DrawerNavigationOptions, type DrawerNavigationEventMap } from '@react-navigation/drawer';
|
2
2
|
import type { DrawerNavigationState, ParamListBase } from '@react-navigation/native';
|
3
|
-
export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "
|
3
|
+
export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
4
4
|
children: React.ReactNode;
|
5
5
|
layout?: ((props: {
|
6
6
|
state: DrawerNavigationState<ParamListBase>;
|
@@ -45,10 +45,15 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
|
|
45
45
|
theme: ReactNavigation.Theme;
|
46
46
|
children: React.ReactElement;
|
47
47
|
}) => React.ReactElement) | undefined;
|
48
|
-
|
48
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
49
|
+
type: string;
|
50
|
+
payload?: object;
|
51
|
+
source?: string;
|
52
|
+
target?: string;
|
53
|
+
}>>(original: import("@react-navigation/routers").Router<DrawerNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<DrawerNavigationState<ParamListBase>, Action>>) | undefined;
|
49
54
|
} & {
|
50
55
|
id?: undefined;
|
51
|
-
}, "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "
|
56
|
+
}, "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
52
57
|
children: React.ReactNode;
|
53
58
|
layout?: ((props: {
|
54
59
|
state: DrawerNavigationState<ParamListBase>;
|
@@ -93,7 +98,12 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
|
|
93
98
|
theme: ReactNavigation.Theme;
|
94
99
|
children: React.ReactElement;
|
95
100
|
}) => React.ReactElement) | undefined;
|
96
|
-
|
101
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
102
|
+
type: string;
|
103
|
+
payload?: object;
|
104
|
+
source?: string;
|
105
|
+
target?: string;
|
106
|
+
}>>(original: import("@react-navigation/routers").Router<DrawerNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<DrawerNavigationState<ParamListBase>, Action>>) | undefined;
|
97
107
|
} & {
|
98
108
|
id?: undefined;
|
99
109
|
}, "children">> & import("react").RefAttributes<unknown>> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAMpF,eAAO,MAAM,MAAM;
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../src/layouts/Drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAMpF,eAAO,MAAM,MAAM;cAQ2Q,MAAO,SAAS;;;;;kBAAmb,MAAO,SAAS;UAAW,MAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAod,gBAAiB,KAAK;;;;;eAAiO,gBAAiB,KAAK;kBAAmB,MAAO,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;cAAtxC,MAAO,SAAS;;;;;kBAAmb,MAAO,SAAS;UAAW,MAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAAod,gBAAiB,KAAK;;;;;eAAiO,gBAAiB,KAAK;kBAAmB,MAAO,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;;CAHliD,CAAA;AAElB,eAAe,MAAM,CAAA"}
|
package/types/layouts/Stack.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { ParamListBase, StackNavigationState } from '@react-navigation/native';
|
2
2
|
import { type NativeStackNavigationEventMap, type NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
3
|
-
export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "
|
3
|
+
export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
4
4
|
children: React.ReactNode;
|
5
5
|
layout?: ((props: {
|
6
6
|
state: StackNavigationState<ParamListBase>;
|
@@ -41,10 +41,15 @@ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
41
41
|
theme: ReactNavigation.Theme;
|
42
42
|
children: React.ReactElement;
|
43
43
|
}) => React.ReactElement) | undefined;
|
44
|
-
|
44
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
45
|
+
type: string;
|
46
|
+
payload?: object;
|
47
|
+
source?: string;
|
48
|
+
target?: string;
|
49
|
+
}>>(original: import("@react-navigation/routers").Router<StackNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<StackNavigationState<ParamListBase>, Action>>) | undefined;
|
45
50
|
} & {
|
46
51
|
id?: undefined;
|
47
|
-
}, "children"> & Partial<Pick<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "
|
52
|
+
}, "children"> & Partial<Pick<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
48
53
|
children: React.ReactNode;
|
49
54
|
layout?: ((props: {
|
50
55
|
state: StackNavigationState<ParamListBase>;
|
@@ -85,7 +90,12 @@ export declare const Stack: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
85
90
|
theme: ReactNavigation.Theme;
|
86
91
|
children: React.ReactElement;
|
87
92
|
}) => React.ReactElement) | undefined;
|
88
|
-
|
93
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
94
|
+
type: string;
|
95
|
+
payload?: object;
|
96
|
+
source?: string;
|
97
|
+
target?: string;
|
98
|
+
}>>(original: import("@react-navigation/routers").Router<StackNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<StackNavigationState<ParamListBase>, Action>>) | undefined;
|
89
99
|
} & {
|
90
100
|
id?: undefined;
|
91
101
|
}, "children">> & import("react").RefAttributes<unknown>> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAElC,MAAM,gCAAgC,CAAA;AAMvC,eAAO,MAAM,KAAK;
|
1
|
+
{"version":3,"file":"Stack.d.ts","sourceRoot":"","sources":["../../src/layouts/Stack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACnF,OAAO,EACL,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAElC,MAAM,gCAAgC,CAAA;AAMvC,eAAO,MAAM,KAAK;cAQ6N,MAAO,SAAS;;;;;kBAAmb,MAAO,SAAS;UAAW,MAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;eAAod,gBAAiB,KAAK;;;;;eAAiO,gBAAiB,KAAK;kBAAmB,MAAO,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;cAAtxC,MAAO,SAAS;;;;;kBAAmb,MAAO,SAAS;UAAW,MAAO,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;eAAod,gBAAiB,KAAK;;;;;eAAiO,gBAAiB,KAAK;kBAAmB,MAAO,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;;CAH9+C,CAAA;AAEvB,eAAe,KAAK,CAAA"}
|
package/types/layouts/Tabs.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { type BottomTabNavigationEventMap, type BottomTabNavigationOptions } from '@react-navigation/bottom-tabs';
|
2
2
|
import type { ParamListBase, TabNavigationState } from '@react-navigation/native';
|
3
|
-
export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "
|
3
|
+
export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
4
4
|
children: React.ReactNode;
|
5
5
|
layout?: ((props: {
|
6
6
|
state: TabNavigationState<ParamListBase>;
|
@@ -41,10 +41,15 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
41
41
|
theme: ReactNavigation.Theme;
|
42
42
|
children: React.ReactElement;
|
43
43
|
}) => React.ReactElement) | undefined;
|
44
|
-
|
44
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
45
|
+
type: string;
|
46
|
+
payload?: object;
|
47
|
+
source?: string;
|
48
|
+
target?: string;
|
49
|
+
}>>(original: import("@react-navigation/routers").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
|
45
50
|
} & {
|
46
51
|
id?: undefined;
|
47
|
-
}, "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "
|
52
|
+
}, "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
48
53
|
children: React.ReactNode;
|
49
54
|
layout?: ((props: {
|
50
55
|
state: TabNavigationState<ParamListBase>;
|
@@ -85,7 +90,12 @@ export declare const Tabs: import("react").ForwardRefExoticComponent<Omit<Omit<i
|
|
85
90
|
theme: ReactNavigation.Theme;
|
86
91
|
children: React.ReactElement;
|
87
92
|
}) => React.ReactElement) | undefined;
|
88
|
-
|
93
|
+
UNSTABLE_router?: (<Action extends Readonly<{
|
94
|
+
type: string;
|
95
|
+
payload?: object;
|
96
|
+
source?: string;
|
97
|
+
target?: string;
|
98
|
+
}>>(original: import("@react-navigation/routers").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/routers").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
|
89
99
|
} & {
|
90
100
|
id?: undefined;
|
91
101
|
}, "children">> & import("react").RefAttributes<unknown>> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAGhC,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAoCjF,eAAO,MAAM,IAAI;
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../src/layouts/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAGhC,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAoCjF,eAAO,MAAM,IAAI;cAtBM,MAAM,SAAS;;;;;kBAmBV,MAG3B,SAAS;UAAW,MAAO,YAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;eAYsC,gBAAiB,KAAK;;;;;eAU/C,gBAAG,KAAK;kBACN,MAAC,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;cA9CpC,MAAM,SAAS;;;;;kBAmBV,MAG3B,SAAS;UAAW,MAAO,YAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;eAYsC,gBAAiB,KAAK;;;;;eAU/C,gBAAG,KAAK;kBACN,MAAC,YAAY;UAAW,MAAO,YAAY;;;;;;;;;;;CAmB1D,CAAA;AAED,eAAe,IAAI,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../src/router/Route.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;
|
1
|
+
{"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../../src/router/Route.tsx"],"names":[],"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BAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oBAAoB;IACpB,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,kCAAkC;IAClC,OAAO,EAAE,IAAI,GAAG,iBAAiB,EAAE,CAAA;IACnC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oLAAoL;IACpL,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,qBAAqB;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;IACrB,yBAAyB;IACzB,WAAW,CAAC,EAAE,SAAS,EAAE,CAAA;CAC1B,CAAA;AAED,eAAO,MAAM,kBAAkB,+DAE1B,CAAA;AAQL,+DAA+D;AAC/D,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EACpB,QAAQ,EACR,IAAI,EACJ,KAAK,GACN,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;KAAE,CAAA;CACxD,2CAQA"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import type React from 'react';
|
2
|
+
import type { UrlObject } from './getNormalizedStatePath';
|
3
|
+
export declare const RouteInfoContext: React.Context<UrlObject | undefined>;
|
4
|
+
/**
|
5
|
+
* Provides the route info (a `UrlObject`) through a context for child page.
|
6
|
+
* Such context can be used to implement hooks such as `usePathname`.
|
7
|
+
*
|
8
|
+
* **IMPORTANT**: The current implementation uses `useStateForPath` - which will not return the a complete state if it isn't being called from a component under a leaf route node.
|
9
|
+
* In other words, the provided route info may not be correct when used in a `_layout`. For example, if the user is on a page `/blog/123`:
|
10
|
+
*
|
11
|
+
* ```
|
12
|
+
* app
|
13
|
+
* ├── _layout.tsx
|
14
|
+
* ├── index.tsx
|
15
|
+
* └── blog
|
16
|
+
* ├── _layout.tsx - in BlogLayout, pathname will be "/blog"
|
17
|
+
* └── [id].tsx - in BlogPage, pathname will be "/blog/123"
|
18
|
+
* ```
|
19
|
+
*
|
20
|
+
* The returned value is lazily calculated and cached, so we won't waste CPU cycles to calculate it if no one is asking for it.
|
21
|
+
*
|
22
|
+
* This is implemented with the `useStateForPath` hook provided by React Navigation, which is known to be safe for not returning a stale or incomplete state when used in pages. See: https://github.com/react-navigation/react-navigation/pull/12521
|
23
|
+
*/
|
24
|
+
export declare function RouteInfoContextProvider({ children }: {
|
25
|
+
children: React.ReactNode;
|
26
|
+
}): import("react/jsx-runtime").JSX.Element;
|
27
|
+
//# sourceMappingURL=RouteInfoContext.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RouteInfoContext.d.ts","sourceRoot":"","sources":["../../src/router/RouteInfoContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AAIzD,eAAO,MAAM,gBAAgB,sCAAkD,CAAA;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAoCnF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oneServe.d.ts","sourceRoot":"","sources":["../../src/server/oneServe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,MAAM,CAAA;
|
1
|
+
{"version":3,"file":"oneServe.d.ts","sourceRoot":"","sources":["../../src/server/oneServe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,MAAM,CAAA;AAcnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAIxC,wBAAsB,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,iBAoShG"}
|
@@ -28,10 +28,10 @@ export declare function useNavigatorContext(): {
|
|
28
28
|
descriptors: NavigatorTypes["descriptors"];
|
29
29
|
router: RouterFactory<any, any, any>;
|
30
30
|
};
|
31
|
-
export declare function useSlot(): JSX.Element | null;
|
31
|
+
export declare function useSlot(): React.JSX.Element | null;
|
32
32
|
/** Renders the currently selected content. */
|
33
33
|
export declare const Slot: React.NamedExoticComponent<Omit<NavigatorProps, "children">>;
|
34
|
-
export declare function QualifiedSlot(): JSX.Element | null;
|
34
|
+
export declare function QualifiedSlot(): React.JSX.Element | null;
|
35
35
|
export declare function DefaultNavigator(): import("react/jsx-runtime").JSX.Element;
|
36
36
|
export {};
|
37
37
|
//# sourceMappingURL=Navigator.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Navigator.d.ts","sourceRoot":"","sources":["../../src/views/Navigator.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,oBAAoB,EACpB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAG7D,eAAO,MAAM,gBAAgB;gBACf,MAAM;WACX,cAAc,CAAC,OAAO,CAAC;gBAClB,cAAc,CAAC,YAAY,CAAC;iBAC3B,cAAc,CAAC,aAAa,CAAC;YAClC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;SACvB,CAAA;AAMf,MAAM,MAAM,cAAc,G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Ac,GAAG;IAC3B,gBAAgB,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;IACjF,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;IAC3E,QAAQ,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACjE,MAAM,CAAC,EAAE,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAA;CACpD,CAAA;AAED,+DAA+D;AAC/D,wBAAgB,SAAS,CAAC,EACxB,gBAAgB,EAChB,aAAa,EACb,QAAQ,EACR,MAAM,GACP,EAAE,cAAc,kDA2BhB;yBAhCe,SAAS;;;;;AAsEzB,wBAAgB,mBAAmB;gBAzFrB,MAAM;WACX,cAAc,CAAC,OAAO,CAAC;gBAClB,cAAc,CAAC,YAAY,CAAC;iBAC3B,cAAc,CAAC,aAAa,CAAC;YAClC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;EA2FrC;AAED,wBAAgB,OAAO,6BAyBtB;AAED,8CAA8C;AAC9C,eAAO,MAAM,IAAI,8DAef,CAAA;AAEF,wBAAgB,aAAa,6BAE5B;AAED,wBAAgB,gBAAgB,4CAQ/B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"generateFileSystemRouteTypesPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInC,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"generateFileSystemRouteTypesPlugin.d.ts","sourceRoot":"","sources":["../../../src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAInC,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,GAAG,MAAM,CAsCrF"}
|