@ubean/build 0.3.0 → 0.3.2
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.js +1 -1
- package/dist/{codegen-D6ewf11I.js → codegen-CYk6X-Hn.js} +34 -21
- package/dist/production.js +2 -2
- package/dist/{vite-D640Tpv8.js → vite-B3y8Qoan.js} +1 -1
- package/dist/vite.js +1 -1
- package/dist/{vue-BJO18Lwe.js → vue-CL_djWZL.js} +13 -6
- package/dist/vue.js +1 -1
- package/package.json +20 -20
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-CYk6X-Hn.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 };
|
|
@@ -276,7 +276,7 @@ async function generateAutoImports(_scanResult, options) {
|
|
|
276
276
|
components.push(...scanned);
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
const componentsDts = generateComponentsDts(components);
|
|
279
|
+
const componentsDts = generateComponentsDts(components, componentsDtsPath);
|
|
280
280
|
await writeFile(componentsDtsPath, componentsDts, "utf-8");
|
|
281
281
|
return {
|
|
282
282
|
composablesImports,
|
|
@@ -285,34 +285,47 @@ async function generateAutoImports(_scanResult, options) {
|
|
|
285
285
|
componentsDtsPath
|
|
286
286
|
};
|
|
287
287
|
}
|
|
288
|
-
|
|
288
|
+
/**
|
|
289
|
+
* Generate the `.ubean/components.d.ts` in a format compatible with
|
|
290
|
+
* unplugin-vue-components (both writers own the same file).
|
|
291
|
+
*
|
|
292
|
+
* `ubean dev` runs codegen first, then unplugin-vue-components rewrites the
|
|
293
|
+
* file in dev mode using its append merge: it keeps entries scraped from the
|
|
294
|
+
* existing `GlobalComponents` interface but drops any surrounding
|
|
295
|
+
* `import`/`const` declaration lines. Entries must therefore be
|
|
296
|
+
* self-contained inline `typeof import('...')` declarations so they stay
|
|
297
|
+
* valid after unplugin merges them.
|
|
298
|
+
*/
|
|
299
|
+
function generateComponentsDts(components, dtsPath) {
|
|
300
|
+
const dtsDir = fileDirname(toPosixPath(normalize(dtsPath)));
|
|
301
|
+
const entries = /* @__PURE__ */ new Map();
|
|
302
|
+
for (const name of [
|
|
303
|
+
"Link",
|
|
304
|
+
"Head",
|
|
305
|
+
"PageView"
|
|
306
|
+
]) entries.set(name, `typeof import('ubean/client')['${name}']`);
|
|
307
|
+
for (const comp of components) {
|
|
308
|
+
const importPath = `./${toPosixPath(relative(dtsDir, toPosixPath(normalize(comp.filePath))))}`;
|
|
309
|
+
entries.set(comp.pascalName, `typeof import('${importPath}')['default']`);
|
|
310
|
+
}
|
|
289
311
|
const lines = [
|
|
290
312
|
"// Auto-generated by ubean - do not edit manually",
|
|
291
313
|
"/* eslint-disable */",
|
|
292
314
|
"// @ts-nocheck",
|
|
315
|
+
"// biome-ignore lint: disable",
|
|
316
|
+
"// oxlint-disable",
|
|
293
317
|
"",
|
|
294
|
-
"
|
|
318
|
+
"export {}",
|
|
319
|
+
"",
|
|
320
|
+
"/* prettier-ignore */",
|
|
321
|
+
"declare module 'vue' {",
|
|
322
|
+
" export interface GlobalComponents {"
|
|
295
323
|
];
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
importLines.push(` const ${name}: typeof import('ubean/client')['${name}'];`);
|
|
300
|
-
componentEntries.push(` ${name}: typeof ${name};`);
|
|
301
|
-
}
|
|
302
|
-
for (const comp of components) {
|
|
303
|
-
importLines.push(` import ${comp.pascalName} from ${JSON.stringify(comp.importPath)};`);
|
|
304
|
-
componentEntries.push(` ${comp.pascalName}: typeof ${comp.pascalName};`);
|
|
305
|
-
}
|
|
306
|
-
if (importLines.length > 0) {
|
|
307
|
-
lines.push(...importLines);
|
|
308
|
-
lines.push("");
|
|
309
|
-
lines.push(" export interface GlobalComponents {");
|
|
310
|
-
lines.push(...componentEntries);
|
|
311
|
-
lines.push(" }");
|
|
312
|
-
} else lines.push(" export interface GlobalComponents {}");
|
|
324
|
+
const sorted = [...entries.entries()].sort(([a], [b]) => a.localeCompare(b));
|
|
325
|
+
lines.push(...sorted.map(([name, declaration]) => ` ${name}: ${declaration}`));
|
|
326
|
+
lines.push(" }");
|
|
313
327
|
lines.push("}");
|
|
314
328
|
lines.push("");
|
|
315
|
-
lines.push("export {}");
|
|
316
329
|
return `${lines.join("\n")}\n`;
|
|
317
330
|
}
|
|
318
331
|
function getBuiltinComposables() {
|
package/dist/production.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
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
|
-
import { n as localeVueParamFromI18n, r as serializeI18nConfig, t as ubeanPlugin } from "./vite-
|
|
5
|
-
import { a as createVueAppEntryVirtualModule, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, t as VUE_PLUGIN_INCLUDE } from "./vue-
|
|
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-CL_djWZL.js";
|
|
6
6
|
import { join, relative, resolve } from "pathe";
|
|
7
7
|
import { resolveModules } from "@ubean/config";
|
|
8
8
|
import { build } from "vite";
|
|
@@ -105,7 +105,7 @@ function ubeanPlugin(options) {
|
|
|
105
105
|
"locales"
|
|
106
106
|
];
|
|
107
107
|
const config = ubeanConfig;
|
|
108
|
-
const srcDir =
|
|
108
|
+
const srcDir = resolve(config.rootDir, config.srcDir);
|
|
109
109
|
for (const dir of watchDirs) server.watcher.add(join(srcDir, dir));
|
|
110
110
|
server.watcher.on("add", handleFileChange);
|
|
111
111
|
server.watcher.on("unlink", handleFileChange);
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as ubeanPlugin } from "./vite-
|
|
1
|
+
import { t as ubeanPlugin } from "./vite-B3y8Qoan.js";
|
|
2
2
|
export { ubeanPlugin };
|
|
@@ -1,8 +1,8 @@
|
|
|
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-CYk6X-Hn.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
|
-
import { join } from "pathe";
|
|
5
|
+
import { join, resolve } from "pathe";
|
|
6
6
|
import { scanProject } from "@ubean/scan";
|
|
7
7
|
import { getVueLocaleParam } from "@ubean/i18n";
|
|
8
8
|
import { transformWithOxc } from "vite";
|
|
@@ -275,7 +275,14 @@ export async function createApp() {
|
|
|
275
275
|
// When hydrating SSR content, must wait for router to be ready before mounting,
|
|
276
276
|
// otherwise RouterView has no matched route and causes hydration mismatch.
|
|
277
277
|
if (initialPage) {
|
|
278
|
-
instance.router
|
|
278
|
+
instance.router
|
|
279
|
+
.isReady()
|
|
280
|
+
.then(async function () {
|
|
281
|
+
// SSR HTML 已包含布局链;客户端水合首帧必须同样就绪(布局是异步
|
|
282
|
+
// 解析的),否则首帧渲染裸 PageView 导致 hydration mismatch。
|
|
283
|
+
await instance.preloadLayouts();
|
|
284
|
+
})
|
|
285
|
+
.then(mountApp);
|
|
279
286
|
} else {
|
|
280
287
|
mountApp();
|
|
281
288
|
}
|
|
@@ -426,7 +433,7 @@ function localeVueParamFromConfig(config) {
|
|
|
426
433
|
function ubeanVite(options) {
|
|
427
434
|
const { config: ubeanConfig } = options;
|
|
428
435
|
const virtualRegistry = useVirtualRegistry();
|
|
429
|
-
const srcDir =
|
|
436
|
+
const srcDir = resolve(ubeanConfig.rootDir, ubeanConfig.srcDir);
|
|
430
437
|
const dtsDir = join(ubeanConfig.rootDir, ".ubean");
|
|
431
438
|
const markdownEnabled = ubeanConfig.markdown?.enabled !== false;
|
|
432
439
|
const mdxEnabled = ubeanConfig.markdown?.mdx === true;
|
|
@@ -656,7 +663,7 @@ function ubeanVite(options) {
|
|
|
656
663
|
*/
|
|
657
664
|
async function runPagefindIndexing(ubeanConfig, searchConfig) {
|
|
658
665
|
const { spawn } = await import("node:child_process");
|
|
659
|
-
const { resolve } = await import("node:path");
|
|
666
|
+
const { resolve: resolvePath } = await import("node:path");
|
|
660
667
|
const isObjectConfig = typeof searchConfig === "object";
|
|
661
668
|
if (!(isObjectConfig ? searchConfig.enabled !== false : true)) return;
|
|
662
669
|
const outDir = isObjectConfig && searchConfig.site ? searchConfig.site : "dist";
|
|
@@ -665,7 +672,7 @@ async function runPagefindIndexing(ubeanConfig, searchConfig) {
|
|
|
665
672
|
const args = [
|
|
666
673
|
"pagefind",
|
|
667
674
|
"--site",
|
|
668
|
-
|
|
675
|
+
resolvePath(ubeanConfig.rootDir, outDir),
|
|
669
676
|
"--output-subdir",
|
|
670
677
|
indexPath
|
|
671
678
|
];
|
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-CL_djWZL.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.2",
|
|
4
4
|
"description": "Vite plugins, production build, SSG prerender, type codegen, and Server Actions plugin for ubean",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -41,37 +41,37 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@intlify/unplugin-vue-i18n": "11.2.5",
|
|
44
|
+
"@ubean/client": "0.3.2",
|
|
45
|
+
"@ubean/config": "0.3.2",
|
|
46
|
+
"@ubean/i18n": "0.3.2",
|
|
47
|
+
"@ubean/islands": "0.3.2",
|
|
48
|
+
"@ubean/markdown": "0.3.2",
|
|
49
|
+
"@ubean/pages": "0.3.2",
|
|
50
|
+
"@ubean/preset": "0.3.2",
|
|
51
|
+
"@ubean/routes": "0.3.2",
|
|
52
|
+
"@ubean/scan": "0.3.2",
|
|
53
|
+
"@ubean/shared": "0.3.2",
|
|
54
|
+
"@ubean/vue": "0.3.2",
|
|
44
55
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
45
56
|
"openapi-typescript": "^7.13.0",
|
|
46
|
-
"oxc-transform": "^0.
|
|
57
|
+
"oxc-transform": "^0.147.0",
|
|
47
58
|
"pathe": "^2.0.3",
|
|
48
59
|
"tinyglobby": "^0.2.17",
|
|
49
60
|
"unimport": "^6.4.0",
|
|
50
61
|
"unplugin-auto-import": "21.1.0",
|
|
51
62
|
"unplugin-vue-components": "^32.1.0",
|
|
52
|
-
"unplugin-vue-markdown": "^32.
|
|
53
|
-
"vue-i18n": "11.4.
|
|
54
|
-
"@ubean/config": "0.3.0",
|
|
55
|
-
"@ubean/client": "0.3.0",
|
|
56
|
-
"@ubean/i18n": "0.3.0",
|
|
57
|
-
"@ubean/pages": "0.3.0",
|
|
58
|
-
"@ubean/islands": "0.3.0",
|
|
59
|
-
"@ubean/preset": "0.3.0",
|
|
60
|
-
"@ubean/scan": "0.3.0",
|
|
61
|
-
"@ubean/markdown": "0.3.0",
|
|
62
|
-
"@ubean/shared": "0.3.0",
|
|
63
|
-
"@ubean/routes": "0.3.0",
|
|
64
|
-
"@ubean/vue": "0.3.0"
|
|
63
|
+
"unplugin-vue-markdown": "^32.1.1",
|
|
64
|
+
"vue-i18n": "11.4.10"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@types/node": "^26.
|
|
68
|
-
"hono": "4.13.
|
|
67
|
+
"@types/node": "^26.4.0",
|
|
68
|
+
"hono": "4.13.5",
|
|
69
69
|
"typescript": "7.0.2",
|
|
70
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
71
|
-
"vite-plus": "0.
|
|
70
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
|
|
71
|
+
"vite-plus": "0.3.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
74
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.0"
|
|
75
75
|
},
|
|
76
76
|
"peerDependenciesMeta": {
|
|
77
77
|
"vite": {
|