@absolutejs/absolute 0.19.0-beta.380 → 0.19.0-beta.382

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.
@@ -180469,7 +180469,9 @@ var getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(strea
180469
180469
  init_escapeScriptContent();
180470
180470
  var SLOT_ID_PREFIX = "abs-slot-";
180471
180471
  var SLOT_PLACEHOLDER_PREFIX = "slot-";
180472
+ var CLOSING_BODY_TAG = "</body>";
180472
180473
  var CLOSING_HEAD_TAG = "</head>";
180474
+ var CLOSING_BODY_TAG_LENGTH = CLOSING_BODY_TAG.length;
180473
180475
  var CLOSING_HEAD_TAG_LENGTH = CLOSING_HEAD_TAG.length;
180474
180476
  var CLOSING_PAGE_TAG_REGEX = /<\/body>\s*<\/html>\s*$/i;
180475
180477
  var STREAMING_RUNTIME_GLOBAL = "__ABS_SLOT_ENQUEUE__";
@@ -180493,6 +180495,13 @@ var injectHtmlIntoHead = (html, injection) => {
180493
180495
  }
180494
180496
  return `${html}${injection}`;
180495
180497
  };
180498
+ var injectHtmlIntoBody = (html, injection) => {
180499
+ const closingBodyIndex = html.indexOf(CLOSING_BODY_TAG);
180500
+ if (closingBodyIndex >= 0) {
180501
+ return `${html.slice(0, closingBodyIndex)}${injection}${html.slice(closingBodyIndex)}`;
180502
+ }
180503
+ return `${html}${injection}`;
180504
+ };
180496
180505
  var toUint8 = (value, encoder) => encoder.encode(value);
180497
180506
  var currentStreamingSlotPolicy = {
180498
180507
  timeoutMs: STREAMING_SLOT_TIMEOUT_MS,
@@ -180757,11 +180766,12 @@ var streamOutOfOrderSlots = ({
180757
180766
  }
180758
180767
  });
180759
180768
  };
180760
- var injectStreamingRuntimeIntoStream = (stream, nonce) => {
180769
+ var injectStreamingRuntimeIntoStream = (stream, nonce, runtimePlacement = "head") => {
180761
180770
  const runtimeTag = renderStreamingSlotsRuntimeTag(nonce);
180762
180771
  const encoder = new TextEncoder;
180763
180772
  const decoder = new TextDecoder;
180764
- const lookbehind = CLOSING_HEAD_TAG_LENGTH - 1;
180773
+ const closingTag = runtimePlacement === "body" ? CLOSING_BODY_TAG : CLOSING_HEAD_TAG;
180774
+ const lookbehind = (runtimePlacement === "body" ? CLOSING_BODY_TAG_LENGTH : CLOSING_HEAD_TAG_LENGTH) - 1;
180765
180775
  return new ReadableStream({
180766
180776
  async start(controller) {
180767
180777
  const reader = stream.getReader();
@@ -180780,9 +180790,9 @@ var injectStreamingRuntimeIntoStream = (stream, nonce) => {
180780
180790
  pending = "";
180781
180791
  continue;
180782
180792
  }
180783
- const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
180784
- if (headIndex >= 0) {
180785
- const withRuntime = `${pending.slice(0, headIndex)}${runtimeTag}${pending.slice(headIndex)}`;
180793
+ const closingTagIndex = pending.indexOf(closingTag);
180794
+ if (closingTagIndex >= 0) {
180795
+ const withRuntime = `${pending.slice(0, closingTagIndex)}${runtimeTag}${pending.slice(closingTagIndex)}`;
180786
180796
  controller.enqueue(encoder.encode(withRuntime));
180787
180797
  pending = "";
180788
180798
  injected = true;
@@ -180796,7 +180806,7 @@ var injectStreamingRuntimeIntoStream = (stream, nonce) => {
180796
180806
  }
180797
180807
  pending += decoder.decode();
180798
180808
  if (!injected) {
180799
- pending = injectHtmlIntoHead(pending, runtimeTag);
180809
+ pending = runtimePlacement === "body" ? injectHtmlIntoBody(pending, runtimeTag) : injectHtmlIntoHead(pending, runtimeTag);
180800
180810
  }
180801
180811
  if (pending.length > 0) {
180802
180812
  controller.enqueue(encoder.encode(pending));
@@ -180813,7 +180823,8 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
180813
180823
  nonce,
180814
180824
  onError,
180815
180825
  onSlotMetric,
180816
- policy
180826
+ policy,
180827
+ runtimePlacement = "head"
180817
180828
  } = {}) => {
180818
180829
  const resolvedPolicy = resolveStreamingSlotPolicy(policy);
180819
180830
  const combinedOnError = createCombinedSlotErrorHandler(resolvedPolicy.onError, onError);
@@ -180830,7 +180841,7 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
180830
180841
  });
180831
180842
  if (preparedSlots.length === 0)
180832
180843
  return stream;
180833
- const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce) : stream;
180844
+ const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce, runtimePlacement) : stream;
180834
180845
  const encoder = new TextEncoder;
180835
180846
  const decoder = new TextDecoder;
180836
180847
  const reader = source.getReader();
@@ -180949,7 +180960,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
180949
180960
  };
180950
180961
 
180951
180962
  // src/core/wrapPageHandlerWithStreamingSlots.ts
180952
- var wrapPageHandlerWithStreamingSlots = (handler) => (...args) => withRegisteredStreamingSlots(() => handler(...args));
180963
+ var wrapPageHandlerWithStreamingSlots = (handler, options) => (...args) => withRegisteredStreamingSlots(() => handler(...args), options);
180953
180964
 
180954
180965
  // src/angular/index.ts
180955
180966
  init_pageHandler();
@@ -181396,5 +181407,5 @@ export {
181396
181407
  DeferSlotComponent
181397
181408
  };
181398
181409
 
181399
- //# debugId=0CCB7900E33BE17764756E2164756E21
181410
+ //# debugId=D1AEBB0C1DB18FF864756E2164756E21
181400
181411
  //# sourceMappingURL=index.js.map