@ubean/build 0.3.4 → 0.3.6
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/codegen/index.d.ts
CHANGED
|
@@ -34,6 +34,13 @@ declare const UBEAN_CLIENT_PRESET: InlinePreset;
|
|
|
34
34
|
* Server-only symbols that come from the main `ubean` package.
|
|
35
35
|
* These import the full ubean entry (which includes build tools like `vite`),
|
|
36
36
|
* so they must only be used in server-side files (API routes, middleware, etc.).
|
|
37
|
+
*
|
|
38
|
+
* Note: the isomorphic data composables (`useData` / `useAsyncData` /
|
|
39
|
+
* `useFetch`) are intentionally NOT listed here — they are exported from
|
|
40
|
+
* `ubean/client` (see UBEAN_CLIENT_PRESET) and re-exported from the same
|
|
41
|
+
* `@ubean/pages` source. Declaring them in both presets makes
|
|
42
|
+
* unplugin-auto-import emit a "Duplicated imports" warning, so they live in
|
|
43
|
+
* the client preset only.
|
|
37
44
|
*/
|
|
38
45
|
declare const UBEAN_SERVER_PRESET: InlinePreset;
|
|
39
46
|
declare const HONO_OPENAPI_PRESET: InlinePreset;
|
|
@@ -134,8 +141,12 @@ interface GenerateOpenApiTypesOptions {
|
|
|
134
141
|
declare function generateOpenApiTypes(schema: unknown, options: GenerateOpenApiTypesOptions): Promise<string>;
|
|
135
142
|
/**
|
|
136
143
|
* 从 dev server 的 `/_openapi.json` 路由获取 schema 并生成类型声明文件。
|
|
144
|
+
*
|
|
145
|
+
* SSG / SPA 等无后端模式访问 `/_openapi.json` 时,dev server 会以 200 返回
|
|
146
|
+
* HTML(页面 fallback)而非 JSON。此时跳过生成并返回 `null`,避免抛出
|
|
147
|
+
* `Unexpected token '<'` 之类的误导性错误。
|
|
137
148
|
*/
|
|
138
|
-
declare function generateOpenApiTypesFromServer(baseUrl: string, options: GenerateOpenApiTypesOptions): Promise<string>;
|
|
149
|
+
declare function generateOpenApiTypesFromServer(baseUrl: string, options: GenerateOpenApiTypesOptions): Promise<string | null>;
|
|
139
150
|
//#endregion
|
|
140
151
|
//#region src/codegen/index.d.ts
|
|
141
152
|
declare const CODEGEN_CONTRACT_VERSION: 1;
|
package/dist/codegen/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as generateImportsTransform, a as generateOpenApiTypesFromServer, b as getUbeanComponentsConfig, c as generateI18nTypes, d as HONO_OPENAPI_PRESET, f as UBEAN_CLIENT_PRESET, g as generateAutoImports, h as VUE_PRESET, i as generateOpenApiTypes, l as messagesToTsType, m as VUE_MACROS_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 getBuiltinComposables, y as getUbeanAutoImportConfig } from "../codegen-
|
|
1
|
+
import { _ as generateImportsTransform, a as generateOpenApiTypesFromServer, b as getUbeanComponentsConfig, c as generateI18nTypes, d as HONO_OPENAPI_PRESET, f as UBEAN_CLIENT_PRESET, g as generateAutoImports, h as VUE_PRESET, i as generateOpenApiTypes, l as messagesToTsType, m as VUE_MACROS_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 getBuiltinComposables, y as getUbeanAutoImportConfig } from "../codegen-DX7zMgPZ.js";
|
|
2
2
|
export { BUILTIN_PRESETS, CODEGEN_CONTRACT_VERSION, CODEGEN_FILES, HONO_OPENAPI_PRESET, UBEAN_CLIENT_PRESET, UBEAN_SERVER_PRESET, VUE_MACROS_PRESET, VUE_PRESET, generateAutoImports, generateI18nTypes, generateImportsTransform, generateOpenApiTypes, generateOpenApiTypesFromServer, generatePageTypes, generateRouteTypes, generateTypes, getBuiltinComposables, getUbeanAutoImportConfig, getUbeanComponentsConfig, messagesToTsType };
|
|
@@ -107,6 +107,7 @@ const UBEAN_CLIENT_PRESET = {
|
|
|
107
107
|
"useRouter",
|
|
108
108
|
"useHead",
|
|
109
109
|
"useViewTransition",
|
|
110
|
+
"useData",
|
|
110
111
|
"useAsyncData",
|
|
111
112
|
"useFetch",
|
|
112
113
|
"useCacheViews",
|
|
@@ -130,14 +131,18 @@ const UBEAN_CLIENT_PRESET = {
|
|
|
130
131
|
* Server-only symbols that come from the main `ubean` package.
|
|
131
132
|
* These import the full ubean entry (which includes build tools like `vite`),
|
|
132
133
|
* so they must only be used in server-side files (API routes, middleware, etc.).
|
|
134
|
+
*
|
|
135
|
+
* Note: the isomorphic data composables (`useData` / `useAsyncData` /
|
|
136
|
+
* `useFetch`) are intentionally NOT listed here — they are exported from
|
|
137
|
+
* `ubean/client` (see UBEAN_CLIENT_PRESET) and re-exported from the same
|
|
138
|
+
* `@ubean/pages` source. Declaring them in both presets makes
|
|
139
|
+
* unplugin-auto-import emit a "Duplicated imports" warning, so they live in
|
|
140
|
+
* the client preset only.
|
|
133
141
|
*/
|
|
134
142
|
const UBEAN_SERVER_PRESET = {
|
|
135
143
|
from: "ubean",
|
|
136
144
|
imports: [
|
|
137
145
|
"defineHandlerMeta",
|
|
138
|
-
"useData",
|
|
139
|
-
"useAsyncData",
|
|
140
|
-
"useFetch",
|
|
141
146
|
"defineAction",
|
|
142
147
|
"defineServerFn",
|
|
143
148
|
"invokeServerFn",
|
|
@@ -600,11 +605,16 @@ async function generateOpenApiTypes(schema, options) {
|
|
|
600
605
|
}
|
|
601
606
|
/**
|
|
602
607
|
* 从 dev server 的 `/_openapi.json` 路由获取 schema 并生成类型声明文件。
|
|
608
|
+
*
|
|
609
|
+
* SSG / SPA 等无后端模式访问 `/_openapi.json` 时,dev server 会以 200 返回
|
|
610
|
+
* HTML(页面 fallback)而非 JSON。此时跳过生成并返回 `null`,避免抛出
|
|
611
|
+
* `Unexpected token '<'` 之类的误导性错误。
|
|
603
612
|
*/
|
|
604
613
|
async function generateOpenApiTypesFromServer(baseUrl, options) {
|
|
605
614
|
const url = `${baseUrl.replace(/\/$/, "")}/_openapi.json`;
|
|
606
615
|
const response = await fetch(url);
|
|
607
616
|
if (!response.ok) throw new Error(`[openapi-types] Failed to fetch OpenAPI schema from ${url}: ${response.status} ${response.statusText}`);
|
|
617
|
+
if (!(response.headers.get("content-type") || "").includes("json")) return null;
|
|
608
618
|
return generateOpenApiTypes(await response.json(), options);
|
|
609
619
|
}
|
|
610
620
|
//#endregion
|
package/dist/production.js
CHANGED
|
@@ -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-D5WBA3u7.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-B3y8Qoan.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-
|
|
5
|
+
import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-JEYc4beF.js";
|
|
6
6
|
import { join, relative, resolve } from "pathe";
|
|
7
7
|
import { resolveModules } from "@ubean/config";
|
|
8
8
|
import { build } from "vite";
|
|
@@ -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 { f as UBEAN_CLIENT_PRESET, p as UBEAN_SERVER_PRESET } from "./codegen-
|
|
3
|
+
import { f as UBEAN_CLIENT_PRESET, p as UBEAN_SERVER_PRESET } from "./codegen-DX7zMgPZ.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { join, resolve } from "pathe";
|
|
6
6
|
import { scanProject } from "@ubean/scan";
|
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-
|
|
1
|
+
import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-JEYc4beF.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.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "Vite plugins, production build, SSG prerender, type codegen, and Server Actions plugin for ubean",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -41,17 +41,17 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@intlify/unplugin-vue-i18n": "11.2.5",
|
|
44
|
-
"@ubean/client": "0.3.
|
|
45
|
-
"@ubean/config": "0.3.
|
|
46
|
-
"@ubean/i18n": "0.3.
|
|
47
|
-
"@ubean/islands": "0.3.
|
|
48
|
-
"@ubean/markdown": "0.3.
|
|
49
|
-
"@ubean/pages": "0.3.
|
|
50
|
-
"@ubean/preset": "0.3.
|
|
51
|
-
"@ubean/routes": "0.3.
|
|
52
|
-
"@ubean/scan": "0.3.
|
|
53
|
-
"@ubean/shared": "0.3.
|
|
54
|
-
"@ubean/vue": "0.3.
|
|
44
|
+
"@ubean/client": "0.3.6",
|
|
45
|
+
"@ubean/config": "0.3.6",
|
|
46
|
+
"@ubean/i18n": "0.3.6",
|
|
47
|
+
"@ubean/islands": "0.3.6",
|
|
48
|
+
"@ubean/markdown": "0.3.6",
|
|
49
|
+
"@ubean/pages": "0.3.6",
|
|
50
|
+
"@ubean/preset": "0.3.6",
|
|
51
|
+
"@ubean/routes": "0.3.6",
|
|
52
|
+
"@ubean/scan": "0.3.6",
|
|
53
|
+
"@ubean/shared": "0.3.6",
|
|
54
|
+
"@ubean/vue": "0.3.6",
|
|
55
55
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
56
56
|
"openapi-typescript": "^7.13.0",
|
|
57
57
|
"oxc-transform": "^0.147.0",
|