evolit 0.1.0-alpha.28 → 0.1.0-alpha.29
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/package.json +4 -4
- package/src/client-assets.js +6 -1
- package/src/navigation-client.js +2 -0
- package/src/render.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "evolit",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.29",
|
|
4
4
|
"description": "A convention-driven application framework for LitSX and web components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "yarn@4.10.3",
|
|
@@ -55,9 +55,9 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@jridgewell/remapping": "^2.3.5",
|
|
58
|
-
"@litsx/compiler": "0.10.0-canary-feat-ssr-
|
|
59
|
-
"@litsx/core": "0.17.0-canary-feat-ssr-
|
|
60
|
-
"@litsx/ssr": "0.2.0-canary-feat-ssr-
|
|
58
|
+
"@litsx/compiler": "0.10.0-canary-feat-ssr-20260801095541",
|
|
59
|
+
"@litsx/core": "0.17.0-canary-feat-ssr-20260801095541",
|
|
60
|
+
"@litsx/ssr": "0.2.0-canary-feat-ssr-20260801095541",
|
|
61
61
|
"@litsx/typescript": "^0.9.0",
|
|
62
62
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
63
63
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
package/src/client-assets.js
CHANGED
|
@@ -1174,7 +1174,12 @@ export function createHydrationBootstrap({
|
|
|
1174
1174
|
: []).filter((moduleUrl) => typeof moduleUrl === "string" && moduleUrl.length > 0),
|
|
1175
1175
|
)];
|
|
1176
1176
|
|
|
1177
|
-
const
|
|
1177
|
+
const hasResourceSnapshots = normalizedHydrationData?.payload?.resources
|
|
1178
|
+
&& typeof normalizedHydrationData.payload.resources === "object"
|
|
1179
|
+
&& Object.keys(normalizedHydrationData.payload.resources).length > 0;
|
|
1180
|
+
const hasHydrationWork = rootModuleUrls.length > 0
|
|
1181
|
+
|| clientImports.length > 0
|
|
1182
|
+
|| hasResourceSnapshots;
|
|
1178
1183
|
if (!hasHydrationWork && !navigationModuleUrl) {
|
|
1179
1184
|
return "";
|
|
1180
1185
|
}
|
package/src/navigation-client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { useHost, useOnConnect, useState } from "@litsx/core";
|
|
|
2
2
|
import {
|
|
3
3
|
applyHydrationPayload,
|
|
4
4
|
hydrateRoot,
|
|
5
|
+
prepareHydrationResources,
|
|
5
6
|
registerHydrationModules,
|
|
6
7
|
} from "@litsx/ssr/hydration";
|
|
7
8
|
import { createHref } from "./navigation-url.js";
|
|
@@ -186,6 +187,7 @@ function versionClientImport(specifier, version) {
|
|
|
186
187
|
|
|
187
188
|
async function applyRouteDelta(delta, documentRef = document, signal, options = {}) {
|
|
188
189
|
throwIfAborted(signal);
|
|
190
|
+
prepareHydrationResources(delta.hydrationData);
|
|
189
191
|
const current = readRoute(documentRef);
|
|
190
192
|
const nextSegments = delta.route?.segments ?? [];
|
|
191
193
|
const currentSegments = current?.segments ?? [];
|
package/src/render.js
CHANGED
|
@@ -199,9 +199,9 @@ function createSegmentChildrenMarker(segment) {
|
|
|
199
199
|
return `<!--evolit:children:${segment.id}-->`;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
function combineSegmentSsrArtifacts(results) {
|
|
202
|
+
export function combineSegmentSsrArtifacts(results) {
|
|
203
203
|
const roots = [];
|
|
204
|
-
const payload = { roots: {}, instances: {} };
|
|
204
|
+
const payload = { roots: {}, instances: {}, resources: {} };
|
|
205
205
|
const clientImports = new Set();
|
|
206
206
|
const headTags = new Set();
|
|
207
207
|
|
|
@@ -218,12 +218,15 @@ function combineSegmentSsrArtifacts(results) {
|
|
|
218
218
|
})));
|
|
219
219
|
Object.assign(payload.roots, result.hydrationData.payload?.roots ?? {});
|
|
220
220
|
Object.assign(payload.instances, result.hydrationData.payload?.instances ?? {});
|
|
221
|
+
Object.assign(payload.resources, result.hydrationData.payload?.resources ?? {});
|
|
221
222
|
}
|
|
222
223
|
|
|
224
|
+
const hasResources = Object.keys(payload.resources).length > 0;
|
|
225
|
+
|
|
223
226
|
return {
|
|
224
227
|
clientImports: [...clientImports],
|
|
225
228
|
headTags: [...headTags],
|
|
226
|
-
hydrationData: roots.length > 0
|
|
229
|
+
hydrationData: roots.length > 0 || hasResources
|
|
227
230
|
? { version: 1, roots, payload, clientImports: [...clientImports] }
|
|
228
231
|
: null,
|
|
229
232
|
};
|