one 1.1.269 → 1.1.270
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/cli.js +2 -2
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/cli.native.js +2 -2
- package/dist/cjs/cli.native.js.map +2 -2
- package/dist/cjs/serve.js +1 -1
- package/dist/cjs/serve.js.map +1 -1
- package/dist/cjs/serve.native.js +1 -1
- package/dist/cjs/serve.native.js.map +2 -2
- package/dist/cjs/server/createRoutesManifest.js.map +1 -1
- package/dist/cjs/server/createRoutesManifest.native.js.map +1 -1
- package/dist/cjs/vite/build.js +8 -1
- package/dist/cjs/vite/build.js.map +1 -1
- package/dist/cjs/vite/build.native.js +13 -3
- package/dist/cjs/vite/build.native.js.map +2 -2
- package/dist/cjs/vite/createFileSystemRouter.js +7 -3
- package/dist/cjs/vite/createFileSystemRouter.js.map +1 -1
- package/dist/cjs/vite/createFileSystemRouter.native.js +12 -3
- package/dist/cjs/vite/createFileSystemRouter.native.js.map +2 -2
- package/dist/cjs/vite/one.js +11 -1
- package/dist/cjs/vite/one.js.map +2 -2
- package/dist/cjs/vite/one.native.js +14 -1
- package/dist/cjs/vite/one.native.js.map +2 -2
- package/dist/cjs/vite/types.native.js.map +1 -1
- package/dist/esm/cli.js +2 -2
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/cli.mjs +2 -2
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/cli.native.js +2 -2
- package/dist/esm/cli.native.js.map +1 -1
- package/dist/esm/serve.js +1 -1
- package/dist/esm/serve.js.map +1 -1
- package/dist/esm/serve.mjs +1 -1
- package/dist/esm/serve.mjs.map +1 -1
- package/dist/esm/serve.native.js +1 -1
- package/dist/esm/serve.native.js.map +1 -1
- 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/vite/build.js +8 -1
- package/dist/esm/vite/build.js.map +1 -1
- package/dist/esm/vite/build.mjs +8 -1
- package/dist/esm/vite/build.mjs.map +1 -1
- package/dist/esm/vite/build.native.js +12 -2
- package/dist/esm/vite/build.native.js.map +1 -1
- package/dist/esm/vite/createFileSystemRouter.js +7 -3
- package/dist/esm/vite/createFileSystemRouter.js.map +1 -1
- package/dist/esm/vite/createFileSystemRouter.mjs +18 -8
- package/dist/esm/vite/createFileSystemRouter.mjs.map +1 -1
- package/dist/esm/vite/createFileSystemRouter.native.js +18 -8
- package/dist/esm/vite/createFileSystemRouter.native.js.map +1 -1
- package/dist/esm/vite/one.js +11 -1
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +15 -1
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +19 -1
- package/dist/esm/vite/one.native.js.map +1 -1
- package/package.json +8 -7
- package/src/cli.ts +2 -3
- package/src/serve.ts +1 -1
- package/src/server/createRoutesManifest.ts +1 -0
- package/src/vite/build.ts +11 -1
- package/src/vite/createFileSystemRouter.tsx +11 -4
- package/src/vite/one.ts +25 -1
- package/src/vite/types.ts +33 -20
- package/types/serve.d.ts.map +1 -1
- package/types/server/createRoutesManifest.d.ts +1 -0
- package/types/server/createRoutesManifest.d.ts.map +1 -1
- package/types/vite/build.d.ts.map +1 -1
- package/types/vite/createFileSystemRouter.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/types.d.ts +30 -17
- package/types/vite/types.d.ts.map +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["events","dirname","resolve","loadConfigFromFile","tsconfigPaths","getOptimizeDeps","getOptionsFilled","isWebEnvironment","existsAsync","requireResolve","clientTreeShakePlugin","createFileSystemRouter","ensureTSConfig","fixDependenciesPlugin","generateTypesForRoutes","loadEnv","createVirtualEntry","virtualEntryId","vitePluginSsrCss","setMaxListeners","one","options","arguments","length","_options_config","oneOptions","process","cwd","config","
|
1
|
+
{"version":3,"names":["events","path","dirname","resolve","loadConfigFromFile","tsconfigPaths","getOptimizeDeps","getOptionsFilled","isWebEnvironment","existsAsync","requireResolve","clientTreeShakePlugin","createFileSystemRouter","ensureTSConfig","fixDependenciesPlugin","generateTypesForRoutes","loadEnv","createVirtualEntry","virtualEntryId","vitePluginSsrCss","setMaxListeners","globalThis","__vxrnEnableNativeEnv","one","options","arguments","length","_options_config","oneOptions","process","cwd","config","__vxrnPluginConfig__","optimizeDeps","optimizeIds","include","optimizeIdRegex","RegExp","map","id","replace","join","tsConfigPathsPlugin","vxrnOptions","devAndProdPlugins","Proxy","name","configIncoming","_options_config2","_configIncoming_plugins","pathsConfig","tsConfigPaths","plugins","flat","some","p","configResolved","resolveId","get","target","key","thisArg","Reflect","_options_web","define","web","defaultRenderMode","JSON","stringify","setupFile","server","url","environments","client","ssr","zero","TESTING","REPLICACHE_VERSION","ZERO_VERSION","hotUpdate","param","modules","m","relativePath","relative","root","rootDir","split","sep","acceptedHmrExports","Set","__vxrnAddNativePlugins","__vxrnAddWebPluginsProd","deps","_options_app","app","enforce","sharedNativeConfig","alias","react","ios","android","applyToEnvironment","environment","importer","shouldOptimize","test","absolutePath","webPath","directoryPath","err","console","warn","entries","getUserOneOptions","command","Error","loadUserOneOptions","found","mode"],"sources":["../../../src/vite/one.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,MAAA,MAAY;AACnB,OAAOC,IAAA,IAAQC,OAAA,EAASC,OAAA,QAAe;AACvC,SAA0DC,kBAAA,QAA0B;AACpF,OAAOC,aAAA,MAAmB;AAC1B,SAASC,eAAA,EAAiBC,gBAAA,EAAkBC,gBAAA,QAAwB;AACpE,OAAO;AACP,SAASC,WAAA,QAAmB;AAC5B,SAASC,cAAA,QAAsB;AAC/B,SAASC,qBAAA,QAA6B;AACtC,SAASC,sBAAA,QAA8B;AACvC,SAASC,cAAA,QAAsB;AAC/B,SAASC,qBAAA,QAA6B;AACtC,SAASC,sBAAA,QAA8B;AACvC,SAASC,OAAA,QAAe;AAExB,SAASC,kBAAA,EAAoBC,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AO,SAAAlH,kBAAA;IACTmH,IAAA","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "one",
|
3
|
-
"version": "1.1.
|
3
|
+
"version": "1.1.270",
|
4
4
|
"source": "src/index.ts",
|
5
5
|
"types": "./types/index.d.ts",
|
6
6
|
"sideEffects": false,
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"lint:fix": "../../node_modules/.bin/biome check --apply-unsafe src",
|
22
22
|
"clean": "tamagui-build clean",
|
23
23
|
"clean:build": "tamagui-build clean:build",
|
24
|
-
"test": "vitest --run",
|
24
|
+
"test": "vitest --run --pool=forks",
|
25
25
|
"test:watch": "vitest --watch"
|
26
26
|
},
|
27
27
|
"exports": {
|
@@ -88,12 +88,12 @@
|
|
88
88
|
"@react-navigation/native-stack": "~6.9.13",
|
89
89
|
"@react-navigation/routers": "~6.1.9",
|
90
90
|
"@ungap/structured-clone": "^1.2.0",
|
91
|
-
"@vxrn/universal-color-scheme": "1.1.
|
92
|
-
"@vxrn/use-isomorphic-layout-effect": "1.1.
|
91
|
+
"@vxrn/universal-color-scheme": "1.1.270",
|
92
|
+
"@vxrn/use-isomorphic-layout-effect": "1.1.270",
|
93
93
|
"babel-dead-code-elimination": "^1.0.6",
|
94
94
|
"citty": "^0.1.6",
|
95
95
|
"core-js": "^3.38.1",
|
96
|
-
"create-vxrn": "1.1.
|
96
|
+
"create-vxrn": "1.1.270",
|
97
97
|
"dotenv": "^16.4.5",
|
98
98
|
"escape-string-regexp": "^5.0.0",
|
99
99
|
"expo-linking": "~6.3.1",
|
@@ -115,7 +115,7 @@
|
|
115
115
|
"url-parse": "^1.5.10",
|
116
116
|
"vite": "6.0.0-beta.1",
|
117
117
|
"vite-tsconfig-paths": "^5.0.1",
|
118
|
-
"vxrn": "1.1.
|
118
|
+
"vxrn": "1.1.270",
|
119
119
|
"ws": "^8.18.0",
|
120
120
|
"xxhashjs": "^0.2.2"
|
121
121
|
},
|
@@ -123,12 +123,13 @@
|
|
123
123
|
"react-native": "*"
|
124
124
|
},
|
125
125
|
"devDependencies": {
|
126
|
-
"@tamagui/build": "^1.112.
|
126
|
+
"@tamagui/build": "^1.112.13",
|
127
127
|
"@types/node": "^22.1.0",
|
128
128
|
"@types/react-dom": "^18.2.25",
|
129
129
|
"@types/url-parse": "^1.4.11",
|
130
130
|
"@types/xxhashjs": "^0.2.4",
|
131
131
|
"depcheck": "^1.4.7",
|
132
|
+
"get-port": "^7.1.0",
|
132
133
|
"react-native": "0.74.1",
|
133
134
|
"rollup": "^4.21.0",
|
134
135
|
"vitest": "^2.1.1"
|
package/src/cli.ts
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
import { defineCommand, runMain } from 'citty'
|
2
2
|
import { loadEnv } from './vite/loadEnv'
|
3
|
-
import { loadUserOneOptions } from './vite/one'
|
4
3
|
// import packageJson from 'one/package.json' with { type: 'json' }
|
5
4
|
|
6
5
|
void loadEnv(process.cwd())
|
@@ -72,7 +71,7 @@ const serveCommand = defineCommand({
|
|
72
71
|
platform: {
|
73
72
|
type: 'string',
|
74
73
|
},
|
75
|
-
|
74
|
+
compress: {
|
76
75
|
type: 'boolean',
|
77
76
|
},
|
78
77
|
cacheHeaders: {
|
@@ -85,7 +84,7 @@ const serveCommand = defineCommand({
|
|
85
84
|
port: args.port ? +args.port : undefined,
|
86
85
|
host: args.host,
|
87
86
|
cacheHeaders: args.cacheHeaders === false ? 'off' : undefined,
|
88
|
-
|
87
|
+
compress: args.compress,
|
89
88
|
platform: args.platform === 'vercel' ? 'vercel' : 'node',
|
90
89
|
})
|
91
90
|
},
|
package/src/serve.ts
CHANGED
@@ -32,7 +32,7 @@ export async function serve(args: VXRNOptions['server'] = {}) {
|
|
32
32
|
...removeUndefined({
|
33
33
|
port: args.port ? +args.port : undefined,
|
34
34
|
host: args.host,
|
35
|
-
|
35
|
+
compress: args.compress,
|
36
36
|
platform: args.platform,
|
37
37
|
cacheHeaders: args.cacheHeaders,
|
38
38
|
}),
|
package/src/vite/build.ts
CHANGED
@@ -97,7 +97,15 @@ export async function build(args: {
|
|
97
97
|
...processEnvDefines,
|
98
98
|
},
|
99
99
|
|
100
|
+
ssr: {
|
101
|
+
noExternal: true,
|
102
|
+
// we patched them to switch to react 19
|
103
|
+
external: ['react', 'react-dom'],
|
104
|
+
optimizeDeps,
|
105
|
+
},
|
106
|
+
|
100
107
|
build: {
|
108
|
+
ssr: true,
|
101
109
|
emptyOutDir: false,
|
102
110
|
outDir: 'dist/api',
|
103
111
|
copyPublicDir: false,
|
@@ -494,7 +502,9 @@ ${JSON.stringify(params || null, null, 2)}`
|
|
494
502
|
|
495
503
|
let postBuildLogs: string[] = []
|
496
504
|
|
497
|
-
|
505
|
+
const platform = userOptions.web?.deploy ?? options.server?.platform
|
506
|
+
|
507
|
+
if (platform === 'vercel') {
|
498
508
|
await FSExtra.writeFile(
|
499
509
|
join(options.root, 'dist', 'index.js'),
|
500
510
|
`import { serve } from 'one/serve'
|
@@ -59,20 +59,17 @@ export function createFileSystemRouter(options: One.PluginOptions): Plugin {
|
|
59
59
|
|
60
60
|
try {
|
61
61
|
const routeFile = join('app', route.file)
|
62
|
+
console.log({ routeFile, url })
|
62
63
|
runner.clearCache()
|
63
64
|
|
64
|
-
// importing directly causes issues :/
|
65
65
|
globalThis['__vxrnresetState']?.()
|
66
66
|
|
67
|
-
// its '' for now for unmatched
|
68
67
|
const exported = routeFile === '' ? {} : await runner.import(routeFile)
|
69
68
|
const loaderData = await exported.loader?.(loaderProps)
|
70
69
|
|
71
|
-
// TODO move to tamagui plugin, also esbuild was getting mad
|
72
70
|
// biome-ignore lint/security/noGlobalEval: <explanation>
|
73
71
|
eval(`process.env.TAMAGUI_IS_SERVER = '1'`)
|
74
72
|
|
75
|
-
// const entry = await server.ssrLoadModule(virtualEntryId)
|
76
73
|
const entry = await runner.import(virtualEntryId)
|
77
74
|
|
78
75
|
const render = entry.default.render as (props: RenderAppProps) => any
|
@@ -82,6 +79,8 @@ export function createFileSystemRouter(options: One.PluginOptions): Plugin {
|
|
82
79
|
|
83
80
|
LoaderDataCache[route.file] = loaderData
|
84
81
|
|
82
|
+
const is404 = route.isNotFound || !exported.default
|
83
|
+
|
85
84
|
const html = await render({
|
86
85
|
loaderData,
|
87
86
|
loaderProps,
|
@@ -89,8 +88,16 @@ export function createFileSystemRouter(options: One.PluginOptions): Plugin {
|
|
89
88
|
preloads,
|
90
89
|
})
|
91
90
|
|
91
|
+
if (is404) {
|
92
|
+
return new Response(html, {
|
93
|
+
status: 404,
|
94
|
+
headers: { 'Content-Type': 'text/html' },
|
95
|
+
})
|
96
|
+
}
|
97
|
+
|
92
98
|
return html
|
93
99
|
} catch (err) {
|
100
|
+
console.error(`Error in handleSSR:`, err)
|
94
101
|
const title = `Error rendering ${url.pathname} on server`
|
95
102
|
const message = err instanceof Error ? err.message : `${err}`
|
96
103
|
const stack = err instanceof Error ? err.stack : ''
|
package/src/vite/one.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import events from 'node:events'
|
2
|
-
import { dirname, resolve } from 'node:path'
|
2
|
+
import path, { dirname, resolve } from 'node:path'
|
3
3
|
import { type Plugin, type PluginOption, type UserConfig, loadConfigFromFile } from 'vite'
|
4
4
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
5
5
|
import { getOptimizeDeps, getOptionsFilled, isWebEnvironment } from 'vxrn'
|
@@ -18,6 +18,9 @@ import { vitePluginSsrCss } from './vitePluginSsrCss'
|
|
18
18
|
|
19
19
|
events.setMaxListeners(1_000)
|
20
20
|
|
21
|
+
// temporary for tamagui plugin compat
|
22
|
+
globalThis.__vxrnEnableNativeEnv = true
|
23
|
+
|
21
24
|
export function one(options: One.PluginOptions = {}): PluginOption {
|
22
25
|
oneOptions = options
|
23
26
|
|
@@ -148,6 +151,27 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
148
151
|
}
|
149
152
|
},
|
150
153
|
} satisfies Plugin,
|
154
|
+
|
155
|
+
{
|
156
|
+
name: 'route-module-hmr-fix',
|
157
|
+
hotUpdate({ server, modules }) {
|
158
|
+
return modules.map((m) => {
|
159
|
+
const { id } = m
|
160
|
+
if (!id) return m
|
161
|
+
|
162
|
+
const relativePath = path.relative(server.config.root, id)
|
163
|
+
// Get the root dir from relativePath
|
164
|
+
const rootDir = relativePath.split(path.sep)[0]
|
165
|
+
if (rootDir === 'app') {
|
166
|
+
// If the file is a route, Vite might force a full-reload due to that file not being imported by any other modules (`!node.importers.size`) (see https://github.com/vitejs/vite/blob/v6.0.0-alpha.18/packages/vite/src/node/server/hmr.ts#L440-L443, https://github.com/vitejs/vite/blob/v6.0.0-alpha.18/packages/vite/src/node/server/hmr.ts#L427 and https://github.com/vitejs/vite/blob/v6.0.0-alpha.18/packages/vite/src/node/server/hmr.ts#L557-L566)
|
167
|
+
// Here we trick Vite to skip that check.
|
168
|
+
m.acceptedHmrExports = new Set()
|
169
|
+
}
|
170
|
+
|
171
|
+
return m
|
172
|
+
})
|
173
|
+
},
|
174
|
+
} satisfies Plugin,
|
151
175
|
] satisfies Plugin[]
|
152
176
|
|
153
177
|
// TODO make this passed into vxrn through real API
|
package/src/vite/types.ts
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { PluginOptions as TSConfigPluginOptions } from 'vite-tsconfig-paths'
|
2
2
|
import type {
|
3
3
|
DepOptimize,
|
4
4
|
DepPatch,
|
5
5
|
AfterBuildProps as VXRNAfterBuildProps,
|
6
|
+
VXRNBuildOptions,
|
6
7
|
VXRNOptions,
|
8
|
+
VXRNServePlatform,
|
7
9
|
} from 'vxrn'
|
8
|
-
import type { PluginOptions as TSConfigPluginOptions } from 'vite-tsconfig-paths'
|
9
10
|
|
10
11
|
export namespace One {
|
11
12
|
export type Options = Omit<VXRNOptions, keyof PluginOptions> & PluginOptions
|
@@ -82,27 +83,41 @@ export namespace One {
|
|
82
83
|
*/
|
83
84
|
defaultRenderMode?: RouteRenderMode
|
84
85
|
|
85
|
-
|
86
|
+
/**
|
87
|
+
* An array of redirect objects, works in development and production:
|
88
|
+
*
|
89
|
+
* @example
|
90
|
+
*
|
91
|
+
* [
|
92
|
+
* {
|
93
|
+
* source: '/vite',
|
94
|
+
* destination: 'https://vxrn.dev',
|
95
|
+
* permanent: true,
|
96
|
+
* },
|
97
|
+
* {
|
98
|
+
* source: '/docs/components/:slug/:version',
|
99
|
+
* destination: '/ui/:slug/:version',
|
100
|
+
* permanent: true,
|
101
|
+
* },
|
102
|
+
* ]
|
103
|
+
*
|
104
|
+
*/
|
105
|
+
redirects?: Redirect[]
|
106
|
+
|
107
|
+
/**
|
108
|
+
* Can be one of "node" or "vercel", this will determine the Hono adapter and build to run
|
109
|
+
* properly in production for each platform.
|
110
|
+
*
|
111
|
+
* @default node
|
112
|
+
*/
|
113
|
+
deploy?: VXRNServePlatform
|
86
114
|
}
|
87
115
|
|
88
116
|
server?: VXRNOptions['server']
|
89
117
|
|
90
118
|
build?: {
|
91
|
-
server?:
|
92
|
-
|
93
|
-
* Controls server build output module format
|
94
|
-
* @default 'esm'
|
95
|
-
*/
|
96
|
-
outputFormat?: 'cjs' | 'esm'
|
97
|
-
}
|
98
|
-
|
99
|
-
api?: {
|
100
|
-
/**
|
101
|
-
* Controls server build output module format
|
102
|
-
* @default 'esm'
|
103
|
-
*/
|
104
|
-
outputFormat?: 'cjs' | 'esm'
|
105
|
-
}
|
119
|
+
server?: VXRNBuildOptions
|
120
|
+
api?: VXRNBuildOptions
|
106
121
|
}
|
107
122
|
|
108
123
|
deps?: FixDependencies
|
@@ -124,8 +139,6 @@ export namespace One {
|
|
124
139
|
permanent: boolean
|
125
140
|
}
|
126
141
|
|
127
|
-
export type Redirects = Redirect[]
|
128
|
-
|
129
142
|
export type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'>
|
130
143
|
|
131
144
|
export type AfterBuildProps = VXRNAfterBuildProps & {
|
package/types/serve.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAevC,wBAAsB,KAAK,CAAC,IAAI,GAAE,WAAW,CAAC,QAAQ,CAAM;
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../src/serve.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAA;AAK3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAevC,wBAAsB,KAAK,CAAC,IAAI,GAAE,WAAW,CAAC,QAAQ,CAAM;mDAdJ,YAC9C;+CAER,YAAY;gDAED,YAAY;iDAElB,YAAW;+CAGS,YAAY;mDAIR,YAAY;GAyB1C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createRoutesManifest.d.ts","sourceRoot":"","sources":["../../src/server/createRoutesManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;IACrB,IAAI,EAAE,GAAG,CAAC,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"createRoutesManifest.d.ts","sourceRoot":"","sources":["../../src/server/createRoutesManifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAa,MAAM,cAAc,CAAA;AAEtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAExC,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAA;AAE3C,MAAM,MAAM,SAAS,CAAC,MAAM,GAAG,MAAM,IAAI;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACjC,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;IACrB,IAAI,EAAE,GAAG,CAAC,SAAS,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,cAAc,CAAC,MAAM,GAAG,MAAM,IAAI;IAC5C,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;IAC9B,UAAU,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,CAAA;CAChC,CAAA;AAYD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAc7F"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/vite/build.ts"],"names":[],"mappings":"AAqBA,wBAAsB,KAAK,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/vite/build.ts"],"names":[],"mappings":"AAqBA,wBAAsB,KAAK,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,iBA6fA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createFileSystemRouter.d.ts","sourceRoot":"","sources":["../../src/vite/createFileSystemRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAW1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAMlC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,GAAG,MAAM,
|
1
|
+
{"version":3,"file":"createFileSystemRouter.d.ts","sourceRoot":"","sources":["../../src/vite/createFileSystemRouter.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,MAAM,EAAiB,MAAM,MAAM,CAAA;AAW1D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAMlC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,GAAG,CAAC,aAAa,GAAG,MAAM,CAyWzE"}
|
package/types/vite/one.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,YAAY,EAAuC,MAAM,MAAM,CAAA;AAG1F,OAAO,qBAAqB,CAAA;AAS5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;
|
1
|
+
{"version":3,"file":"one.d.ts","sourceRoot":"","sources":["../../src/vite/one.ts"],"names":[],"mappings":"AAEA,OAAO,EAAe,KAAK,YAAY,EAAuC,MAAM,MAAM,CAAA;AAG1F,OAAO,qBAAqB,CAAA;AAS5B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AASlC,wBAAgB,GAAG,CAAC,OAAO,GAAE,GAAG,CAAC,aAAkB,GAAG,YAAY,CA6PjE;AAeD,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,8BAalE"}
|
package/types/vite/types.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { DepOptimize, DepPatch, AfterBuildProps as VXRNAfterBuildProps, VXRNOptions } from 'vxrn';
|
2
1
|
import type { PluginOptions as TSConfigPluginOptions } from 'vite-tsconfig-paths';
|
2
|
+
import type { DepOptimize, DepPatch, AfterBuildProps as VXRNAfterBuildProps, VXRNBuildOptions, VXRNOptions, VXRNServePlatform } from 'vxrn';
|
3
3
|
export declare namespace One {
|
4
4
|
type Options = Omit<VXRNOptions, keyof PluginOptions> & PluginOptions;
|
5
5
|
type RouteRenderMode = 'ssg' | 'spa' | 'ssr';
|
@@ -64,24 +64,38 @@ export declare namespace One {
|
|
64
64
|
* @default 'ssg'
|
65
65
|
*/
|
66
66
|
defaultRenderMode?: RouteRenderMode;
|
67
|
-
|
67
|
+
/**
|
68
|
+
* An array of redirect objects, works in development and production:
|
69
|
+
*
|
70
|
+
* @example
|
71
|
+
*
|
72
|
+
* [
|
73
|
+
* {
|
74
|
+
* source: '/vite',
|
75
|
+
* destination: 'https://vxrn.dev',
|
76
|
+
* permanent: true,
|
77
|
+
* },
|
78
|
+
* {
|
79
|
+
* source: '/docs/components/:slug/:version',
|
80
|
+
* destination: '/ui/:slug/:version',
|
81
|
+
* permanent: true,
|
82
|
+
* },
|
83
|
+
* ]
|
84
|
+
*
|
85
|
+
*/
|
86
|
+
redirects?: Redirect[];
|
87
|
+
/**
|
88
|
+
* Can be one of "node" or "vercel", this will determine the Hono adapter and build to run
|
89
|
+
* properly in production for each platform.
|
90
|
+
*
|
91
|
+
* @default node
|
92
|
+
*/
|
93
|
+
deploy?: VXRNServePlatform;
|
68
94
|
};
|
69
95
|
server?: VXRNOptions['server'];
|
70
96
|
build?: {
|
71
|
-
server?:
|
72
|
-
|
73
|
-
* Controls server build output module format
|
74
|
-
* @default 'esm'
|
75
|
-
*/
|
76
|
-
outputFormat?: 'cjs' | 'esm';
|
77
|
-
};
|
78
|
-
api?: {
|
79
|
-
/**
|
80
|
-
* Controls server build output module format
|
81
|
-
* @default 'esm'
|
82
|
-
*/
|
83
|
-
outputFormat?: 'cjs' | 'esm';
|
84
|
-
};
|
97
|
+
server?: VXRNBuildOptions;
|
98
|
+
api?: VXRNBuildOptions;
|
85
99
|
};
|
86
100
|
deps?: FixDependencies;
|
87
101
|
afterBuild?: (props: AfterBuildProps) => void | Promise<void>;
|
@@ -98,7 +112,6 @@ export declare namespace One {
|
|
98
112
|
destination: string;
|
99
113
|
permanent: boolean;
|
100
114
|
};
|
101
|
-
type Redirects = Redirect[];
|
102
115
|
type BuildInfo = Pick<AfterBuildProps, 'routeMap' | 'builtRoutes'>;
|
103
116
|
type AfterBuildProps = VXRNAfterBuildProps & {
|
104
117
|
routeMap: Record<string, string>;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vite/types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vite/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,IAAI,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,KAAK,EACV,WAAW,EACX,QAAQ,EACR,eAAe,IAAI,mBAAmB,EACtC,gBAAgB,EAChB,WAAW,EACX,iBAAiB,EAClB,MAAM,MAAM,CAAA;AAEb,yBAAiB,GAAG,CAAC;IACnB,KAAY,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,aAAa,CAAC,GAAG,aAAa,CAAA;IAE5E,KAAY,eAAe,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;IAEnD,KAAY,SAAS,GAAG,eAAe,GAAG,KAAK,GAAG,QAAQ,CAAA;IAE1D,KAAY,YAAY,GAAG;QACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;KAC7C,CAAA;IAED,KAAY,eAAe,GAAG;QAC5B,CAAC,GAAG,EAAE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