@ubean/build 0.4.5 → 0.4.7

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.
@@ -1,6 +1,6 @@
1
1
  import { Plugin } from "vite";
2
2
  //#region src/actions-plugin.d.ts
3
- interface ServerActionsPluginOptions {
3
+ export interface ServerActionsPluginOptions {
4
4
  /**
5
5
  * The project root directory (used for computing stable action IDs).
6
6
  * Defaults to `process.cwd()` at plugin creation time.
@@ -32,31 +32,30 @@ interface DefineActionCall {
32
32
  *
33
33
  * 跳过注释内的匹配(如 JSDoc 示例)和函数声明(`function defineAction(`)。
34
34
  */
35
- declare function findDefineActionCalls(code: string): DefineActionCall[];
35
+ export declare function findDefineActionCalls(code: string): DefineActionCall[];
36
36
  /**
37
37
  * 检测源码是否包含 `defineAction(` 调用。
38
38
  */
39
- declare function hasDefineActionCall(code: string): boolean;
39
+ export declare function hasDefineActionCall(code: string): boolean;
40
40
  /**
41
41
  * 服务端转换:为每个 `defineAction()` 调用注入 `filePath`(以及缺失时的 `name`),
42
42
  * 确保 action ID 在 dev / build 之间稳定。
43
43
  *
44
44
  * 返回转换后的代码;若无 `defineAction` 调用则返回 `null`。
45
45
  */
46
- declare function transformActionsForServer(code: string, filePath: string, root: string): string | null;
46
+ export declare function transformActionsForServer(code: string, filePath: string, root: string): string | null;
47
47
  /**
48
48
  * 客户端转换:将每个 `defineAction(...)` 调用替换为
49
49
  * `__ubean_createActionStub('<id>')`(别名 import,避免与用户代码冲突)。
50
50
  *
51
51
  * 返回转换后的代码(含注入的 import);若无 `defineAction` 调用则返回 `null`。
52
52
  */
53
- declare function transformActionsForClient(code: string, filePath: string, root: string): string | null;
53
+ export declare function transformActionsForClient(code: string, filePath: string, root: string): string | null;
54
54
  /**
55
55
  * Vite 插件:Server Actions 的客户端/服务端拆分。
56
56
  *
57
57
  * - 服务端(SSR):注入 `filePath`/`name` 到 `defineAction()` 选项。
58
58
  * - 客户端(浏览器):将 `defineAction(...)` 替换为 `createActionStub('<id>')`。
59
59
  */
60
- declare function ubeanServerActionsPlugin(options?: ServerActionsPluginOptions): Plugin;
61
- //#endregion
62
- export { ServerActionsPluginOptions, findDefineActionCalls, hasDefineActionCall, transformActionsForClient, transformActionsForServer, ubeanServerActionsPlugin };
60
+ export declare function ubeanServerActionsPlugin(options?: ServerActionsPluginOptions): Plugin;
61
+ //#endregion
@@ -35,9 +35,9 @@ interface ResolvedAutoImports {
35
35
  options: AutoImportOptions;
36
36
  }
37
37
  /** 将 `boolean | AutoImportOptions` 归一化为分库开关 + 透传选项。 */
38
- declare function resolveAutoImportsConfig(input: boolean | AutoImportOptions | undefined): ResolvedAutoImports;
38
+ export declare function resolveAutoImportsConfig(input: boolean | AutoImportOptions | undefined): ResolvedAutoImports;
39
39
  /** 按分库开关组装内置预设(顺序稳定:ubean client/server → vue → vue-router → vue-i18n → hono-openapi)。 */
40
- declare function getAutoImportPresets(resolved: ResolvedAutoImports): InlinePreset[];
40
+ export declare function getAutoImportPresets(resolved: ResolvedAutoImports): InlinePreset[];
41
41
  interface ResolvedComponentsAutoImport {
42
42
  /** 目录扫描 + dts 总开关(`components: false` 时为 `false`;resolver 仍然生效)。 */
43
43
  enabled: boolean;
@@ -47,28 +47,28 @@ interface ResolvedComponentsAutoImport {
47
47
  options: ComponentsOptions;
48
48
  }
49
49
  /** 将 `boolean | ComponentsOptions` 归一化。 */
50
- declare function resolveComponentsConfig(input: boolean | ComponentsOptions | undefined): ResolvedComponentsAutoImport;
50
+ export declare function resolveComponentsConfig(input: boolean | ComponentsOptions | undefined): ResolvedComponentsAutoImport;
51
51
  /** unplugin 系选项普遍使用 `Arrayable<T>`,合并进数组前先归一化。 */
52
- declare function toArray<T>(value: T | T[] | undefined): T[];
53
- declare const VUE_PRESET: InlinePreset;
54
- declare const VUE_MACROS_PRESET: InlinePreset;
52
+ export declare function toArray<T>(value: T | T[] | undefined): T[];
53
+ export declare const VUE_PRESET: InlinePreset;
54
+ export declare const VUE_MACROS_PRESET: InlinePreset;
55
55
  /**
56
56
  * Client-safe symbols sourced from the first-class `ubean/client` entry.
57
57
  * These are safe to auto-import in Vue components (browser-side) because
58
58
  * `@ubean/client` has zero build-time dependencies and no `node:*` imports.
59
59
  */
60
- declare const UBEAN_CLIENT_PRESET: InlinePreset;
60
+ export declare const UBEAN_CLIENT_PRESET: InlinePreset;
61
61
  /**
62
62
  * vue-router composables, sourced directly from `vue-router` (not re-exported
63
63
  * through `ubean/client` — third-party APIs are imported from their own packages).
64
64
  */
65
- declare const VUE_ROUTER_PRESET: InlinePreset;
65
+ export declare const VUE_ROUTER_PRESET: InlinePreset;
66
66
  /**
67
67
  * vue-i18n Composition API, sourced directly from `vue-i18n` (ubean no longer
68
68
  * wraps `useI18n` — same instance is exposed by the framework-installed
69
69
  * vue-i18n plugin; `t` is destructured from the returned composer).
70
70
  */
71
- declare const VUE_I18N_PRESET: InlinePreset;
71
+ export declare const VUE_I18N_PRESET: InlinePreset;
72
72
  /**
73
73
  * Server-only symbols sourced from the `ubean/server` aggregation entry
74
74
  * (`@ubean/app` + `@ubean/routes` + `@ubean/server` + `@ubean/shared/node`).
@@ -85,9 +85,9 @@ declare const VUE_I18N_PRESET: InlinePreset;
85
85
  * unplugin-auto-import emit a "Duplicated imports" warning, so they live in
86
86
  * the client preset only.
87
87
  */
88
- declare const UBEAN_SERVER_PRESET: InlinePreset;
89
- declare const HONO_OPENAPI_PRESET: InlinePreset;
90
- declare const BUILTIN_PRESETS: InlinePreset[];
88
+ export declare const UBEAN_SERVER_PRESET: InlinePreset;
89
+ export declare const HONO_OPENAPI_PRESET: InlinePreset;
90
+ export declare const BUILTIN_PRESETS: InlinePreset[];
91
91
  interface ComponentInfo {
92
92
  name: string;
93
93
  filePath: string;
@@ -100,8 +100,8 @@ interface AutoImportResult {
100
100
  autoImportsDtsPath: string;
101
101
  componentsDtsPath: string;
102
102
  }
103
- declare function generateAutoImports(_scanResult: ScanResult, options: GenerateAutoImportsOptions): Promise<AutoImportResult>;
104
- declare function getBuiltinComposables(): Import[];
103
+ export declare function generateAutoImports(_scanResult: ScanResult, options: GenerateAutoImportsOptions): Promise<AutoImportResult>;
104
+ export declare function getBuiltinComposables(): Import[];
105
105
  /** unplugin-auto-import 的组装结果(透传字段类型直接引用 unplugin 类型,避免跨包类型命名问题)。 */
106
106
  interface UbeanAutoImportConfig {
107
107
  imports: Options$1['imports'];
@@ -110,7 +110,7 @@ interface UbeanAutoImportConfig {
110
110
  vueTemplate: boolean;
111
111
  eslintrc: Options$1['eslintrc'];
112
112
  }
113
- declare function getUbeanAutoImportConfig(options?: {
113
+ export declare function getUbeanAutoImportConfig(options?: {
114
114
  cwd?: string;
115
115
  srcDir?: string;
116
116
  buildDir?: string;
@@ -126,7 +126,7 @@ interface UbeanComponentsConfig {
126
126
  dts: Options['dts'];
127
127
  deep: boolean;
128
128
  }
129
- declare function getUbeanComponentsConfig(options?: {
129
+ export declare function getUbeanComponentsConfig(options?: {
130
130
  cwd?: string;
131
131
  srcDir?: string;
132
132
  buildDir?: string;
@@ -135,7 +135,7 @@ declare function getUbeanComponentsConfig(options?: {
135
135
  /** `ubean.config.ts` 的 `components` 配置。 */
136
136
  components?: boolean | ComponentsOptions;
137
137
  }): UbeanComponentsConfig;
138
- declare function generateImportsTransform(imports: Import[]): {
138
+ export declare function generateImportsTransform(imports: Import[]): {
139
139
  code: string;
140
140
  map?: null;
141
141
  };
@@ -147,12 +147,12 @@ interface RouteTypesOptions {
147
147
  outDir: string;
148
148
  fileName?: string;
149
149
  }
150
- declare function generateRouteTypes(result: ScanResult, options: RouteTypesOptions): Promise<string>;
150
+ export declare function generateRouteTypes(result: ScanResult, options: RouteTypesOptions): Promise<string>;
151
151
  interface PageTypesOptions {
152
152
  outDir: string;
153
153
  fileName?: string;
154
154
  }
155
- declare function generatePageTypes(result: ScanResult, options: PageTypesOptions): Promise<string>;
155
+ export declare function generatePageTypes(result: ScanResult, options: PageTypesOptions): Promise<string>;
156
156
  //#endregion
157
157
  //#region src/codegen/i18n-types.d.ts
158
158
  interface I18nTypesOptions {
@@ -161,13 +161,13 @@ interface I18nTypesOptions {
161
161
  defaultLocale?: string;
162
162
  }
163
163
  /** Convert a JSON message tree into a TypeScript object type body. */
164
- declare function messagesToTsType(value: unknown, indent?: number): string;
164
+ export declare function messagesToTsType(value: unknown, indent?: number): string;
165
165
  /**
166
166
  * Generate `.ubean/i18n.d.ts` augmenting vue-i18n `DefineLocaleMessage`
167
167
  * from the default locale JSON. Users can also hand-write the same
168
168
  * module augmentation if they prefer.
169
169
  */
170
- declare function generateI18nTypes(result: ScanResult, options: I18nTypesOptions): Promise<string | null>;
170
+ export declare function generateI18nTypes(result: ScanResult, options: I18nTypesOptions): Promise<string | null>;
171
171
  //#endregion
172
172
  //#region src/codegen/openapi-types.d.ts
173
173
  /**
@@ -187,7 +187,7 @@ interface GenerateOpenApiTypesOptions {
187
187
  /**
188
188
  * 从 OpenAPI schema 对象生成 paths 类型声明文件。
189
189
  */
190
- declare function generateOpenApiTypes(schema: unknown, options: GenerateOpenApiTypesOptions): Promise<string>;
190
+ export declare function generateOpenApiTypes(schema: unknown, options: GenerateOpenApiTypesOptions): Promise<string>;
191
191
  /**
192
192
  * 从 dev server 的 `/_openapi.json` 路由获取 schema 并生成类型声明文件。
193
193
  *
@@ -195,18 +195,18 @@ declare function generateOpenApiTypes(schema: unknown, options: GenerateOpenApiT
195
195
  * HTML(页面 fallback)而非 JSON。此时跳过生成并返回 `null`,避免抛出
196
196
  * `Unexpected token '<'` 之类的误导性错误。
197
197
  */
198
- declare function generateOpenApiTypesFromServer(baseUrl: string, options: GenerateOpenApiTypesOptions): Promise<string | null>;
198
+ export declare function generateOpenApiTypesFromServer(baseUrl: string, options: GenerateOpenApiTypesOptions): Promise<string | null>;
199
199
  //#endregion
200
200
  //#region src/codegen/index.d.ts
201
- declare const CODEGEN_CONTRACT_VERSION: 1;
202
- interface CodegenFileContract {
201
+ export declare const CODEGEN_CONTRACT_VERSION: 1;
202
+ export interface CodegenFileContract {
203
203
  name: string;
204
204
  module: string | null;
205
205
  required: boolean;
206
206
  types: string[];
207
207
  }
208
- declare const CODEGEN_FILES: readonly CodegenFileContract[];
209
- interface CodegenManifest {
208
+ export declare const CODEGEN_FILES: readonly CodegenFileContract[];
209
+ export interface CodegenManifest {
210
210
  contractVersion: typeof CODEGEN_CONTRACT_VERSION;
211
211
  generatedAt: string;
212
212
  files: Array<{
@@ -217,12 +217,12 @@ interface CodegenManifest {
217
217
  generated: boolean;
218
218
  }>;
219
219
  }
220
- interface CodegenOptions extends Omit<GenerateAutoImportsOptions, 'cwd' | 'srcDir' | 'buildDir'> {
220
+ export interface CodegenOptions extends Omit<GenerateAutoImportsOptions, 'cwd' | 'srcDir' | 'buildDir'> {
221
221
  cwd: string;
222
222
  srcDir: string;
223
223
  buildDir: string;
224
224
  }
225
- interface CodegenResult {
225
+ export interface CodegenResult {
226
226
  routeTypesPath: string;
227
227
  pageTypesPath: string;
228
228
  i18nTypesPath?: string | null;
@@ -230,6 +230,6 @@ interface CodegenResult {
230
230
  componentsDtsPath?: string;
231
231
  generated: string[];
232
232
  }
233
- declare function generateTypes(result: ScanResult, options: CodegenOptions): Promise<CodegenResult>;
233
+ export declare function generateTypes(result: ScanResult, options: CodegenOptions): Promise<CodegenResult>;
234
234
  //#endregion
235
- export { type AutoImportResult, BUILTIN_PRESETS, CODEGEN_CONTRACT_VERSION, CODEGEN_FILES, CodegenFileContract, CodegenManifest, CodegenOptions, CodegenResult, type ComponentInfo, type GenerateAutoImportsOptions, type GenerateOpenApiTypesOptions, HONO_OPENAPI_PRESET, type I18nTypesOptions, type Import, type InlinePreset, type PageTypesOptions, type ResolvedAutoImports, type ResolvedComponentsAutoImport, type RouteTypesOptions, UBEAN_CLIENT_PRESET, UBEAN_SERVER_PRESET, VUE_I18N_PRESET, VUE_MACROS_PRESET, VUE_PRESET, VUE_ROUTER_PRESET, generateAutoImports, generateI18nTypes, generateImportsTransform, generateOpenApiTypes, generateOpenApiTypesFromServer, generatePageTypes, generateRouteTypes, generateTypes, getAutoImportPresets, getBuiltinComposables, getUbeanAutoImportConfig, getUbeanComponentsConfig, messagesToTsType, resolveAutoImportsConfig, resolveComponentsConfig, toArray };
235
+ export type { AutoImportResult, ComponentInfo, GenerateAutoImportsOptions, GenerateOpenApiTypesOptions, I18nTypesOptions, Import, InlinePreset, PageTypesOptions, ResolvedAutoImports, ResolvedComponentsAutoImport, RouteTypesOptions };
@@ -1,2 +1,2 @@
1
- import { C as getUbeanComponentsConfig, E as toArray, S as getUbeanAutoImportConfig, T as resolveComponentsConfig, _ as VUE_ROUTER_PRESET, a as generateOpenApiTypesFromServer, b as getAutoImportPresets, c as generateI18nTypes, d as HONO_OPENAPI_PRESET, f as UBEAN_CLIENT_PRESET, g as VUE_PRESET, h as VUE_MACROS_PRESET, i as generateOpenApiTypes, l as messagesToTsType, m as VUE_I18N_PRESET, n as CODEGEN_FILES, o as generatePageTypes, p as UBEAN_SERVER_PRESET, r as generateTypes, s as generateRouteTypes, t as CODEGEN_CONTRACT_VERSION, u as BUILTIN_PRESETS, v as generateAutoImports, w as resolveAutoImportsConfig, x as getBuiltinComposables, y as generateImportsTransform } from "../codegen-BqqGw4Dv.js";
1
+ import { C as getUbeanComponentsConfig, E as toArray, S as getUbeanAutoImportConfig, T as resolveComponentsConfig, _ as VUE_ROUTER_PRESET, a as generateOpenApiTypesFromServer, b as getAutoImportPresets, c as generateI18nTypes, d as HONO_OPENAPI_PRESET, f as UBEAN_CLIENT_PRESET, g as VUE_PRESET, h as VUE_MACROS_PRESET, i as generateOpenApiTypes, l as messagesToTsType, m as VUE_I18N_PRESET, n as CODEGEN_FILES, o as generatePageTypes, p as UBEAN_SERVER_PRESET, r as generateTypes, s as generateRouteTypes, t as CODEGEN_CONTRACT_VERSION, u as BUILTIN_PRESETS, v as generateAutoImports, w as resolveAutoImportsConfig, x as getBuiltinComposables, y as generateImportsTransform } from "../codegen-B3oGeRtK.js";
2
2
  export { BUILTIN_PRESETS, CODEGEN_CONTRACT_VERSION, CODEGEN_FILES, HONO_OPENAPI_PRESET, UBEAN_CLIENT_PRESET, UBEAN_SERVER_PRESET, VUE_I18N_PRESET, VUE_MACROS_PRESET, VUE_PRESET, VUE_ROUTER_PRESET, generateAutoImports, generateI18nTypes, generateImportsTransform, generateOpenApiTypes, generateOpenApiTypesFromServer, generatePageTypes, generateRouteTypes, generateTypes, getAutoImportPresets, getBuiltinComposables, getUbeanAutoImportConfig, getUbeanComponentsConfig, messagesToTsType, resolveAutoImportsConfig, resolveComponentsConfig, toArray };
@@ -369,7 +369,8 @@ function generateComponentsDts(components, dtsPath) {
369
369
  for (const name of [
370
370
  "Link",
371
371
  "Head",
372
- "PageView"
372
+ "PageView",
373
+ "ClientOnly"
373
374
  ]) entries.set(name, `typeof import('ubean/client')['${name}']`);
374
375
  for (const comp of components) {
375
376
  const importPath = `./${toPosixPath(relative(dtsDir, toPosixPath(normalize(comp.filePath))))}`;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { a as defineVirtualModule, c as useVirtualRegistry, i as VirtualModuleTr
2
2
  import { CompiledLayout, CompiledMiddleware, CompiledPage, CompiledRoute } from "@ubean/routes";
3
3
  import { ScannedApiRoute, ScannedLocale, ScannedMiddleware, ScannedPageRoute } from "@ubean/scan";
4
4
  //#region src/macros.d.ts
5
- declare function stripMacros(code: string, macros?: readonly string[]): string;
6
- declare function transformMacros(code: string, id: string): string | null;
5
+ export declare function stripMacros(code: string, macros?: readonly string[]): string;
6
+ export declare function transformMacros(code: string, id: string): string | null;
7
7
  //#endregion
8
8
  //#region src/registry.d.ts
9
9
  /**
@@ -32,28 +32,28 @@ type ComponentResolver = ((name: string) => any) | {
32
32
  * Register a component resolver (e.g. `UiResolver()` from `@soybeanjs/ui/resolver`).
33
33
  * The resolver will be merged into `unplugin-vue-components`'s `resolvers` array.
34
34
  */
35
- declare function registerComponentResolver(resolver: ComponentResolver): void;
35
+ export declare function registerComponentResolver(resolver: ComponentResolver): void;
36
36
  /**
37
37
  * Get all registered component resolvers.
38
38
  * Called by `ubeanVite` when constructing the `Components()` plugin.
39
39
  */
40
- declare function getComponentResolvers(): ComponentResolver[];
40
+ export declare function getComponentResolvers(): ComponentResolver[];
41
41
  /**
42
42
  * Register a CSS import path to be injected into the client entry.
43
43
  * e.g. `registerCssImport('@soybeanjs/ui/styles.css')` makes the client
44
44
  * entry module prepend `import '@soybeanjs/ui/styles.css'`.
45
45
  */
46
- declare function registerCssImport(cssPath: string): void;
46
+ export declare function registerCssImport(cssPath: string): void;
47
47
  /**
48
48
  * Get all registered CSS import paths.
49
49
  * Called by `createClientEntryVirtualModule` to prepend CSS imports.
50
50
  */
51
- declare function getCssImports(): string[];
51
+ export declare function getCssImports(): string[];
52
52
  /**
53
53
  * Reset the registry (for testing).
54
54
  * @internal
55
55
  */
56
- declare function resetModuleRegistry(): void;
56
+ export declare function resetModuleRegistry(): void;
57
57
  //#endregion
58
58
  //#region src/ssr-singleton.d.ts
59
59
  /**
@@ -68,10 +68,10 @@ declare function resetModuleRegistry(): void;
68
68
  * - Prod: `ubean` is bundled (`noExternal`). Do **not** also externalize
69
69
  * `@ubean/i18n` — that would create a second copy beside the bundle.
70
70
  */
71
- declare const SSR_SINGLETON_PACKAGES: readonly ["ubean", "@ubean/client", "@ubean/i18n", "vue-i18n", "@intlify/core", "@intlify/core-base"];
72
- declare const SSR_SINGLETON_DEDUPE: readonly ["vue", "vue-i18n", "@ubean/client", "@ubean/i18n"];
73
- declare const SSR_SINGLETON_OPTIMIZE_EXCLUDE: readonly ["ubean", "@ubean/client", "@ubean/i18n"];
74
- declare function ssrSingletonDevPolicy(): {
71
+ export declare const SSR_SINGLETON_PACKAGES: readonly ["ubean", "@ubean/client", "@ubean/i18n", "vue-i18n", "@intlify/core", "@intlify/core-base"];
72
+ export declare const SSR_SINGLETON_DEDUPE: readonly ["vue", "vue-i18n", "@ubean/client", "@ubean/i18n"];
73
+ export declare const SSR_SINGLETON_OPTIMIZE_EXCLUDE: readonly ["ubean", "@ubean/client", "@ubean/i18n"];
74
+ export declare function ssrSingletonDevPolicy(): {
75
75
  resolve: {
76
76
  dedupe: string[];
77
77
  };
@@ -84,16 +84,16 @@ declare function ssrSingletonDevPolicy(): {
84
84
  external: string[];
85
85
  };
86
86
  };
87
- declare function ssrSingletonProdSsr(): {
87
+ export declare function ssrSingletonProdSsr(): {
88
88
  noExternal: string[];
89
89
  };
90
- declare function ssrSingletonProdOptimizeExclude(extra?: string[]): string[];
90
+ export declare function ssrSingletonProdOptimizeExclude(extra?: string[]): string[];
91
91
  //#endregion
92
92
  //#region src/virtual-modules.d.ts
93
- declare function createRoutingVirtualModule(routes: CompiledRoute[], middlewares: CompiledMiddleware[], cwd: string): VirtualModule;
94
- declare function createPagesVirtualModule(pages: CompiledPage[], layouts: CompiledLayout[], cwd: string): VirtualModule;
95
- declare function createMetaVirtualModule(): VirtualModule;
96
- declare function createAppVirtualModule(apiRoutes: ScannedApiRoute[], middlewares: ScannedMiddleware[], pages: ScannedPageRoute[], srcDir: string): VirtualModule;
97
- declare function createLocalesVirtualModule(_locales: ScannedLocale[], defaultLocale: string | undefined, srcDir?: string, i18nConfigJson?: string): VirtualModule;
93
+ export declare function createRoutingVirtualModule(routes: CompiledRoute[], middlewares: CompiledMiddleware[], cwd: string): VirtualModule;
94
+ export declare function createPagesVirtualModule(pages: CompiledPage[], layouts: CompiledLayout[], cwd: string): VirtualModule;
95
+ export declare function createMetaVirtualModule(): VirtualModule;
96
+ export declare function createAppVirtualModule(apiRoutes: ScannedApiRoute[], middlewares: ScannedMiddleware[], pages: ScannedPageRoute[], srcDir: string): VirtualModule;
97
+ export declare function createLocalesVirtualModule(_locales: ScannedLocale[], defaultLocale: string | undefined, srcDir?: string, i18nConfigJson?: string): VirtualModule;
98
98
  //#endregion
99
- export { SSR_SINGLETON_DEDUPE, SSR_SINGLETON_OPTIMIZE_EXCLUDE, SSR_SINGLETON_PACKAGES, type VirtualModule, type VirtualModuleContext, VirtualModuleRegistry, type VirtualModuleTransform, createAppVirtualModule, createLocalesVirtualModule, createMetaVirtualModule, createPagesVirtualModule, createRoutingVirtualModule, defineVirtualModule, defineVirtualModulePrefix, getComponentResolvers, getCssImports, registerComponentResolver, registerCssImport, resetModuleRegistry, resetVirtualRegistry, ssrSingletonDevPolicy, ssrSingletonProdOptimizeExclude, ssrSingletonProdSsr, stripMacros, transformMacros, useVirtualRegistry };
99
+ export { type VirtualModule, type VirtualModuleContext, VirtualModuleRegistry, type VirtualModuleTransform, defineVirtualModule, defineVirtualModulePrefix, resetVirtualRegistry, useVirtualRegistry };
@@ -2,7 +2,7 @@ import { PrerenderConfig, PrerenderResult, RouteRule } from "@ubean/config";
2
2
  import { ScannedPageRoute } from "@ubean/scan";
3
3
  import { RouteRule as RouteRule$1 } from "@ubean/shared";
4
4
  //#region src/prerender.d.ts
5
- interface PrerendererOptions {
5
+ export interface PrerendererOptions {
6
6
  cwd: string;
7
7
  outputDir: string;
8
8
  pages: ScannedPageRoute[];
@@ -48,7 +48,7 @@ interface PrerendererOptions {
48
48
  * 返回的路径列表会进一步与 `pages` 候选池匹配(glob 模式)或直接加入(具体路径)。
49
49
  * 动态路由的具象值(如 `/blog/hello-world`)可通过具体路径直接加入。
50
50
  */
51
- declare function extractPrerenderRoutesFromRules(routeRules: Record<string, RouteRule$1> | undefined): string[];
51
+ export declare function extractPrerenderRoutesFromRules(routeRules: Record<string, RouteRule$1> | undefined): string[];
52
52
  /**
53
53
  * 收集需要预渲染的路由列表。
54
54
  *
@@ -62,7 +62,7 @@ declare function extractPrerenderRoutesFromRules(routeRules: Record<string, Rout
62
62
  *
63
63
  * 返回的 `skipped` 为被 `exclude` 命中的路由集合。
64
64
  */
65
- declare function collectPrerenderRoutes(pages: ScannedPageRoute[], options?: {
65
+ export declare function collectPrerenderRoutes(pages: ScannedPageRoute[], options?: {
66
66
  all?: boolean;
67
67
  include?: string[];
68
68
  exclude?: string[];
@@ -74,7 +74,7 @@ declare function collectPrerenderRoutes(pages: ScannedPageRoute[], options?: {
74
74
  routes: string[];
75
75
  skipped: string[];
76
76
  };
77
- declare function extractLinks(html: string, baseUrl?: string): string[];
77
+ export declare function extractLinks(html: string, baseUrl?: string): string[];
78
78
  /**
79
79
  * 将路由路径映射到磁盘文件路径。
80
80
  *
@@ -87,7 +87,7 @@ declare function extractLinks(html: string, baseUrl?: string): string[];
87
87
  * 处理带扩展名路由是为了避免 `/robots.txt/index.html`、`/sitemap.xml/index.html`
88
88
  * 这种被错误转成目录的产物。
89
89
  */
90
- declare function routeToFilePath(route: string, outputDir: string): string;
90
+ export declare function routeToFilePath(route: string, outputDir: string): string;
91
91
  /**
92
92
  * 将路由路径映射到对应的 `__data.json` 文件路径。
93
93
  *
@@ -99,11 +99,11 @@ declare function routeToFilePath(route: string, outputDir: string): string;
99
99
  * 与 HTML 不同,这里不需要处理扩展名路由(`.html`/`.txt` 等)—— payload
100
100
  * 仅对页面路由有意义,扩展名路由(如 `/robots.txt`)不参与 payload 提取。
101
101
  */
102
- declare function routeToDataFilePath(route: string, outputDir: string): string;
102
+ export declare function routeToDataFilePath(route: string, outputDir: string): string;
103
103
  /**
104
104
  * `extractDataPayload` 的返回结构。
105
105
  */
106
- interface ExtractedPayload {
106
+ export interface ExtractedPayload {
107
107
  /** 从 `__UBEAN_DATA__` 解析出的 payload 数据。 */
108
108
  data: Record<string, unknown>;
109
109
  /** 替换内联 script 后的 HTML(包含 preload link + 引导脚本)。 */
@@ -126,10 +126,10 @@ interface ExtractedPayload {
126
126
  * @param html 预渲染后的完整 HTML
127
127
  * @param route 当前路由路径(用于计算 dataUrl)
128
128
  */
129
- declare function extractDataPayload(html: string, route: string): ExtractedPayload | null;
130
- declare function writePrerenderedFile(filePath: string, html: string): Promise<void>;
131
- declare function prerender(options: PrerendererOptions): Promise<PrerenderResult>;
132
- declare function generatePrerenderManifest(result: PrerenderResult, baseUrl?: string): {
129
+ export declare function extractDataPayload(html: string, route: string): ExtractedPayload | null;
130
+ export declare function writePrerenderedFile(filePath: string, html: string): Promise<void>;
131
+ export declare function prerender(options: PrerendererOptions): Promise<PrerenderResult>;
132
+ export declare function generatePrerenderManifest(result: PrerenderResult, baseUrl?: string): {
133
133
  routes: string[];
134
134
  generatedAt: string;
135
135
  errors: Array<{
@@ -138,4 +138,4 @@ declare function generatePrerenderManifest(result: PrerenderResult, baseUrl?: st
138
138
  }>;
139
139
  };
140
140
  //#endregion
141
- export { ExtractedPayload, PrerendererOptions, type RouteRule, collectPrerenderRoutes, extractDataPayload, extractLinks, extractPrerenderRoutesFromRules, generatePrerenderManifest, prerender, routeToDataFilePath, routeToFilePath, writePrerenderedFile };
141
+ export type { RouteRule };
@@ -2,7 +2,7 @@ import { ResolvedConfig } from "@ubean/config";
2
2
  import { ScanResult } from "@ubean/scan";
3
3
  import { Preset } from "@ubean/preset";
4
4
  //#region src/production.d.ts
5
- interface BuildOptions {
5
+ export interface BuildOptions {
6
6
  cwd: string;
7
7
  config: ResolvedConfig;
8
8
  preset: Preset;
@@ -12,7 +12,7 @@ interface BuildOptions {
12
12
  /** Inlined content collections for production SSR (`queryCollection`). */
13
13
  contentSnapshot?: Record<string, unknown[]>;
14
14
  }
15
- interface BuildManifest {
15
+ export interface BuildManifest {
16
16
  assets: Array<{
17
17
  file: string;
18
18
  src?: string;
@@ -24,6 +24,5 @@ interface BuildManifest {
24
24
  serverDir: string;
25
25
  preset: string;
26
26
  }
27
- declare function buildProduction(options: BuildOptions): Promise<BuildManifest>;
28
- //#endregion
29
- export { BuildManifest, BuildOptions, buildProduction };
27
+ export declare function buildProduction(options: BuildOptions): Promise<BuildManifest>;
28
+ //#endregion
@@ -2,7 +2,7 @@ import { a as useVirtualRegistry } from "./virtual-registry-BWkaQHXN.js";
2
2
  import { a as createRoutingVirtualModule, i as createPagesVirtualModule, n as createLocalesVirtualModule, r as createMetaVirtualModule, t as createAppVirtualModule } from "./virtual-modules-vLkLkAfT.js";
3
3
  import { a as ssrSingletonProdOptimizeExclude, o as ssrSingletonProdSsr } from "./ssr-singleton-CEQi_H6-.js";
4
4
  import { n as localeVueParamFromI18n, r as serializeI18nConfig, t as ubeanPlugin } from "./vite-D2EZl_6P.js";
5
- import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-CIj7ErAs.js";
5
+ import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-DcydGsvy.js";
6
6
  import { join, relative, resolve } from "pathe";
7
7
  import { resolveModules } from "@ubean/config";
8
8
  import { build } from "vite";
@@ -1,8 +1,8 @@
1
1
  import { ScannedPageRoute } from "@ubean/scan";
2
2
  //#region src/static-render.d.ts
3
3
  /** 哨兵路由:prerender 队列中的 404 页标记,产物映射为 `404.html` */
4
- declare const STATIC_NOT_FOUND_ROUTE = "/__ubean_404__";
5
- interface CompiledPageRoute {
4
+ export declare const STATIC_NOT_FOUND_ROUTE = "/__ubean_404__";
5
+ export interface CompiledPageRoute {
6
6
  page: ScannedPageRoute;
7
7
  regex: RegExp;
8
8
  /** 捕获组顺序对应的参数名 */
@@ -24,8 +24,8 @@ interface CompiledPageRoute {
24
24
  * - `/blog/:slug(.*)*`(自定义正则 + 可重复 = catch-all)
25
25
  * - `/users/:id(\\d+)`(自定义正则)
26
26
  */
27
- declare function compilePageRoute(page: ScannedPageRoute): CompiledPageRoute;
28
- interface StaticRouteMatch {
27
+ export declare function compilePageRoute(page: ScannedPageRoute): CompiledPageRoute;
28
+ export interface StaticRouteMatch {
29
29
  page: ScannedPageRoute;
30
30
  params: Record<string, string>;
31
31
  }
@@ -35,7 +35,7 @@ interface StaticRouteMatch {
35
35
  * 匹配顺序(确定性):静态段多者优先 → catch-all 最后 → 同分保持传入顺序。
36
36
  * 参数值经 `decodeURIComponent` 解码(对齐 Hono `c.req.param()` 行为)。
37
37
  */
38
- declare function matchRoutePattern(pages: Array<ScannedPageRoute | CompiledPageRoute>, path: string): StaticRouteMatch | null;
38
+ export declare function matchRoutePattern(pages: Array<ScannedPageRoute | CompiledPageRoute>, path: string): StaticRouteMatch | null;
39
39
  /**
40
40
  * 按路由策略将收集到的路由展开为全语言 URL 列表。
41
41
  *
@@ -50,8 +50,8 @@ declare function matchRoutePattern(pages: Array<ScannedPageRoute | CompiledPageR
50
50
  * - 404 哨兵路由不展开(静态托管平台仅认单份 `404.html`)
51
51
  * - 已带 locale 前缀的 URL(crawlLinks 发现)保持原样,避免 `/zh/zh/about`
52
52
  */
53
- declare function expandRoutesForLocales(routes: string[], i18n: StaticSsgRendererI18nInit): string[];
54
- interface StaticSsgRendererI18nInit {
53
+ export declare function expandRoutesForLocales(routes: string[], i18n: StaticSsgRendererI18nInit): string[];
54
+ export interface StaticSsgRendererI18nInit {
55
55
  enabled?: boolean;
56
56
  strategy?: 'prefix' | 'prefix_except_default' | 'prefix_and_default' | 'no_prefix';
57
57
  defaultLocale?: string;
@@ -59,7 +59,7 @@ interface StaticSsgRendererI18nInit {
59
59
  code: string;
60
60
  }>;
61
61
  }
62
- interface StaticSsgRendererInit {
62
+ export interface StaticSsgRendererInit {
63
63
  /** 扫描得到的页面(含动态路由模式,供具象 URL 匹配) */
64
64
  pages: ScannedPageRoute[];
65
65
  /** `pages/404.vue` 自动检测的 404 页(可选) */
@@ -67,17 +67,17 @@ interface StaticSsgRendererInit {
67
67
  /** i18n 配置(用于 locale 前缀剥离与默认语言) */
68
68
  i18n?: StaticSsgRendererI18nInit;
69
69
  }
70
- interface RenderStaticPageInput {
70
+ export interface RenderStaticPageInput {
71
71
  pageName: string;
72
72
  params: Record<string, string>;
73
73
  url: string;
74
74
  locale?: string;
75
75
  }
76
- type RenderStaticPageFn = (input: RenderStaticPageInput) => Promise<{
76
+ export type RenderStaticPageFn = (input: RenderStaticPageInput) => Promise<{
77
77
  html: string;
78
78
  statusCode: number;
79
79
  }>;
80
- interface StaticSsgRenderer {
80
+ export interface StaticSsgRenderer {
81
81
  /** 与 `PrerendererOptions.fetcher` 同构的契约 */
82
82
  fetcher: (url: string) => Promise<{
83
83
  html: string;
@@ -94,8 +94,7 @@ interface StaticSsgRenderer {
94
94
  * 失败(entry 缺失 / 无 renderStaticPage 导出 / 加载异常)返回 `undefined`,
95
95
  * 由调用方降级(warn + placeholder prerender)。
96
96
  */
97
- declare function createStaticSsgRenderer(cwd: string, manifest: {
97
+ export declare function createStaticSsgRenderer(cwd: string, manifest: {
98
98
  serverDir: string;
99
99
  }, init: StaticSsgRendererInit): Promise<StaticSsgRenderer | undefined>;
100
- //#endregion
101
- export { CompiledPageRoute, RenderStaticPageFn, RenderStaticPageInput, STATIC_NOT_FOUND_ROUTE, StaticRouteMatch, StaticSsgRenderer, StaticSsgRendererI18nInit, StaticSsgRendererInit, compilePageRoute, createStaticSsgRenderer, expandRoutesForLocales, matchRoutePattern };
100
+ //#endregion
package/dist/vite.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ResolvedConfig } from "@ubean/config";
2
2
  import { Plugin } from "vite";
3
3
  //#region src/vite.d.ts
4
- interface UbeanPluginOptions {
4
+ export interface UbeanPluginOptions {
5
5
  /**
6
6
  * 已解析的 ubean 配置。如果未提供,插件会按以下顺序获取:
7
7
  * 1. 尝试从全局缓存读取(`loadUbeanConfig` 已被 CLI 调用时会有缓存)
@@ -36,6 +36,5 @@ interface UbeanPluginOptions {
36
36
  * ubeanPlugin({ config: resolvedConfig })
37
37
  * ```
38
38
  */
39
- declare function ubeanPlugin(options?: UbeanPluginOptions): Plugin;
40
- //#endregion
41
- export { UbeanPluginOptions, ubeanPlugin };
39
+ export declare function ubeanPlugin(options?: UbeanPluginOptions): Plugin;
40
+ //#endregion
@@ -1,6 +1,6 @@
1
1
  import { a as useVirtualRegistry, n as defineVirtualModule } from "./virtual-registry-BWkaQHXN.js";
2
2
  import { c as getCssImports, i as ssrSingletonDevPolicy, s as getComponentResolvers } from "./ssr-singleton-CEQi_H6-.js";
3
- import { E as toArray, T as resolveComponentsConfig, b as getAutoImportPresets, w as resolveAutoImportsConfig } from "./codegen-BqqGw4Dv.js";
3
+ import { E as toArray, T as resolveComponentsConfig, b as getAutoImportPresets, w as resolveAutoImportsConfig } from "./codegen-B3oGeRtK.js";
4
4
  import { createRequire } from "node:module";
5
5
  import { join, resolve } from "pathe";
6
6
  import { scanProject } from "@ubean/scan";
@@ -630,7 +630,8 @@ function ubeanVite(options) {
630
630
  const UBEAN_BUILTIN_COMPONENTS = [
631
631
  "Link",
632
632
  "Head",
633
- "PageView"
633
+ "PageView",
634
+ "ClientOnly"
634
635
  ];
635
636
  function ubeanComponentsResolver(componentName) {
636
637
  if (UBEAN_BUILTIN_COMPONENTS.includes(componentName)) return {
package/dist/vue.d.ts CHANGED
@@ -7,8 +7,8 @@ interface UbeanViteOptions {
7
7
  config: ResolvedConfig;
8
8
  ssr?: boolean;
9
9
  }
10
- declare const VUE_PLUGIN_INCLUDE: RegExp[];
11
- declare function ubeanVite(options: UbeanViteOptions): Plugin[];
10
+ export declare const VUE_PLUGIN_INCLUDE: RegExp[];
11
+ export declare function ubeanVite(options: UbeanViteOptions): Plugin[];
12
12
  //#endregion
13
13
  //#region src/vue-virtual-modules.d.ts
14
14
  /**
@@ -21,9 +21,9 @@ declare function ubeanVite(options: UbeanViteOptions): Plugin[];
21
21
  * `requiresAuth` / `head` / `definePage({ meta })` 透传字段(超集,
22
22
  * 使 `createMatcherGuard()` 与 SPA head guard 在框架模式下同样可用)。
23
23
  */
24
- declare function createVuePagesVirtualModule(pages: ScannedPageRoute[], layouts: ScannedLayout[], notFoundPage?: ScannedPageRoute, loadingPage?: ScannedPageRoute, errorPage?: ScannedPageRoute, localeVueParam?: string): VirtualModule;
25
- declare function createVueAppEntryVirtualModule(appEntry?: ScannedAppEntry): VirtualModule;
26
- declare function createClientEntryVirtualModule(): VirtualModule;
27
- declare function createServerEntryVirtualModule(serverEntry?: ScannedServerEntry): VirtualModule;
24
+ export declare function createVuePagesVirtualModule(pages: ScannedPageRoute[], layouts: ScannedLayout[], notFoundPage?: ScannedPageRoute, loadingPage?: ScannedPageRoute, errorPage?: ScannedPageRoute, localeVueParam?: string): VirtualModule;
25
+ export declare function createVueAppEntryVirtualModule(appEntry?: ScannedAppEntry): VirtualModule;
26
+ export declare function createClientEntryVirtualModule(): VirtualModule;
27
+ export declare function createServerEntryVirtualModule(serverEntry?: ScannedServerEntry): VirtualModule;
28
28
  //#endregion
29
- export { type UbeanViteOptions, VUE_PLUGIN_INCLUDE, createClientEntryVirtualModule, createServerEntryVirtualModule, createVueAppEntryVirtualModule, createVuePagesVirtualModule, ubeanVite as default, ubeanVite };
29
+ export { type UbeanViteOptions, ubeanVite as default };
package/dist/vue.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-CIj7ErAs.js";
1
+ import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-DcydGsvy.js";
2
2
  export { VUE_PLUGIN_INCLUDE, createClientEntryVirtualModule, createServerEntryVirtualModule, createVueAppEntryVirtualModule, createVuePagesVirtualModule, ubeanVite as default, ubeanVite };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubean/build",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Vite plugins, production build, SSG prerender, type codegen, and Server Actions plugin for ubean",
5
5
  "files": [
6
6
  "dist"
@@ -45,17 +45,17 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@intlify/unplugin-vue-i18n": "11.2.5",
48
- "@ubean/client": "0.4.5",
49
- "@ubean/config": "0.4.5",
50
- "@ubean/i18n": "0.4.5",
51
- "@ubean/islands": "0.4.5",
52
- "@ubean/markdown": "0.4.5",
53
- "@ubean/pages": "0.4.5",
54
- "@ubean/preset": "0.4.5",
55
- "@ubean/routes": "0.4.5",
56
- "@ubean/scan": "0.4.5",
57
- "@ubean/shared": "0.4.5",
58
- "@ubean/vue": "0.4.5",
48
+ "@ubean/client": "0.4.7",
49
+ "@ubean/config": "0.4.7",
50
+ "@ubean/i18n": "0.4.7",
51
+ "@ubean/islands": "0.4.7",
52
+ "@ubean/markdown": "0.4.7",
53
+ "@ubean/pages": "0.4.7",
54
+ "@ubean/preset": "0.4.7",
55
+ "@ubean/routes": "0.4.7",
56
+ "@ubean/scan": "0.4.7",
57
+ "@ubean/shared": "0.4.7",
58
+ "@ubean/vue": "0.4.7",
59
59
  "@vitejs/plugin-vue": "^6.0.8",
60
60
  "openapi-typescript": "^7.13.0",
61
61
  "pathe": "^2.0.3",
@@ -69,12 +69,12 @@
69
69
  "devDependencies": {
70
70
  "@types/node": "^26.5.0",
71
71
  "hono": "4.13.7",
72
- "typescript": "7.0.2",
73
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
74
- "vite-plus": "0.3.0"
72
+ "typescript": "npm:typescript-native-bridge@latest",
73
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
74
+ "vite-plus": "0.3.1"
75
75
  },
76
76
  "peerDependencies": {
77
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0"
77
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.3.1"
78
78
  },
79
79
  "peerDependenciesMeta": {
80
80
  "vite": {