one 1.21.12 → 1.22.0
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/cli/build.cjs +13 -17
- package/dist/cjs/cli/build.native.js +12 -16
- package/dist/cjs/cli/build.native.js.map +1 -1
- package/dist/cjs/fork/NavigationContainer.cjs +2 -25
- package/dist/cjs/fork/NavigationContainer.native.js +1 -24
- package/dist/cjs/fork/NavigationContainer.native.js.map +1 -1
- package/dist/cjs/metro-config/withOne.test.cjs +2 -2
- package/dist/cjs/metro-config/withOne.test.native.js +2 -2
- package/dist/cjs/metro-config/withOne.test.native.js.map +1 -1
- package/dist/cjs/router/useInitializeOneRouter.cjs +3 -3
- package/dist/cjs/router/useInitializeOneRouter.native.js +3 -3
- package/dist/cjs/router/useInitializeOneRouter.native.js.map +1 -1
- package/dist/cjs/useLoader.native.js +0 -18
- package/dist/cjs/useLoader.native.js.map +1 -1
- package/dist/cjs/vite/one.cjs +2 -1
- package/dist/cjs/vite/one.native.js +6 -5
- package/dist/cjs/vite/one.native.js.map +1 -1
- package/dist/cjs/vite/plugins/bundledDevPlugin.cjs +130 -0
- package/dist/cjs/vite/plugins/bundledDevPlugin.native.js +154 -0
- package/dist/cjs/vite/plugins/bundledDevPlugin.native.js.map +1 -0
- package/dist/cjs/vite/plugins/devtoolsPlugin.cjs +4 -0
- package/dist/cjs/vite/plugins/devtoolsPlugin.native.js +5 -0
- package/dist/cjs/vite/plugins/devtoolsPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +29 -15
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +31 -14
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.cjs +16 -9
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.native.js +18 -9
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.test.native.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +9 -0
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +10 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/cli/build.mjs +13 -17
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js +12 -16
- package/dist/esm/cli/build.native.js.map +1 -1
- package/dist/esm/fork/NavigationContainer.mjs +2 -25
- package/dist/esm/fork/NavigationContainer.mjs.map +1 -1
- package/dist/esm/fork/NavigationContainer.native.js +1 -24
- package/dist/esm/fork/NavigationContainer.native.js.map +1 -1
- package/dist/esm/metro-config/withOne.test.mjs +2 -2
- package/dist/esm/metro-config/withOne.test.mjs.map +1 -1
- package/dist/esm/metro-config/withOne.test.native.js +2 -2
- package/dist/esm/metro-config/withOne.test.native.js.map +1 -1
- package/dist/esm/router/useInitializeOneRouter.mjs +3 -3
- package/dist/esm/router/useInitializeOneRouter.mjs.map +1 -1
- package/dist/esm/router/useInitializeOneRouter.native.js +3 -3
- package/dist/esm/router/useInitializeOneRouter.native.js.map +1 -1
- package/dist/esm/router/useScreens.test.mjs +1 -1
- package/dist/esm/router/useScreens.test.mjs.map +1 -1
- package/dist/esm/useLoader.native.js +0 -18
- package/dist/esm/useLoader.native.js.map +1 -1
- package/dist/esm/vite/one.mjs +2 -1
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +6 -5
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/bundledDevPlugin.mjs +94 -0
- package/dist/esm/vite/plugins/bundledDevPlugin.mjs.map +1 -0
- package/dist/esm/vite/plugins/bundledDevPlugin.native.js +115 -0
- package/dist/esm/vite/plugins/bundledDevPlugin.native.js.map +1 -0
- package/dist/esm/vite/plugins/devtoolsPlugin.mjs +4 -0
- package/dist/esm/vite/plugins/devtoolsPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/devtoolsPlugin.native.js +5 -0
- package/dist/esm/vite/plugins/devtoolsPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +29 -15
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +31 -14
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.mjs +16 -9
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.native.js +18 -9
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.test.native.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +9 -0
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +10 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/package.json +31 -29
- package/src/cli/build.ts +34 -37
- package/src/fork/NavigationContainer.tsx +10 -37
- package/src/metro-config/withOne.test.ts +6 -3
- package/src/router/useInitializeOneRouter.ts +8 -5
- package/src/useLoader.ts +6 -2
- package/src/vite/one.ts +3 -0
- package/src/vite/plugins/bundledDevPlugin.ts +116 -0
- package/src/vite/plugins/devtoolsPlugin.ts +19 -0
- package/src/vite/plugins/fileSystemRouterPlugin.test.ts +19 -9
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +48 -43
- package/src/vite/plugins/virtualEntryPlugin.ts +27 -0
- package/src/vite/types.ts +11 -0
- package/types/cli/build.d.ts.map +1 -1
- package/types/fork/NavigationContainer.d.ts.map +1 -1
- package/types/fork/useLinking.native.d.ts +4 -4
- package/types/layouts/Drawer.d.ts +4 -4
- package/types/layouts/Stack.d.ts +4 -4
- package/types/layouts/Tabs.d.ts +4 -4
- package/types/router/useInitializeOneRouter.d.ts.map +1 -1
- package/types/ui/TabContext.d.ts +7 -7
- package/types/ui/TabRouter.d.ts +5 -5
- package/types/ui/TabRouter.d.ts.map +1 -1
- package/types/ui/Tabs.d.ts +9 -9
- package/types/useLoader.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/bundledDevPlugin.d.ts +3 -0
- package/types/vite/plugins/bundledDevPlugin.d.ts.map +1 -0
- package/types/vite/plugins/devtoolsPlugin.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
- package/types/vite/types.d.ts +10 -0
- package/types/vite/types.d.ts.map +1 -1
- package/vendor/react/package.json +2 -2
- package/vendor/react-dom/package.json +2 -2
- package/dist/cjs/fork/SSRNavigationContainer.cjs +0 -149
- package/dist/cjs/fork/SSRNavigationContainer.native.js +0 -199
- package/dist/cjs/fork/SSRNavigationContainer.native.js.map +0 -1
- package/dist/esm/fork/SSRNavigationContainer.mjs +0 -124
- package/dist/esm/fork/SSRNavigationContainer.mjs.map +0 -1
- package/dist/esm/fork/SSRNavigationContainer.native.js +0 -160
- package/dist/esm/fork/SSRNavigationContainer.native.js.map +0 -1
- package/src/fork/SSRNavigationContainer.tsx +0 -148
- package/types/fork/SSRNavigationContainer.d.ts +0 -16
- package/types/fork/SSRNavigationContainer.d.ts.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import fs from 'node:fs'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
import type { Plugin } from 'vite'
|
|
4
|
+
import { virtualEntryId } from './virtualEntryConstants'
|
|
5
|
+
|
|
6
|
+
// Vite 8.1 experimental bundled dev (FullBundleDevEnvironment): a rolldown-powered
|
|
7
|
+
// single-bundle web client. This plugin wires up the pieces One needs to run under
|
|
8
|
+
// it. Enable with `one({ web: { experimentalBundledDev: true } })`. Only active in
|
|
9
|
+
// dev (serve); a no-op for builds and for non-web environments.
|
|
10
|
+
//
|
|
11
|
+
// Companion changes live where they're structurally required:
|
|
12
|
+
// - virtualEntryPlugin: installs the react-refresh preamble into the bundled
|
|
13
|
+
// client entry (the separate /@one/dev.js path can't, since /@vite/client isn't
|
|
14
|
+
// a standalone module in bundled mode).
|
|
15
|
+
// - fileSystemRouterPlugin: serves the bundled entry url and drops /@vite/client
|
|
16
|
+
// from preloads.
|
|
17
|
+
// - devtoolsPlugin: stubs /@vite/client + /@react-refresh imports in /@one/dev.js.
|
|
18
|
+
|
|
19
|
+
const MIME: Record<string, string> = {
|
|
20
|
+
png: 'image/png',
|
|
21
|
+
jpg: 'image/jpeg',
|
|
22
|
+
jpeg: 'image/jpeg',
|
|
23
|
+
gif: 'image/gif',
|
|
24
|
+
webp: 'image/webp',
|
|
25
|
+
avif: 'image/avif',
|
|
26
|
+
bmp: 'image/bmp',
|
|
27
|
+
ico: 'image/x-icon',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// rolldown's native asset handling drops default-import asset specifiers
|
|
31
|
+
// (`import logo from './logo.png'`) coming from raw-bundled node_modules deps under
|
|
32
|
+
// One's client env — the binding is elided while its usage is kept, crashing with
|
|
33
|
+
// "X is not defined" (e.g. @react-navigation/elements' icon Assets). transform() DOES
|
|
34
|
+
// run in the FullBundleDev pipeline, so rewrite those imports to inline data-uris.
|
|
35
|
+
//
|
|
36
|
+
// The same data-uri must be produced on the SERVER too: SSR otherwise emits the
|
|
37
|
+
// original asset URL (e.g. `<img src="/features/.../mj.jpg">`), which both 404s under
|
|
38
|
+
// FullBundleDev and diverges from the client's inlined data-uri → React hydration
|
|
39
|
+
// mismatch. So the inliner runs on client (rolldown plugin) and ssr (top-level
|
|
40
|
+
// transform) alike — see bundledDevPlugin().
|
|
41
|
+
function inlineAssetImports(code: string, id: string): { code: string; map: null } | null {
|
|
42
|
+
if (!/\.(png|jpe?g|gif|webp|avif|bmp|ico)/.test(code)) return null
|
|
43
|
+
const importRe =
|
|
44
|
+
/import\s+(\w+)\s+from\s*['"]([^'"?]+\.(?:png|jpe?g|gif|webp|avif|bmp|ico))['"]\s*;?/g
|
|
45
|
+
const base = id.split('?')[0]
|
|
46
|
+
let result = code
|
|
47
|
+
let changed = false
|
|
48
|
+
let m: RegExpExecArray | null
|
|
49
|
+
const edits: { full: string; name: string; uri: string }[] = []
|
|
50
|
+
while ((m = importRe.exec(code))) {
|
|
51
|
+
const [full, name, spec] = m
|
|
52
|
+
const abs = spec.startsWith('.') ? path.resolve(path.dirname(base), spec) : null
|
|
53
|
+
if (!abs || !fs.existsSync(abs)) continue
|
|
54
|
+
const ext = path.extname(abs).slice(1).toLowerCase()
|
|
55
|
+
const uri = `data:${MIME[ext] || 'application/octet-stream'};base64,${fs.readFileSync(abs).toString('base64')}`
|
|
56
|
+
edits.push({ full, name, uri })
|
|
57
|
+
}
|
|
58
|
+
for (const e of edits) {
|
|
59
|
+
result = result.replace(e.full, `const ${e.name} = ${JSON.stringify(e.uri)};`)
|
|
60
|
+
changed = true
|
|
61
|
+
}
|
|
62
|
+
return changed ? { code: result, map: null } : null
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function webBundledAssetPlugin() {
|
|
66
|
+
return {
|
|
67
|
+
name: 'one:web-bundled-asset',
|
|
68
|
+
transform: (code: string, id: string) => inlineAssetImports(code, id),
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function bundledDevPlugin(enabled: boolean): Plugin {
|
|
73
|
+
return {
|
|
74
|
+
name: 'one:bundled-dev',
|
|
75
|
+
|
|
76
|
+
// mirror the client's asset inlining on the server env so SSR emits the same
|
|
77
|
+
// data-uris (the rolldown client plugin above can't reach the ssr pipeline).
|
|
78
|
+
transform(code, id) {
|
|
79
|
+
if (!enabled) return
|
|
80
|
+
const env = (this as any).environment
|
|
81
|
+
if (!env || env.name !== 'ssr' || env.mode !== 'dev') return
|
|
82
|
+
return inlineAssetImports(code, id)
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
config(_userConfig, env) {
|
|
86
|
+
if (!enabled || env.command !== 'serve') return
|
|
87
|
+
|
|
88
|
+
return {
|
|
89
|
+
experimental: { bundledDev: true },
|
|
90
|
+
environments: {
|
|
91
|
+
client: {
|
|
92
|
+
build: {
|
|
93
|
+
rolldownOptions: {
|
|
94
|
+
// bundle the virtual entry so FullBundleDev serves it at
|
|
95
|
+
// /assets/_virtual_one-entry.js
|
|
96
|
+
input: [virtualEntryId],
|
|
97
|
+
plugins: [webBundledAssetPlugin()],
|
|
98
|
+
experimental: {
|
|
99
|
+
// rolldown 1.1.0 defaulted lazyBarrel ON, which breaks One's
|
|
100
|
+
// index.mjs barrel re-exports under FullBundleDev (e.g. `Slot`
|
|
101
|
+
// resolves to undefined). pin it off.
|
|
102
|
+
lazyBarrel: false,
|
|
103
|
+
},
|
|
104
|
+
// react-native packages import native-only exports
|
|
105
|
+
// (codegenNativeComponent, TurboModuleRegistry, …) from react-native
|
|
106
|
+
// → aliased to react-native-web, which doesn't export them. shim as
|
|
107
|
+
// undefined instead of failing the build (matches the dep optimizer).
|
|
108
|
+
shimMissingExports: true,
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -18,6 +18,13 @@ export function createDevtoolsPlugin(options: DevtoolsPluginOptions = {}): Plugi
|
|
|
18
18
|
apply: 'serve', // only in dev
|
|
19
19
|
|
|
20
20
|
configureServer(server) {
|
|
21
|
+
// vite 8.1 bundledDev: /@vite/client and /@react-refresh aren't standalone
|
|
22
|
+
// modules (the HMR client + refresh runtime are bundled into the entry), so
|
|
23
|
+
// dev.mjs's top-level imports of them 404 / fail MIME checks and take the whole
|
|
24
|
+
// devtools script down. stub them: HMR (route/loader/css/cursor) becomes a
|
|
25
|
+
// no-op here and the refresh preamble is installed by the bundled entry instead.
|
|
26
|
+
const isBundledDev = !!(server.config as any).experimental?.bundledDev
|
|
27
|
+
|
|
21
28
|
// serve the devtools script by reading and combining the source files
|
|
22
29
|
server.middlewares.use(async (req, res, next) => {
|
|
23
30
|
if (req.url === DEVTOOLS_VIRTUAL_ID) {
|
|
@@ -31,6 +38,18 @@ export function createDevtoolsPlugin(options: DevtoolsPluginOptions = {}): Plugi
|
|
|
31
38
|
.replace("import './devtools.mjs'", '')
|
|
32
39
|
.replace("import './source-inspector.mjs'", '')
|
|
33
40
|
|
|
41
|
+
if (isBundledDev) {
|
|
42
|
+
code = code
|
|
43
|
+
.replace(
|
|
44
|
+
"import { createHotContext } from '/@vite/client'",
|
|
45
|
+
'const createHotContext = () => ({ on() {}, off() {}, accept() {}, dispose() {}, prune() {}, send() {}, invalidate() {} })'
|
|
46
|
+
)
|
|
47
|
+
.replace(
|
|
48
|
+
"import { injectIntoGlobalHook } from '/@react-refresh'",
|
|
49
|
+
'const injectIntoGlobalHook = () => {}'
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
34
53
|
// only include devtools UI if enabled
|
|
35
54
|
if (includeUI) {
|
|
36
55
|
const devtoolsPath = resolvePath('one/devtools/devtools.mjs')
|
|
@@ -9,7 +9,6 @@ vi.mock('vite', async () => {
|
|
|
9
9
|
return {
|
|
10
10
|
...actual,
|
|
11
11
|
createServerModuleRunner: vi.fn(() => ({
|
|
12
|
-
clearCache: vi.fn(),
|
|
13
12
|
import: vi.fn(),
|
|
14
13
|
})),
|
|
15
14
|
}
|
|
@@ -24,6 +23,7 @@ type MiddlewareHandler = (
|
|
|
24
23
|
type WatcherListener = (...args: string[]) => void | Promise<void>
|
|
25
24
|
|
|
26
25
|
describe('createFileSystemRouterPlugin', () => {
|
|
26
|
+
const previousVxrnVersion = globalThis['__vxrnVersion']
|
|
27
27
|
const previousIsVxrnCli = process.env.IS_VXRN_CLI
|
|
28
28
|
const previousViteEnvironment = process.env.VITE_ENVIRONMENT
|
|
29
29
|
let previousVxrnPluginConfig: unknown
|
|
@@ -55,6 +55,7 @@ describe('createFileSystemRouterPlugin', () => {
|
|
|
55
55
|
} else {
|
|
56
56
|
;(globalThis as any).__vxrnPluginConfig__ = previousVxrnPluginConfig
|
|
57
57
|
}
|
|
58
|
+
globalThis['__vxrnVersion'] = previousVxrnVersion
|
|
58
59
|
vi.restoreAllMocks()
|
|
59
60
|
})
|
|
60
61
|
|
|
@@ -135,7 +136,6 @@ describe('createFileSystemRouterPlugin', () => {
|
|
|
135
136
|
let renderCount = 0
|
|
136
137
|
const render = vi.fn(async () => `<html><body>${++renderCount}</body></html>`)
|
|
137
138
|
const runner = {
|
|
138
|
-
clearCache: vi.fn(),
|
|
139
139
|
import: vi.fn(async (id: string) => {
|
|
140
140
|
if (id === virtualEntryId) {
|
|
141
141
|
return { default: { render } }
|
|
@@ -234,15 +234,25 @@ describe('createFileSystemRouterPlugin', () => {
|
|
|
234
234
|
await expect(request('/')).resolves.toContain('<body>1</body>')
|
|
235
235
|
expect(render).toHaveBeenCalledTimes(1)
|
|
236
236
|
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
const versionBeforeChange = globalThis['__vxrnVersion']
|
|
238
|
+
// vite calls hotUpdate on the ssr environment after invalidating the graph;
|
|
239
|
+
// that is what tells the next render its route tree is built out of pre-edit
|
|
240
|
+
// modules
|
|
241
|
+
;(plugin as any).hotUpdate.call(
|
|
242
|
+
{
|
|
243
|
+
environment: {
|
|
244
|
+
name: 'ssr',
|
|
245
|
+
moduleGraph: { getModulesByFile: () => new Set([{ id: routeFile }]) },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
{ file: routeFile }
|
|
249
|
+
)
|
|
243
250
|
|
|
244
251
|
await expect(request('/')).resolves.toContain('<body>2</body>')
|
|
245
252
|
expect(render).toHaveBeenCalledTimes(2)
|
|
246
|
-
|
|
253
|
+
|
|
254
|
+
// the render also has to invalidate the route context the tree is built
|
|
255
|
+
// from, otherwise it renders fresh html out of pre-edit route modules
|
|
256
|
+
expect(globalThis['__vxrnVersion']).toBe((versionBeforeChange || 0) + 1)
|
|
247
257
|
})
|
|
248
258
|
})
|
|
@@ -45,17 +45,19 @@ const routeTypeColors: Record<string, (s: string) => string> = {
|
|
|
45
45
|
const USE_SERVER_ENV = false //!!process.env.USE_SERVER_ENV
|
|
46
46
|
|
|
47
47
|
export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin {
|
|
48
|
-
|
|
48
|
+
// under vite 8.1 bundledDev the client entry is bundled and served at a fixed
|
|
49
|
+
// /assets url instead of the unbundled /@id/__x00__virtual url. swapped in
|
|
50
|
+
// configureServer once we can see whether the client env is bundled.
|
|
51
|
+
let preloads = ['/@vite/client', virtalEntryIdClient]
|
|
49
52
|
|
|
50
53
|
let runner: ModuleRunner
|
|
51
54
|
let server: ViteDevServer
|
|
52
55
|
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
|
|
58
|
-
let needsCacheClear = true
|
|
56
|
+
// set by hotUpdate below when the ssr environment sees a file change, consumed
|
|
57
|
+
// by the next page render. only refresh on an actual change, never per
|
|
58
|
+
// request: a per-request refresh rebuilds the route tree and re-renders every
|
|
59
|
+
// ssg page for nothing.
|
|
60
|
+
let needsRouteRefresh = false
|
|
59
61
|
|
|
60
62
|
// Track file dependencies from loaders for hot reload
|
|
61
63
|
// Maps file path -> set of route paths that depend on it
|
|
@@ -124,7 +126,7 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
124
126
|
{
|
|
125
127
|
async handlePage({ route, url, loaderProps }) {
|
|
126
128
|
const ssgCacheKey = route.type === 'ssg' ? getSsgHtmlCacheKey(route, url) : null
|
|
127
|
-
if (ssgCacheKey && !
|
|
129
|
+
if (ssgCacheKey && !needsRouteRefresh) {
|
|
128
130
|
const cachedHtml = ssgHtmlCache.get(ssgCacheKey)
|
|
129
131
|
if (cachedHtml) {
|
|
130
132
|
return cachedHtml
|
|
@@ -166,7 +168,7 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
166
168
|
await renderPromise
|
|
167
169
|
}
|
|
168
170
|
|
|
169
|
-
if (ssgCacheKey && !
|
|
171
|
+
if (ssgCacheKey && !needsRouteRefresh) {
|
|
170
172
|
const cachedHtml = ssgHtmlCache.get(ssgCacheKey)
|
|
171
173
|
if (cachedHtml) {
|
|
172
174
|
return cachedHtml
|
|
@@ -183,10 +185,17 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
183
185
|
// so we must branch on route.file, not the joined path.
|
|
184
186
|
const isGeneratedNotFound = route.file === ''
|
|
185
187
|
const routeFile = isGeneratedNotFound ? '' : path.join(routerRoot, route.file)
|
|
186
|
-
if (
|
|
187
|
-
runner
|
|
188
|
+
if (needsRouteRefresh) {
|
|
189
|
+
// the module runner keeps itself fresh: every import re-checks the
|
|
190
|
+
// server, which has already invalidated the changed file and its
|
|
191
|
+
// importers, so only that chain re-evaluates. what it can't know
|
|
192
|
+
// about is our own route cache — the route context in
|
|
193
|
+
// useViteRoutes holds resolved route modules, and the SSR route
|
|
194
|
+
// tree is built from that context. bumping the version both watch
|
|
195
|
+
// rebuilds them from the fresh modules on this render.
|
|
196
|
+
globalThis['__vxrnVersion'] = (globalThis['__vxrnVersion'] || 0) + 1
|
|
188
197
|
ssgHtmlCache.clear()
|
|
189
|
-
|
|
198
|
+
needsRouteRefresh = false
|
|
190
199
|
}
|
|
191
200
|
|
|
192
201
|
globalThis['__vxrnresetState']?.()
|
|
@@ -587,7 +596,7 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
587
596
|
try {
|
|
588
597
|
handleRequest = createRequestHandler()
|
|
589
598
|
ssgHtmlCache.clear()
|
|
590
|
-
|
|
599
|
+
needsRouteRefresh = true
|
|
591
600
|
} catch (error) {
|
|
592
601
|
console.warn(`[one] Failed to rebuild routes after ${changedPath} changed.`, error)
|
|
593
602
|
}
|
|
@@ -598,6 +607,22 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
598
607
|
enforce: 'post',
|
|
599
608
|
apply: 'serve',
|
|
600
609
|
|
|
610
|
+
// the route tree we rendered from is built out of whatever route modules
|
|
611
|
+
// were resolved at the time, so any ssr-side change makes it stale. this
|
|
612
|
+
// runs inside vite's update sequence, after the graph has been invalidated,
|
|
613
|
+
// so by the time the next render reads the flag the fresh modules are
|
|
614
|
+
// already there to rebuild from.
|
|
615
|
+
//
|
|
616
|
+
// ask the graph rather than reading the `modules` argument: vite calls
|
|
617
|
+
// hotUpdate for every watcher event including files it knows nothing about,
|
|
618
|
+
// and an earlier plugin may have replaced `modules` (route-module-hmr-fix
|
|
619
|
+
// returns [] for ssr app files to suppress the full reload).
|
|
620
|
+
hotUpdate({ file }) {
|
|
621
|
+
if (this.environment.name !== 'ssr') return
|
|
622
|
+
if (!this.environment.moduleGraph.getModulesByFile(file)?.size) return
|
|
623
|
+
needsRouteRefresh = true
|
|
624
|
+
},
|
|
625
|
+
|
|
601
626
|
async config() {
|
|
602
627
|
const setting = options.optimization?.autoEntriesScanning ?? 'flat'
|
|
603
628
|
const routerRoot = normalizePath(getRouterRootFromOneOptions(options))
|
|
@@ -651,6 +676,16 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
651
676
|
configureServer(serverIn) {
|
|
652
677
|
server = serverIn
|
|
653
678
|
|
|
679
|
+
// vite 8.1 bundledDev: the client env bundles the virtual entry and serves
|
|
680
|
+
// it at /assets/_virtual_one-entry.js. the unbundled /@id/__x00__virtual url
|
|
681
|
+
// 404s in this mode, so point preloads (and bootstrap) at the bundled url.
|
|
682
|
+
const clientEnv = server.environments?.client as any
|
|
683
|
+
if (clientEnv?.config?.isBundled || clientEnv?.bundledDev) {
|
|
684
|
+
// bundled mode: the HMR client + refresh runtime are bundled into the
|
|
685
|
+
// entry; /@vite/client doesn't exist as a standalone module (404s).
|
|
686
|
+
preloads = ['/assets/_virtual_one-entry.js']
|
|
687
|
+
}
|
|
688
|
+
|
|
654
689
|
// change this to .server to test using the indepedently scoped env
|
|
655
690
|
runner = createServerModuleRunner(
|
|
656
691
|
USE_SERVER_ENV ? server.environments.server : server.environments.ssr
|
|
@@ -658,36 +693,6 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
658
693
|
|
|
659
694
|
const appDir = path.resolve(process.cwd(), getRouterRootFromOneOptions(options))
|
|
660
695
|
|
|
661
|
-
// any watched file change means the SSR runner may be serving stale module
|
|
662
|
-
// code — mark the cache dirty so the next render re-evaluates once (set
|
|
663
|
-
// immediately/undebounced so it can't race ahead of a render).
|
|
664
|
-
//
|
|
665
|
-
// but only for files the SSR runner has ACTUALLY evaluated. the watcher
|
|
666
|
-
// fires for EVERY file event under the project root — including build-tool
|
|
667
|
-
// scratch files (e.g. *.bun-build temp artifacts), freshly created
|
|
668
|
-
// unrelated files, and other tooling's churn. in a busy monorepo that
|
|
669
|
-
// churn is near-constant, and marking the cache dirty on it forces a full
|
|
670
|
-
// re-evaluation of the SSR module tree on the very next render (a new
|
|
671
|
-
// AsyncFunction per module) — exactly the unbounded heap leak the
|
|
672
|
-
// needsCacheClear comment above exists to prevent (→ 5-8GB RSS / OOM).
|
|
673
|
-
//
|
|
674
|
-
// `runner.evaluatedModules` is the precise set clearCache() would re-evaluate,
|
|
675
|
-
// so a change outside it can never make the cache stale. it correctly
|
|
676
|
-
// includes both route files (loaded via runner.import) and shared source
|
|
677
|
-
// modules — unlike server.environments.ssr.moduleGraph, which misses
|
|
678
|
-
// runner-imported route files. (route-file adds/removes are still handled
|
|
679
|
-
// separately below via recreateRequestHandler, so a brand-new route is
|
|
680
|
-
// never missed.)
|
|
681
|
-
server.watcher.on('all', (_event, file) => {
|
|
682
|
-
if (file && runner?.evaluatedModules) {
|
|
683
|
-
const mods =
|
|
684
|
-
runner.evaluatedModules.getModulesByFile(file) ||
|
|
685
|
-
runner.evaluatedModules.getModulesByFile(normalizePath(file))
|
|
686
|
-
if (!mods || mods.size === 0) return
|
|
687
|
-
}
|
|
688
|
-
needsCacheClear = true
|
|
689
|
-
})
|
|
690
|
-
|
|
691
696
|
// on change ./app stuff lets reload this to pick up any route changes
|
|
692
697
|
const fileWatcherChangeListener = debounce((type: string, changedPath: string) => {
|
|
693
698
|
if (
|
|
@@ -226,12 +226,39 @@ export function createVirtualEntry(options: {
|
|
|
226
226
|
const linkingArg = options.router?.linking
|
|
227
227
|
? `linking: ${JSON.stringify(options.router.linking)},`
|
|
228
228
|
: ''
|
|
229
|
+
|
|
230
|
+
// vite 8.1 bundledDev: the client is a single bundle, so the react-refresh
|
|
231
|
+
// preamble normally provided by /@one/dev.js (which imports /@vite/client —
|
|
232
|
+
// a module that doesn't exist in bundled mode) never installs $RefreshReg$,
|
|
233
|
+
// and every compiler-wrapped route module then throws "preamble was not
|
|
234
|
+
// loaded". install it here instead — this runs at entry-body time, before
|
|
235
|
+
// the lazily-globbed route modules evaluate. ('one' and /@react-refresh are
|
|
236
|
+
// node_modules / the runtime, so neither is refresh-wrapped.)
|
|
237
|
+
// `isBundled` is true for EVERY environment during build, so it alone can't
|
|
238
|
+
// gate this — a prod build would emit an import of /@react-refresh, which
|
|
239
|
+
// only exists while serving. dev mode is what makes the preamble necessary.
|
|
240
|
+
const isBundledClient =
|
|
241
|
+
this.environment.mode === 'dev' &&
|
|
242
|
+
this.environment.name === 'client' &&
|
|
243
|
+
!!(this.environment.config as any)?.isBundled
|
|
244
|
+
const refreshPreambleImport = isBundledClient
|
|
245
|
+
? `import { injectIntoGlobalHook as __oneInjectRefresh } from '/@react-refresh'`
|
|
246
|
+
: ''
|
|
247
|
+
const refreshPreambleSetup = isBundledClient
|
|
248
|
+
? `if (typeof window !== 'undefined' && !window.$RefreshReg$) {
|
|
249
|
+
__oneInjectRefresh(window)
|
|
250
|
+
window.$RefreshReg$ = () => {}
|
|
251
|
+
window.$RefreshSig$ = () => (type) => type
|
|
252
|
+
}`
|
|
253
|
+
: ''
|
|
229
254
|
return `
|
|
230
255
|
${setupResult.promiseDeclaration}
|
|
231
256
|
${nativewindImport}
|
|
257
|
+
${refreshPreambleImport}
|
|
232
258
|
|
|
233
259
|
import { createApp, registerPreloadedRoute as _registerPreloadedRoute } from 'one'
|
|
234
260
|
${setupResult.importStatement}
|
|
261
|
+
${refreshPreambleSetup}
|
|
235
262
|
|
|
236
263
|
// Export registerPreloadedRoute so preload files can import it from this bundle
|
|
237
264
|
// Named export that wraps the original function
|
package/src/vite/types.ts
CHANGED
|
@@ -544,6 +544,17 @@ export namespace One {
|
|
|
544
544
|
* @default false
|
|
545
545
|
*/
|
|
546
546
|
suspendRoutes?: boolean
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Experimental: serve the web client through Vite 8.1's bundled dev mode
|
|
550
|
+
* (rolldown-powered FullBundleDevEnvironment) instead of unbundled ESM dev.
|
|
551
|
+
* Fewer requests / faster parse, especially for apps with large icon/util
|
|
552
|
+
* imports. Dev-only; ignored for builds.
|
|
553
|
+
*
|
|
554
|
+
* @experimental
|
|
555
|
+
* @default false
|
|
556
|
+
*/
|
|
557
|
+
experimentalBundledDev?: boolean
|
|
547
558
|
}
|
|
548
559
|
|
|
549
560
|
/**
|
package/types/cli/build.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAmXA,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;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/cli/build.ts"],"names":[],"mappings":"AAmXA,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;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,iBAuxCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAK5B,MAAM,wBAAwB,CAAA;AAO/B,OAAO,EAEL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAEnB,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,OAAO,CAAC,MAAM,CAAC;IAGb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAA;CACF;
|
|
1
|
+
{"version":3,"file":"NavigationContainer.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAK5B,MAAM,wBAAwB,CAAA;AAO/B,OAAO,EAEL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EAEnB,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,OAAO,CAAC,MAAM,CAAC;IAGb,IAAI,yBAAyB,EAAE,OAAO,CACpC,sBAAsB,CAAC,GAAG,CAAC,EAC3B;QAAE,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC,CAAA;KAAE,CAC1C,CAAA;CACF;AAID,KAAK,KAAK,CAAC,SAAS,SAAS,EAAE,IAAI,wBAAwB,GAAG;IAC5D,SAAS,CAAC,EAAE,eAAe,CAAA;IAC3B,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,aAAa,CAAC,EAAE,oBAAoB,CAAA;CACrC,CAAA;AA2ID,eAAO,MAAM,mBAAmB,EAAiD,CAC/E,aAAa,SAAS,EAAE,GAAG,eAAe,CAAC,aAAa,EAExD,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAA;CACvD,KACE,KAAK,CAAC,YAAY,CAAA"}
|
|
@@ -15,24 +15,24 @@ export declare function useLinking(ref: React.RefObject<NavigationContainerRef<P
|
|
|
15
15
|
index: number;
|
|
16
16
|
routeNames: string[];
|
|
17
17
|
history?: unknown[];
|
|
18
|
-
routes: import("@react-navigation/
|
|
18
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
19
19
|
type: string;
|
|
20
20
|
stale: false;
|
|
21
21
|
}>, "stale" | "routes">> & Readonly<{
|
|
22
22
|
stale?: true;
|
|
23
|
-
routes: import("@react-navigation/
|
|
23
|
+
routes: import("@react-navigation/core").PartialRoute<import("@react-navigation/core").Route<string, object | undefined>>[];
|
|
24
24
|
}> & {
|
|
25
25
|
state?: Partial<Omit<Readonly<{
|
|
26
26
|
key: string;
|
|
27
27
|
index: number;
|
|
28
28
|
routeNames: string[];
|
|
29
29
|
history?: unknown[];
|
|
30
|
-
routes: import("@react-navigation/
|
|
30
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
31
31
|
type: string;
|
|
32
32
|
stale: false;
|
|
33
33
|
}>, "stale" | "routes">> & Readonly<{
|
|
34
34
|
stale?: true;
|
|
35
|
-
routes: import("@react-navigation/
|
|
35
|
+
routes: import("@react-navigation/core").PartialRoute<import("@react-navigation/core").Route<string, object | undefined>>[];
|
|
36
36
|
}> & /*elided*/ any;
|
|
37
37
|
}) | undefined>;
|
|
38
38
|
};
|
|
@@ -11,7 +11,7 @@ type DrawerExtraProps = {
|
|
|
11
11
|
*/
|
|
12
12
|
render?: DrawerRender;
|
|
13
13
|
};
|
|
14
|
-
export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
14
|
+
export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
layout?: ((props: {
|
|
17
17
|
state: DrawerNavigationState<ParamListBase>;
|
|
@@ -56,13 +56,13 @@ export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<impo
|
|
|
56
56
|
payload?: object;
|
|
57
57
|
source?: string;
|
|
58
58
|
target?: string;
|
|
59
|
-
}>>(original: import("@react-navigation/
|
|
59
|
+
}>>(original: import("@react-navigation/core").Router<DrawerNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<DrawerNavigationState<ParamListBase>, Action>>) | undefined;
|
|
60
60
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
61
61
|
} & ({
|
|
62
62
|
id?: undefined;
|
|
63
63
|
} | {
|
|
64
64
|
id: string;
|
|
65
|
-
})), "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
65
|
+
})), "children"> & Partial<Pick<Omit<import("@react-navigation/drawer").DrawerNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
66
66
|
children: React.ReactNode;
|
|
67
67
|
layout?: ((props: {
|
|
68
68
|
state: DrawerNavigationState<ParamListBase>;
|
|
@@ -107,7 +107,7 @@ export declare const Drawer: React.ForwardRefExoticComponent<Omit<Omit<Omit<impo
|
|
|
107
107
|
payload?: object;
|
|
108
108
|
source?: string;
|
|
109
109
|
target?: string;
|
|
110
|
-
}>>(original: import("@react-navigation/
|
|
110
|
+
}>>(original: import("@react-navigation/core").Router<DrawerNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<DrawerNavigationState<ParamListBase>, Action>>) | undefined;
|
|
111
111
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
112
112
|
} & ({
|
|
113
113
|
id?: undefined;
|
package/types/layouts/Stack.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type StackExtraProps = {
|
|
|
12
12
|
*/
|
|
13
13
|
render?: StackRender;
|
|
14
14
|
};
|
|
15
|
-
export declare const Stack: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
15
|
+
export declare const Stack: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
layout?: ((props: {
|
|
18
18
|
state: StackNavigationState<ParamListBase>;
|
|
@@ -53,13 +53,13 @@ export declare const Stack: React.ForwardRefExoticComponent<Omit<Omit<Omit<impor
|
|
|
53
53
|
payload?: object;
|
|
54
54
|
source?: string;
|
|
55
55
|
target?: string;
|
|
56
|
-
}>>(original: import("@react-navigation/
|
|
56
|
+
}>>(original: import("@react-navigation/core").Router<StackNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<StackNavigationState<ParamListBase>, Action>>) | undefined;
|
|
57
57
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
58
58
|
} & ({
|
|
59
59
|
id?: undefined;
|
|
60
60
|
} | {
|
|
61
61
|
id: string;
|
|
62
|
-
})), "children"> & Partial<Pick<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
62
|
+
})), "children"> & Partial<Pick<Omit<import("@react-navigation/native-stack").NativeStackNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
63
63
|
children: React.ReactNode;
|
|
64
64
|
layout?: ((props: {
|
|
65
65
|
state: StackNavigationState<ParamListBase>;
|
|
@@ -100,7 +100,7 @@ export declare const Stack: React.ForwardRefExoticComponent<Omit<Omit<Omit<impor
|
|
|
100
100
|
payload?: object;
|
|
101
101
|
source?: string;
|
|
102
102
|
target?: string;
|
|
103
|
-
}>>(original: import("@react-navigation/
|
|
103
|
+
}>>(original: import("@react-navigation/core").Router<StackNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<StackNavigationState<ParamListBase>, Action>>) | undefined;
|
|
104
104
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
105
105
|
} & ({
|
|
106
106
|
id?: undefined;
|
package/types/layouts/Tabs.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ type TabsExtraProps = {
|
|
|
11
11
|
*/
|
|
12
12
|
render?: TabsRender;
|
|
13
13
|
};
|
|
14
|
-
export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
14
|
+
export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
15
15
|
children: React.ReactNode;
|
|
16
16
|
layout?: ((props: {
|
|
17
17
|
state: TabNavigationState<ParamListBase>;
|
|
@@ -52,13 +52,13 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<Omit<import
|
|
|
52
52
|
payload?: object;
|
|
53
53
|
source?: string;
|
|
54
54
|
target?: string;
|
|
55
|
-
}>>(original: import("@react-navigation/
|
|
55
|
+
}>>(original: import("@react-navigation/core").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
|
|
56
56
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
57
57
|
} & ({
|
|
58
58
|
id?: undefined;
|
|
59
59
|
} | {
|
|
60
60
|
id: string;
|
|
61
|
-
})), "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/
|
|
61
|
+
})), "children"> & Partial<Pick<Omit<import("@react-navigation/bottom-tabs").BottomTabNavigatorProps, "children" | "initialRouteName" | "layout" | "id" | "screenOptions" | "screenListeners" | "screenLayout" | "UNSTABLE_router" | "UNSTABLE_routeNamesChangeBehavior"> & import("@react-navigation/core").DefaultRouterOptions<string> & ({
|
|
62
62
|
children: React.ReactNode;
|
|
63
63
|
layout?: ((props: {
|
|
64
64
|
state: TabNavigationState<ParamListBase>;
|
|
@@ -99,7 +99,7 @@ export declare const Tabs: React.ForwardRefExoticComponent<Omit<Omit<Omit<import
|
|
|
99
99
|
payload?: object;
|
|
100
100
|
source?: string;
|
|
101
101
|
target?: string;
|
|
102
|
-
}>>(original: import("@react-navigation/
|
|
102
|
+
}>>(original: import("@react-navigation/core").Router<TabNavigationState<ParamListBase>, Action>) => Partial<import("@react-navigation/core").Router<TabNavigationState<ParamListBase>, Action>>) | undefined;
|
|
103
103
|
UNSTABLE_routeNamesChangeBehavior?: "firstMatch" | "lastUnhandled";
|
|
104
104
|
} & ({
|
|
105
105
|
id?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInitializeOneRouter.d.ts","sourceRoot":"","sources":["../../src/router/useInitializeOneRouter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useInitializeOneRouter.d.ts","sourceRoot":"","sources":["../../src/router/useInitializeOneRouter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,WAAW,MAAM,UAAU,CAAA;AAevC,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,GAAG,CAAC,YAAY,EACzB,eAAe,EAAE,GAAG,GAAG,SAAS,EAChC,OAAO,CAAC,EAAE,gBAAgB,sBAsC3B;AAGD,wBAAgB,mBAAmB,SAElC;AAKD,wBAAgB,UAAU,SAGzB"}
|
package/types/ui/TabContext.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const TabsDescriptorsContext: import("react").Context<Record<stri
|
|
|
75
75
|
merge?: boolean;
|
|
76
76
|
} : never): void;
|
|
77
77
|
preload<RouteName extends string>(...args: RouteName extends unknown ? [screen: RouteName, params?: object | undefined] : never): void;
|
|
78
|
-
reset(state: TabNavigationState<any> | import("@react-navigation/
|
|
78
|
+
reset(state: TabNavigationState<any> | import("@react-navigation/core").PartialState<TabNavigationState<any>>): void;
|
|
79
79
|
goBack(): void;
|
|
80
80
|
isFocused(): boolean;
|
|
81
81
|
canGoBack(): boolean;
|
|
@@ -88,7 +88,7 @@ export declare const TabsDescriptorsContext: import("react").Context<Record<stri
|
|
|
88
88
|
index: number;
|
|
89
89
|
routeNames: string[];
|
|
90
90
|
history?: unknown[];
|
|
91
|
-
routes: import("@react-navigation/
|
|
91
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
92
92
|
type: string;
|
|
93
93
|
stale: false;
|
|
94
94
|
}>, {}, {}> | undefined>(id?: string | undefined): T;
|
|
@@ -111,7 +111,7 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
111
111
|
index: number;
|
|
112
112
|
routeNames: string[];
|
|
113
113
|
history?: unknown[];
|
|
114
|
-
routes: import("@react-navigation/
|
|
114
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
115
115
|
type: string;
|
|
116
116
|
stale: false;
|
|
117
117
|
}>>) => Readonly<{
|
|
@@ -151,15 +151,15 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
151
151
|
index: number;
|
|
152
152
|
routeNames: string[];
|
|
153
153
|
history?: unknown[];
|
|
154
|
-
routes: import("@react-navigation/
|
|
154
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
155
155
|
type: string;
|
|
156
156
|
stale: false;
|
|
157
|
-
}> | import("@react-navigation/
|
|
157
|
+
}> | import("@react-navigation/core").PartialState<Readonly<{
|
|
158
158
|
key: string;
|
|
159
159
|
index: number;
|
|
160
160
|
routeNames: string[];
|
|
161
161
|
history?: unknown[];
|
|
162
|
-
routes: import("@react-navigation/
|
|
162
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
163
163
|
type: string;
|
|
164
164
|
stale: false;
|
|
165
165
|
}>>): void;
|
|
@@ -173,7 +173,7 @@ export declare const TabsNavigatorContext: import("react").Context<({
|
|
|
173
173
|
index: number;
|
|
174
174
|
routeNames: string[];
|
|
175
175
|
history?: unknown[];
|
|
176
|
-
routes: import("@react-navigation/
|
|
176
|
+
routes: import("@react-navigation/core").NavigationRoute<ParamListBase, string>[];
|
|
177
177
|
type: string;
|
|
178
178
|
stale: false;
|
|
179
179
|
}>;
|