@absolutejs/absolute 0.19.0-beta.381 → 0.19.0-beta.383

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.
@@ -169050,7 +169050,7 @@ ${registrations}
169050
169050
  ({ tsLibDir } = cached);
169051
169051
  cached.lastUsed = Date.now();
169052
169052
  } else {
169053
- const tsPath = __require.resolve("/home/alexkahn/abs/absolutejs/node_modules/typescript/lib/typescript.js");
169053
+ const tsPath = __require.resolve("typescript");
169054
169054
  const tsRootDir = dirname(tsPath);
169055
169055
  tsLibDir = tsRootDir.endsWith("lib") ? tsRootDir : resolve(tsRootDir, "lib");
169056
169056
  const config = readConfiguration("./tsconfig.json");
@@ -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();
@@ -180915,14 +180926,21 @@ var cloneHeaders = (response) => {
180915
180926
  const headers = new Headers(response.headers);
180916
180927
  return headers;
180917
180928
  };
180918
- var enhanceHtmlResponseWithStreamingSlots = (response, { nonce, onError, streamingSlots = [], policy } = {}) => {
180929
+ var enhanceHtmlResponseWithStreamingSlots = (response, {
180930
+ nonce,
180931
+ onError,
180932
+ runtimePlacement,
180933
+ streamingSlots = [],
180934
+ policy
180935
+ } = {}) => {
180919
180936
  if (!response.body || streamingSlots.length === 0) {
180920
180937
  return response;
180921
180938
  }
180922
180939
  const body = appendStreamingSlotPatchesToStream(response.body, streamingSlots, {
180923
180940
  nonce,
180924
180941
  onError,
180925
- policy
180942
+ policy,
180943
+ runtimePlacement
180926
180944
  });
180927
180945
  return new Response(body, {
180928
180946
  headers: cloneHeaders(response),
@@ -180949,7 +180967,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
180949
180967
  };
180950
180968
 
180951
180969
  // src/core/wrapPageHandlerWithStreamingSlots.ts
180952
- var wrapPageHandlerWithStreamingSlots = (handler) => (...args) => withRegisteredStreamingSlots(() => handler(...args));
180970
+ var wrapPageHandlerWithStreamingSlots = (handler, options) => (...args) => withRegisteredStreamingSlots(() => handler(...args), options);
180953
180971
 
180954
180972
  // src/angular/index.ts
180955
180973
  init_pageHandler();
@@ -181396,5 +181414,5 @@ export {
181396
181414
  DeferSlotComponent
181397
181415
  };
181398
181416
 
181399
- //# debugId=0CCB7900E33BE17764756E2164756E21
181417
+ //# debugId=67CBE568BCE4713664756E2164756E21
181400
181418
  //# sourceMappingURL=index.js.map