one 1.1.407 → 1.1.409
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/Root.cjs +31 -28
- package/dist/cjs/Root.js +26 -30
- package/dist/cjs/Root.js.map +1 -1
- package/dist/cjs/Root.native.js +9 -6
- package/dist/cjs/Root.native.js.map +2 -2
- package/dist/cjs/cli/build.cjs +4 -6
- package/dist/cjs/cli/build.js +3 -3
- package/dist/cjs/cli/build.js.map +1 -1
- package/dist/cjs/cli/build.native.js +3 -3
- package/dist/cjs/cli/build.native.js.map +2 -2
- package/dist/cjs/cli/buildPage.js.map +1 -1
- package/dist/cjs/cli/buildPage.native.js.map +1 -1
- package/dist/cjs/constants.js.map +1 -1
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/createApp.cjs +6 -5
- package/dist/cjs/createApp.js +5 -5
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/createHandleRequest.cjs +2 -2
- package/dist/cjs/createHandleRequest.js +1 -1
- package/dist/cjs/createHandleRequest.js.map +1 -1
- package/dist/cjs/createHandleRequest.native.js +1 -1
- package/dist/cjs/createHandleRequest.native.js.map +1 -1
- package/dist/cjs/index.cjs +4 -3
- package/dist/cjs/index.js +4 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +5 -3
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/router/useScreens.cjs +4 -3
- package/dist/cjs/router/useScreens.js +3 -3
- package/dist/cjs/router/useScreens.js.map +1 -1
- package/dist/cjs/router/useScreens.native.js +2 -2
- package/dist/cjs/router/useScreens.native.js.map +2 -2
- package/dist/cjs/server/ServerContextScript.cjs +56 -0
- package/dist/cjs/server/ServerContextScript.js +55 -0
- package/dist/cjs/server/ServerContextScript.js.map +6 -0
- package/dist/cjs/server/ServerContextScript.native.js +56 -0
- package/dist/cjs/server/ServerContextScript.native.js.map +6 -0
- package/dist/cjs/server/createRoutesManifest.js.map +1 -1
- package/dist/cjs/server/createRoutesManifest.native.js.map +1 -1
- package/dist/cjs/useLoader.cjs +3 -3
- package/dist/cjs/useLoader.js +2 -2
- package/dist/cjs/useLoader.js.map +1 -1
- package/dist/cjs/useLoader.native.js +2 -2
- package/dist/cjs/useLoader.native.js.map +2 -2
- package/dist/cjs/vite/constants.cjs +4 -2
- package/dist/cjs/vite/constants.js +3 -2
- package/dist/cjs/vite/constants.js.map +1 -1
- package/dist/cjs/vite/constants.native.js +5 -3
- package/dist/cjs/vite/constants.native.js.map +2 -2
- package/dist/cjs/vite/one-server-only.cjs +114 -0
- package/dist/cjs/vite/one-server-only.js +108 -0
- package/dist/cjs/vite/one-server-only.js.map +6 -0
- package/dist/cjs/vite/{server.native.js → one-server-only.native.js} +14 -6
- package/dist/cjs/vite/one-server-only.native.js.map +6 -0
- package/dist/cjs/vite/one.cjs +2 -25
- package/dist/cjs/vite/one.js +7 -28
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js +4 -29
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/resolveResponse.cjs +5 -5
- package/dist/cjs/vite/resolveResponse.js +5 -5
- package/dist/cjs/vite/resolveResponse.js.map +1 -1
- package/dist/cjs/vite/resolveResponse.native.js +5 -5
- package/dist/cjs/vite/resolveResponse.native.js.map +1 -1
- package/dist/cjs/vite/types.native.js.map +1 -1
- package/dist/cjs/vite.cjs +2 -4
- package/dist/cjs/vite.js +2 -3
- package/dist/cjs/vite.js.map +1 -1
- package/dist/cjs/vite.native.js +3 -5
- package/dist/cjs/vite.native.js.map +1 -1
- package/dist/cjs/zero/useQuery.cjs +2 -2
- package/dist/cjs/zero/useQuery.js +2 -2
- package/dist/cjs/zero/useQuery.js.map +1 -1
- package/dist/cjs/zero/useQuery.native.js +1 -1
- package/dist/cjs/zero/useQuery.native.js.map +1 -1
- package/dist/esm/Root.js +33 -31
- package/dist/esm/Root.js.map +1 -1
- package/dist/esm/Root.mjs +32 -29
- package/dist/esm/Root.mjs.map +1 -1
- package/dist/esm/Root.native.js +11 -7
- package/dist/esm/Root.native.js.map +2 -2
- package/dist/esm/cli/build.js +2 -2
- package/dist/esm/cli/build.js.map +1 -1
- package/dist/esm/cli/build.mjs +2 -4
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js +2 -2
- package/dist/esm/cli/build.native.js.map +2 -2
- package/dist/esm/cli/buildPage.js.map +1 -1
- package/dist/esm/cli/buildPage.mjs.map +1 -1
- package/dist/esm/cli/buildPage.native.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/constants.mjs.map +1 -1
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/createApp.js +2 -5
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/createApp.mjs +2 -1
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/createHandleRequest.js +1 -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 +2 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -1
- package/dist/esm/index.native.js.map +2 -2
- package/dist/esm/router/useScreens.js +3 -2
- package/dist/esm/router/useScreens.js.map +1 -1
- package/dist/esm/router/useScreens.mjs +3 -2
- package/dist/esm/router/useScreens.mjs.map +1 -1
- package/dist/esm/router/useScreens.native.js +3 -2
- package/dist/esm/router/useScreens.native.js.map +2 -2
- package/dist/esm/server/ServerContextScript.js +42 -0
- package/dist/esm/server/ServerContextScript.js.map +6 -0
- package/dist/esm/server/ServerContextScript.mjs +33 -0
- package/dist/esm/server/ServerContextScript.mjs.map +1 -0
- package/dist/esm/server/ServerContextScript.native.js +38 -0
- package/dist/esm/server/ServerContextScript.native.js.map +6 -0
- package/dist/esm/server/createRoutesManifest.js.map +1 -1
- package/dist/esm/server/createRoutesManifest.mjs.map +1 -1
- package/dist/esm/server/createRoutesManifest.native.js.map +1 -1
- package/dist/esm/useLoader.js +2 -2
- package/dist/esm/useLoader.js.map +1 -1
- package/dist/esm/useLoader.mjs +2 -2
- package/dist/esm/useLoader.mjs.map +1 -1
- package/dist/esm/useLoader.native.js +2 -2
- package/dist/esm/useLoader.native.js.map +2 -2
- package/dist/esm/vite/constants.js +3 -2
- package/dist/esm/vite/constants.js.map +1 -1
- package/dist/esm/vite/constants.mjs +3 -2
- package/dist/esm/vite/constants.mjs.map +1 -1
- package/dist/esm/vite/constants.native.js +3 -2
- package/dist/esm/vite/constants.native.js.map +2 -2
- package/dist/esm/vite/one-server-only.js +93 -0
- package/dist/esm/vite/one-server-only.js.map +6 -0
- package/dist/esm/vite/one-server-only.mjs +81 -0
- package/dist/esm/vite/one-server-only.mjs.map +1 -0
- package/dist/esm/vite/{server.native.js → one-server-only.native.js} +8 -2
- package/dist/esm/vite/one-server-only.native.js.map +6 -0
- package/dist/esm/vite/one.js +8 -36
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +4 -27
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +5 -31
- package/dist/esm/vite/one.native.js.map +2 -2
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +1 -1
- package/dist/esm/vite/resolveResponse.js +1 -1
- package/dist/esm/vite/resolveResponse.mjs +1 -1
- package/dist/esm/vite/resolveResponse.native.js +1 -1
- package/dist/esm/vite.js +2 -4
- package/dist/esm/vite.js.map +1 -1
- package/dist/esm/vite.mjs +2 -3
- package/dist/esm/vite.mjs.map +1 -1
- package/dist/esm/vite.native.js +2 -4
- package/dist/esm/vite.native.js.map +2 -2
- package/dist/esm/zero/useQuery.js +1 -1
- package/dist/esm/zero/useQuery.mjs +1 -1
- package/dist/esm/zero/useQuery.native.js +1 -1
- package/package.json +8 -22
- package/src/Root.tsx +21 -7
- package/src/cli/build.ts +3 -4
- package/src/cli/buildPage.ts +1 -2
- package/src/constants.ts +2 -2
- package/src/createApp.tsx +2 -5
- package/src/createHandleRequest.ts +3 -3
- package/src/index.ts +3 -1
- package/src/router/useScreens.tsx +3 -3
- package/src/server/ServerContextScript.tsx +42 -0
- package/src/server/createRoutesManifest.ts +2 -13
- package/src/useLoader.ts +2 -3
- package/src/vite/constants.ts +2 -0
- package/src/vite/one-server-only.native.ts +6 -0
- package/src/vite/one-server-only.tsx +152 -0
- package/src/vite/one.ts +10 -48
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +1 -1
- package/src/vite/resolveResponse.ts +1 -1
- package/src/vite/types.ts +20 -1
- package/src/vite.ts +1 -3
- package/src/zero/useQuery.ts +1 -1
- package/types/Root.d.ts.map +1 -1
- package/types/cli/build.d.ts.map +1 -1
- package/types/cli/buildPage.d.ts +1 -2
- package/types/cli/buildPage.d.ts.map +1 -1
- package/types/constants.d.ts +2 -2
- package/types/constants.d.ts.map +1 -1
- package/types/createApp.d.ts.map +1 -1
- package/types/createHandleRequest.d.ts +2 -1
- package/types/createHandleRequest.d.ts.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +2 -2
- package/types/layouts/Stack.d.ts +2 -2
- package/types/layouts/Tabs.d.ts +2 -2
- package/types/router/useScreens.d.ts.map +1 -1
- package/types/server/ServerContextScript.d.ts +2 -0
- package/types/server/ServerContextScript.d.ts.map +1 -0
- package/types/server/createRoutesManifest.d.ts +1 -12
- package/types/server/createRoutesManifest.d.ts.map +1 -1
- package/types/useLoader.d.ts.map +1 -1
- package/types/vite/constants.d.ts +1 -0
- package/types/vite/constants.d.ts.map +1 -1
- package/types/vite/one-server-only.d.ts +26 -0
- package/types/vite/one-server-only.d.ts.map +1 -0
- package/types/vite/one-server-only.native.d.ts +7 -0
- package/types/vite/one-server-only.native.d.ts.map +1 -0
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/types.d.ts +18 -1
- package/types/vite/types.d.ts.map +1 -1
- package/types/vite.d.ts +1 -2
- package/types/vite.d.ts.map +1 -1
- package/dist/cjs/utils/one__ensureAsyncLocalID.cjs +0 -31
- package/dist/cjs/utils/one__ensureAsyncLocalID.js +0 -27
- package/dist/cjs/utils/one__ensureAsyncLocalID.js.map +0 -6
- package/dist/cjs/utils/one__ensureAsyncLocalID.native.js +0 -32
- package/dist/cjs/utils/one__ensureAsyncLocalID.native.js.map +0 -6
- package/dist/cjs/utils/serverContext.cjs +0 -93
- package/dist/cjs/utils/serverContext.js +0 -92
- package/dist/cjs/utils/serverContext.js.map +0 -6
- package/dist/cjs/utils/serverContext.native.js +0 -103
- package/dist/cjs/utils/serverContext.native.js.map +0 -6
- package/dist/cjs/vite/server.cjs +0 -63
- package/dist/cjs/vite/server.js +0 -49
- package/dist/cjs/vite/server.js.map +0 -6
- package/dist/cjs/vite/server.native.js.map +0 -6
- package/dist/esm/utils/one__ensureAsyncLocalID.js +0 -11
- package/dist/esm/utils/one__ensureAsyncLocalID.js.map +0 -6
- package/dist/esm/utils/one__ensureAsyncLocalID.mjs +0 -8
- package/dist/esm/utils/one__ensureAsyncLocalID.mjs.map +0 -1
- package/dist/esm/utils/one__ensureAsyncLocalID.native.js +0 -11
- package/dist/esm/utils/one__ensureAsyncLocalID.native.js.map +0 -6
- package/dist/esm/utils/serverContext.js +0 -79
- package/dist/esm/utils/serverContext.js.map +0 -6
- package/dist/esm/utils/serverContext.mjs +0 -64
- package/dist/esm/utils/serverContext.mjs.map +0 -1
- package/dist/esm/utils/serverContext.native.js +0 -80
- package/dist/esm/utils/serverContext.native.js.map +0 -6
- package/dist/esm/vite/server.js +0 -34
- package/dist/esm/vite/server.js.map +0 -6
- package/dist/esm/vite/server.mjs +0 -36
- package/dist/esm/vite/server.mjs.map +0 -1
- package/dist/esm/vite/server.native.js.map +0 -6
- package/src/utils/one__ensureAsyncLocalID.ts +0 -11
- package/src/utils/serverContext.tsx +0 -119
- package/src/vite/server.native.ts +0 -7
- package/src/vite/server.ts +0 -57
- package/types/utils/one__ensureAsyncLocalID.d.ts +0 -2
- package/types/utils/one__ensureAsyncLocalID.d.ts.map +0 -1
- package/types/utils/serverContext.d.ts +0 -26
- package/types/utils/serverContext.d.ts.map +0 -1
- package/types/vite/server.d.ts +0 -9
- package/types/vite/server.d.ts.map +0 -1
- package/types/vite/server.native.d.ts +0 -5
- package/types/vite/server.native.d.ts.map +0 -1
package/src/constants.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { One } from './vite/types'
|
2
2
|
|
3
3
|
export const isWebClient = process.env.TAMAGUI_TARGET !== 'native' && typeof window !== 'undefined'
|
4
4
|
export const isWebServer = process.env.TAMAGUI_TARGET !== 'native' && typeof window === 'undefined'
|
@@ -21,7 +21,7 @@ export const SERVER_CONTEXT_KEY = '__one_server_context__'
|
|
21
21
|
|
22
22
|
export const getSpaHeaderElements = ({
|
23
23
|
serverContext = {},
|
24
|
-
}: { serverContext?: ServerContext } = {}) => `
|
24
|
+
}: { serverContext?: One.ServerContext } = {}) => `
|
25
25
|
<script>globalThis['global'] = globalThis</script>
|
26
26
|
<script>globalThis['__vxrnIsSPA'] = true</script>
|
27
27
|
<script>globalThis["${SERVER_CONTEXT_KEY}"] = ${JSON.stringify(serverContext)}</script>
|
package/src/createApp.tsx
CHANGED
@@ -10,11 +10,8 @@ import type { RenderAppProps } from './types'
|
|
10
10
|
import ReactDOMServer from 'react-dom/server.browser'
|
11
11
|
import { getServerHeadInsertions } from './useServerHeadInsertion'
|
12
12
|
import { ensureExists } from './utils/ensureExists'
|
13
|
-
import {
|
14
|
-
|
15
|
-
SERVER_CONTEXT_POST_RENDER_STRING,
|
16
|
-
setServerContext,
|
17
|
-
} from './utils/serverContext'
|
13
|
+
import { getServerContext, setServerContext } from './vite/one-server-only'
|
14
|
+
import { SERVER_CONTEXT_POST_RENDER_STRING } from './vite/constants'
|
18
15
|
|
19
16
|
export type CreateAppProps = { routes: Record<string, () => Promise<unknown>> }
|
20
17
|
|
@@ -1,14 +1,14 @@
|
|
1
|
-
import { extname } from 'node:path'
|
2
|
-
import { getPathFromLoaderPath } from './utils/cleanUrl'
|
3
1
|
import { LOADER_JS_POSTFIX_UNCACHED } from './constants'
|
4
2
|
import type { Middleware, MiddlewareContext } from './createMiddleware'
|
5
3
|
import type { RouteNode } from './router/Route'
|
6
|
-
import type {
|
4
|
+
import type { RouteInfoCompiled } from './server/createRoutesManifest'
|
7
5
|
import type { LoaderProps } from './types'
|
6
|
+
import { getPathFromLoaderPath } from './utils/cleanUrl'
|
8
7
|
import { getHonoPath } from './utils/getHonoPath'
|
9
8
|
import { isResponse } from './utils/isResponse'
|
10
9
|
import { getManifest } from './vite/getManifest'
|
11
10
|
import { resolveAPIEndpoint, resolveResponse } from './vite/resolveResponse'
|
11
|
+
import type { RouteInfo } from './vite/types'
|
12
12
|
|
13
13
|
export type RequestHandlers = {
|
14
14
|
handlePage?: (props: RequestHandlerProps) => Promise<any>
|
package/src/index.ts
CHANGED
@@ -62,7 +62,9 @@ export { isResponse } from './utils/isResponse'
|
|
62
62
|
export { getURL } from './getURL'
|
63
63
|
export { redirect } from './utils/redirect'
|
64
64
|
export { href } from './href'
|
65
|
-
|
65
|
+
|
66
|
+
// server
|
67
|
+
export { setResponseHeaders, getServerData, setServerData } from './vite/one-server-only'
|
66
68
|
|
67
69
|
// re-export
|
68
70
|
export * from '@vxrn/universal-color-scheme'
|
@@ -8,13 +8,14 @@ import type {
|
|
8
8
|
ScreenListeners,
|
9
9
|
} from '@react-navigation/native'
|
10
10
|
import React, { forwardRef, Suspense, useEffect } from 'react'
|
11
|
+
import { ServerContextScript } from '../server/ServerContextScript'
|
11
12
|
import { getPageExport } from '../utils/getPageExport'
|
12
|
-
import { getServerContext, ServerContextScript } from '../utils/serverContext'
|
13
13
|
import { useConstant } from '../utils/useConstant'
|
14
14
|
import { EmptyRoute } from '../views/EmptyRoute'
|
15
15
|
import { RootErrorBoundary } from '../views/RootErrorBoundary'
|
16
16
|
import { Try } from '../views/Try'
|
17
17
|
import { DevHead } from '../vite/DevHead'
|
18
|
+
import { useServerContext } from '../vite/one-server-only'
|
18
19
|
import { filterRootHTML } from './filterRootHTML'
|
19
20
|
import {
|
20
21
|
Route,
|
@@ -182,8 +183,7 @@ export function getQualifiedRouteComponent(value: RouteNode) {
|
|
182
183
|
const out = BaseComponent(props, ref)
|
183
184
|
const { children, bodyProps, head, htmlProps } = filterRootHTML(out)
|
184
185
|
const { children: headChildren, ...headProps } = head?.props || {}
|
185
|
-
|
186
|
-
const serverContext = getServerContext()
|
186
|
+
const serverContext = useServerContext()
|
187
187
|
|
188
188
|
if (process.env.TAMAGUI_TARGET === 'native') {
|
189
189
|
// on native we just ignore all html/body/head
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { SERVER_CONTEXT_KEY } from '../constants'
|
2
|
+
import { SERVER_CONTEXT_POST_RENDER_STRING } from '../vite/constants'
|
3
|
+
import { useServerContext } from '../vite/one-server-only'
|
4
|
+
|
5
|
+
export function ServerContextScript() {
|
6
|
+
if (process.env.VITE_ENVIRONMENT === 'client') {
|
7
|
+
return (
|
8
|
+
<script
|
9
|
+
async
|
10
|
+
// @ts-ignore
|
11
|
+
href={SERVER_CONTEXT_KEY}
|
12
|
+
suppressHydrationWarning
|
13
|
+
dangerouslySetInnerHTML={{
|
14
|
+
__html: ``,
|
15
|
+
}}
|
16
|
+
/>
|
17
|
+
)
|
18
|
+
}
|
19
|
+
|
20
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
21
|
+
const context = useServerContext()
|
22
|
+
|
23
|
+
return (
|
24
|
+
<script
|
25
|
+
async
|
26
|
+
// @ts-ignore
|
27
|
+
href={SERVER_CONTEXT_KEY}
|
28
|
+
suppressHydrationWarning
|
29
|
+
dangerouslySetInnerHTML={{
|
30
|
+
__html: `
|
31
|
+
globalThis["${SERVER_CONTEXT_KEY}"] = ${JSON.stringify({
|
32
|
+
...context,
|
33
|
+
postRenderData: SERVER_CONTEXT_POST_RENDER_STRING,
|
34
|
+
})};
|
35
|
+
`,
|
36
|
+
}}
|
37
|
+
/>
|
38
|
+
)
|
39
|
+
}
|
40
|
+
|
41
|
+
return null
|
42
|
+
}
|
@@ -1,20 +1,9 @@
|
|
1
1
|
import { type Options, getRoutes } from '../router/getRoutes'
|
2
2
|
import { getServerManifest } from './getServerManifest'
|
3
|
-
import type { RouteNode } from '../router/Route'
|
4
|
-
import type { One } from '../vite/types'
|
5
3
|
|
6
|
-
|
4
|
+
import type { One, RouteInfo } from '../vite/types'
|
7
5
|
|
8
|
-
export type
|
9
|
-
file: string
|
10
|
-
page: string
|
11
|
-
namedRegex: TRegex
|
12
|
-
routeKeys: Record<string, string>
|
13
|
-
layouts?: RouteNode[]
|
14
|
-
middlewares?: RouteNode[]
|
15
|
-
type: One.RouteType
|
16
|
-
isNotFound?: boolean
|
17
|
-
}
|
6
|
+
export { type Options } from '../router/getRoutes'
|
18
7
|
|
19
8
|
export type RouteInfoCompiled = RouteInfo & {
|
20
9
|
compiledRegex: RegExp
|
package/src/useLoader.ts
CHANGED
@@ -2,12 +2,11 @@
|
|
2
2
|
import { useEffect, useRef } from 'react'
|
3
3
|
import { useActiveParams, useParams, usePathname } from './hooks'
|
4
4
|
import { resolveHref } from './link/href'
|
5
|
-
import { useRouteNode } from './router/Route'
|
6
5
|
import { preloadingLoader } from './router/router'
|
7
6
|
import { getLoaderPath } from './utils/cleanUrl'
|
8
7
|
import { dynamicImport } from './utils/dynamicImport'
|
9
|
-
import { getServerContext } from './utils/serverContext'
|
10
8
|
import { weakKey } from './utils/weakKey'
|
9
|
+
import { useServerContext } from './vite/one-server-only'
|
11
10
|
|
12
11
|
const promises: Record<string, undefined | Promise<void>> = {}
|
13
12
|
const errors = {}
|
@@ -18,7 +17,7 @@ export function useLoader<
|
|
18
17
|
Returned = Loader extends (p: any) => any ? ReturnType<Loader> : unknown,
|
19
18
|
>(loader: Loader): Returned extends Promise<any> ? Awaited<Returned> : Returned {
|
20
19
|
const { loaderProps: loaderPropsFromServerContext, loaderData: loaderDataFromServerContext } =
|
21
|
-
|
20
|
+
useServerContext() || {}
|
22
21
|
|
23
22
|
// server side we just run the loader directly
|
24
23
|
if (typeof window === 'undefined') {
|
package/src/vite/constants.ts
CHANGED
@@ -0,0 +1,152 @@
|
|
1
|
+
// ⛔️⛔️⛔️⛔️⛔️⛔️
|
2
|
+
//
|
3
|
+
// NOTE: we have a big issue right now, we have "one" in optimizeDeps
|
4
|
+
// because otherwise you get an error when Root imports Text/View from react-native
|
5
|
+
// even though react-native is in optimizeDeps, it seems thats not working
|
6
|
+
// but what happens is that somehow one is imported directly by node right away
|
7
|
+
// and then later its imported through optimizeDeps, a seaprate instance, creating a separate requestAsyncLocalStore
|
8
|
+
|
9
|
+
import { AsyncLocalStorage } from 'node:async_hooks'
|
10
|
+
import { SERVER_CONTEXT_KEY } from '../constants'
|
11
|
+
import type { One } from './types'
|
12
|
+
import React from 'react'
|
13
|
+
|
14
|
+
type ALSInstance = AsyncLocalStorage<unknown>
|
15
|
+
|
16
|
+
const key = '__vxrnrequestAsyncLocalStore'
|
17
|
+
const read = () => globalThis[key] as ALSInstance | undefined
|
18
|
+
|
19
|
+
const ASYNC_LOCAL_STORE = {
|
20
|
+
get current() {
|
21
|
+
if (read()) return read()
|
22
|
+
const _ = new AsyncLocalStorage()
|
23
|
+
globalThis[key] = _
|
24
|
+
return _
|
25
|
+
},
|
26
|
+
}
|
27
|
+
|
28
|
+
export const requestAsyncLocalStore =
|
29
|
+
process.env.VITE_ENVIRONMENT === 'ssr' ? ASYNC_LOCAL_STORE.current : null
|
30
|
+
|
31
|
+
const newCache = new WeakMap<any, Headers>()
|
32
|
+
|
33
|
+
export const asyncHeadersCache =
|
34
|
+
(globalThis['__vxrnasyncHeadersCache'] as typeof newCache) ?? newCache
|
35
|
+
|
36
|
+
globalThis['__vxrnasyncHeadersCache'] ||= asyncHeadersCache
|
37
|
+
|
38
|
+
export async function runWithAsyncLocalContext<A>(cb: (id: Object) => Promise<A>): Promise<A> {
|
39
|
+
const id = { _id: Math.random() }
|
40
|
+
let out: A = null as any
|
41
|
+
await ASYNC_LOCAL_STORE.current!.run(id, async () => {
|
42
|
+
out = await cb(id)
|
43
|
+
})
|
44
|
+
return out
|
45
|
+
}
|
46
|
+
|
47
|
+
export async function setResponseHeaders(cb: (headers: Headers) => void) {
|
48
|
+
const id = ensureAsyncLocalID()
|
49
|
+
const headers = asyncHeadersCache.get(id) ?? new Headers()
|
50
|
+
asyncHeadersCache.set(id, headers)
|
51
|
+
cb(headers)
|
52
|
+
}
|
53
|
+
|
54
|
+
export function mergeHeaders(onto: Headers, from: Headers) {
|
55
|
+
from.forEach((value, key) => {
|
56
|
+
if (value === undefined || value === 'undefined') {
|
57
|
+
onto.delete(key)
|
58
|
+
} else {
|
59
|
+
onto.append(key, value)
|
60
|
+
}
|
61
|
+
})
|
62
|
+
}
|
63
|
+
|
64
|
+
export function ensureAsyncLocalID() {
|
65
|
+
const id = requestAsyncLocalStore?.getStore()
|
66
|
+
|
67
|
+
if (!id) {
|
68
|
+
throw new Error(`Internal One error, no AsyncLocalStorage id!`)
|
69
|
+
}
|
70
|
+
|
71
|
+
return id as Object
|
72
|
+
}
|
73
|
+
|
74
|
+
export type MaybeServerContext = null | One.ServerContext
|
75
|
+
|
76
|
+
const serverContexts = new WeakMap<any, One.ServerContext>()
|
77
|
+
|
78
|
+
export function setServerContext(data: One.ServerContext) {
|
79
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
80
|
+
const id = ensureAsyncLocalID()
|
81
|
+
if (!serverContexts.has(id)) {
|
82
|
+
serverContexts.set(id, {})
|
83
|
+
}
|
84
|
+
|
85
|
+
const context = serverContexts.get(id)!
|
86
|
+
Object.assign(context, data)
|
87
|
+
} else {
|
88
|
+
throw new Error(`Don't call setServerContext on client`)
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
export function getServerContext() {
|
93
|
+
const out = (() => {
|
94
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
95
|
+
const id = ensureAsyncLocalID()
|
96
|
+
return serverContexts.get(id)
|
97
|
+
}
|
98
|
+
return globalThis[SERVER_CONTEXT_KEY] as MaybeServerContext
|
99
|
+
})()
|
100
|
+
|
101
|
+
return out
|
102
|
+
}
|
103
|
+
|
104
|
+
export function useServerContext() {
|
105
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
106
|
+
try {
|
107
|
+
const useContext = globalThis['__vxrnGetContextFromReactContext']
|
108
|
+
if (useContext) {
|
109
|
+
return serverContexts.get(useContext())
|
110
|
+
}
|
111
|
+
} catch {
|
112
|
+
// ok, not in react tree
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
return getServerContext()
|
117
|
+
}
|
118
|
+
|
119
|
+
/**
|
120
|
+
* For passing data from the server to the client. Can only be called on the server.
|
121
|
+
* You can type it by overriding `One.ClientData` type using declare module 'one'.
|
122
|
+
*
|
123
|
+
* On the client, you can access the data with `getServerData`.
|
124
|
+
*/
|
125
|
+
export function setServerData<Key extends keyof One.ClientData>(
|
126
|
+
key: Key,
|
127
|
+
value: One.ClientData[Key]
|
128
|
+
) {
|
129
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
130
|
+
const context = getServerContext()
|
131
|
+
setServerContext({
|
132
|
+
postRenderData: {
|
133
|
+
...context?.postRenderData,
|
134
|
+
[key]: value,
|
135
|
+
},
|
136
|
+
})
|
137
|
+
} else {
|
138
|
+
throw new Error(`Cannot setServerData in ${process.env.VITE_ENVIRONMENT} environment!`)
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* For getting data set by setServerData on the server.
|
144
|
+
*/
|
145
|
+
export function getServerData(key: keyof One.ClientData) {
|
146
|
+
if (process.env.VITE_ENVIRONMENT === 'ssr') {
|
147
|
+
throw new Error(`Cannot getServerData on the server`)
|
148
|
+
}
|
149
|
+
if (process.env.VITE_ENVIRONMENT !== 'ssr') {
|
150
|
+
return getServerContext()?.postRenderData?.[key]
|
151
|
+
}
|
152
|
+
}
|
package/src/vite/one.ts
CHANGED
@@ -1,20 +1,13 @@
|
|
1
1
|
import { configureVXRNCompilerPlugin } from '@vxrn/compiler'
|
2
2
|
import { resolvePath } from '@vxrn/resolve'
|
3
3
|
import events from 'node:events'
|
4
|
-
import path, {
|
4
|
+
import path, { sep } from 'node:path'
|
5
5
|
import type { Plugin, PluginOption, UserConfig } from 'vite'
|
6
6
|
import { barrel } from 'vite-plugin-barrel'
|
7
7
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
8
|
-
import {
|
9
|
-
autoDepOptimizePlugin,
|
10
|
-
getOptimizeDeps,
|
11
|
-
getOptionsFilled,
|
12
|
-
isWebEnvironment,
|
13
|
-
loadEnv,
|
14
|
-
} from 'vxrn'
|
8
|
+
import { autoDepOptimizePlugin, getOptimizeDeps, getOptionsFilled, loadEnv } from 'vxrn'
|
15
9
|
import { CACHE_KEY } from '../constants'
|
16
10
|
import '../polyfills-server'
|
17
|
-
import { existsAsync } from '../utils/existsAsync'
|
18
11
|
import { ensureTSConfig } from './ensureTsConfig'
|
19
12
|
import { setOneOptions } from './loadConfig'
|
20
13
|
import { clientTreeShakePlugin } from './plugins/clientTreeShakePlugin'
|
@@ -343,18 +336,17 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
343
336
|
|
344
337
|
{
|
345
338
|
name: 'one:remove-server-from-client',
|
339
|
+
enforce: 'pre',
|
346
340
|
|
347
341
|
transform(code, id) {
|
348
|
-
if (this.environment.name
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
return `export function ensureAsyncLocalID() {
|
355
|
-
return {}
|
342
|
+
if (this.environment.name === 'client') {
|
343
|
+
if (id.includes(`vite${sep}one-server-only`)) {
|
344
|
+
return code.replace(
|
345
|
+
`import { AsyncLocalStorage } from "node:async_hooks"`,
|
346
|
+
`class AsyncLocalStorage {}`
|
347
|
+
)
|
356
348
|
}
|
357
|
-
|
349
|
+
}
|
358
350
|
},
|
359
351
|
},
|
360
352
|
] satisfies Plugin[]
|
@@ -476,36 +468,6 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
476
468
|
},
|
477
469
|
} satisfies Plugin,
|
478
470
|
|
479
|
-
{
|
480
|
-
name: 'one:optimize-deps-load-web-extensions-web-only',
|
481
|
-
enforce: 'pre',
|
482
|
-
|
483
|
-
applyToEnvironment(environment) {
|
484
|
-
return isWebEnvironment(environment)
|
485
|
-
},
|
486
|
-
|
487
|
-
async resolveId(id, importer = '') {
|
488
|
-
const shouldOptimize = optimizeIdRegex.test(importer)
|
489
|
-
|
490
|
-
if (shouldOptimize) {
|
491
|
-
const absolutePath = resolve(dirname(importer), id)
|
492
|
-
const webPath = absolutePath.replace(/(.m?js)/, '') + '.web.js'
|
493
|
-
if (webPath === id) return
|
494
|
-
try {
|
495
|
-
const directoryPath = absolutePath + '/index.web.js'
|
496
|
-
if (await existsAsync(directoryPath)) {
|
497
|
-
return directoryPath
|
498
|
-
}
|
499
|
-
if (await existsAsync(webPath)) {
|
500
|
-
return webPath
|
501
|
-
}
|
502
|
-
} catch (err) {
|
503
|
-
console.warn(`error probably fine`, err)
|
504
|
-
}
|
505
|
-
}
|
506
|
-
},
|
507
|
-
} satisfies Plugin,
|
508
|
-
|
509
471
|
SSRCSSPlugin({
|
510
472
|
entries: [virtualEntryId],
|
511
473
|
}),
|
@@ -9,7 +9,7 @@ import type { RenderAppProps } from '../../types'
|
|
9
9
|
import { isResponse } from '../../utils/isResponse'
|
10
10
|
import { isStatusRedirect } from '../../utils/isStatus'
|
11
11
|
import { promiseWithResolvers } from '../../utils/promiseWithResolvers'
|
12
|
-
import { setServerContext } from '
|
12
|
+
import { setServerContext } from '../one-server-only'
|
13
13
|
import { LoaderDataCache } from '../../vite/constants'
|
14
14
|
import { replaceLoader } from '../../vite/replaceLoader'
|
15
15
|
import type { One } from '../../vite/types'
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { isResponse } from '../utils/isResponse'
|
2
|
-
import { asyncHeadersCache, mergeHeaders, runWithAsyncLocalContext } from './server'
|
2
|
+
import { asyncHeadersCache, mergeHeaders, runWithAsyncLocalContext } from './one-server-only'
|
3
3
|
|
4
4
|
export function resolveResponse(getResponse: () => Promise<Response>) {
|
5
5
|
return new Promise<Response>((res, rej) => {
|
package/src/vite/types.ts
CHANGED
@@ -8,7 +8,18 @@ import type {
|
|
8
8
|
VXRNOptions,
|
9
9
|
VXRNServePlatform,
|
10
10
|
} from 'vxrn'
|
11
|
-
import type {
|
11
|
+
import type { RouteNode } from '../router/Route'
|
12
|
+
|
13
|
+
export type RouteInfo<TRegex = string> = {
|
14
|
+
file: string
|
15
|
+
page: string
|
16
|
+
namedRegex: TRegex
|
17
|
+
routeKeys: Record<string, string>
|
18
|
+
layouts?: RouteNode[]
|
19
|
+
middlewares?: RouteNode[]
|
20
|
+
type: One.RouteType
|
21
|
+
isNotFound?: boolean
|
22
|
+
}
|
12
23
|
|
13
24
|
export namespace One {
|
14
25
|
export type Options = Omit<VXRNOptions, keyof PluginOptions> & PluginOptions
|
@@ -269,4 +280,12 @@ export namespace One {
|
|
269
280
|
loaderData: any
|
270
281
|
preloads: string[]
|
271
282
|
}
|
283
|
+
|
284
|
+
export type ServerContext = {
|
285
|
+
css?: string[]
|
286
|
+
postRenderData?: any
|
287
|
+
loaderData?: any
|
288
|
+
loaderProps?: any
|
289
|
+
mode?: 'spa' | 'ssg' | 'ssr'
|
290
|
+
}
|
272
291
|
}
|
package/src/vite.ts
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
// plugins
|
2
2
|
export { resolvePath } from '@vxrn/resolve'
|
3
3
|
export { clientTreeShakePlugin } from './vite/plugins/clientTreeShakePlugin'
|
4
|
+
export { createFileSystemRouterPlugin } from './vite/plugins/fileSystemRouterPlugin'
|
4
5
|
export { removeReactNativeWebAnimatedPlugin } from './vite/plugins/removeReactNativeWebAnimatedPlugin'
|
5
6
|
export { SSRCSSPlugin } from './vite/plugins/SSRCSSPlugin'
|
6
|
-
export { createFileSystemRouterPlugin } from './vite/plugins/fileSystemRouterPlugin'
|
7
7
|
|
8
8
|
export { makePluginWebOnly } from './vite/makePluginWebOnly'
|
9
9
|
|
10
|
-
export { setResponseHeaders } from './vite/server'
|
11
|
-
|
12
10
|
export { build } from './cli/build'
|
13
11
|
export { one } from './vite/one'
|
package/src/zero/useQuery.ts
CHANGED
@@ -2,7 +2,7 @@ import { useRef } from 'react'
|
|
2
2
|
import { getQueryKey } from './getQueryKey'
|
3
3
|
import { resolveZeroQuery } from './resolveQuery'
|
4
4
|
import { useQuery as useQueryZero } from './useQueryZero'
|
5
|
-
import { getServerContext } from '../
|
5
|
+
import { getServerContext } from '../vite/one-server-only'
|
6
6
|
|
7
7
|
let clientInitialData: Object | null = getServerContext()?.postRenderData
|
8
8
|
|
package/types/Root.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../src/Root.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,wBAAwB,EAC9B,MAAM,0BAA0B,CAAA;AAEjC,OAAO,
|
1
|
+
{"version":3,"file":"Root.d.ts","sourceRoot":"","sources":["../src/Root.tsx"],"names":[],"mappings":"AAAA,OAAO,E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"
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAgCA,wBAAsB,KAAK,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,SAAS,CAAA;CACrC,iBAsfA"}
|
package/types/cli/buildPage.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { RouteInfo } from '../
|
2
|
-
import type { One } from '../vite/types';
|
1
|
+
import type { One, RouteInfo } from '../vite/types';
|
3
2
|
export declare function buildPage(serverEntry: string, path: string, relativeId: string, params: any, foundRoute: RouteInfo<string>, clientManifestEntry: any, staticDir: string, clientDir: string, builtMiddlewares: Record<string, string>, serverJsPath: string, preloads: string[], allCSS: string[]): Promise<One.RouteBuildInfo>;
|
4
3
|
//# sourceMappingURL=buildPage.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buildPage.d.ts","sourceRoot":"","sources":["../../src/cli/buildPage.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"buildPage.d.ts","sourceRoot":"","sources":["../../src/cli/buildPage.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAInD,wBAAsB,SAAS,CAC7B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,GAAG,EACX,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAC7B,mBAAmB,EAAE,GAAG,EACxB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACxC,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAAE,EAClB,MAAM,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAgG7B"}
|
package/types/constants.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { One } from './vite/types';
|
2
2
|
export declare const isWebClient: boolean;
|
3
3
|
export declare const isWebServer: boolean;
|
4
4
|
export declare const isNative: boolean;
|
@@ -12,6 +12,6 @@ export declare const VIRTUAL_SSR_CSS_ENTRY = "virtual:ssr-css.css";
|
|
12
12
|
export declare const VIRTUAL_SSR_CSS_HREF = "/@id/__x00__virtual:ssr-css.css";
|
13
13
|
export declare const SERVER_CONTEXT_KEY = "__one_server_context__";
|
14
14
|
export declare const getSpaHeaderElements: ({ serverContext, }?: {
|
15
|
-
serverContext?: ServerContext;
|
15
|
+
serverContext?: One.ServerContext;
|
16
16
|
}) => string;
|
17
17
|
//# sourceMappingURL=constants.d.ts.map
|
package/types/constants.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,WAAW,SAA2E,CAAA;AACnG,eAAO,MAAM,QAAQ,SAA0C,CAAA;AAE/D,eAAO,MAAM,SAAS,QAA4E,CAAA;AAElG,eAAO,MAAM,0BAA0B,oBAAoB,CAAA;AAC3D,eAAO,MAAM,8BAA8B,0BAAwC,CAAA;AACnF,eAAO,MAAM,uBAAuB,QAA6C,CAAA;AACjF,eAAO,MAAM,iBAAiB,QAA+C,CAAA;AAE7E,eAAO,MAAM,kBAAkB,QAA6B,CAAA;AAG5D,eAAO,MAAM,qBAAqB,wBAAwB,CAAA;AAC1D,eAAO,MAAM,oBAAoB,oCAAyC,CAAA;AAE1E,eAAO,MAAM,kBAAkB,2BAA2B,CAAA;AAE1D,eAAO,MAAM,oBAAoB,wBAE9B;IAAE,aAAa,CAAC,EAAE,GAAG,CAAC,aAAa,CAAA;CAAE,WAIvC,CAAA"}
|
package/types/createApp.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../src/createApp.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAOhB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../src/createApp.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAOhB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAQ7C,MAAM,MAAM,cAAc,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;CAAE,CAAA;AAE/E,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc;;oBAIrB,cAAc;EAyGzC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { RouteNode } from './router/Route';
|
2
|
-
import type {
|
2
|
+
import type { RouteInfoCompiled } from './server/createRoutesManifest';
|
3
3
|
import type { LoaderProps } from './types';
|
4
|
+
import type { RouteInfo } from './vite/types';
|
4
5
|
export type RequestHandlers = {
|
5
6
|
handlePage?: (props: RequestHandlerProps) => Promise<any>;
|
6
7
|
handleLoader?: (props: RequestHandlerProps) => Promise<any>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"createHandleRequest.d.ts","sourceRoot":"","sources":["../src/createHandleRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,S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AE,GAAG,EACR,KAAK,EAAE,iBAAiB,qBAkBzB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,OAMpD;AAUD,wBAAgB,eAAe,CAAC,QAAQ,EAAE;IAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IAAC,SAAS,EAAE,SAAS,EAAE,CAAA;CAAE,GAAG;IAC9F,UAAU,EAAE,iBAAiB,EAAE,CAAA;IAC/B,SAAS,EAAE,iBAAiB,EAAE,CAAA;CAC/B,CAKA;AAGD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,eAAe;;uBASV,OAAO,KAAG,OAAO,CAAC,sBAAsB,CAAC;EAqE3F"}
|
package/types/index.d.ts
CHANGED
@@ -31,7 +31,7 @@ export { isResponse } from './utils/isResponse';
|
|
31
31
|
export { getURL } from './getURL';
|
32
32
|
export { redirect } from './utils/redirect';
|
33
33
|
export { href } from './href';
|
34
|
-
export { getServerData, setServerData } from './
|
34
|
+
export { setResponseHeaders, getServerData, setServerData } from './vite/one-server-only';
|
35
35
|
export * from '@vxrn/universal-color-scheme';
|
36
36
|
export { useFocusEffect } from './useFocusEffect';
|
37
37
|
export { useNavigation } from './router/useNavigation';
|
package/types/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAA;AACjC,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;AAElF,YAAY,EAAE,QAAQ,EAAE,WAAW,E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AAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA"}
|
@@ -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, "
|
3
|
+
export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "layout" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "screenLayout" | "UNSTABLE_getStateForRouteNamesChange"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
4
4
|
children: React.ReactNode;
|
5
5
|
layout?: ((props: {
|
6
6
|
state: DrawerNavigationState<ParamListBase>;
|
@@ -48,7 +48,7 @@ export declare const Drawer: import("react").ForwardRefExoticComponent<Omit<Omit
|
|
48
48
|
UNSTABLE_getStateForRouteNamesChange?: (state: import("@react-navigation/routers").NavigationState) => import("@react-navigation/routers").PartialState<import("@react-navigation/routers").NavigationState> | undefined;
|
49
49
|
} & {
|
50
50
|
id?: undefined;
|
51
|
-
}, "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "
|
51
|
+
}, "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "layout" | "initialRouteName" | "screenOptions" | "id" | "screenListeners" | "screenLayout" | "UNSTABLE_getStateForRouteNamesChange"> & import("@react-navigation/routers").DefaultRouterOptions<string> & {
|
52
52
|
children: React.ReactNode;
|
53
53
|
layout?: ((props: {
|
54
54
|
state: DrawerNavigationState<ParamListBase>;
|