@vmz/core 0.1.30 → 0.1.31
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/client-nav.js +1 -1
- package/dist/dom.browser.d.ts +7 -0
- package/dist/dom.browser.js +8 -0
- package/dist/serve-host.mjs +16 -26
- package/package.json +11 -7
package/dist/client-nav.js
CHANGED
|
@@ -56,7 +56,7 @@ export function installClientNavigation(opts = {}) {
|
|
|
56
56
|
win.vmzDestroy(inst);
|
|
57
57
|
}
|
|
58
58
|
async function loadDomFallback() {
|
|
59
|
-
return import(/* @vite-ignore */ '/
|
|
59
|
+
return import(/* @vite-ignore */ '/dom.browser.js');
|
|
60
60
|
}
|
|
61
61
|
function navKey(pathname, search) {
|
|
62
62
|
return `${pathname || '/'}${search || ''}`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser delivery face (0.1.31): DOM core + hydrate/resume/route attach.
|
|
3
|
+
* Does NOT re-export Node SSR `renderToString` / `renderToStream`.
|
|
4
|
+
* Full barrel remains `@vmz/core/dom` (`dom.js` / dist `vmz-dom.js`) for Node host.
|
|
5
|
+
*/
|
|
6
|
+
export * from './dom-core.js';
|
|
7
|
+
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from './dom-ssr.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Browser delivery face (0.1.31): DOM core + hydrate/resume/route attach.
|
|
4
|
+
* Does NOT re-export Node SSR `renderToString` / `renderToStream`.
|
|
5
|
+
* Full barrel remains `@vmz/core/dom` (`dom.js` / dist `vmz-dom.js`) for Node host.
|
|
6
|
+
*/
|
|
7
|
+
export * from './dom-core.js';
|
|
8
|
+
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from './dom-ssr.js';
|
package/dist/serve-host.mjs
CHANGED
|
@@ -32,7 +32,19 @@ const ROUTE_CATALOG_SCHEMA = 'vmz.route.catalog.v0';
|
|
|
32
32
|
const ROUTE_CATALOG_REL = '_vmz/route-catalog.json';
|
|
33
33
|
const LOCALE_LINK_PLAN_REL = '_vmz/locale-link-plan.json';
|
|
34
34
|
const require = createRequire(import.meta.url);
|
|
35
|
-
|
|
35
|
+
/** App delivery root. Host companions may live under `_vmz/host/` (0.1.31). */
|
|
36
|
+
function resolveServeDistDir() {
|
|
37
|
+
if (process.env.VMZ_DIST)
|
|
38
|
+
return path.resolve(process.env.VMZ_DIST);
|
|
39
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
40
|
+
const norm = here.replace(/\\/g, '/');
|
|
41
|
+
const marker = '/_vmz/host';
|
|
42
|
+
const idx = norm.toLowerCase().lastIndexOf(marker);
|
|
43
|
+
if (idx >= 0)
|
|
44
|
+
return path.resolve(here.slice(0, idx));
|
|
45
|
+
return here;
|
|
46
|
+
}
|
|
47
|
+
const distDir = resolveServeDistDir();
|
|
36
48
|
/** App project root for bare import / JSON resolve (dev SSR ≡ build node_modules). */
|
|
37
49
|
function projectRootForResolve() {
|
|
38
50
|
const fromEnv = typeof process.env.VMZ_PROJECT_ROOT === 'string' ? process.env.VMZ_PROJECT_ROOT.trim() : '';
|
|
@@ -510,7 +522,7 @@ async function* emitPageHtml(Page, chunkId, eventOnlyShell, props = {}, opts = {
|
|
|
510
522
|
hideOverlay();
|
|
511
523
|
if (msg.mode === "island") {
|
|
512
524
|
try {
|
|
513
|
-
const { registerComponents, hydrate } = await import("/
|
|
525
|
+
const { registerComponents, hydrate } = await import("/dom.browser.js?t=" + msg.token);
|
|
514
526
|
const names = (msg.affectedChunks || [])
|
|
515
527
|
.map((c) => String(c))
|
|
516
528
|
.filter((c) => c.startsWith("components/") || !c.includes("/"))
|
|
@@ -799,7 +811,6 @@ async function softReload(opts = {}) {
|
|
|
799
811
|
reloadToken = nextToken;
|
|
800
812
|
const affected = opts.payload?.affectedChunks ?? [];
|
|
801
813
|
const seeds = opts.payload?.seedChunks ?? [];
|
|
802
|
-
const emitted = opts.payload?.emitted ?? [];
|
|
803
814
|
const full = opts.payload?.full;
|
|
804
815
|
const islandHmr = Boolean(opts.payload?.islandHmr);
|
|
805
816
|
const rerunLoaders = opts.payload?.rerunLoaders ?? [];
|
|
@@ -809,7 +820,8 @@ async function softReload(opts = {}) {
|
|
|
809
820
|
const bundleRevision = opts.payload?.bundleRevision != null ? String(opts.payload.bundleRevision) : null;
|
|
810
821
|
if (buildId)
|
|
811
822
|
lastDevBuildId = buildId;
|
|
812
|
-
|
|
823
|
+
// 0.1.31: payload-only scope. `reloadToken` is opaque cache-bust — never invent full/affected here.
|
|
824
|
+
const reloadAllPages = Boolean(full) || (!islandHmr && rerunLoaders.length === 0 && affected.length === 0);
|
|
813
825
|
try {
|
|
814
826
|
try {
|
|
815
827
|
const routes = JSON.parse(await readFile(path.join(distDir, 'vmz-routes.json'), 'utf8'));
|
|
@@ -940,28 +952,6 @@ async function softReload(opts = {}) {
|
|
|
940
952
|
throw err;
|
|
941
953
|
}
|
|
942
954
|
}
|
|
943
|
-
/**
|
|
944
|
-
* Shared lib / full rebuild / missing affected list → refresh every page ctor.
|
|
945
|
-
* Otherwise only re-import the dirty page chunks (Vite-like module graph).
|
|
946
|
-
* @param {{ full?: boolean, affected: string[], emitted: string[], islandHmr: boolean }} opts
|
|
947
|
-
*/
|
|
948
|
-
function shouldReloadAllPages(opts) {
|
|
949
|
-
if (opts.islandHmr)
|
|
950
|
-
return false;
|
|
951
|
-
if (opts.full)
|
|
952
|
-
return true;
|
|
953
|
-
if (Array.isArray(opts.rerunLoaders) && opts.rerunLoaders.length > 0)
|
|
954
|
-
return false;
|
|
955
|
-
if (!opts.affected.length)
|
|
956
|
-
return true;
|
|
957
|
-
for (const f of opts.emitted) {
|
|
958
|
-
const n = String(f).replace(/\\/g, '/');
|
|
959
|
-
if (n.includes('/lib/') || /\/Application\.client\.js$/.test(n) || /\/vmz-(dom|runtime|http|client-nav)\.js$/.test(n)) {
|
|
960
|
-
return true;
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
return false;
|
|
964
|
-
}
|
|
965
955
|
/** @param {string} chunkId @param {string[]} affected */
|
|
966
956
|
function pageNeedsReload(chunkId, affected) {
|
|
967
957
|
if (chunkId === 'pages/Layout' || chunkId.endsWith('/Layout'))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ production runtime core — DOM / SSR / HTTP / WriteBarrier (no compiler)",
|
|
6
6
|
"exports": {
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"types": "./dist/dom.client.d.ts",
|
|
17
17
|
"default": "./dist/dom.client.js"
|
|
18
18
|
},
|
|
19
|
+
"./dom/browser": {
|
|
20
|
+
"types": "./dist/dom.browser.d.ts",
|
|
21
|
+
"default": "./dist/dom.browser.js"
|
|
22
|
+
},
|
|
19
23
|
"./server": {
|
|
20
24
|
"types": "./dist/server.d.ts",
|
|
21
25
|
"default": "./dist/server.js"
|
|
@@ -66,12 +70,12 @@
|
|
|
66
70
|
"linkedom": "^0.18.13"
|
|
67
71
|
},
|
|
68
72
|
"optionalDependencies": {
|
|
69
|
-
"@vmz/vmz-win32-x64": "0.1.
|
|
70
|
-
"@vmz/vmz-win32-arm64": "0.1.
|
|
71
|
-
"@vmz/vmz-darwin-x64": "0.1.
|
|
72
|
-
"@vmz/vmz-darwin-arm64": "0.1.
|
|
73
|
-
"@vmz/vmz-linux-x64": "0.1.
|
|
74
|
-
"@vmz/vmz-linux-arm64": "0.1.
|
|
73
|
+
"@vmz/vmz-win32-x64": "0.1.31",
|
|
74
|
+
"@vmz/vmz-win32-arm64": "0.1.31",
|
|
75
|
+
"@vmz/vmz-darwin-x64": "0.1.31",
|
|
76
|
+
"@vmz/vmz-darwin-arm64": "0.1.31",
|
|
77
|
+
"@vmz/vmz-linux-x64": "0.1.31",
|
|
78
|
+
"@vmz/vmz-linux-arm64": "0.1.31"
|
|
75
79
|
},
|
|
76
80
|
"publishConfig": {
|
|
77
81
|
"access": "public"
|