@absolutejs/absolute 0.19.0-beta.14 → 0.19.0-beta.16

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,15 +61,19 @@ 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(() => {
68
69
  refreshRuntime.performReactRefresh();
69
70
 
70
- if (serverStartTime) {
71
- const total = Date.now() - serverStartTime;
72
- console.log(`[HMR] updated in ${total}ms`);
71
+ if (window.__HMR_WS__) {
72
+ const clientDuration = Math.round(performance.now() - clientStart);
73
+ const total = (serverDuration ?? 0) + clientDuration;
74
+ window.__HMR_WS__.send(
75
+ JSON.stringify({ duration: total, type: 'hmr-timing' })
76
+ );
73
77
  }
74
78
 
75
79
  if (window.__ERROR_BOUNDARY__) {
package/dist/index.js CHANGED
@@ -63,6 +63,8 @@ var isValidHMRClientMessage = (data) => {
63
63
  return true;
64
64
  case "hydration-error":
65
65
  return true;
66
+ case "hmr-timing":
67
+ return true;
66
68
  default:
67
69
  return false;
68
70
  }
@@ -172446,6 +172448,12 @@ var trySendMessage = (client2, messageStr) => {
172446
172448
  state.activeFrameworks.add(data.framework);
172447
172449
  }
172448
172450
  break;
172451
+ case "hmr-timing":
172452
+ if (data.duration !== undefined) {
172453
+ const lastPath = state.lastHmrPath ?? "";
172454
+ logHmrUpdate(lastPath, state.lastHmrFramework, data.duration);
172455
+ }
172456
+ break;
172449
172457
  }
172450
172458
  }, handleHMRMessage = (state, client2, message) => {
172451
172459
  try {
@@ -172459,7 +172467,9 @@ var trySendMessage = (client2, messageStr) => {
172459
172467
  handleParsedMessage(state, client2, parsedData);
172460
172468
  } catch {}
172461
172469
  };
172462
- var init_webSocket = () => {};
172470
+ var init_webSocket = __esm(() => {
172471
+ init_logger();
172472
+ });
172463
172473
 
172464
172474
  // src/utils/registerClientScript.ts
172465
172475
  var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, registerClientScript = (script, requestId) => {
@@ -202790,7 +202800,9 @@ var parseErrorLocationFromMessage = (msg) => {
202790
202800
  if (changedFile) {
202791
202801
  const pageModuleUrl = await getReactModuleUrl(changedFile);
202792
202802
  if (pageModuleUrl) {
202793
- logHmrUpdate(changedFile, "react", Date.now() - startTime);
202803
+ const serverDuration = Date.now() - startTime;
202804
+ state.lastHmrPath = changedFile;
202805
+ state.lastHmrFramework = "react";
202794
202806
  broadcastToClients(state, {
202795
202807
  data: {
202796
202808
  framework: "react",
@@ -202799,8 +202811,8 @@ var parseErrorLocationFromMessage = (msg) => {
202799
202811
  manifest: state.manifest,
202800
202812
  pageModuleUrl,
202801
202813
  primarySource: changedFile,
202802
- sourceFiles: reactFiles,
202803
- startTime
202814
+ serverDuration,
202815
+ sourceFiles: reactFiles
202804
202816
  },
202805
202817
  type: "react-update"
202806
202818
  });
@@ -204231,5 +204243,5 @@ export {
204231
204243
  ANGULAR_INIT_TIMEOUT_MS
204232
204244
  };
204233
204245
 
204234
- //# debugId=B86E30B640AC1F6964756E2164756E21
204246
+ //# debugId=65BA6BC8707FD3E164756E2164756E21
204235
204247
  //# sourceMappingURL=index.js.map