@absolutejs/absolute 0.19.0-beta.453 → 0.19.0-beta.455

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.
package/dist/build.js CHANGED
@@ -177780,6 +177780,10 @@ var ssrDirty4 = false, isRecord9 = (value) => typeof value === "object" && value
177780
177780
  return new Response(html, {
177781
177781
  headers: { "Content-Type": "text/html" }
177782
177782
  });
177783
+ }, primeVueStream = async (stream) => {
177784
+ const reader = stream.getReader();
177785
+ const firstChunk = await reader.read();
177786
+ return { firstChunk, reader };
177783
177787
  }, handleVuePageRequest = async (_PageComponent, pagePath, indexPath, headTag = "<head></head>", ...props) => {
177784
177788
  const [maybeProps] = props;
177785
177789
  if (ssrDirty4) {
@@ -177812,12 +177816,20 @@ var ssrDirty4 = false, isRecord9 = (value) => typeof value === "object" && value
177812
177816
  render: () => h(resolvedPage.component, maybeProps ?? null)
177813
177817
  });
177814
177818
  const bodyStream = renderToWebStream(app);
177819
+ const { firstChunk, reader } = await primeVueStream(bodyStream);
177815
177820
  const head = `<!DOCTYPE html><html>${headTag}<body><div id="root">`;
177816
177821
  const tail = `</div><script>window.__INITIAL_PROPS__=${JSON.stringify(maybeProps ?? {})}</script><script type="module" src="${indexPath}"></script></body></html>`;
177817
177822
  const stream = new ReadableStream({
177818
177823
  start(controller) {
177819
177824
  controller.enqueue(head);
177820
- const reader = bodyStream.getReader();
177825
+ if (!firstChunk.done) {
177826
+ controller.enqueue(firstChunk.value);
177827
+ }
177828
+ if (firstChunk.done) {
177829
+ controller.enqueue(tail);
177830
+ controller.close();
177831
+ return;
177832
+ }
177821
177833
  const pumpLoop = () => {
177822
177834
  reader.read().then(({ done, value }) => done ? (controller.enqueue(tail), controller.close()) : (controller.enqueue(value), pumpLoop())).catch((err) => controller.error(err));
177823
177835
  };
@@ -180619,5 +180631,5 @@ export {
180619
180631
  build
180620
180632
  };
180621
180633
 
180622
- //# debugId=67AFDB4FAB020DA664756E2164756E21
180634
+ //# debugId=5258323ADD13A6F464756E2164756E21
180623
180635
  //# sourceMappingURL=build.js.map