@absolutejs/absolute 0.19.0-beta.95 → 0.19.0-beta.97
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/.absolutejs/tsconfig.tsbuildinfo +1 -1
- package/dist/build.js +156 -121
- package/dist/build.js.map +6 -6
- package/dist/dev/client/handlers/react.ts +19 -35
- package/dist/dev/client/handlers/rebuild.ts +0 -10
- package/dist/index.js +159 -124
- package/dist/index.js.map +6 -6
- package/dist/src/dev/transformCache.d.ts +2 -0
- package/package.json +2 -2
- package/types/globals.d.ts +0 -1
- package/dist/freshBuildWorker.js +0 -559
- package/dist/src/build/freshReadPlugin.d.ts +0 -2
|
@@ -40,25 +40,7 @@ export const handleReactUpdate = (message: {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
const newUrl = componentKey && message.data.manifest?.[componentKey];
|
|
45
|
-
|
|
46
|
-
if (newUrl && refreshRuntime) {
|
|
47
|
-
// Bundled files have bare specifiers (react-dom/client) that
|
|
48
|
-
// the browser can't resolve via import(). Only use import()
|
|
49
|
-
// for module server URLs (/@src/). Bundled files need a reload.
|
|
50
|
-
if (newUrl.startsWith('/@src/')) {
|
|
51
|
-
applyRefreshImport(newUrl, refreshRuntime, serverDuration);
|
|
52
|
-
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Bundled file — reload to load the new script tag
|
|
57
|
-
window.location.reload();
|
|
58
|
-
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
|
|
43
|
+
// No module URL — shouldn't happen, but reload as safety fallback
|
|
62
44
|
window.location.reload();
|
|
63
45
|
};
|
|
64
46
|
|
|
@@ -87,24 +69,14 @@ const applyRefreshImport = (
|
|
|
87
69
|
.then(() => {
|
|
88
70
|
const result = refreshRuntime.performReactRefresh();
|
|
89
71
|
|
|
90
|
-
// If
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
//
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return import(
|
|
97
|
-
`${window.__REACT_PAGE_MODULE__}?t=${Date.now()}`
|
|
98
|
-
).then(() => {
|
|
99
|
-
refreshRuntime.performReactRefresh();
|
|
100
|
-
|
|
101
|
-
return undefined;
|
|
102
|
-
});
|
|
72
|
+
// If no components were refreshed (data file HMR), force a
|
|
73
|
+
// re-render. The mutable store (globalThis.__HMR_DATA__) has
|
|
74
|
+
// fresh values — components just need to re-execute their
|
|
75
|
+
// render functions to read them.
|
|
76
|
+
if (!result) {
|
|
77
|
+
forceReactRerender();
|
|
103
78
|
}
|
|
104
79
|
|
|
105
|
-
return undefined;
|
|
106
|
-
})
|
|
107
|
-
.then(() => {
|
|
108
80
|
sendTiming(clientStart, serverDuration);
|
|
109
81
|
|
|
110
82
|
return undefined;
|
|
@@ -118,6 +90,18 @@ const applyRefreshImport = (
|
|
|
118
90
|
});
|
|
119
91
|
};
|
|
120
92
|
|
|
93
|
+
// Force React to re-render the entire tree. Components read from
|
|
94
|
+
// the mutable HMR data store (destructured at render time via
|
|
95
|
+
// rewriteDataImports), so re-rendering picks up fresh values.
|
|
96
|
+
const forceReactRerender = () => {
|
|
97
|
+
const boundary = window.__ERROR_BOUNDARY__ as
|
|
98
|
+
| { hmrUpdate?: () => void }
|
|
99
|
+
| undefined;
|
|
100
|
+
if (boundary?.hmrUpdate) {
|
|
101
|
+
boundary.hmrUpdate();
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
121
105
|
const reloadReactCSS = (cssPath: string) => {
|
|
122
106
|
const existingCSSLinks = document.head.querySelectorAll<HTMLLinkElement>(
|
|
123
107
|
'link[rel="stylesheet"]'
|
|
@@ -102,7 +102,6 @@ export const handleModuleUpdate = (message: {
|
|
|
102
102
|
export const handleRebuildComplete = (message: {
|
|
103
103
|
data: {
|
|
104
104
|
affectedFrameworks?: string[];
|
|
105
|
-
fullReload?: boolean;
|
|
106
105
|
manifest?: Record<string, string>;
|
|
107
106
|
};
|
|
108
107
|
}) => {
|
|
@@ -113,15 +112,6 @@ export const handleRebuildComplete = (message: {
|
|
|
113
112
|
window.__HMR_MANIFEST__ = message.data.manifest;
|
|
114
113
|
}
|
|
115
114
|
|
|
116
|
-
// Subprocess build: the server's manifest now points to fresh
|
|
117
|
-
// bundles. Reload to get the new HTML (with updated script tag)
|
|
118
|
-
// and let React hydrate with the fresh bundled JS.
|
|
119
|
-
if (message.data.fullReload) {
|
|
120
|
-
window.location.reload();
|
|
121
|
-
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
115
|
if (
|
|
126
116
|
message.data.affectedFrameworks &&
|
|
127
117
|
!message.data.affectedFrameworks.includes('angular') &&
|