@absolutejs/absolute 0.19.0-beta.15 → 0.19.0-beta.17

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.
@@ -13,7 +13,7 @@ export const handleReactUpdate = (message: {
13
13
  manifest?: Record<string, string>;
14
14
  pageModuleUrl?: string;
15
15
  primarySource?: string;
16
- startTime?: number;
16
+ serverDuration?: number;
17
17
  };
18
18
  }) => {
19
19
  const currentFramework = detectCurrentFramework();
@@ -33,13 +33,13 @@ export const handleReactUpdate = (message: {
33
33
 
34
34
  const refreshRuntime = window.$RefreshRuntime$;
35
35
 
36
- const serverStartTime = message.data.startTime;
36
+ const serverDuration = message.data.serverDuration;
37
37
 
38
38
  // ESM fast path: import the page module directly (no index re-import)
39
39
  const pageModuleUrl = message.data.pageModuleUrl;
40
40
 
41
41
  if (pageModuleUrl && refreshRuntime) {
42
- applyRefreshImport(pageModuleUrl, refreshRuntime, serverStartTime);
42
+ applyRefreshImport(pageModuleUrl, refreshRuntime, serverDuration);
43
43
 
44
44
  return;
45
45
  }
@@ -49,7 +49,7 @@ export const handleReactUpdate = (message: {
49
49
  const newUrl = componentKey && message.data.manifest?.[componentKey];
50
50
 
51
51
  if (newUrl && refreshRuntime) {
52
- applyRefreshImport(newUrl, refreshRuntime, serverStartTime);
52
+ applyRefreshImport(newUrl, refreshRuntime, serverDuration);
53
53
 
54
54
  return;
55
55
  }
@@ -61,16 +61,27 @@ export const handleReactUpdate = (message: {
61
61
  const applyRefreshImport = (
62
62
  moduleUrl: string,
63
63
  refreshRuntime: { performReactRefresh: () => void },
64
- serverStartTime?: number
64
+ serverDuration?: number
65
65
  ) => {
66
+ const clientStart = performance.now();
66
67
  import(`${moduleUrl}?t=${Date.now()}`)
67
68
  .then(() => {
69
+ const fetchDone = performance.now();
68
70
  refreshRuntime.performReactRefresh();
71
+ const refreshDone = performance.now();
69
72
 
70
- if (serverStartTime && window.__HMR_WS__) {
71
- const total = Date.now() - serverStartTime;
73
+ if (window.__HMR_WS__) {
74
+ const fetchMs = Math.round(fetchDone - clientStart);
75
+ const refreshMs = Math.round(refreshDone - fetchDone);
76
+ const total = (serverDuration ?? 0) + fetchMs + refreshMs;
72
77
  window.__HMR_WS__.send(
73
- JSON.stringify({ duration: total, type: 'hmr-timing' })
78
+ JSON.stringify({
79
+ duration: total,
80
+ fetchMs,
81
+ refreshMs,
82
+ serverMs: serverDuration ?? 0,
83
+ type: 'hmr-timing'
84
+ })
74
85
  );
75
86
  }
76
87
 
package/dist/index.js CHANGED
@@ -172448,12 +172448,18 @@ var trySendMessage = (client2, messageStr) => {
172448
172448
  state.activeFrameworks.add(data.framework);
172449
172449
  }
172450
172450
  break;
172451
- case "hmr-timing":
172452
- if (data.duration !== undefined) {
172451
+ case "hmr-timing": {
172452
+ const timing = data;
172453
+ if (timing.duration !== undefined) {
172453
172454
  const lastPath = state.lastHmrPath ?? "";
172454
- logHmrUpdate(lastPath, state.lastHmrFramework, data.duration);
172455
+ const breakdown = timing.serverMs !== undefined ? ` (server ${timing.serverMs}ms + fetch ${timing.fetchMs ?? 0}ms + refresh ${timing.refreshMs ?? 0}ms)` : "";
172456
+ logHmrUpdate(lastPath, state.lastHmrFramework, timing.duration);
172457
+ if (breakdown) {
172458
+ console.log(` ${breakdown}`);
172459
+ }
172455
172460
  }
172456
172461
  break;
172462
+ }
172457
172463
  }
172458
172464
  }, handleHMRMessage = (state, client2, message) => {
172459
172465
  try {
@@ -202800,6 +202806,7 @@ var parseErrorLocationFromMessage = (msg) => {
202800
202806
  if (changedFile) {
202801
202807
  const pageModuleUrl = await getReactModuleUrl(changedFile);
202802
202808
  if (pageModuleUrl) {
202809
+ const serverDuration = Date.now() - startTime;
202803
202810
  state.lastHmrPath = changedFile;
202804
202811
  state.lastHmrFramework = "react";
202805
202812
  broadcastToClients(state, {
@@ -202810,8 +202817,8 @@ var parseErrorLocationFromMessage = (msg) => {
202810
202817
  manifest: state.manifest,
202811
202818
  pageModuleUrl,
202812
202819
  primarySource: changedFile,
202813
- sourceFiles: reactFiles,
202814
- startTime
202820
+ serverDuration,
202821
+ sourceFiles: reactFiles
202815
202822
  },
202816
202823
  type: "react-update"
202817
202824
  });
@@ -204242,5 +204249,5 @@ export {
204242
204249
  ANGULAR_INIT_TIMEOUT_MS
204243
204250
  };
204244
204251
 
204245
- //# debugId=C3CD39F5CF85CA9664756E2164756E21
204252
+ //# debugId=6655048BCB2F286B64756E2164756E21
204246
204253
  //# sourceMappingURL=index.js.map