@absolutejs/absolute 0.19.0-beta.105 → 0.19.0-beta.107

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.
@@ -18,4 +18,18 @@ if (!window.$RefreshRuntime$) {
18
18
  RefreshRuntime.register(type, id);
19
19
  window.$RefreshSig$ = () =>
20
20
  RefreshRuntime.createSignatureFunctionForTransform();
21
+
22
+ // Replay buffered registrations from the bootstrap script.
23
+ // The SSR HTML injects a buffering $RefreshReg$ that captures
24
+ // registrations before the runtime is ready.
25
+ const buffer = (window as unknown as Record<string, unknown>)
26
+ .__REFRESH_BUFFER__ as Array<[unknown, string]> | undefined;
27
+ if (buffer) {
28
+ for (const [type, id] of buffer) {
29
+ RefreshRuntime.register(type, id);
30
+ }
31
+ (
32
+ window as unknown as Record<string, unknown>
33
+ ).__REFRESH_BUFFER__ = undefined;
34
+ }
21
35
  }
package/dist/index.js CHANGED
@@ -171640,19 +171640,6 @@ var isDev, extractBuildError = (logs, pass, label, frameworkNames, isIncremental
171640
171640
  }
171641
171641
  const reactClientLogs = reactClientResult?.logs ?? [];
171642
171642
  const reactClientOutputs = reactClientResult?.outputs ?? [];
171643
- if (hmr && reactClientOutputs.length > 0) {
171644
- const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
171645
- for (const output of reactClientOutputs) {
171646
- if (output.kind !== "entry-point")
171647
- continue;
171648
- try {
171649
- const content = await Bun.file(output.path).text();
171650
- if (content.includes(REFRESH_NOOP)) {
171651
- writeFileSync3(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
171652
- }
171653
- } catch {}
171654
- }
171655
- }
171656
171643
  if (reactClientResult && !reactClientResult.success && reactClientLogs.length > 0) {
171657
171644
  extractBuildError(reactClientLogs, "react-client", "React client", frameworkNames, isIncremental, throwOnError);
171658
171645
  }
@@ -203497,18 +203484,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203497
203484
  if (vendorPaths) {
203498
203485
  await rewriteReactImports2(clientResult.outputs.map((art) => art.path), vendorPaths);
203499
203486
  }
203500
- const { readFileSync: readFs, writeFileSync: writeFs } = await import("fs");
203501
- const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
203502
- for (const output of clientResult.outputs) {
203503
- if (output.kind !== "entry-point")
203504
- continue;
203505
- try {
203506
- const content = readFs(output.path, "utf-8");
203507
- if (content.includes(REFRESH_NOOP)) {
203508
- writeFs(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
203509
- }
203510
- } catch {}
203511
- }
203512
203487
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
203513
203488
  Object.assign(state.manifest, clientManifest);
203514
203489
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
@@ -205064,10 +205039,11 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
205064
205039
  const { createElement } = await import("react");
205065
205040
  const { renderToReadableStream } = await import("react-dom/server");
205066
205041
  const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
205067
- const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)}` : "";
205042
+ const propsScript = maybeProps ? `window.__INITIAL_PROPS__=${JSON.stringify(maybeProps)};` : "";
205043
+ const refreshSetup = "window.__REFRESH_BUFFER__=[];window.$RefreshReg$=function(t,i){window.__REFRESH_BUFFER__.push([t,i])};window.$RefreshSig$=function(){return function(t){return t}};";
205068
205044
  const stream = await renderToReadableStream(element, {
205069
205045
  bootstrapModules: [index],
205070
- bootstrapScriptContent: propsScript || undefined,
205046
+ bootstrapScriptContent: propsScript + refreshSetup || undefined,
205071
205047
  onError(error) {
205072
205048
  console.error("[SSR] React streaming error:", error);
205073
205049
  }
@@ -205348,5 +205324,5 @@ export {
205348
205324
  ANGULAR_INIT_TIMEOUT_MS
205349
205325
  };
205350
205326
 
205351
- //# debugId=0BA452EB4E084FF464756E2164756E21
205327
+ //# debugId=F8B0E1B6E39B3BEB64756E2164756E21
205352
205328
  //# sourceMappingURL=index.js.map