@vmz/core 0.1.22 → 0.1.24
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/serve-host.mjs +17 -4
- package/package.json +7 -7
package/dist/serve-host.mjs
CHANGED
|
@@ -773,12 +773,14 @@ async function softReload(opts = {}) {
|
|
|
773
773
|
const emitted = opts.payload?.emitted ?? [];
|
|
774
774
|
const full = opts.payload?.full;
|
|
775
775
|
const islandHmr = Boolean(opts.payload?.islandHmr);
|
|
776
|
+
const rerunLoaders = opts.payload?.rerunLoaders ?? [];
|
|
777
|
+
const skipEntryRewrite = Boolean(opts.payload?.skipEntryRewrite);
|
|
776
778
|
const buildId = opts.payload?.buildId != null ? String(opts.payload.buildId) : null;
|
|
777
779
|
const sourceRevision = opts.payload?.sourceRevision != null ? String(opts.payload.sourceRevision) : null;
|
|
778
780
|
const bundleRevision = opts.payload?.bundleRevision != null ? String(opts.payload.bundleRevision) : null;
|
|
779
781
|
if (buildId)
|
|
780
782
|
lastDevBuildId = buildId;
|
|
781
|
-
const reloadAllPages = shouldReloadAllPages({ full, affected, emitted, islandHmr });
|
|
783
|
+
const reloadAllPages = shouldReloadAllPages({ full, affected, emitted, islandHmr, rerunLoaders });
|
|
782
784
|
try {
|
|
783
785
|
try {
|
|
784
786
|
const routes = JSON.parse(await readFile(path.join(distDir, 'vmz-routes.json'), 'utf8'));
|
|
@@ -804,7 +806,12 @@ async function softReload(opts = {}) {
|
|
|
804
806
|
/** @type {Map<string, any>} */
|
|
805
807
|
const nextCtors = new Map();
|
|
806
808
|
if (!islandHmr) {
|
|
807
|
-
const
|
|
809
|
+
const reloadSet = rerunLoaders.length > 0
|
|
810
|
+
? rerunLoaders
|
|
811
|
+
: reloadAllPages
|
|
812
|
+
? nextCatalog.map((p) => p.chunkId)
|
|
813
|
+
: nextCatalog.filter((p) => pageNeedsReload(p.chunkId, affected)).map((p) => p.chunkId);
|
|
814
|
+
const pagesToLoad = nextCatalog.filter((p) => reloadSet.includes(p.chunkId));
|
|
808
815
|
for (const p of pagesToLoad) {
|
|
809
816
|
const pageRel = `${p.chunkId}.client.js`;
|
|
810
817
|
const href = bustUrl(pathToFileURL(path.join(distDir, pageRel)).href);
|
|
@@ -841,10 +848,10 @@ async function softReload(opts = {}) {
|
|
|
841
848
|
.map((e) => e.component)
|
|
842
849
|
.filter(Boolean);
|
|
843
850
|
const lazySet = new Set(lazyEventNames);
|
|
844
|
-
await writeFile(path.join(distDir, 'entry-client.js'), emitEntryClient(componentEntries.filter((e) => !lazySet.has(e.name)), componentEntries.filter((e) => lazySet.has(e.name)), reloadToken), 'utf8');
|
|
851
|
+
await writeFile(path.join(distDir, 'entry-client.js'), emitEntryClient(componentEntries.filter((e) => !lazySet.has(e.name)), componentEntries.filter((e) => lazySet.has(e.name)), skipEntryRewrite ? reloadToken : nextToken), 'utf8');
|
|
845
852
|
const strategies = resumeEntries.map((e) => e.strategy);
|
|
846
853
|
const eventOnlyShell = isEventOnlyShell(strategies);
|
|
847
|
-
await writeFile(path.join(distDir, 'entry-event.js'), emitEntryEvent(reloadToken), 'utf8');
|
|
854
|
+
await writeFile(path.join(distDir, 'entry-event.js'), emitEntryEvent(skipEntryRewrite ? reloadToken : nextToken), 'utf8');
|
|
848
855
|
lastDevError = null;
|
|
849
856
|
const mode = islandHmr ? 'island' : eventOnlyShell ? 'event-shell' : 'full';
|
|
850
857
|
notifySse(JSON.stringify({
|
|
@@ -906,6 +913,8 @@ function shouldReloadAllPages(opts) {
|
|
|
906
913
|
return false;
|
|
907
914
|
if (opts.full)
|
|
908
915
|
return true;
|
|
916
|
+
if (Array.isArray(opts.rerunLoaders) && opts.rerunLoaders.length > 0)
|
|
917
|
+
return false;
|
|
909
918
|
if (!opts.affected.length)
|
|
910
919
|
return true;
|
|
911
920
|
for (const f of opts.emitted) {
|
|
@@ -1085,6 +1094,10 @@ async function loadPageCtor(chunkId) {
|
|
|
1085
1094
|
async function listPageClientFiles(dir) {
|
|
1086
1095
|
const fromDep = await listPagesFromDeployment(dir);
|
|
1087
1096
|
if (!fromDep.length) {
|
|
1097
|
+
if (isDev) {
|
|
1098
|
+
console.warn(`vmz dev: no page units with pathPattern in ${path.join(dir, 'vmz-deployment.json')}`);
|
|
1099
|
+
return [];
|
|
1100
|
+
}
|
|
1088
1101
|
throw new Error(`vmz serve: no page units with pathPattern in ${path.join(dir, 'vmz-deployment.json')} (plan-only host)`);
|
|
1089
1102
|
}
|
|
1090
1103
|
return fromDep;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vmz/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "VMZ production runtime core — DOM / SSR / HTTP / WriteBarrier (no compiler)",
|
|
6
6
|
"exports": {
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"linkedom": "^0.18.13"
|
|
67
67
|
},
|
|
68
68
|
"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.
|
|
69
|
+
"@vmz/vmz-win32-x64": "0.1.24",
|
|
70
|
+
"@vmz/vmz-win32-arm64": "0.1.24",
|
|
71
|
+
"@vmz/vmz-darwin-x64": "0.1.24",
|
|
72
|
+
"@vmz/vmz-darwin-arm64": "0.1.24",
|
|
73
|
+
"@vmz/vmz-linux-x64": "0.1.24",
|
|
74
|
+
"@vmz/vmz-linux-arm64": "0.1.24"
|
|
75
75
|
},
|
|
76
76
|
"publishConfig": {
|
|
77
77
|
"access": "public"
|