defuss-ssg 0.7.0 → 0.7.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/README.md +49 -15
- package/dist/cli.mjs +29 -29
- package/dist/content.d.cts +1 -1
- package/dist/content.d.mts +1 -1
- package/dist/content.mjs +1 -1
- package/dist/index.cjs +54 -37
- package/dist/index.d.cts +46 -6
- package/dist/index.d.mts +46 -6
- package/dist/index.mjs +3 -3
- package/dist/{path-CjHWUK8o.mjs → path-j0LJZE_u.mjs} +1 -1
- package/dist/runtime.cjs +26 -0
- package/dist/runtime.d.cts +1 -0
- package/dist/runtime.d.mts +1 -0
- package/dist/runtime.mjs +26 -0
- package/dist/{serve-BFMU8uCH.mjs → serve-qxXVqJiL.mjs} +39 -38
- package/dist/{types-CZSWRdQS.d.cts → types-Dh8AcW7C.d.cts} +1 -1
- package/dist/{types-CZSWRdQS.d.mts → types-Dh8AcW7C.d.mts} +1 -1
- package/dist/{vite-BC7XxFTV.cjs → vite-CE8Q5aF_.cjs} +601 -104
- package/dist/{vite-CSOGjlHB.mjs → vite-bKsy4atm.mjs} +587 -106
- package/dist/vite.cjs +1 -1
- package/dist/vite.d.cts +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.mjs +2 -2
- package/package.json +5 -5
package/dist/runtime.cjs
CHANGED
|
@@ -443,6 +443,9 @@ const shouldPreserveHydratedBoundary = (boundary, options) => {
|
|
|
443
443
|
if (!options.preserveHydratedState) {
|
|
444
444
|
return false;
|
|
445
445
|
}
|
|
446
|
+
if (options.preserveHydratedBoundaries === false) {
|
|
447
|
+
return false;
|
|
448
|
+
}
|
|
446
449
|
if (options.kind === "component" && options.componentSrc) {
|
|
447
450
|
return boundary.getAttribute("data-hydrate-src") !== options.componentSrc;
|
|
448
451
|
}
|
|
@@ -685,6 +688,14 @@ const navigateTo = async (url, replace = false, options = {}) => {
|
|
|
685
688
|
console.log(
|
|
686
689
|
`[navigateTo] url=${url} key=${key} replace=${replace} cached=${pageCache.has(key)}`
|
|
687
690
|
);
|
|
691
|
+
console.log("[defuss-ssg] Morph refresh: navigateTo start", {
|
|
692
|
+
url,
|
|
693
|
+
replace,
|
|
694
|
+
kind: options.kind || "other",
|
|
695
|
+
preserveHydratedState: options.preserveHydratedState !== false,
|
|
696
|
+
preserveHydratedBoundaries: options.preserveHydratedBoundaries !== false,
|
|
697
|
+
componentSrc: options.componentSrc || null
|
|
698
|
+
});
|
|
688
699
|
if (!pageCache.has(key)) {
|
|
689
700
|
await prefetch(url);
|
|
690
701
|
}
|
|
@@ -722,9 +733,24 @@ const navigateTo = async (url, replace = false, options = {}) => {
|
|
|
722
733
|
console.log(
|
|
723
734
|
`[navigateTo] Morphing body content (new length=${bodyHtml.length})`
|
|
724
735
|
);
|
|
736
|
+
console.log("[defuss-ssg] Morph refresh: DOM morph start", {
|
|
737
|
+
url,
|
|
738
|
+
bodyLength: bodyHtml.length,
|
|
739
|
+
kind: options.kind || "other"
|
|
740
|
+
});
|
|
725
741
|
await defuss.$(document.body).update(bodyHtml);
|
|
742
|
+
console.log("[defuss-ssg] Morph refresh: DOM morph complete", {
|
|
743
|
+
url,
|
|
744
|
+
bodyLength: bodyHtml.length,
|
|
745
|
+
kind: options.kind || "other"
|
|
746
|
+
});
|
|
726
747
|
await triggerHydration(document.body);
|
|
727
748
|
restoreBoundaryStateSnapshots(boundaryStateSnapshots);
|
|
749
|
+
console.log("[defuss-ssg] Morph refresh: hydration restore complete", {
|
|
750
|
+
url,
|
|
751
|
+
kind: options.kind || "other",
|
|
752
|
+
boundarySnapshots: boundaryStateSnapshots.length
|
|
753
|
+
});
|
|
728
754
|
if (replace) {
|
|
729
755
|
history.replaceState({ ...history.state, navigated: true }, "", url);
|
|
730
756
|
} else {
|
package/dist/runtime.d.cts
CHANGED
|
@@ -9,6 +9,7 @@ declare const setupLiveReload: () => void;
|
|
|
9
9
|
type LiveReloadKind = "page" | "endpoint" | "component" | "asset" | "dependency" | "config" | "rpc" | "other";
|
|
10
10
|
type NavigateOptions = {
|
|
11
11
|
preserveHydratedState?: boolean;
|
|
12
|
+
preserveHydratedBoundaries?: boolean;
|
|
12
13
|
kind?: LiveReloadKind;
|
|
13
14
|
componentSrc?: string;
|
|
14
15
|
};
|
package/dist/runtime.d.mts
CHANGED
|
@@ -9,6 +9,7 @@ declare const setupLiveReload: () => void;
|
|
|
9
9
|
type LiveReloadKind = "page" | "endpoint" | "component" | "asset" | "dependency" | "config" | "rpc" | "other";
|
|
10
10
|
type NavigateOptions = {
|
|
11
11
|
preserveHydratedState?: boolean;
|
|
12
|
+
preserveHydratedBoundaries?: boolean;
|
|
12
13
|
kind?: LiveReloadKind;
|
|
13
14
|
componentSrc?: string;
|
|
14
15
|
};
|
package/dist/runtime.mjs
CHANGED
|
@@ -441,6 +441,9 @@ const shouldPreserveHydratedBoundary = (boundary, options) => {
|
|
|
441
441
|
if (!options.preserveHydratedState) {
|
|
442
442
|
return false;
|
|
443
443
|
}
|
|
444
|
+
if (options.preserveHydratedBoundaries === false) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
444
447
|
if (options.kind === "component" && options.componentSrc) {
|
|
445
448
|
return boundary.getAttribute("data-hydrate-src") !== options.componentSrc;
|
|
446
449
|
}
|
|
@@ -683,6 +686,14 @@ const navigateTo = async (url, replace = false, options = {}) => {
|
|
|
683
686
|
console.log(
|
|
684
687
|
`[navigateTo] url=${url} key=${key} replace=${replace} cached=${pageCache.has(key)}`
|
|
685
688
|
);
|
|
689
|
+
console.log("[defuss-ssg] Morph refresh: navigateTo start", {
|
|
690
|
+
url,
|
|
691
|
+
replace,
|
|
692
|
+
kind: options.kind || "other",
|
|
693
|
+
preserveHydratedState: options.preserveHydratedState !== false,
|
|
694
|
+
preserveHydratedBoundaries: options.preserveHydratedBoundaries !== false,
|
|
695
|
+
componentSrc: options.componentSrc || null
|
|
696
|
+
});
|
|
686
697
|
if (!pageCache.has(key)) {
|
|
687
698
|
await prefetch(url);
|
|
688
699
|
}
|
|
@@ -720,9 +731,24 @@ const navigateTo = async (url, replace = false, options = {}) => {
|
|
|
720
731
|
console.log(
|
|
721
732
|
`[navigateTo] Morphing body content (new length=${bodyHtml.length})`
|
|
722
733
|
);
|
|
734
|
+
console.log("[defuss-ssg] Morph refresh: DOM morph start", {
|
|
735
|
+
url,
|
|
736
|
+
bodyLength: bodyHtml.length,
|
|
737
|
+
kind: options.kind || "other"
|
|
738
|
+
});
|
|
723
739
|
await $(document.body).update(bodyHtml);
|
|
740
|
+
console.log("[defuss-ssg] Morph refresh: DOM morph complete", {
|
|
741
|
+
url,
|
|
742
|
+
bodyLength: bodyHtml.length,
|
|
743
|
+
kind: options.kind || "other"
|
|
744
|
+
});
|
|
724
745
|
await triggerHydration(document.body);
|
|
725
746
|
restoreBoundaryStateSnapshots(boundaryStateSnapshots);
|
|
747
|
+
console.log("[defuss-ssg] Morph refresh: hydration restore complete", {
|
|
748
|
+
url,
|
|
749
|
+
kind: options.kind || "other",
|
|
750
|
+
boundarySnapshots: boundaryStateSnapshots.length
|
|
751
|
+
});
|
|
726
752
|
if (replace) {
|
|
727
753
|
history.replaceState({ ...history.state, navigated: true }, "", url);
|
|
728
754
|
} else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mdx from '@mdx-js/rollup';
|
|
2
|
-
import { createServer
|
|
2
|
+
import { createServer } from 'vite';
|
|
3
3
|
import defuss from 'defuss-vite';
|
|
4
|
-
import {
|
|
4
|
+
import { L as validateProjectDir, B as readConfig, n as defussSsg, A as mergeUserViteConfig, D as registerEndpoints, t as initializeRpc, C as readIncomingBody, m as createWebRequest, s as handleRpcRequest, I as sendWebResponse } from './vite-bKsy4atm.mjs';
|
|
5
5
|
import { existsSync } from 'node:fs';
|
|
6
6
|
import { join } from 'node:path';
|
|
7
7
|
import process from 'node:process';
|
|
@@ -16,43 +16,44 @@ const dev = async ({
|
|
|
16
16
|
}) => {
|
|
17
17
|
const projectDirStatus = validateProjectDir(projectDir);
|
|
18
18
|
if (projectDirStatus.code !== "OK") return projectDirStatus;
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"**/.endpoints/**",
|
|
35
|
-
"**/.rpc/**"
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
plugins: [
|
|
40
|
-
defuss({ enableJsxDevMode: true }),
|
|
41
|
-
mdx({
|
|
42
|
-
jsxImportSource: "defuss",
|
|
43
|
-
development: true,
|
|
44
|
-
remarkPlugins: config.remarkPlugins,
|
|
45
|
-
rehypePlugins: config.rehypePlugins
|
|
46
|
-
}),
|
|
47
|
-
...defussSsg({
|
|
48
|
-
projectDir,
|
|
49
|
-
debug,
|
|
50
|
-
writeDevOutput
|
|
51
|
-
})
|
|
19
|
+
const initialConfig = await readConfig(projectDir, debug);
|
|
20
|
+
const currentViteConfig = {
|
|
21
|
+
root: projectDir,
|
|
22
|
+
configFile: false,
|
|
23
|
+
appType: "custom",
|
|
24
|
+
server: {
|
|
25
|
+
host,
|
|
26
|
+
port,
|
|
27
|
+
watch: {
|
|
28
|
+
ignored: [
|
|
29
|
+
"**/node_modules/**",
|
|
30
|
+
"**/dist/**",
|
|
31
|
+
"**/.ssg-temp/**",
|
|
32
|
+
"**/.endpoints/**",
|
|
33
|
+
"**/.rpc/**"
|
|
52
34
|
]
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
plugins: [
|
|
38
|
+
defuss({ enableJsxDevMode: true }),
|
|
39
|
+
mdx({
|
|
40
|
+
jsxImportSource: "defuss",
|
|
41
|
+
development: true,
|
|
42
|
+
remarkPlugins: initialConfig.remarkPlugins,
|
|
43
|
+
rehypePlugins: initialConfig.rehypePlugins
|
|
44
|
+
}),
|
|
45
|
+
...defussSsg({
|
|
46
|
+
projectDir,
|
|
47
|
+
debug,
|
|
48
|
+
writeDevOutput
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
const config = await readConfig(projectDir, debug, {
|
|
53
|
+
currentViteConfig
|
|
54
|
+
});
|
|
55
|
+
const server = await createServer(
|
|
56
|
+
mergeUserViteConfig(currentViteConfig, config.viteConfig)
|
|
56
57
|
);
|
|
57
58
|
await server.listen(port);
|
|
58
59
|
server.printUrls();
|
|
@@ -7961,4 +7961,4 @@ interface SsgConfig {
|
|
|
7961
7961
|
viteConfig?: InlineConfig;
|
|
7962
7962
|
}
|
|
7963
7963
|
|
|
7964
|
-
export type {
|
|
7964
|
+
export type { BuildMode as B, ContainerRuntime as C, DefussSsgViteOptions as D, EndpointRouteContext as E, PluginFn as P, RehypePlugins as R, ServeOptions as S, BuildOptions as a, ContentEntry as b, ContentGlobOptions as c, DevChangeKind as d, DevOptions as e, EndpointRouteMethod as f, EndpointRouteRegistrar as g, EndpointRouteResponder as h, PluginFnPageDom as i, PluginFnPageHtml as j, PluginFnPageVdom as k, PluginFnPrePost as l, RemarkPlugins as m, SsgConfig as n, SsgPlugin as o, Status as p, StatusCode as q };
|
|
@@ -7961,4 +7961,4 @@ interface SsgConfig {
|
|
|
7961
7961
|
viteConfig?: InlineConfig;
|
|
7962
7962
|
}
|
|
7963
7963
|
|
|
7964
|
-
export type {
|
|
7964
|
+
export type { BuildMode as B, ContainerRuntime as C, DefussSsgViteOptions as D, EndpointRouteContext as E, PluginFn as P, RehypePlugins as R, ServeOptions as S, BuildOptions as a, ContentEntry as b, ContentGlobOptions as c, DevChangeKind as d, DevOptions as e, EndpointRouteMethod as f, EndpointRouteRegistrar as g, EndpointRouteResponder as h, PluginFnPageDom as i, PluginFnPageHtml as j, PluginFnPageVdom as k, PluginFnPrePost as l, RemarkPlugins as m, SsgConfig as n, SsgPlugin as o, Status as p, StatusCode as q };
|