@finesoft/front 0.1.13 → 0.1.15
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/app-MYBG3TGV.js +10 -0
- package/dist/app-MYBG3TGV.js.map +1 -0
- package/dist/browser.js +12 -10
- package/dist/chunk-2VETWTN5.js +88 -0
- package/dist/chunk-2VETWTN5.js.map +1 -0
- package/dist/chunk-FYP2ZYYV.js +25 -0
- package/dist/chunk-FYP2ZYYV.js.map +1 -0
- package/dist/{chunk-OVGQ4NUA.js → chunk-RVKDILGM.js} +2 -327
- package/dist/chunk-RVKDILGM.js.map +1 -0
- package/dist/chunk-T2AQHAYK.js +337 -0
- package/dist/chunk-T2AQHAYK.js.map +1 -0
- package/dist/chunk-Z4MHYAS3.js +108 -0
- package/dist/chunk-Z4MHYAS3.js.map +1 -0
- package/dist/index.cjs +1788 -839
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +202 -1
- package/dist/index.d.ts +202 -1
- package/dist/index.js +693 -180
- package/dist/index.js.map +1 -1
- package/dist/locale-YK3THSI6.js +7 -0
- package/dist/locale-YK3THSI6.js.map +1 -0
- package/dist/src-7D236CLJ.js +19 -0
- package/dist/src-7D236CLJ.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-OVGQ4NUA.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FrameworkConfig, Framework, BasePage, PrefetchedIntent } from './browser.cjs';
|
|
2
2
|
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BrowserAppConfig, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, Net, None, Optional, PrefetchedIntents, RouteDefinition, RouteMatch, Router, Storage, buildUrl, createPrefetchedIntentsFromDom, defineRoutes, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, pipe, pipeAsync, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.cjs';
|
|
3
|
+
import * as node_fs from 'node:fs';
|
|
3
4
|
import { Hono } from 'hono';
|
|
4
5
|
import { ViteDevServer } from 'vite';
|
|
5
6
|
|
|
@@ -96,6 +97,160 @@ declare function injectSSRContent(options: InjectSSROptions): string;
|
|
|
96
97
|
|
|
97
98
|
declare function serializeServerData(data: PrefetchedIntent[]): string;
|
|
98
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Adapter 接口定义
|
|
102
|
+
*
|
|
103
|
+
* 每个适配器实现 Adapter 接口,在 vite build 的 closeBundle 阶段
|
|
104
|
+
* 接收 AdapterContext 并生成目标平台的部署产物。
|
|
105
|
+
*/
|
|
106
|
+
/** 适配器上下文 — 由 vite-plugin 的 closeBundle 构造后传入 adapter.build() */
|
|
107
|
+
interface AdapterContext {
|
|
108
|
+
/** 项目根路径 */
|
|
109
|
+
root: string;
|
|
110
|
+
/** SSR 入口文件相对路径(如 "src/ssr.ts") */
|
|
111
|
+
ssrEntry: string;
|
|
112
|
+
/** setup 文件相对路径(如 "src/proxies.ts"),仅当 options.setup 为 string 时有值 */
|
|
113
|
+
setupPath?: string;
|
|
114
|
+
/** 支持的语言列表 */
|
|
115
|
+
locales: string[];
|
|
116
|
+
/** 默认语言 */
|
|
117
|
+
defaultLocale: string;
|
|
118
|
+
/** dist/client/index.html 的内容 */
|
|
119
|
+
templateHtml: string;
|
|
120
|
+
/** Vite 的 resolve 配置 */
|
|
121
|
+
resolvedResolve: unknown;
|
|
122
|
+
/** Vite 的 css 配置 */
|
|
123
|
+
resolvedCss: unknown;
|
|
124
|
+
vite: any;
|
|
125
|
+
fs: typeof node_fs;
|
|
126
|
+
path: {
|
|
127
|
+
resolve: (...args: string[]) => string;
|
|
128
|
+
join: (...args: string[]) => string;
|
|
129
|
+
};
|
|
130
|
+
/** 生成 serverless/edge function 入口源码 */
|
|
131
|
+
generateSSREntry(opts: GenerateSSREntryOptions): string;
|
|
132
|
+
/** 用 Vite SSR 模式构建 bundle */
|
|
133
|
+
buildBundle(opts: BuildBundleOptions): Promise<void>;
|
|
134
|
+
/** 复制 dist/client 静态资源到目标目录 */
|
|
135
|
+
copyStaticAssets(destDir: string, opts?: CopyStaticAssetsOptions): void;
|
|
136
|
+
}
|
|
137
|
+
interface GenerateSSREntryOptions {
|
|
138
|
+
/** 平台特定的导入语句(如 `import { handle } from "hono/vercel";`) */
|
|
139
|
+
platformImport: string;
|
|
140
|
+
/** 平台特定的导出语句(如 `export default handle(app);`) */
|
|
141
|
+
platformExport: string;
|
|
142
|
+
}
|
|
143
|
+
interface BuildBundleOptions {
|
|
144
|
+
/** 临时入口文件路径 */
|
|
145
|
+
entry: string;
|
|
146
|
+
/** 输出目录 */
|
|
147
|
+
outDir: string;
|
|
148
|
+
/** 构建 target(默认 "node18") */
|
|
149
|
+
target?: string;
|
|
150
|
+
/** 输出文件名(默认 "index.mjs") */
|
|
151
|
+
fileName?: string;
|
|
152
|
+
/** 排除的模块(默认 ["vite", "esbuild", "rollup", "fsevents", "lightningcss"]) */
|
|
153
|
+
external?: string[];
|
|
154
|
+
/** 是否打包所有依赖(默认 true) */
|
|
155
|
+
noExternal?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface CopyStaticAssetsOptions {
|
|
158
|
+
/** 是否排除 index.html(默认 true) */
|
|
159
|
+
excludeHtml?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/** 适配器接口 */
|
|
162
|
+
interface Adapter {
|
|
163
|
+
/** 适配器名称(用于日志) */
|
|
164
|
+
name: string;
|
|
165
|
+
/** 生成目标平台部署产物 */
|
|
166
|
+
build(ctx: AdapterContext): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Auto 适配器 — 根据环境变量自动选择目标平台
|
|
171
|
+
*
|
|
172
|
+
* 检测顺序:
|
|
173
|
+
* VERCEL → vercel
|
|
174
|
+
* CF_PAGES → cloudflare
|
|
175
|
+
* NETLIFY → netlify
|
|
176
|
+
* (default) → node
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare function autoAdapter(): Adapter;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Cloudflare Pages 适配器
|
|
183
|
+
*
|
|
184
|
+
* 生成 dist/cloudflare/ 目录:
|
|
185
|
+
* - _worker.js — Workers 入口(Hono 原生支持 CF fetch 接口)
|
|
186
|
+
* - assets/ — 静态资源
|
|
187
|
+
*
|
|
188
|
+
* 注意:Cloudflare Workers 不支持原生 Node.js API。
|
|
189
|
+
* 若 setup 代理使用了 process.env,需在 wrangler.toml 启用 nodejs_compat。
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
declare function cloudflareAdapter(): Adapter;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Netlify 适配器 — Netlify Functions v2
|
|
196
|
+
*
|
|
197
|
+
* 生成:
|
|
198
|
+
* - .netlify/functions-internal/ssr/index.mjs — Serverless Function
|
|
199
|
+
* - dist/client/_redirects — 路由重写规则
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
declare function netlifyAdapter(): Adapter;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Node 适配器 — 独立 HTTP 服务器
|
|
206
|
+
*
|
|
207
|
+
* 生成 dist/server/index.mjs,使用 @hono/node-server 监听端口。
|
|
208
|
+
* 运行:node dist/server/index.mjs
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
declare function nodeAdapter(): Adapter;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* resolveAdapter — 字符串 → Adapter 映射
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
declare function resolveAdapter(value: string | Adapter): Adapter;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Static 适配器 — 构建时预渲染
|
|
221
|
+
*
|
|
222
|
+
* 加载 SSR 模块和路由定义,将无参数路由自动预渲染为静态 HTML。
|
|
223
|
+
* 动态参数路由通过 dynamicRoutes 选项补充具体 URL。
|
|
224
|
+
*
|
|
225
|
+
* 输出:dist/static/ — 纯静态站点,可部署到任何静态托管。
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
interface StaticAdapterOptions {
|
|
229
|
+
/**
|
|
230
|
+
* 导出 routes 数组的文件路径(相对于项目根目录)。
|
|
231
|
+
* 默认 "src/lib/bootstrap.ts"。
|
|
232
|
+
* 文件需 export 一个 RouteDefinition[] 类型的 routes 变量。
|
|
233
|
+
*/
|
|
234
|
+
routesExport?: string;
|
|
235
|
+
/**
|
|
236
|
+
* 额外的动态路由 URL(带具体参数值),如:
|
|
237
|
+
* ["/product/123", "/list/games"]
|
|
238
|
+
*/
|
|
239
|
+
dynamicRoutes?: string[];
|
|
240
|
+
}
|
|
241
|
+
declare function staticAdapter(opts?: StaticAdapterOptions): Adapter;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Vercel 适配器 — Build Output API v3
|
|
245
|
+
*
|
|
246
|
+
* 生成 .vercel/output/ 目录:
|
|
247
|
+
* - config.json — 路由规则
|
|
248
|
+
* - static/ — 静态资源
|
|
249
|
+
* - functions/ssr.func/ — Serverless Function
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
declare function vercelAdapter(): Adapter;
|
|
253
|
+
|
|
99
254
|
/**
|
|
100
255
|
* createSSRApp — 创建 Hono SSR 应用
|
|
101
256
|
*
|
|
@@ -224,4 +379,50 @@ declare function startServer(options: StartServerOptions): Promise<{
|
|
|
224
379
|
vite?: ViteDevServer;
|
|
225
380
|
}>;
|
|
226
381
|
|
|
227
|
-
|
|
382
|
+
/**
|
|
383
|
+
* finesoftFrontViteConfig — Vite 插件
|
|
384
|
+
*
|
|
385
|
+
* 将 Hono SSR 服务器集成到 Vite 的 dev / build / preview 生命周期中,
|
|
386
|
+
* 使 template-project 只需 `vite` / `vite build` / `vite preview` 即可运行。
|
|
387
|
+
*
|
|
388
|
+
* 支持多平台 adapter: "vercel" | "cloudflare" | "netlify" | "node" | "static" | "auto"
|
|
389
|
+
* 或自定义 Adapter 对象。
|
|
390
|
+
*/
|
|
391
|
+
|
|
392
|
+
interface FinesoftFrontViteOptions {
|
|
393
|
+
/** 支持的语言列表 */
|
|
394
|
+
locales?: string[];
|
|
395
|
+
/** 默认语言 */
|
|
396
|
+
defaultLocale?: string;
|
|
397
|
+
/** SSR 配置 */
|
|
398
|
+
ssr?: {
|
|
399
|
+
/** SSR 入口文件路径(默认 "src/ssr.ts") */
|
|
400
|
+
entry?: string;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* 注册业务路由(API 代理等)。
|
|
404
|
+
* - 传入 Function:仅 dev/preview 时可用。
|
|
405
|
+
* - 传入 string(文件路径):dev/preview/adapter 均可用,
|
|
406
|
+
* 文件需 export default 一个 (app: Hono) => void 函数。
|
|
407
|
+
*/
|
|
408
|
+
setup?: ((app: Hono) => void | Promise<void>) | string;
|
|
409
|
+
/**
|
|
410
|
+
* 部署适配器。
|
|
411
|
+
* - 字符串快捷方式:"vercel" | "cloudflare" | "netlify" | "node" | "static" | "auto"
|
|
412
|
+
* - 自定义 Adapter 对象:{ name, build(ctx) }
|
|
413
|
+
* - 不设置则不生成部署产物
|
|
414
|
+
*/
|
|
415
|
+
adapter?: string | Adapter;
|
|
416
|
+
}
|
|
417
|
+
declare function finesoftFrontViteConfig(options?: FinesoftFrontViteOptions): {
|
|
418
|
+
name: string;
|
|
419
|
+
config(userConfig: Record<string, any>, env: {
|
|
420
|
+
command: string;
|
|
421
|
+
}): Record<string, any>;
|
|
422
|
+
configResolved(config: Record<string, any>): void;
|
|
423
|
+
configureServer(server: any): () => Promise<void>;
|
|
424
|
+
configurePreviewServer(server: any): () => Promise<void>;
|
|
425
|
+
closeBundle(): Promise<void>;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
export { type Adapter, type AdapterContext, BasePage, type FinesoftFrontViteOptions, Framework, FrameworkConfig, type InjectSSROptions, PrefetchedIntent, type RuntimeInfo, type SSRAppOptions, type SSRModule, type SSRRenderConfig, type SSRRenderOptions, type SSRRenderResult, SSR_PLACEHOLDERS, type ServerConfig, type ServerInstance, type StartServerOptions, autoAdapter, cloudflareAdapter, createSSRApp, createSSRRender, createServer, detectRuntime, finesoftFrontViteConfig, injectSSRContent, netlifyAdapter, nodeAdapter, parseAcceptLanguage, resolveAdapter, resolveRoot, serializeServerData, ssrRender, startServer, staticAdapter, vercelAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FrameworkConfig, Framework, BasePage, PrefetchedIntent } from './browser.js';
|
|
2
2
|
export { ACTION_KINDS, Action, ActionDispatcher, ActionHandler, ActionHandlerDependencies, AsyncMapper, BaseController, BaseItem, BaseLogger, BaseShelf, BrowserAppConfig, CompositeLogger, CompositeLoggerFactory, CompoundAction, ConsoleLogger, ConsoleLoggerFactory, Container, DEP_KEYS, ExternalUrlAction, ExternalUrlDependencies, FeatureFlags, FlowAction, FlowActionCallbacks, FlowActionDependencies, History, HttpClient, HttpClientConfig, HttpError, Intent, IntentController, IntentDispatcher, Locale, Logger, LoggerFactory, Logger as LoggerInterface, LruMap, Mapper, MetricsRecorder, Net, None, Optional, PrefetchedIntents, RouteDefinition, RouteMatch, Router, Storage, buildUrl, createPrefetchedIntentsFromDom, defineRoutes, deserializeServerData, generateUuid, getBaseUrl, isCompoundAction, isExternalUrlAction, isFlowAction, isNone, isSome, makeDependencies, makeExternalUrlAction, makeFlowAction, mapEach, pipe, pipeAsync, registerActionHandlers, registerExternalUrlHandler, registerFlowActionHandler, removeHost, removeQueryParams, removeScheme, resetFilterCache, shouldLog, stableStringify, startBrowserApp, tryScroll } from './browser.js';
|
|
3
|
+
import * as node_fs from 'node:fs';
|
|
3
4
|
import { Hono } from 'hono';
|
|
4
5
|
import { ViteDevServer } from 'vite';
|
|
5
6
|
|
|
@@ -96,6 +97,160 @@ declare function injectSSRContent(options: InjectSSROptions): string;
|
|
|
96
97
|
|
|
97
98
|
declare function serializeServerData(data: PrefetchedIntent[]): string;
|
|
98
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Adapter 接口定义
|
|
102
|
+
*
|
|
103
|
+
* 每个适配器实现 Adapter 接口,在 vite build 的 closeBundle 阶段
|
|
104
|
+
* 接收 AdapterContext 并生成目标平台的部署产物。
|
|
105
|
+
*/
|
|
106
|
+
/** 适配器上下文 — 由 vite-plugin 的 closeBundle 构造后传入 adapter.build() */
|
|
107
|
+
interface AdapterContext {
|
|
108
|
+
/** 项目根路径 */
|
|
109
|
+
root: string;
|
|
110
|
+
/** SSR 入口文件相对路径(如 "src/ssr.ts") */
|
|
111
|
+
ssrEntry: string;
|
|
112
|
+
/** setup 文件相对路径(如 "src/proxies.ts"),仅当 options.setup 为 string 时有值 */
|
|
113
|
+
setupPath?: string;
|
|
114
|
+
/** 支持的语言列表 */
|
|
115
|
+
locales: string[];
|
|
116
|
+
/** 默认语言 */
|
|
117
|
+
defaultLocale: string;
|
|
118
|
+
/** dist/client/index.html 的内容 */
|
|
119
|
+
templateHtml: string;
|
|
120
|
+
/** Vite 的 resolve 配置 */
|
|
121
|
+
resolvedResolve: unknown;
|
|
122
|
+
/** Vite 的 css 配置 */
|
|
123
|
+
resolvedCss: unknown;
|
|
124
|
+
vite: any;
|
|
125
|
+
fs: typeof node_fs;
|
|
126
|
+
path: {
|
|
127
|
+
resolve: (...args: string[]) => string;
|
|
128
|
+
join: (...args: string[]) => string;
|
|
129
|
+
};
|
|
130
|
+
/** 生成 serverless/edge function 入口源码 */
|
|
131
|
+
generateSSREntry(opts: GenerateSSREntryOptions): string;
|
|
132
|
+
/** 用 Vite SSR 模式构建 bundle */
|
|
133
|
+
buildBundle(opts: BuildBundleOptions): Promise<void>;
|
|
134
|
+
/** 复制 dist/client 静态资源到目标目录 */
|
|
135
|
+
copyStaticAssets(destDir: string, opts?: CopyStaticAssetsOptions): void;
|
|
136
|
+
}
|
|
137
|
+
interface GenerateSSREntryOptions {
|
|
138
|
+
/** 平台特定的导入语句(如 `import { handle } from "hono/vercel";`) */
|
|
139
|
+
platformImport: string;
|
|
140
|
+
/** 平台特定的导出语句(如 `export default handle(app);`) */
|
|
141
|
+
platformExport: string;
|
|
142
|
+
}
|
|
143
|
+
interface BuildBundleOptions {
|
|
144
|
+
/** 临时入口文件路径 */
|
|
145
|
+
entry: string;
|
|
146
|
+
/** 输出目录 */
|
|
147
|
+
outDir: string;
|
|
148
|
+
/** 构建 target(默认 "node18") */
|
|
149
|
+
target?: string;
|
|
150
|
+
/** 输出文件名(默认 "index.mjs") */
|
|
151
|
+
fileName?: string;
|
|
152
|
+
/** 排除的模块(默认 ["vite", "esbuild", "rollup", "fsevents", "lightningcss"]) */
|
|
153
|
+
external?: string[];
|
|
154
|
+
/** 是否打包所有依赖(默认 true) */
|
|
155
|
+
noExternal?: boolean;
|
|
156
|
+
}
|
|
157
|
+
interface CopyStaticAssetsOptions {
|
|
158
|
+
/** 是否排除 index.html(默认 true) */
|
|
159
|
+
excludeHtml?: boolean;
|
|
160
|
+
}
|
|
161
|
+
/** 适配器接口 */
|
|
162
|
+
interface Adapter {
|
|
163
|
+
/** 适配器名称(用于日志) */
|
|
164
|
+
name: string;
|
|
165
|
+
/** 生成目标平台部署产物 */
|
|
166
|
+
build(ctx: AdapterContext): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Auto 适配器 — 根据环境变量自动选择目标平台
|
|
171
|
+
*
|
|
172
|
+
* 检测顺序:
|
|
173
|
+
* VERCEL → vercel
|
|
174
|
+
* CF_PAGES → cloudflare
|
|
175
|
+
* NETLIFY → netlify
|
|
176
|
+
* (default) → node
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
declare function autoAdapter(): Adapter;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Cloudflare Pages 适配器
|
|
183
|
+
*
|
|
184
|
+
* 生成 dist/cloudflare/ 目录:
|
|
185
|
+
* - _worker.js — Workers 入口(Hono 原生支持 CF fetch 接口)
|
|
186
|
+
* - assets/ — 静态资源
|
|
187
|
+
*
|
|
188
|
+
* 注意:Cloudflare Workers 不支持原生 Node.js API。
|
|
189
|
+
* 若 setup 代理使用了 process.env,需在 wrangler.toml 启用 nodejs_compat。
|
|
190
|
+
*/
|
|
191
|
+
|
|
192
|
+
declare function cloudflareAdapter(): Adapter;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Netlify 适配器 — Netlify Functions v2
|
|
196
|
+
*
|
|
197
|
+
* 生成:
|
|
198
|
+
* - .netlify/functions-internal/ssr/index.mjs — Serverless Function
|
|
199
|
+
* - dist/client/_redirects — 路由重写规则
|
|
200
|
+
*/
|
|
201
|
+
|
|
202
|
+
declare function netlifyAdapter(): Adapter;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Node 适配器 — 独立 HTTP 服务器
|
|
206
|
+
*
|
|
207
|
+
* 生成 dist/server/index.mjs,使用 @hono/node-server 监听端口。
|
|
208
|
+
* 运行:node dist/server/index.mjs
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
declare function nodeAdapter(): Adapter;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* resolveAdapter — 字符串 → Adapter 映射
|
|
215
|
+
*/
|
|
216
|
+
|
|
217
|
+
declare function resolveAdapter(value: string | Adapter): Adapter;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Static 适配器 — 构建时预渲染
|
|
221
|
+
*
|
|
222
|
+
* 加载 SSR 模块和路由定义,将无参数路由自动预渲染为静态 HTML。
|
|
223
|
+
* 动态参数路由通过 dynamicRoutes 选项补充具体 URL。
|
|
224
|
+
*
|
|
225
|
+
* 输出:dist/static/ — 纯静态站点,可部署到任何静态托管。
|
|
226
|
+
*/
|
|
227
|
+
|
|
228
|
+
interface StaticAdapterOptions {
|
|
229
|
+
/**
|
|
230
|
+
* 导出 routes 数组的文件路径(相对于项目根目录)。
|
|
231
|
+
* 默认 "src/lib/bootstrap.ts"。
|
|
232
|
+
* 文件需 export 一个 RouteDefinition[] 类型的 routes 变量。
|
|
233
|
+
*/
|
|
234
|
+
routesExport?: string;
|
|
235
|
+
/**
|
|
236
|
+
* 额外的动态路由 URL(带具体参数值),如:
|
|
237
|
+
* ["/product/123", "/list/games"]
|
|
238
|
+
*/
|
|
239
|
+
dynamicRoutes?: string[];
|
|
240
|
+
}
|
|
241
|
+
declare function staticAdapter(opts?: StaticAdapterOptions): Adapter;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Vercel 适配器 — Build Output API v3
|
|
245
|
+
*
|
|
246
|
+
* 生成 .vercel/output/ 目录:
|
|
247
|
+
* - config.json — 路由规则
|
|
248
|
+
* - static/ — 静态资源
|
|
249
|
+
* - functions/ssr.func/ — Serverless Function
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
declare function vercelAdapter(): Adapter;
|
|
253
|
+
|
|
99
254
|
/**
|
|
100
255
|
* createSSRApp — 创建 Hono SSR 应用
|
|
101
256
|
*
|
|
@@ -224,4 +379,50 @@ declare function startServer(options: StartServerOptions): Promise<{
|
|
|
224
379
|
vite?: ViteDevServer;
|
|
225
380
|
}>;
|
|
226
381
|
|
|
227
|
-
|
|
382
|
+
/**
|
|
383
|
+
* finesoftFrontViteConfig — Vite 插件
|
|
384
|
+
*
|
|
385
|
+
* 将 Hono SSR 服务器集成到 Vite 的 dev / build / preview 生命周期中,
|
|
386
|
+
* 使 template-project 只需 `vite` / `vite build` / `vite preview` 即可运行。
|
|
387
|
+
*
|
|
388
|
+
* 支持多平台 adapter: "vercel" | "cloudflare" | "netlify" | "node" | "static" | "auto"
|
|
389
|
+
* 或自定义 Adapter 对象。
|
|
390
|
+
*/
|
|
391
|
+
|
|
392
|
+
interface FinesoftFrontViteOptions {
|
|
393
|
+
/** 支持的语言列表 */
|
|
394
|
+
locales?: string[];
|
|
395
|
+
/** 默认语言 */
|
|
396
|
+
defaultLocale?: string;
|
|
397
|
+
/** SSR 配置 */
|
|
398
|
+
ssr?: {
|
|
399
|
+
/** SSR 入口文件路径(默认 "src/ssr.ts") */
|
|
400
|
+
entry?: string;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* 注册业务路由(API 代理等)。
|
|
404
|
+
* - 传入 Function:仅 dev/preview 时可用。
|
|
405
|
+
* - 传入 string(文件路径):dev/preview/adapter 均可用,
|
|
406
|
+
* 文件需 export default 一个 (app: Hono) => void 函数。
|
|
407
|
+
*/
|
|
408
|
+
setup?: ((app: Hono) => void | Promise<void>) | string;
|
|
409
|
+
/**
|
|
410
|
+
* 部署适配器。
|
|
411
|
+
* - 字符串快捷方式:"vercel" | "cloudflare" | "netlify" | "node" | "static" | "auto"
|
|
412
|
+
* - 自定义 Adapter 对象:{ name, build(ctx) }
|
|
413
|
+
* - 不设置则不生成部署产物
|
|
414
|
+
*/
|
|
415
|
+
adapter?: string | Adapter;
|
|
416
|
+
}
|
|
417
|
+
declare function finesoftFrontViteConfig(options?: FinesoftFrontViteOptions): {
|
|
418
|
+
name: string;
|
|
419
|
+
config(userConfig: Record<string, any>, env: {
|
|
420
|
+
command: string;
|
|
421
|
+
}): Record<string, any>;
|
|
422
|
+
configResolved(config: Record<string, any>): void;
|
|
423
|
+
configureServer(server: any): () => Promise<void>;
|
|
424
|
+
configurePreviewServer(server: any): () => Promise<void>;
|
|
425
|
+
closeBundle(): Promise<void>;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
export { type Adapter, type AdapterContext, BasePage, type FinesoftFrontViteOptions, Framework, FrameworkConfig, type InjectSSROptions, PrefetchedIntent, type RuntimeInfo, type SSRAppOptions, type SSRModule, type SSRRenderConfig, type SSRRenderOptions, type SSRRenderResult, SSR_PLACEHOLDERS, type ServerConfig, type ServerInstance, type StartServerOptions, autoAdapter, cloudflareAdapter, createSSRApp, createSSRRender, createServer, detectRuntime, finesoftFrontViteConfig, injectSSRContent, netlifyAdapter, nodeAdapter, parseAcceptLanguage, resolveAdapter, resolveRoot, serializeServerData, ssrRender, startServer, staticAdapter, vercelAdapter };
|