defuss-ssg 0.7.2 → 0.7.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/cli.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { B as readConfig, L as validateProjectDir, b as build } from './vite-bKsy4atm.mjs';
2
+ import { B as readConfig, L as validateProjectDir, b as build } from './vite-7imK29Sk.mjs';
3
3
  import { spawnSync, spawn } from 'node:child_process';
4
4
  import { createHash } from 'node:crypto';
5
5
  import { mkdtempSync, writeFileSync, rmSync, existsSync, readFileSync } from 'node:fs';
6
6
  import { tmpdir } from 'node:os';
7
7
  import { resolve, join, basename, dirname } from 'node:path';
8
8
  import { fileURLToPath } from 'node:url';
9
- import { d as dev, s as serve } from './serve-qxXVqJiL.mjs';
9
+ import { d as dev, s as serve } from './serve-Mjyd3sxP.mjs';
10
10
  import 'fast-glob';
11
11
  import 'node:fs/promises';
12
12
  import 'defuss/server';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var vite = require('./vite-CE8Q5aF_.cjs');
3
+ var vite = require('./vite-BzISHTvt.cjs');
4
4
  var content = require('./content.cjs');
5
5
  var mdx = require('@mdx-js/rollup');
6
6
  var vite$1 = require('vite');
@@ -52,7 +52,8 @@ const dev = async ({
52
52
  "**/dist/**",
53
53
  "**/.ssg-temp/**",
54
54
  "**/.endpoints/**",
55
- "**/.rpc/**"
55
+ "**/.rpc/**",
56
+ "**/.defuss-tauri/**"
56
57
  ]
57
58
  }
58
59
  },
@@ -167,10 +168,13 @@ const serve = async ({
167
168
  app.get?.("/rpc/upload/progress/:uploadId", rpcHandler);
168
169
  app.head?.("/rpc/upload/:uploadId", rpcHandler);
169
170
  }
170
- const staticMiddleware = defussExpress.express.static?.(outputDir);
171
+ const staticMiddleware = defussExpress.express.static?.(outputDir, { index: "index.html" });
171
172
  if (staticMiddleware) {
172
173
  app.use?.(staticMiddleware);
173
174
  }
175
+ app.use?.((_req, res) => {
176
+ res.sendFile("index.html", { root: outputDir });
177
+ });
174
178
  try {
175
179
  await defussExpress.startServer(app, {
176
180
  host,
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { H as HTTP_METHODS, S as SSG_CONFIG_MODULE_ID, a as applyConfigDefaults, b as build, c as buildEndpoints, d as clearVirtualConfigModuleState, e as cloneConfigValue, f as compileConfigModule, g as compileEndpoints, h as compileRpcModule, i as configDefaults, j as createConfigModulePlugin, k as createConfigModuleStateKey, l as createTaggedBaseViteConfig, n as defussSsg, o as discoverEndpointSourceFiles, p as discoverRpcFile, q as endpointFileToRoute, r as handleEndpointRoute, s as handleRpcRequest, t as initializeRpc, u as isBareModuleId, v as isPlainObject, w as isTaggedBaseViteConfig, x as loadCompiledConfigModule, y as loadEndpointModule, z as matchRoutePattern, A as mergeUserViteConfig, B as readConfig, D as registerEndpoints, E as resolveConfigPath, F as resolveEndpoints, G as routeToExpressPattern, J as setVirtualConfigModuleState, K as stripBaseViteConfigMarker } from './vite-bKsy4atm.mjs';
1
+ export { H as HTTP_METHODS, S as SSG_CONFIG_MODULE_ID, a as applyConfigDefaults, b as build, c as buildEndpoints, d as clearVirtualConfigModuleState, e as cloneConfigValue, f as compileConfigModule, g as compileEndpoints, h as compileRpcModule, i as configDefaults, j as createConfigModulePlugin, k as createConfigModuleStateKey, l as createTaggedBaseViteConfig, n as defussSsg, o as discoverEndpointSourceFiles, p as discoverRpcFile, q as endpointFileToRoute, r as handleEndpointRoute, s as handleRpcRequest, t as initializeRpc, u as isBareModuleId, v as isPlainObject, w as isTaggedBaseViteConfig, x as loadCompiledConfigModule, y as loadEndpointModule, z as matchRoutePattern, A as mergeUserViteConfig, B as readConfig, D as registerEndpoints, E as resolveConfigPath, F as resolveEndpoints, G as routeToExpressPattern, J as setVirtualConfigModuleState, K as stripBaseViteConfigMarker } from './vite-7imK29Sk.mjs';
2
2
  export { glob } from './content.mjs';
3
- export { d as dev, s as serve } from './serve-qxXVqJiL.mjs';
3
+ export { d as dev, s as serve } from './serve-Mjyd3sxP.mjs';
4
4
  import 'fast-glob';
5
5
  import 'node:fs';
6
6
  import 'node:fs/promises';
package/dist/runtime.cjs CHANGED
@@ -132,10 +132,11 @@ const getHydrationRootElement = (nodes) => {
132
132
  }
133
133
  return null;
134
134
  };
135
- const normaliseHydrationMarkup = (container) => {
135
+ const normaliseHydrationMarkup = (container, preserveHydrated) => {
136
136
  const boundaries = Array.from(
137
137
  container.querySelectorAll('[data-hydrate="true"]')
138
138
  );
139
+ const preservedWrappers = /* @__PURE__ */ new Map();
139
140
  for (const boundary of boundaries) {
140
141
  const id = boundary.getAttribute("data-hydrate-id");
141
142
  if (!id) {
@@ -149,6 +150,7 @@ const normaliseHydrationMarkup = (container) => {
149
150
  copyHydrationAttributes(boundary, rootElement, false);
150
151
  boundary.replaceWith(...hydratableNodes);
151
152
  }
153
+ return preservedWrappers;
152
154
  };
153
155
  const isRestorableFormControl = (element) => element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement;
154
156
  const isInsideNestedHydratedBoundary = (root, element) => {
@@ -439,18 +441,6 @@ const syncPageControlStateSnapshots = (container, snapshots) => {
439
441
  applyControlStateSnapshot(container, snapshot);
440
442
  }
441
443
  };
442
- const shouldPreserveHydratedBoundary = (boundary, options) => {
443
- if (!options.preserveHydratedState) {
444
- return false;
445
- }
446
- if (options.preserveHydratedBoundaries === false) {
447
- return false;
448
- }
449
- if (options.kind === "component" && options.componentSrc) {
450
- return boundary.getAttribute("data-hydrate-src") !== options.componentSrc;
451
- }
452
- return true;
453
- };
454
444
  const collectBoundaryStateSnapshots = (container, options) => {
455
445
  if (!options.preserveHydratedState) {
456
446
  return [];
@@ -501,30 +491,6 @@ const restoreBoundaryStateSnapshots = (snapshots) => {
501
491
  }
502
492
  }
503
493
  };
504
- const preserveHydratedBoundaries = (container, options) => {
505
- const currentBoundaries = /* @__PURE__ */ new Map();
506
- for (const boundary of document.querySelectorAll('[data-hydrate="true"][data-hydrated="true"]')) {
507
- const id = boundary.getAttribute("data-hydrate-id");
508
- if (!id) {
509
- continue;
510
- }
511
- currentBoundaries.set(id, boundary);
512
- }
513
- for (const nextBoundary of container.querySelectorAll('[data-hydrate="true"]')) {
514
- const id = nextBoundary.getAttribute("data-hydrate-id");
515
- if (!id) {
516
- continue;
517
- }
518
- const currentBoundary = currentBoundaries.get(id);
519
- if (!currentBoundary) {
520
- continue;
521
- }
522
- if (!shouldPreserveHydratedBoundary(nextBoundary, options)) {
523
- continue;
524
- }
525
- nextBoundary.outerHTML = currentBoundary.outerHTML;
526
- }
527
- };
528
494
  const hydrateBoundary = async (boundary, options = {}) => {
529
495
  if (boundary.getAttribute("data-hydrate") !== "true") {
530
496
  return;
@@ -718,14 +684,64 @@ const navigateTo = async (url, replace = false, options = {}) => {
718
684
  return;
719
685
  }
720
686
  const preservedWindowScroll = options.preserveHydratedState ? { x: window.scrollX, y: window.scrollY } : null;
721
- normaliseHydrationMarkup(newBody);
687
+ const liveHydratedBoundaries = /* @__PURE__ */ new Map();
688
+ if (options.preserveHydratedState !== false) {
689
+ for (const boundary of document.querySelectorAll('[data-hydrate="true"][data-hydrated="true"]')) {
690
+ const id = boundary.getAttribute("data-hydrate-id");
691
+ if (id) {
692
+ liveHydratedBoundaries.set(id, boundary);
693
+ }
694
+ }
695
+ }
696
+ if (options.kind === "component" && options.componentSrc && liveHydratedBoundaries.size > 0) {
697
+ const newChangedBoundary = newBody.querySelector(
698
+ `[data-hydrate-src="${options.componentSrc}"]`
699
+ );
700
+ const liveChangedBoundary = Array.from(liveHydratedBoundaries.values()).find(
701
+ (el) => el.getAttribute("data-hydrate-src") === options.componentSrc
702
+ );
703
+ if (newChangedBoundary && liveChangedBoundary) {
704
+ const hydratableNodes = getHydratableNodes(newChangedBoundary, newChangedBoundary.getAttribute("data-hydrate-id") || "");
705
+ const rootElement = getHydrationRootElement(hydratableNodes);
706
+ if (rootElement) {
707
+ await defuss.$(liveChangedBoundary).update(rootElement);
708
+ }
709
+ updateHead(doc);
710
+ if (preservedWindowScroll) {
711
+ window.scrollTo(preservedWindowScroll.x, preservedWindowScroll.y);
712
+ }
713
+ console.log("[defuss-ssg] Morph refresh: component-only morph complete", {
714
+ componentSrc: options.componentSrc
715
+ });
716
+ return;
717
+ }
718
+ }
719
+ normaliseHydrationMarkup(newBody, false);
720
+ const placeholders = /* @__PURE__ */ new Map();
721
+ for (const [id, liveBoundary] of liveHydratedBoundaries) {
722
+ if (options.kind === "component" && options.componentSrc) {
723
+ const src = liveBoundary.getAttribute("data-hydrate-src");
724
+ if (src === options.componentSrc) {
725
+ continue;
726
+ }
727
+ }
728
+ const newBoundary = newBody.querySelector(
729
+ `[data-hydrate-id="${id}"]`
730
+ );
731
+ if (!(newBoundary instanceof Element)) {
732
+ continue;
733
+ }
734
+ const placeholder = document.createElement("div");
735
+ placeholder.setAttribute("data-hydrate-placeholder", id);
736
+ newBoundary.replaceWith(placeholder);
737
+ placeholders.set(id, placeholder);
738
+ }
722
739
  const pageControlStateSnapshots = collectPageControlStateSnapshots(options);
723
740
  syncPageControlStateSnapshots(newBody, pageControlStateSnapshots);
724
741
  const boundaryStateSnapshots = collectBoundaryStateSnapshots(
725
742
  newBody,
726
743
  options
727
744
  );
728
- preserveHydratedBoundaries(newBody, options);
729
745
  const scrollY = window.scrollY;
730
746
  history.replaceState({ ...history.state, scrollY }, "");
731
747
  updateHead(doc);
@@ -744,6 +760,16 @@ const navigateTo = async (url, replace = false, options = {}) => {
744
760
  bodyLength: bodyHtml.length,
745
761
  kind: options.kind || "other"
746
762
  });
763
+ for (const [id, placeholder] of placeholders) {
764
+ if (!placeholder.isConnected) {
765
+ continue;
766
+ }
767
+ const liveBoundary = liveHydratedBoundaries.get(id);
768
+ if (!liveBoundary) {
769
+ continue;
770
+ }
771
+ placeholder.replaceWith(liveBoundary);
772
+ }
747
773
  await triggerHydration(document.body);
748
774
  restoreBoundaryStateSnapshots(boundaryStateSnapshots);
749
775
  console.log("[defuss-ssg] Morph refresh: hydration restore complete", {
@@ -861,6 +887,9 @@ runtimeWindow.__defuss_ssg_runtime = {
861
887
  },
862
888
  set bustCache(value) {
863
889
  runtimeWindow.__defuss_bustCache = value;
890
+ if (value) {
891
+ fetching.clear();
892
+ }
864
893
  }
865
894
  };
866
895
 
package/dist/runtime.mjs CHANGED
@@ -130,10 +130,11 @@ const getHydrationRootElement = (nodes) => {
130
130
  }
131
131
  return null;
132
132
  };
133
- const normaliseHydrationMarkup = (container) => {
133
+ const normaliseHydrationMarkup = (container, preserveHydrated) => {
134
134
  const boundaries = Array.from(
135
135
  container.querySelectorAll('[data-hydrate="true"]')
136
136
  );
137
+ const preservedWrappers = /* @__PURE__ */ new Map();
137
138
  for (const boundary of boundaries) {
138
139
  const id = boundary.getAttribute("data-hydrate-id");
139
140
  if (!id) {
@@ -147,6 +148,7 @@ const normaliseHydrationMarkup = (container) => {
147
148
  copyHydrationAttributes(boundary, rootElement, false);
148
149
  boundary.replaceWith(...hydratableNodes);
149
150
  }
151
+ return preservedWrappers;
150
152
  };
151
153
  const isRestorableFormControl = (element) => element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement;
152
154
  const isInsideNestedHydratedBoundary = (root, element) => {
@@ -437,18 +439,6 @@ const syncPageControlStateSnapshots = (container, snapshots) => {
437
439
  applyControlStateSnapshot(container, snapshot);
438
440
  }
439
441
  };
440
- const shouldPreserveHydratedBoundary = (boundary, options) => {
441
- if (!options.preserveHydratedState) {
442
- return false;
443
- }
444
- if (options.preserveHydratedBoundaries === false) {
445
- return false;
446
- }
447
- if (options.kind === "component" && options.componentSrc) {
448
- return boundary.getAttribute("data-hydrate-src") !== options.componentSrc;
449
- }
450
- return true;
451
- };
452
442
  const collectBoundaryStateSnapshots = (container, options) => {
453
443
  if (!options.preserveHydratedState) {
454
444
  return [];
@@ -499,30 +489,6 @@ const restoreBoundaryStateSnapshots = (snapshots) => {
499
489
  }
500
490
  }
501
491
  };
502
- const preserveHydratedBoundaries = (container, options) => {
503
- const currentBoundaries = /* @__PURE__ */ new Map();
504
- for (const boundary of document.querySelectorAll('[data-hydrate="true"][data-hydrated="true"]')) {
505
- const id = boundary.getAttribute("data-hydrate-id");
506
- if (!id) {
507
- continue;
508
- }
509
- currentBoundaries.set(id, boundary);
510
- }
511
- for (const nextBoundary of container.querySelectorAll('[data-hydrate="true"]')) {
512
- const id = nextBoundary.getAttribute("data-hydrate-id");
513
- if (!id) {
514
- continue;
515
- }
516
- const currentBoundary = currentBoundaries.get(id);
517
- if (!currentBoundary) {
518
- continue;
519
- }
520
- if (!shouldPreserveHydratedBoundary(nextBoundary, options)) {
521
- continue;
522
- }
523
- nextBoundary.outerHTML = currentBoundary.outerHTML;
524
- }
525
- };
526
492
  const hydrateBoundary = async (boundary, options = {}) => {
527
493
  if (boundary.getAttribute("data-hydrate") !== "true") {
528
494
  return;
@@ -716,14 +682,64 @@ const navigateTo = async (url, replace = false, options = {}) => {
716
682
  return;
717
683
  }
718
684
  const preservedWindowScroll = options.preserveHydratedState ? { x: window.scrollX, y: window.scrollY } : null;
719
- normaliseHydrationMarkup(newBody);
685
+ const liveHydratedBoundaries = /* @__PURE__ */ new Map();
686
+ if (options.preserveHydratedState !== false) {
687
+ for (const boundary of document.querySelectorAll('[data-hydrate="true"][data-hydrated="true"]')) {
688
+ const id = boundary.getAttribute("data-hydrate-id");
689
+ if (id) {
690
+ liveHydratedBoundaries.set(id, boundary);
691
+ }
692
+ }
693
+ }
694
+ if (options.kind === "component" && options.componentSrc && liveHydratedBoundaries.size > 0) {
695
+ const newChangedBoundary = newBody.querySelector(
696
+ `[data-hydrate-src="${options.componentSrc}"]`
697
+ );
698
+ const liveChangedBoundary = Array.from(liveHydratedBoundaries.values()).find(
699
+ (el) => el.getAttribute("data-hydrate-src") === options.componentSrc
700
+ );
701
+ if (newChangedBoundary && liveChangedBoundary) {
702
+ const hydratableNodes = getHydratableNodes(newChangedBoundary, newChangedBoundary.getAttribute("data-hydrate-id") || "");
703
+ const rootElement = getHydrationRootElement(hydratableNodes);
704
+ if (rootElement) {
705
+ await $(liveChangedBoundary).update(rootElement);
706
+ }
707
+ updateHead(doc);
708
+ if (preservedWindowScroll) {
709
+ window.scrollTo(preservedWindowScroll.x, preservedWindowScroll.y);
710
+ }
711
+ console.log("[defuss-ssg] Morph refresh: component-only morph complete", {
712
+ componentSrc: options.componentSrc
713
+ });
714
+ return;
715
+ }
716
+ }
717
+ normaliseHydrationMarkup(newBody, false);
718
+ const placeholders = /* @__PURE__ */ new Map();
719
+ for (const [id, liveBoundary] of liveHydratedBoundaries) {
720
+ if (options.kind === "component" && options.componentSrc) {
721
+ const src = liveBoundary.getAttribute("data-hydrate-src");
722
+ if (src === options.componentSrc) {
723
+ continue;
724
+ }
725
+ }
726
+ const newBoundary = newBody.querySelector(
727
+ `[data-hydrate-id="${id}"]`
728
+ );
729
+ if (!(newBoundary instanceof Element)) {
730
+ continue;
731
+ }
732
+ const placeholder = document.createElement("div");
733
+ placeholder.setAttribute("data-hydrate-placeholder", id);
734
+ newBoundary.replaceWith(placeholder);
735
+ placeholders.set(id, placeholder);
736
+ }
720
737
  const pageControlStateSnapshots = collectPageControlStateSnapshots(options);
721
738
  syncPageControlStateSnapshots(newBody, pageControlStateSnapshots);
722
739
  const boundaryStateSnapshots = collectBoundaryStateSnapshots(
723
740
  newBody,
724
741
  options
725
742
  );
726
- preserveHydratedBoundaries(newBody, options);
727
743
  const scrollY = window.scrollY;
728
744
  history.replaceState({ ...history.state, scrollY }, "");
729
745
  updateHead(doc);
@@ -742,6 +758,16 @@ const navigateTo = async (url, replace = false, options = {}) => {
742
758
  bodyLength: bodyHtml.length,
743
759
  kind: options.kind || "other"
744
760
  });
761
+ for (const [id, placeholder] of placeholders) {
762
+ if (!placeholder.isConnected) {
763
+ continue;
764
+ }
765
+ const liveBoundary = liveHydratedBoundaries.get(id);
766
+ if (!liveBoundary) {
767
+ continue;
768
+ }
769
+ placeholder.replaceWith(liveBoundary);
770
+ }
745
771
  await triggerHydration(document.body);
746
772
  restoreBoundaryStateSnapshots(boundaryStateSnapshots);
747
773
  console.log("[defuss-ssg] Morph refresh: hydration restore complete", {
@@ -859,6 +885,9 @@ runtimeWindow.__defuss_ssg_runtime = {
859
885
  },
860
886
  set bustCache(value) {
861
887
  runtimeWindow.__defuss_bustCache = value;
888
+ if (value) {
889
+ fetching.clear();
890
+ }
862
891
  }
863
892
  };
864
893
 
@@ -1,7 +1,7 @@
1
1
  import mdx from '@mdx-js/rollup';
2
2
  import { createServer } from 'vite';
3
3
  import defuss from 'defuss-vite';
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';
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-7imK29Sk.mjs';
5
5
  import { existsSync } from 'node:fs';
6
6
  import { join } from 'node:path';
7
7
  import process from 'node:process';
@@ -30,7 +30,8 @@ const dev = async ({
30
30
  "**/dist/**",
31
31
  "**/.ssg-temp/**",
32
32
  "**/.endpoints/**",
33
- "**/.rpc/**"
33
+ "**/.rpc/**",
34
+ "**/.defuss-tauri/**"
34
35
  ]
35
36
  }
36
37
  },
@@ -145,10 +146,13 @@ const serve = async ({
145
146
  app.get?.("/rpc/upload/progress/:uploadId", rpcHandler);
146
147
  app.head?.("/rpc/upload/:uploadId", rpcHandler);
147
148
  }
148
- const staticMiddleware = express.static?.(outputDir);
149
+ const staticMiddleware = express.static?.(outputDir, { index: "index.html" });
149
150
  if (staticMiddleware) {
150
151
  app.use?.(staticMiddleware);
151
152
  }
153
+ app.use?.((_req, res) => {
154
+ res.sendFile("index.html", { root: outputDir });
155
+ });
152
156
  try {
153
157
  await startServer(app, {
154
158
  host,
@@ -936,7 +936,7 @@ const build = async ({
936
936
  const shouldCopyToTemp = (src) => {
937
937
  const relative2 = src.startsWith(projectDir) ? normalizePath$1(src.slice(projectDir.length).replace(/^[\\/]+/, "")) : src;
938
938
  const firstSegment = relative2.split(/[\\/]/)[0];
939
- return !(firstSegment === "node_modules" || firstSegment === config.output || firstSegment === ".endpoints" || firstSegment === ".ssg-temp" || firstSegment === ".git" || firstSegment === "public" || projectPaths.assetsSourceDirCandidates.some(
939
+ return !(firstSegment === "node_modules" || firstSegment === config.output || firstSegment === ".endpoints" || firstSegment === ".ssg-temp" || firstSegment === ".defuss-tauri" || firstSegment === ".git" || firstSegment === "public" || projectPaths.assetsSourceDirCandidates.some(
940
940
  (candidateDir) => isPathInOrUnder$1(relative2, candidateDir)
941
941
  ));
942
942
  };
@@ -1945,6 +1945,7 @@ if (import.meta.hot) {
1945
1945
  const preserveHydratedBoundaries =
1946
1946
  options.preserveHydratedBoundaries !== false;
1947
1947
  const rerunModuleScripts = options.rerunModuleScripts === true;
1948
+ const componentSrc = options.componentSrc || undefined;
1948
1949
 
1949
1950
  console.log("[defuss-ssg] Morph refresh: applying", {
1950
1951
  url: window.location.pathname,
@@ -1952,6 +1953,7 @@ if (import.meta.hot) {
1952
1953
  preserveHydratedState,
1953
1954
  preserveHydratedBoundaries,
1954
1955
  rerunModuleScripts,
1956
+ componentSrc,
1955
1957
  hasRuntimeNavigate: Boolean(runtime?.navigateTo),
1956
1958
  });
1957
1959
 
@@ -1966,6 +1968,7 @@ if (import.meta.hot) {
1966
1968
  preserveHydratedState,
1967
1969
  preserveHydratedBoundaries,
1968
1970
  kind,
1971
+ componentSrc,
1969
1972
  });
1970
1973
  };
1971
1974
 
@@ -2194,6 +2197,7 @@ if (import.meta.hot) {
2194
2197
  await softRefreshCurrentPage(data?.kind || "other", {
2195
2198
  preserveHydratedBoundaries,
2196
2199
  rerunModuleScripts,
2200
+ componentSrc: data?.componentSrc,
2197
2201
  });
2198
2202
  } catch (error) {
2199
2203
  console.error("[defuss-ssg] failed to soft refresh current page", error);
@@ -2838,7 +2842,8 @@ function defussSsg(options = {}) {
2838
2842
  "**/dist/**",
2839
2843
  "**/.ssg-temp/**",
2840
2844
  "**/.endpoints/**",
2841
- "**/.rpc/**"
2845
+ "**/.rpc/**",
2846
+ "**/.defuss-tauri/**"
2842
2847
  ]
2843
2848
  }
2844
2849
  }
@@ -2881,6 +2886,20 @@ function defussSsg(options = {}) {
2881
2886
  }
2882
2887
  });
2883
2888
  const handleStructuralChange = async (file) => {
2889
+ const relFile = relative(projectDir, file).replace(/\\/g, "/");
2890
+ const skipPrefixes = [
2891
+ ".ssg-temp",
2892
+ ".endpoints",
2893
+ ".rpc",
2894
+ ".defuss-tauri",
2895
+ "dist",
2896
+ "node_modules"
2897
+ ];
2898
+ if (skipPrefixes.some(
2899
+ (prefix) => relFile === prefix || relFile.startsWith(prefix + "/") || relFile.startsWith("./" + prefix + "/") || relFile.startsWith("../" + prefix + "/")
2900
+ )) {
2901
+ return;
2902
+ }
2884
2903
  const kind = classifyChangedFile(file, projectDir, config, rpcFile);
2885
2904
  if (kind === "other") {
2886
2905
  return;
@@ -239,7 +239,7 @@ const configDefaults = {
239
239
 
240
240
  const CONTENT_MODULE_ID = "virtual:defuss-ssg/content";
241
241
  const CONTENT_RESOLVED_ID = "\0virtual:defuss-ssg/content";
242
- const __filename$2 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-CE8Q5aF_.cjs', document.baseURI).href)));
242
+ const __filename$2 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-BzISHTvt.cjs', document.baseURI).href)));
243
243
  const __dirname$2 = node_path.dirname(__filename$2);
244
244
  const resolveContentHelperFile = () => {
245
245
  const candidates = [
@@ -733,7 +733,7 @@ const registerEndpoints = async (registrar, projectDir, _config, debug = false)
733
733
  }
734
734
  };
735
735
 
736
- const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-CE8Q5aF_.cjs', document.baseURI).href)));
736
+ const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-BzISHTvt.cjs', document.baseURI).href)));
737
737
  const __dirname$1 = node_path.dirname(__filename$1);
738
738
  const isHtmlLikePageSource = (filePath) => {
739
739
  const extension = node_path.extname(filePath).toLowerCase();
@@ -760,7 +760,7 @@ const resolveLocalHelperFile = (sourceRelativePath, builtRelativePath) => {
760
760
  return node_path.resolve(__dirname$1, builtRelativePath);
761
761
  };
762
762
  const loadProjectTailwindVitePlugins = async (projectDir, debug) => {
763
- const requireFromBuild = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-CE8Q5aF_.cjs', document.baseURI).href)));
763
+ const requireFromBuild = node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('vite-BzISHTvt.cjs', document.baseURI).href)));
764
764
  try {
765
765
  const resolvedPluginPath = requireFromBuild.resolve("@tailwindcss/vite", {
766
766
  paths: [projectDir]
@@ -939,7 +939,7 @@ const build = async ({
939
939
  const shouldCopyToTemp = (src) => {
940
940
  const relative2 = src.startsWith(projectDir) ? normalizePath$1(src.slice(projectDir.length).replace(/^[\\/]+/, "")) : src;
941
941
  const firstSegment = relative2.split(/[\\/]/)[0];
942
- return !(firstSegment === "node_modules" || firstSegment === config.output || firstSegment === ".endpoints" || firstSegment === ".ssg-temp" || firstSegment === ".git" || firstSegment === "public" || projectPaths.assetsSourceDirCandidates.some(
942
+ return !(firstSegment === "node_modules" || firstSegment === config.output || firstSegment === ".endpoints" || firstSegment === ".ssg-temp" || firstSegment === ".defuss-tauri" || firstSegment === ".git" || firstSegment === "public" || projectPaths.assetsSourceDirCandidates.some(
943
943
  (candidateDir) => isPathInOrUnder$1(relative2, candidateDir)
944
944
  ));
945
945
  };
@@ -1948,6 +1948,7 @@ if (import.meta.hot) {
1948
1948
  const preserveHydratedBoundaries =
1949
1949
  options.preserveHydratedBoundaries !== false;
1950
1950
  const rerunModuleScripts = options.rerunModuleScripts === true;
1951
+ const componentSrc = options.componentSrc || undefined;
1951
1952
 
1952
1953
  console.log("[defuss-ssg] Morph refresh: applying", {
1953
1954
  url: window.location.pathname,
@@ -1955,6 +1956,7 @@ if (import.meta.hot) {
1955
1956
  preserveHydratedState,
1956
1957
  preserveHydratedBoundaries,
1957
1958
  rerunModuleScripts,
1959
+ componentSrc,
1958
1960
  hasRuntimeNavigate: Boolean(runtime?.navigateTo),
1959
1961
  });
1960
1962
 
@@ -1969,6 +1971,7 @@ if (import.meta.hot) {
1969
1971
  preserveHydratedState,
1970
1972
  preserveHydratedBoundaries,
1971
1973
  kind,
1974
+ componentSrc,
1972
1975
  });
1973
1976
  };
1974
1977
 
@@ -2197,6 +2200,7 @@ if (import.meta.hot) {
2197
2200
  await softRefreshCurrentPage(data?.kind || "other", {
2198
2201
  preserveHydratedBoundaries,
2199
2202
  rerunModuleScripts,
2203
+ componentSrc: data?.componentSrc,
2200
2204
  });
2201
2205
  } catch (error) {
2202
2206
  console.error("[defuss-ssg] failed to soft refresh current page", error);
@@ -2841,7 +2845,8 @@ function defussSsg(options = {}) {
2841
2845
  "**/dist/**",
2842
2846
  "**/.ssg-temp/**",
2843
2847
  "**/.endpoints/**",
2844
- "**/.rpc/**"
2848
+ "**/.rpc/**",
2849
+ "**/.defuss-tauri/**"
2845
2850
  ]
2846
2851
  }
2847
2852
  }
@@ -2884,6 +2889,20 @@ function defussSsg(options = {}) {
2884
2889
  }
2885
2890
  });
2886
2891
  const handleStructuralChange = async (file) => {
2892
+ const relFile = node_path.relative(projectDir, file).replace(/\\/g, "/");
2893
+ const skipPrefixes = [
2894
+ ".ssg-temp",
2895
+ ".endpoints",
2896
+ ".rpc",
2897
+ ".defuss-tauri",
2898
+ "dist",
2899
+ "node_modules"
2900
+ ];
2901
+ if (skipPrefixes.some(
2902
+ (prefix) => relFile === prefix || relFile.startsWith(prefix + "/") || relFile.startsWith("./" + prefix + "/") || relFile.startsWith("../" + prefix + "/")
2903
+ )) {
2904
+ return;
2905
+ }
2887
2906
  const kind = classifyChangedFile(file, projectDir, config, rpcFile);
2888
2907
  if (kind === "other") {
2889
2908
  return;
package/dist/vite.cjs CHANGED
@@ -5,7 +5,7 @@ require('node:fs');
5
5
  require('node:fs/promises');
6
6
  require('node:path');
7
7
  require('defuss/server');
8
- var vite = require('./vite-CE8Q5aF_.cjs');
8
+ var vite = require('./vite-BzISHTvt.cjs');
9
9
  require('./path-Br3DXScZ.cjs');
10
10
  require('node:crypto');
11
11
  require('@mdx-js/rollup');
package/dist/vite.mjs CHANGED
@@ -3,7 +3,7 @@ import 'node:fs';
3
3
  import 'node:fs/promises';
4
4
  import 'node:path';
5
5
  import 'defuss/server';
6
- export { n as defussSsg } from './vite-bKsy4atm.mjs';
6
+ export { n as defussSsg } from './vite-7imK29Sk.mjs';
7
7
  import './path-j0LJZE_u.mjs';
8
8
  import 'node:crypto';
9
9
  import '@mdx-js/rollup';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "defuss-ssg",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -103,8 +103,8 @@
103
103
  },
104
104
  "dependencies": {
105
105
  "@mdx-js/rollup": "^3.1.0",
106
- "defuss": "^3.4.6",
107
- "defuss-express": "^0.3.2",
106
+ "defuss": "^3.4.7",
107
+ "defuss-express": "^0.3.5",
108
108
  "defuss-vite": "^1.2.0",
109
109
  "esbuild": "^0.27.3",
110
110
  "fast-glob": "^3.3.3",
@@ -136,4 +136,4 @@
136
136
  "typescript": "^5.9.3",
137
137
  "vitest": "^4.0.17"
138
138
  }
139
- }
139
+ }