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

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,6 +13,7 @@ export const handleReactUpdate = (message: {
13
13
  manifest?: Record<string, string>;
14
14
  pageModuleUrl?: string;
15
15
  primarySource?: string;
16
+ startTime?: number;
16
17
  };
17
18
  }) => {
18
19
  const currentFramework = detectCurrentFramework();
@@ -32,11 +33,13 @@ export const handleReactUpdate = (message: {
32
33
 
33
34
  const refreshRuntime = window.$RefreshRuntime$;
34
35
 
36
+ const serverStartTime = message.data.startTime;
37
+
35
38
  // ESM fast path: import the page module directly (no index re-import)
36
39
  const pageModuleUrl = message.data.pageModuleUrl;
37
40
 
38
41
  if (pageModuleUrl && refreshRuntime) {
39
- applyRefreshImport(pageModuleUrl, refreshRuntime);
42
+ applyRefreshImport(pageModuleUrl, refreshRuntime, serverStartTime);
40
43
 
41
44
  return;
42
45
  }
@@ -46,7 +49,7 @@ export const handleReactUpdate = (message: {
46
49
  const newUrl = componentKey && message.data.manifest?.[componentKey];
47
50
 
48
51
  if (newUrl && refreshRuntime) {
49
- applyRefreshImport(newUrl, refreshRuntime);
52
+ applyRefreshImport(newUrl, refreshRuntime, serverStartTime);
50
53
 
51
54
  return;
52
55
  }
@@ -57,11 +60,20 @@ export const handleReactUpdate = (message: {
57
60
 
58
61
  const applyRefreshImport = (
59
62
  moduleUrl: string,
60
- refreshRuntime: { performReactRefresh: () => void }
63
+ refreshRuntime: { performReactRefresh: () => void },
64
+ serverStartTime?: number
61
65
  ) => {
62
66
  import(`${moduleUrl}?t=${Date.now()}`)
63
67
  .then(() => {
64
68
  refreshRuntime.performReactRefresh();
69
+
70
+ if (serverStartTime && window.__HMR_WS__) {
71
+ const total = Date.now() - serverStartTime;
72
+ window.__HMR_WS__.send(
73
+ JSON.stringify({ duration: total, type: 'hmr-timing' })
74
+ );
75
+ }
76
+
65
77
  if (window.__ERROR_BOUNDARY__) {
66
78
  window.__ERROR_BOUNDARY__.reset();
67
79
  } else {
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,8 +202800,8 @@ var parseErrorLocationFromMessage = (msg) => {
202790
202800
  if (changedFile) {
202791
202801
  const pageModuleUrl = await getReactModuleUrl(changedFile);
202792
202802
  if (pageModuleUrl) {
202793
- const duration2 = Date.now() - startTime;
202794
- logHmrUpdate(changedFile, "react", duration2);
202803
+ state.lastHmrPath = changedFile;
202804
+ state.lastHmrFramework = "react";
202795
202805
  broadcastToClients(state, {
202796
202806
  data: {
202797
202807
  framework: "react",
@@ -202800,7 +202810,8 @@ var parseErrorLocationFromMessage = (msg) => {
202800
202810
  manifest: state.manifest,
202801
202811
  pageModuleUrl,
202802
202812
  primarySource: changedFile,
202803
- sourceFiles: reactFiles
202813
+ sourceFiles: reactFiles,
202814
+ startTime
202804
202815
  },
202805
202816
  type: "react-update"
202806
202817
  });
@@ -204231,5 +204242,5 @@ export {
204231
204242
  ANGULAR_INIT_TIMEOUT_MS
204232
204243
  };
204233
204244
 
204234
- //# debugId=892EF511C5CC4FEC64756E2164756E21
204245
+ //# debugId=C3CD39F5CF85CA9664756E2164756E21
204235
204246
  //# sourceMappingURL=index.js.map