@ubean/app 0.1.11 → 0.1.13

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Context, Hono, MiddlewareHandler, Next } from "hono";
1
+ import { Context, Hono, MiddlewareHandler } from "hono";
2
2
  import { RegisterOptions, RouteRegistrar } from "@ubean/api-routes";
3
3
  import { Hookable } from "hookable";
4
4
  import { ScannedApiRoute, ScannedApiRoute as ScannedApiRoute$1, ScannedCronTask, ScannedLayout, ScannedLayout as ScannedLayout$1, ScannedMiddleware, ScannedMiddleware as ScannedMiddleware$1, ScannedPageRoute, ScannedPageRoute as ScannedPageRoute$1 } from "@ubean/routing";
@@ -135,6 +135,8 @@ interface PageAssetTags {
135
135
  head?: string;
136
136
  bodyAttrs?: string;
137
137
  htmlAttrs?: string;
138
+ /** Favicon HREF (如 `/favicon.ico`),自动注入 `<link rel="icon">` 到 `<head>` */
139
+ favicon?: string;
138
140
  }
139
141
  interface UbeanAppOptions {
140
142
  rootDir?: string;
@@ -154,6 +156,8 @@ interface UbeanAppOptions {
154
156
  pageLoaders?: Record<string, () => Promise<unknown>>;
155
157
  pageRenderer?: PageRenderer | null;
156
158
  pageAssetTags?: PageAssetTags;
159
+ /** 不进行 SSR 的路由模式列表(glob),匹配的页面走 CSR */
160
+ ssrExclude?: string[];
157
161
  publicDir?: string;
158
162
  healthEndpoint?: boolean;
159
163
  openAPI?: boolean | {
@@ -168,6 +172,8 @@ interface UbeanAppOptions {
168
172
  defaultLocale?: string;
169
173
  locales?: string[];
170
174
  };
175
+ /** `pages/404.vue` 自动检测的 404 页面,注册为 Hono 兜底处理器 */
176
+ notFoundPage?: ScannedPageRoute$1;
171
177
  }
172
178
  interface UbeanAppPlugin {
173
179
  name: string;
@@ -176,35 +182,6 @@ interface UbeanAppPlugin {
176
182
  /** Called after all routes are registered */
177
183
  ready?: (app: UbeanApp) => void | Promise<void>;
178
184
  }
179
- /**
180
- * Structural view of the DevTools middleware returned by `createDevToolsMiddleware`
181
- * in `@ubean/devtools`. Defined locally (rather than importing the real return
182
- * type) so `ubean` has no static dependency on `@ubean/devtools` — the package is
183
- * loaded via a dynamic `import()` only when DevTools is enabled.
184
- *
185
- * @deprecated DevTools is now a Vite plugin (`@ubean/devtools`'s
186
- * `ubeanDevtoolsPlugin`) loaded by the dev runner. The Hono app no longer
187
- * hosts DevTools middleware. This placeholder is kept only for type
188
- * compatibility with external consumers that may still reference it.
189
- */
190
- interface DevToolsInstance {
191
- rpc: {
192
- setRoutes(routes: never[]): void;
193
- setPages(pages: never[]): void;
194
- setMiddlewares(middlewares: never[]): void;
195
- setLayouts(layouts: never[]): void;
196
- setCrons(crons: never[]): void;
197
- setPresets(presets: string[]): void;
198
- setOpenAPI(openAPI: {
199
- enabled: boolean;
200
- scalarPath?: string;
201
- openAPIPath?: string;
202
- }): void;
203
- setCustomTabs(tabs: never[]): void;
204
- updateInfo(partial: Record<string, unknown>): void;
205
- };
206
- middleware: (c: Context<UbeanEnv$1>, next: Next) => Promise<Response | void>;
207
- }
208
185
  declare class UbeanApp {
209
186
  readonly hono: Hono<UbeanEnv$1>;
210
187
  readonly hooks: Hookable<UbeanRuntimeHooks>;
@@ -235,4 +212,4 @@ interface AppPlugin {
235
212
  }
236
213
  declare function createUbeanApp(options?: UbeanAppOptions): UbeanApp;
237
214
  //#endregion
238
- export { type AppPlugin, type ComposedHandler, type DefineServerOptions, type DevToolsInstance, type PageAssetTags, type PageRenderer, type RegisterOptions, type ResolvedServerConfig, type RouteMeta, type RouteRegistrar, type RouteRule, type ScannedApiRoute, type ScannedLayout, type ScannedMiddleware, type ScannedPageRoute, type ServerHooks, UbeanApp, type UbeanAppOptions, type UbeanAppPlugin, type UbeanEnv, type UbeanMiddleware, type UbeanRuntimeHooks, applyServerConfig, createDefaultServerConfig, createUbeanApp, defineServer, mergeServerConfigs };
215
+ export { type AppPlugin, type ComposedHandler, type DefineServerOptions, type PageAssetTags, type PageRenderer, type RegisterOptions, type ResolvedServerConfig, type RouteMeta, type RouteRegistrar, type RouteRule, type ScannedApiRoute, type ScannedLayout, type ScannedMiddleware, type ScannedPageRoute, type ServerHooks, UbeanApp, type UbeanAppOptions, type UbeanAppPlugin, type UbeanEnv, type UbeanMiddleware, type UbeanRuntimeHooks, applyServerConfig, createDefaultServerConfig, createUbeanApp, defineServer, mergeServerConfigs };
package/dist/index.js CHANGED
@@ -158,7 +158,9 @@ var UbeanApp = class {
158
158
  pageLoaders: this.options.pageLoaders || {},
159
159
  pageRenderer: this.options.pageRenderer ?? null,
160
160
  pageAssetTags: this.options.pageAssetTags ?? {},
161
- i18nConfig: this.options.i18nConfig
161
+ ssrExclude: this.options.ssrExclude,
162
+ i18nConfig: this.options.i18nConfig,
163
+ notFoundPage: this.options.notFoundPage
162
164
  };
163
165
  await registerRoutes(this, registerOpts);
164
166
  if (this.options.openAPI) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/app",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Hono app factory and server config for ubean (createUbeanApp, defineServer)",
5
5
  "files": [
6
6
  "dist"
@@ -19,21 +19,21 @@
19
19
  "hono": "4.12.32",
20
20
  "hookable": "^6.1.1",
21
21
  "pathe": "^2.0.3",
22
- "@ubean/api-routes": "0.1.11",
23
- "@ubean/error": "0.1.11",
24
- "@ubean/server": "0.1.11",
25
- "@ubean/types": "0.1.11"
22
+ "@ubean/error": "0.1.13",
23
+ "@ubean/api-routes": "0.1.13",
24
+ "@ubean/types": "0.1.13",
25
+ "@ubean/server": "0.1.13"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^26.1.2",
29
29
  "typescript": "7.0.2",
30
30
  "vite-plus": "0.2.6",
31
- "@ubean/pages": "0.1.11",
32
- "@ubean/routing": "0.1.11"
31
+ "@ubean/routing": "0.1.13",
32
+ "@ubean/pages": "0.1.13"
33
33
  },
34
34
  "peerDependencies": {
35
- "@ubean/pages": "0.1.11",
36
- "@ubean/routing": "0.1.11"
35
+ "@ubean/pages": "0.1.13",
36
+ "@ubean/routing": "0.1.13"
37
37
  },
38
38
  "peerDependenciesMeta": {
39
39
  "@ubean/routing": {