@absolutejs/absolute 0.19.0-beta.106 → 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,20 +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
- console.log(`[build] stripping refresh noop from ${reactClientOutputs.filter((o) => o.kind === "entry-point").length} entry points`);
171645
- const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
171646
- for (const output of reactClientOutputs) {
171647
- if (output.kind !== "entry-point")
171648
- continue;
171649
- try {
171650
- const content = await Bun.file(output.path).text();
171651
- if (content.includes(REFRESH_NOOP)) {
171652
- writeFileSync3(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
171653
- }
171654
- } catch {}
171655
- }
171656
- }
171657
171643
  if (reactClientResult && !reactClientResult.success && reactClientLogs.length > 0) {
171658
171644
  extractBuildError(reactClientLogs, "react-client", "React client", frameworkNames, isIncremental, throwOnError);
171659
171645
  }
@@ -203498,18 +203484,6 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, parseError
203498
203484
  if (vendorPaths) {
203499
203485
  await rewriteReactImports2(clientResult.outputs.map((art) => art.path), vendorPaths);
203500
203486
  }
203501
- const { readFileSync: readFs, writeFileSync: writeFs } = await import("fs");
203502
- const REFRESH_NOOP = "window.$RefreshReg$||(window.$RefreshReg$=function(){});window.$RefreshSig$||(window.$RefreshSig$=function(){return function(t){return t}});";
203503
- for (const output of clientResult.outputs) {
203504
- if (output.kind !== "entry-point")
203505
- continue;
203506
- try {
203507
- const content = readFs(output.path, "utf-8");
203508
- if (content.includes(REFRESH_NOOP)) {
203509
- writeFs(output.path, content.replace(REFRESH_NOOP, "").replace(/^\n/, ""));
203510
- }
203511
- } catch {}
203512
- }
203513
203487
  const clientManifest = generateManifest2(clientResult.outputs, buildDir);
203514
203488
  Object.assign(state.manifest, clientManifest);
203515
203489
  await populateAssetStore(state.assetStore, clientManifest, buildDir);
@@ -205065,10 +205039,11 @@ var handleReactPageRequest = async (PageComponent, index, ...props) => {
205065
205039
  const { createElement } = await import("react");
205066
205040
  const { renderToReadableStream } = await import("react-dom/server");
205067
205041
  const element = maybeProps !== undefined ? createElement(PageComponent, maybeProps) : createElement(PageComponent);
205068
- 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}};";
205069
205044
  const stream = await renderToReadableStream(element, {
205070
205045
  bootstrapModules: [index],
205071
- bootstrapScriptContent: propsScript || undefined,
205046
+ bootstrapScriptContent: propsScript + refreshSetup || undefined,
205072
205047
  onError(error) {
205073
205048
  console.error("[SSR] React streaming error:", error);
205074
205049
  }
@@ -205349,5 +205324,5 @@ export {
205349
205324
  ANGULAR_INIT_TIMEOUT_MS
205350
205325
  };
205351
205326
 
205352
- //# debugId=2E32E9477B04367664756E2164756E21
205327
+ //# debugId=F8B0E1B6E39B3BEB64756E2164756E21
205353
205328
  //# sourceMappingURL=index.js.map