@ubean/build 0.6.0-beta.2 → 0.6.0-beta.4
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 +3 -3
- package/dist/index.js +2 -2
- package/dist/production.js +1 -1
- package/dist/{ssr-singleton-DPTawJSx.js → ssr-singleton-Bbds29jS.js} +3 -3
- package/dist/{virtual-modules-CvGWlsXj.js → virtual-modules-BK0L1Op-.js} +1 -1
- package/dist/{vite-VaaeRB17.js → vite-BZJ_a-WB.js} +25 -8
- package/dist/vite.d.ts +11 -1
- package/dist/vite.js +3 -3
- package/dist/{vue-CKAJjBBR.js → vue-DR8VizGq.js} +47 -8
- package/dist/vue.js +1 -1
- package/package.json +19 -19
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ type ComponentResolver = ((name: string) => any) | {
|
|
|
29
29
|
resolve: (name: string) => any;
|
|
30
30
|
};
|
|
31
31
|
/**
|
|
32
|
-
* Register a component resolver (e.g. `UiResolver()` from `@
|
|
32
|
+
* Register a component resolver (e.g. `UiResolver()` from `@vean/ui/resolver`).
|
|
33
33
|
* The resolver will be merged into `unplugin-vue-components`'s `resolvers` array.
|
|
34
34
|
*/
|
|
35
35
|
export declare function registerComponentResolver(resolver: ComponentResolver): void;
|
|
@@ -40,8 +40,8 @@ export declare function registerComponentResolver(resolver: ComponentResolver):
|
|
|
40
40
|
export declare function getComponentResolvers(): ComponentResolver[];
|
|
41
41
|
/**
|
|
42
42
|
* Register a CSS import path to be injected into the client entry.
|
|
43
|
-
* e.g. `registerCssImport('@
|
|
44
|
-
* entry module prepend `import '@
|
|
43
|
+
* e.g. `registerCssImport('@vean/ui/styles.css')` makes the client
|
|
44
|
+
* entry module prepend `import '@vean/ui/styles.css'`.
|
|
45
45
|
*/
|
|
46
46
|
export declare function registerCssImport(cssPath: string): void;
|
|
47
47
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as resetVirtualRegistry, a as ssrSingletonProdOptimizeExclude, c as getComponentResolvers, d as registerCssImport, f as resetModuleRegistry, g as defineVirtualModulePrefix, h as defineVirtualModule, i as ssrSingletonDevPolicy, l as getCssImports, m as createVirtualRegistry, n as SSR_SINGLETON_OPTIMIZE_EXCLUDE, o as ssrSingletonProdSsr, p as VirtualModuleRegistry, r as SSR_SINGLETON_PACKAGES, t as SSR_SINGLETON_DEDUPE, u as registerComponentResolver, v as useVirtualRegistry } from "./ssr-singleton-
|
|
2
|
-
import { a as createRoutingVirtualModule, i as createPagesVirtualModule, n as createLocalesVirtualModule, o as stripMacros, r as createMetaVirtualModule, s as transformMacros, t as createAppVirtualModule } from "./virtual-modules-
|
|
1
|
+
import { _ as resetVirtualRegistry, a as ssrSingletonProdOptimizeExclude, c as getComponentResolvers, d as registerCssImport, f as resetModuleRegistry, g as defineVirtualModulePrefix, h as defineVirtualModule, i as ssrSingletonDevPolicy, l as getCssImports, m as createVirtualRegistry, n as SSR_SINGLETON_OPTIMIZE_EXCLUDE, o as ssrSingletonProdSsr, p as VirtualModuleRegistry, r as SSR_SINGLETON_PACKAGES, t as SSR_SINGLETON_DEDUPE, u as registerComponentResolver, v as useVirtualRegistry } from "./ssr-singleton-Bbds29jS.js";
|
|
2
|
+
import { a as createRoutingVirtualModule, i as createPagesVirtualModule, n as createLocalesVirtualModule, o as stripMacros, r as createMetaVirtualModule, s as transformMacros, t as createAppVirtualModule } from "./virtual-modules-BK0L1Op-.js";
|
|
3
3
|
export { SSR_SINGLETON_DEDUPE, SSR_SINGLETON_OPTIMIZE_EXCLUDE, SSR_SINGLETON_PACKAGES, VirtualModuleRegistry, createAppVirtualModule, createLocalesVirtualModule, createMetaVirtualModule, createPagesVirtualModule, createRoutingVirtualModule, createVirtualRegistry, defineVirtualModule, defineVirtualModulePrefix, getComponentResolvers, getCssImports, registerComponentResolver, registerCssImport, resetModuleRegistry, resetVirtualRegistry, ssrSingletonDevPolicy, ssrSingletonProdOptimizeExclude, ssrSingletonProdSsr, stripMacros, transformMacros, useVirtualRegistry };
|
package/dist/production.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as getPresetBuildConfig, S as generateVirtualModulesToDisk, T as buildWithEnvironments, b as generateNodeServerEntry, v as createIslandsSsrStubPlugin, w as serializePagesForEntry, x as generateStandardHandlerEntry, y as generateCloudflareWorkerEntry } from "./vite-
|
|
1
|
+
import { C as getPresetBuildConfig, S as generateVirtualModulesToDisk, T as buildWithEnvironments, b as generateNodeServerEntry, v as createIslandsSsrStubPlugin, w as serializePagesForEntry, x as generateStandardHandlerEntry, y as generateCloudflareWorkerEntry } from "./vite-BZJ_a-WB.js";
|
|
2
2
|
export { buildWithEnvironments, createIslandsSsrStubPlugin, generateCloudflareWorkerEntry, generateNodeServerEntry, generateStandardHandlerEntry, generateVirtualModulesToDisk, getPresetBuildConfig, serializePagesForEntry };
|
|
@@ -106,7 +106,7 @@ function getRegistry() {
|
|
|
106
106
|
return g[REGISTRY_KEY];
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
|
-
* Register a component resolver (e.g. `UiResolver()` from `@
|
|
109
|
+
* Register a component resolver (e.g. `UiResolver()` from `@vean/ui/resolver`).
|
|
110
110
|
* The resolver will be merged into `unplugin-vue-components`'s `resolvers` array.
|
|
111
111
|
*/
|
|
112
112
|
function registerComponentResolver(resolver) {
|
|
@@ -121,8 +121,8 @@ function getComponentResolvers() {
|
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Register a CSS import path to be injected into the client entry.
|
|
124
|
-
* e.g. `registerCssImport('@
|
|
125
|
-
* entry module prepend `import '@
|
|
124
|
+
* e.g. `registerCssImport('@vean/ui/styles.css')` makes the client
|
|
125
|
+
* entry module prepend `import '@vean/ui/styles.css'`.
|
|
126
126
|
*/
|
|
127
127
|
function registerCssImport(cssPath) {
|
|
128
128
|
const reg = getRegistry();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as ssrSingletonProdOptimizeExclude, m as createVirtualRegistry, o as ssrSingletonProdSsr, y as __exportAll } from "./ssr-singleton-
|
|
2
|
-
import { a as createRoutingVirtualModule, i as createPagesVirtualModule, n as createLocalesVirtualModule, r as createMetaVirtualModule, s as transformMacros, t as createAppVirtualModule } from "./virtual-modules-
|
|
1
|
+
import { a as ssrSingletonProdOptimizeExclude, m as createVirtualRegistry, o as ssrSingletonProdSsr, y as __exportAll } from "./ssr-singleton-Bbds29jS.js";
|
|
2
|
+
import { a as createRoutingVirtualModule, i as createPagesVirtualModule, n as createLocalesVirtualModule, r as createMetaVirtualModule, s as transformMacros, t as createAppVirtualModule } from "./virtual-modules-BK0L1Op-.js";
|
|
3
3
|
import { i as generateOpenApiTypes, r as generateTypes } from "./codegen-Up8-XhRo.js";
|
|
4
|
-
import { _ as toWebRequest, a as createVueAppEntryVirtualModule, b as getDevScanCoordinator, g as sendWebResponse, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, u as ensureDevApp } from "./vue-
|
|
4
|
+
import { _ as toWebRequest, a as createVueAppEntryVirtualModule, b as getDevScanCoordinator, g as sendWebResponse, i as createServerEntryVirtualModule, n as ubeanVite, o as createVuePagesVirtualModule, r as createClientEntryVirtualModule, u as ensureDevApp } from "./vue-DR8VizGq.js";
|
|
5
5
|
import { createStaticSsgRenderer } from "./static-render.js";
|
|
6
6
|
import { prerender, resolvePrerenderStaticDir } from "./prerender.js";
|
|
7
7
|
import { join, relative, resolve } from "pathe";
|
|
@@ -2442,7 +2442,7 @@ async function buildEnvironmentsForConfig(config) {
|
|
|
2442
2442
|
Promise.resolve().then(() => build_configs_exports),
|
|
2443
2443
|
import("./production.js"),
|
|
2444
2444
|
import("@ubean/preset"),
|
|
2445
|
-
import("./ssr-singleton-
|
|
2445
|
+
import("./ssr-singleton-Bbds29jS.js").then((n) => n.s)
|
|
2446
2446
|
]);
|
|
2447
2447
|
registerBuiltinPresets();
|
|
2448
2448
|
const outDirs = getBuildOutDirsForConfig(config);
|
|
@@ -2461,6 +2461,13 @@ function ubeanPlugin(options) {
|
|
|
2461
2461
|
let ubeanConfig = options?.config ?? tryGetConfig() ?? void 0;
|
|
2462
2462
|
/** 已跑过 codegen 的扫描结果(`buildStart` 会在两个环境各跑一次)。 */
|
|
2463
2463
|
let lastCodegenScan = null;
|
|
2464
|
+
/**
|
|
2465
|
+
* dev 扫描协调器(`configureServer` 建立、`buildStart` 用)。
|
|
2466
|
+
*
|
|
2467
|
+
* Vite 的顺序是 `configureServer` → `buildStart`,且 dev 下每个环境各跑一次 `buildStart`
|
|
2468
|
+
* (`prime` 幂等),所以这里用闭包引用登记结构基线。
|
|
2469
|
+
*/
|
|
2470
|
+
let devCoordinator;
|
|
2464
2471
|
/** client manifest 的内存载体(RM-V18):`buildApp` 填、本插件的 load 读。 */
|
|
2465
2472
|
const assetManifestRef = { current: null };
|
|
2466
2473
|
let srcDirAbs = "";
|
|
@@ -2544,7 +2551,8 @@ function ubeanPlugin(options) {
|
|
|
2544
2551
|
ubeanConfig = await loadUbeanConfig();
|
|
2545
2552
|
ensureDerived();
|
|
2546
2553
|
}
|
|
2547
|
-
await scanAndRegister();
|
|
2554
|
+
const initial = await scanAndRegister();
|
|
2555
|
+
if (initial) devCoordinator?.prime(initial);
|
|
2548
2556
|
},
|
|
2549
2557
|
resolveId(id) {
|
|
2550
2558
|
if (this.environment?.name === "ubean" && isWorkerTarget()) {
|
|
@@ -2600,15 +2608,23 @@ function ubeanPlugin(options) {
|
|
|
2600
2608
|
return null;
|
|
2601
2609
|
},
|
|
2602
2610
|
configureServer(server) {
|
|
2603
|
-
getDevScanCoordinator(server, (source) => ({
|
|
2611
|
+
const coordinator = getDevScanCoordinator(server, (source) => ({
|
|
2604
2612
|
rootDir: ubeanConfig.rootDir,
|
|
2605
2613
|
srcDir: ubeanConfig.srcDir,
|
|
2606
2614
|
dirs: ubeanConfig.dir,
|
|
2607
2615
|
ignore: ubeanConfig.scanOptions?.ignore,
|
|
2608
2616
|
source,
|
|
2609
2617
|
scan: () => scanProjectOnce(),
|
|
2610
|
-
reload: () => server.ws.send({ type: "full-reload" })
|
|
2611
|
-
|
|
2618
|
+
reload: () => server.ws.send({ type: "full-reload" }),
|
|
2619
|
+
onStructureUnchanged: (changed) => {
|
|
2620
|
+
const config = ubeanConfig;
|
|
2621
|
+
if (!config?.logging.lifecycle) return;
|
|
2622
|
+
const files = changed.map((file) => relative(config.rootDir, file)).join(", ");
|
|
2623
|
+
server.config.logger.info(`[ubean] structure unchanged (${files}) — keeping HMR, no full reload`);
|
|
2624
|
+
}
|
|
2625
|
+
}));
|
|
2626
|
+
devCoordinator = coordinator;
|
|
2627
|
+
coordinator.subscribe(async (result, changed) => {
|
|
2612
2628
|
await applyScan(result);
|
|
2613
2629
|
await runProjectCodegen(result);
|
|
2614
2630
|
for (const mod of VIRTUAL_MODULES) {
|
|
@@ -2665,6 +2681,7 @@ function ubeanPlugin(options) {
|
|
|
2665
2681
|
const result = await scanProjectOnce();
|
|
2666
2682
|
await applyScan(result);
|
|
2667
2683
|
await runProjectCodegen(result);
|
|
2684
|
+
return result;
|
|
2668
2685
|
}
|
|
2669
2686
|
/**
|
|
2670
2687
|
* 生成项目类型声明(`.ubean/routes.d.ts`、`pages.d.ts`、`i18n.d.ts`、`auto-imports.d.ts`、
|
package/dist/vite.d.ts
CHANGED
|
@@ -496,8 +496,13 @@ interface DevScanCoordinatorOptions {
|
|
|
496
496
|
source: DevScanSource;
|
|
497
497
|
/** 扫描实现;默认 `scanProject`(调用方一般不需要覆盖)。 */
|
|
498
498
|
scan?: () => Promise<ScanResult>;
|
|
499
|
-
/**
|
|
499
|
+
/**
|
|
500
|
+
* 扫描产物与基线不一致(结构变化)时的重载回调:`full-reload` 由协调器统一发。
|
|
501
|
+
* 产物一致时**不调用**(那次改动交给 Vite 的 HMR)。
|
|
502
|
+
*/
|
|
500
503
|
reload?: () => void;
|
|
504
|
+
/** 扫描产物与基线一致(结构没变、不发重载)时的回调,供调用方记日志。 */
|
|
505
|
+
onStructureUnchanged?: (changed: string[]) => void;
|
|
501
506
|
debounceMs?: number;
|
|
502
507
|
/** 扫描失败回调;默认打到 console.error。 */
|
|
503
508
|
onError?: (error: unknown) => void;
|
|
@@ -507,6 +512,11 @@ interface DevScanCoordinator {
|
|
|
507
512
|
subscribe(fn: DevScanSubscriber): () => void;
|
|
508
513
|
/** 建立监听(幂等)。 */
|
|
509
514
|
start(): void;
|
|
515
|
+
/**
|
|
516
|
+
* 登记结构基线:把「当前磁盘上的结构」交给协调器,作为后续「结构是否变化」的比对面。
|
|
517
|
+
* 只记基线,不通知订阅者、不重载(供插件在 `buildStart` 的首次扫描后调用)。
|
|
518
|
+
*/
|
|
519
|
+
prime(result: ScanResult): void;
|
|
510
520
|
/** 手动触发一次扫描(DevTools CRUD 后、测试)。 */
|
|
511
521
|
rescan(changed?: string[]): Promise<ScanResult>;
|
|
512
522
|
/** 是否已有订阅者(供调用方判断「框架是否接管了 dev 重载」)。 */
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as createVirtualRegistry } from "./ssr-singleton-
|
|
2
|
-
import { A as toVueRouterPagePath, C as bootstrapDevApp, D as resolveLocaleVueParam, E as resolveDevSecurityHeaders, O as enhanceDevApp, S as peekDevScanCoordinator, T as createDevAppReady, _ as toWebRequest, b as getDevScanCoordinator, c as collectDevCssLinks, d as getDevApp, f as injectStylesheetLinks, g as sendWebResponse, h as ubeanDevRequestPlugin, k as buildDevSsrRoutes, l as createUbeanRequestHandlers, m as isViteResourceRequest, p as isFrameworkHtmlPage, s as DEVTOOLS_PASS_THROUGH_PREFIXES, u as ensureDevApp, v as DEV_SCAN_DIRS, w as createDevApp, x as onDevScan, y as createDevScanCoordinator } from "./vue-
|
|
3
|
-
import { D as createCloudflarePreviewRunner, E as MINIFLARE_INSTALL_HINT, O as defaultLoadMiniflare, _ as ubeanPreviewPlugin, a as createEnvRunnerTransport, c as getDevWorkerEntrySource, d as attachPreviewMiddleware, f as createPreviewMiddleware, g as sendPreviewStatus, h as sendPreviewFile, i as bridgeEnvRunnerInvokes, k as readCompatibilityDate, l as invalidateDevWorkerModules, m as resolvePreviewFile, n as UBEAN_DEV_ENV_NAME, o as createUbeanDevEnvironmentFactory, p as previewMimeType, r as UbeanDevEnvironment, s as DEV_WORKER_FILE, t as ubeanPlugin, u as writeDevWorkerEntry } from "./vite-
|
|
1
|
+
import { m as createVirtualRegistry } from "./ssr-singleton-Bbds29jS.js";
|
|
2
|
+
import { A as toVueRouterPagePath, C as bootstrapDevApp, D as resolveLocaleVueParam, E as resolveDevSecurityHeaders, O as enhanceDevApp, S as peekDevScanCoordinator, T as createDevAppReady, _ as toWebRequest, b as getDevScanCoordinator, c as collectDevCssLinks, d as getDevApp, f as injectStylesheetLinks, g as sendWebResponse, h as ubeanDevRequestPlugin, k as buildDevSsrRoutes, l as createUbeanRequestHandlers, m as isViteResourceRequest, p as isFrameworkHtmlPage, s as DEVTOOLS_PASS_THROUGH_PREFIXES, u as ensureDevApp, v as DEV_SCAN_DIRS, w as createDevApp, x as onDevScan, y as createDevScanCoordinator } from "./vue-DR8VizGq.js";
|
|
3
|
+
import { D as createCloudflarePreviewRunner, E as MINIFLARE_INSTALL_HINT, O as defaultLoadMiniflare, _ as ubeanPreviewPlugin, a as createEnvRunnerTransport, c as getDevWorkerEntrySource, d as attachPreviewMiddleware, f as createPreviewMiddleware, g as sendPreviewStatus, h as sendPreviewFile, i as bridgeEnvRunnerInvokes, k as readCompatibilityDate, l as invalidateDevWorkerModules, m as resolvePreviewFile, n as UBEAN_DEV_ENV_NAME, o as createUbeanDevEnvironmentFactory, p as previewMimeType, r as UbeanDevEnvironment, s as DEV_WORKER_FILE, t as ubeanPlugin, u as writeDevWorkerEntry } from "./vite-BZJ_a-WB.js";
|
|
4
4
|
export { DEVTOOLS_PASS_THROUGH_PREFIXES, DEV_SCAN_DIRS, DEV_WORKER_FILE, MINIFLARE_INSTALL_HINT, UBEAN_DEV_ENV_NAME, UbeanDevEnvironment, attachPreviewMiddleware, bootstrapDevApp, bridgeEnvRunnerInvokes, buildDevSsrRoutes, collectDevCssLinks, createCloudflarePreviewRunner, createDevApp, createDevAppReady, createDevScanCoordinator, createEnvRunnerTransport, createPreviewMiddleware, createUbeanDevEnvironmentFactory, createUbeanRequestHandlers, createVirtualRegistry, defaultLoadMiniflare, enhanceDevApp, ensureDevApp, getDevApp, getDevScanCoordinator, getDevWorkerEntrySource, injectStylesheetLinks, invalidateDevWorkerModules, isFrameworkHtmlPage, isViteResourceRequest, onDevScan, peekDevScanCoordinator, previewMimeType, readCompatibilityDate, resolveDevSecurityHeaders, resolveLocaleVueParam, resolvePreviewFile, sendPreviewFile, sendPreviewStatus, sendWebResponse, toVueRouterPagePath, toWebRequest, ubeanDevRequestPlugin, ubeanPlugin, ubeanPreviewPlugin, writeDevWorkerEntry };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as getComponentResolvers, h as defineVirtualModule, i as ssrSingletonDevPolicy, l as getCssImports, m as createVirtualRegistry } from "./ssr-singleton-
|
|
1
|
+
import { c as getComponentResolvers, h as defineVirtualModule, i as ssrSingletonDevPolicy, l as getCssImports, m as createVirtualRegistry } from "./ssr-singleton-Bbds29jS.js";
|
|
2
2
|
import { D as toArray, E as resolveComponentsConfig, T as resolveAutoImportsConfig, d as COMPONENT_HALF_GLOBS, x as getAutoImportPresets } from "./codegen-Up8-XhRo.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
|
-
import { join, resolve } from "pathe";
|
|
4
|
+
import { join, relative, resolve } from "pathe";
|
|
5
5
|
import { loadUbeanConfig } from "@ubean/config";
|
|
6
6
|
import { scanProject } from "@ubean/scan";
|
|
7
7
|
import { applyServerConfig, createUbeanApp } from "@ubean/app";
|
|
@@ -427,6 +427,8 @@ function createDevScanCoordinator(options) {
|
|
|
427
427
|
let running = null;
|
|
428
428
|
let rerunRequested = false;
|
|
429
429
|
let started = false;
|
|
430
|
+
/** 上一次扫描产物 = 「当前结构」。由 `prime()` 登记,之后每次扫描后更新。 */
|
|
431
|
+
let baseline;
|
|
430
432
|
const warn = options.onError ?? ((error) => console.error("[ubean] scan failed:", error));
|
|
431
433
|
/** 扫描目录(绝对)与「额外监听的文件」(入口文件,由扫描结果给出)。 */
|
|
432
434
|
const scanDirPaths = DEV_SCAN_DIRS.map((dir) => `${srcDirNormalized}/${dir}`);
|
|
@@ -467,6 +469,20 @@ function createDevScanCoordinator(options) {
|
|
|
467
469
|
source.add(entry.fullPath);
|
|
468
470
|
}
|
|
469
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* 扫描产物是否与基线不同(= 项目结构变了)。
|
|
474
|
+
*
|
|
475
|
+
* 判据刻意用**整份产物的序列化**,而不是手写「哪些字段算结构」的清单:扫描器是路由表/元数据的
|
|
476
|
+
* 唯一生产者,产物一致即结构一致;清单则会随 `definePage` 之类新增字段而失配 —— 漏一个字段,
|
|
477
|
+
* 浏览器就会带着旧元数据一直跑(且没有任何报错)。扫描产物是纯数据(实测两次扫描序列化结果
|
|
478
|
+
* 逐字节相同),所以直接比对。
|
|
479
|
+
*
|
|
480
|
+
* 无基线时一律返回 `true`:`prime()` 之前的行为与整改前一致(保守多发一次重载)。
|
|
481
|
+
*/
|
|
482
|
+
function structureChanged(result) {
|
|
483
|
+
if (baseline === void 0) return true;
|
|
484
|
+
return JSON.stringify(result) !== JSON.stringify(baseline);
|
|
485
|
+
}
|
|
470
486
|
async function runScan(changed) {
|
|
471
487
|
const result = await (options.scan ?? (() => scanProject({
|
|
472
488
|
cwd: rootDir,
|
|
@@ -475,8 +491,11 @@ function createDevScanCoordinator(options) {
|
|
|
475
491
|
ignore: options.ignore
|
|
476
492
|
})))();
|
|
477
493
|
registerExtraFiles(result);
|
|
494
|
+
const structural = structureChanged(result);
|
|
495
|
+
baseline = result;
|
|
478
496
|
for (const subscriber of subscribers) await subscriber(result, changed);
|
|
479
|
-
options.reload?.();
|
|
497
|
+
if (structural) options.reload?.();
|
|
498
|
+
else options.onStructureUnchanged?.(changed);
|
|
480
499
|
return result;
|
|
481
500
|
}
|
|
482
501
|
async function rescan(changed = []) {
|
|
@@ -525,6 +544,9 @@ function createDevScanCoordinator(options) {
|
|
|
525
544
|
source.on("unlink", onFileEvent);
|
|
526
545
|
source.on("change", onFileEvent);
|
|
527
546
|
},
|
|
547
|
+
prime(result) {
|
|
548
|
+
baseline = result;
|
|
549
|
+
},
|
|
528
550
|
rescan,
|
|
529
551
|
subscriberCount: () => subscribers.size,
|
|
530
552
|
stop() {
|
|
@@ -1495,7 +1517,9 @@ function ubeanVite(options) {
|
|
|
1495
1517
|
});
|
|
1496
1518
|
}
|
|
1497
1519
|
async function scanAndRegister() {
|
|
1498
|
-
|
|
1520
|
+
const result = await scanProjectOnce();
|
|
1521
|
+
applyScan(result);
|
|
1522
|
+
return result;
|
|
1499
1523
|
}
|
|
1500
1524
|
/**
|
|
1501
1525
|
* 依据扫描结果重建本插件的虚拟模块。
|
|
@@ -1510,11 +1534,19 @@ function ubeanVite(options) {
|
|
|
1510
1534
|
virtualRegistry.register(createClientEntryVirtualModule());
|
|
1511
1535
|
}
|
|
1512
1536
|
const HASH_IDS = Object.keys(HASH_ID_TO_VIRTUAL);
|
|
1537
|
+
/**
|
|
1538
|
+
* dev 扫描协调器(`configureServer` 建立)。
|
|
1539
|
+
*
|
|
1540
|
+
* `buildStart` 需要它来登记结构基线,但 Vite 的顺序是 `configureServer` → `buildStart`
|
|
1541
|
+
* (dev 下每个环境各跑一次 `buildStart`,`prime` 幂等),所以这里是闭包引用而不是参数传递。
|
|
1542
|
+
*/
|
|
1543
|
+
let devCoordinator;
|
|
1513
1544
|
const plugins = [{
|
|
1514
1545
|
name: "ubean:vue",
|
|
1515
1546
|
enforce: "pre",
|
|
1516
1547
|
async buildStart() {
|
|
1517
|
-
await scanAndRegister();
|
|
1548
|
+
const result = await scanAndRegister();
|
|
1549
|
+
devCoordinator?.prime(result);
|
|
1518
1550
|
},
|
|
1519
1551
|
resolveId(id, importer, opts) {
|
|
1520
1552
|
if (HASH_ID_TO_VIRTUAL[id]) return toResolvedVirtualId(HASH_ID_TO_VIRTUAL[id]);
|
|
@@ -1596,15 +1628,22 @@ function ubeanVite(options) {
|
|
|
1596
1628
|
return result.replace("</body>", ` <script type="module" src="${CLIENT_ENTRY_URL}"><\/script>\n</body>`);
|
|
1597
1629
|
},
|
|
1598
1630
|
configureServer(server) {
|
|
1599
|
-
getDevScanCoordinator(server, (source) => ({
|
|
1631
|
+
const coordinator = getDevScanCoordinator(server, (source) => ({
|
|
1600
1632
|
rootDir: ubeanConfig.rootDir,
|
|
1601
1633
|
srcDir: ubeanConfig.srcDir,
|
|
1602
1634
|
dirs: ubeanConfig.dir,
|
|
1603
1635
|
ignore: ubeanConfig.scanOptions?.ignore,
|
|
1604
1636
|
source,
|
|
1605
1637
|
scan: scanProjectOnce,
|
|
1606
|
-
reload: () => server.ws.send({ type: "full-reload" })
|
|
1607
|
-
|
|
1638
|
+
reload: () => server.ws.send({ type: "full-reload" }),
|
|
1639
|
+
onStructureUnchanged: (changed) => {
|
|
1640
|
+
if (!ubeanConfig.logging.lifecycle) return;
|
|
1641
|
+
const files = changed.map((file) => relative(ubeanConfig.rootDir, file)).join(", ");
|
|
1642
|
+
server.config.logger.info(`[ubean] structure unchanged (${files}) — keeping HMR, no full reload`);
|
|
1643
|
+
}
|
|
1644
|
+
}));
|
|
1645
|
+
devCoordinator = coordinator;
|
|
1646
|
+
coordinator.subscribe((result) => {
|
|
1608
1647
|
applyScan(result);
|
|
1609
1648
|
for (const vid of VIRTUAL_IDS) {
|
|
1610
1649
|
const mod = server.moduleGraph.getModuleById(toResolvedVirtualId(vid));
|
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-DR8VizGq.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.6.0-beta.
|
|
3
|
+
"version": "0.6.0-beta.4",
|
|
4
4
|
"description": "Vite plugins, production build, SSG prerender, type codegen, and Server Actions plugin for ubean",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -45,19 +45,19 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@intlify/unplugin-vue-i18n": "11.2.5",
|
|
48
|
-
"@ubean/app": "0.6.0-beta.
|
|
49
|
-
"@ubean/client": "0.6.0-beta.
|
|
50
|
-
"@ubean/config": "0.6.0-beta.
|
|
51
|
-
"@ubean/i18n": "0.6.0-beta.
|
|
52
|
-
"@ubean/islands": "0.6.0-beta.
|
|
53
|
-
"@ubean/markdown": "0.6.0-beta.
|
|
54
|
-
"@ubean/pages": "0.6.0-beta.
|
|
55
|
-
"@ubean/preset": "0.6.0-beta.
|
|
56
|
-
"@ubean/routes": "0.6.0-beta.
|
|
57
|
-
"@ubean/scan": "0.6.0-beta.
|
|
58
|
-
"@ubean/server": "0.6.0-beta.
|
|
59
|
-
"@ubean/shared": "0.6.0-beta.
|
|
60
|
-
"@ubean/vue": "0.6.0-beta.
|
|
48
|
+
"@ubean/app": "0.6.0-beta.4",
|
|
49
|
+
"@ubean/client": "0.6.0-beta.4",
|
|
50
|
+
"@ubean/config": "0.6.0-beta.4",
|
|
51
|
+
"@ubean/i18n": "0.6.0-beta.4",
|
|
52
|
+
"@ubean/islands": "0.6.0-beta.4",
|
|
53
|
+
"@ubean/markdown": "0.6.0-beta.4",
|
|
54
|
+
"@ubean/pages": "0.6.0-beta.4",
|
|
55
|
+
"@ubean/preset": "0.6.0-beta.4",
|
|
56
|
+
"@ubean/routes": "0.6.0-beta.4",
|
|
57
|
+
"@ubean/scan": "0.6.0-beta.4",
|
|
58
|
+
"@ubean/server": "0.6.0-beta.4",
|
|
59
|
+
"@ubean/shared": "0.6.0-beta.4",
|
|
60
|
+
"@ubean/vue": "0.6.0-beta.4",
|
|
61
61
|
"@vitejs/plugin-vue": "^6.0.9",
|
|
62
62
|
"openapi-typescript": "^7.13.0",
|
|
63
63
|
"pathe": "^2.0.3",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"vue-i18n": "11.4.12"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@types/node": "^26.6.
|
|
73
|
-
"hono": "4.13.
|
|
72
|
+
"@types/node": "^26.6.3",
|
|
73
|
+
"hono": "4.13.9",
|
|
74
74
|
"typescript": "npm:typescript-native-bridge@latest",
|
|
75
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@
|
|
76
|
-
"vite-plus": "
|
|
75
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
76
|
+
"vite-plus": "latest"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@
|
|
79
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest"
|
|
80
80
|
},
|
|
81
81
|
"peerDependenciesMeta": {
|
|
82
82
|
"vite": {
|