@absolutejs/absolute 0.19.0-beta.381 → 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.
package/dist/vue/index.js CHANGED
@@ -1911,7 +1911,9 @@ var getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(strea
1911
1911
  init_escapeScriptContent();
1912
1912
  var SLOT_ID_PREFIX = "abs-slot-";
1913
1913
  var SLOT_PLACEHOLDER_PREFIX = "slot-";
1914
+ var CLOSING_BODY_TAG = "</body>";
1914
1915
  var CLOSING_HEAD_TAG = "</head>";
1916
+ var CLOSING_BODY_TAG_LENGTH = CLOSING_BODY_TAG.length;
1915
1917
  var CLOSING_HEAD_TAG_LENGTH = CLOSING_HEAD_TAG.length;
1916
1918
  var CLOSING_PAGE_TAG_REGEX = /<\/body>\s*<\/html>\s*$/i;
1917
1919
  var STREAMING_RUNTIME_GLOBAL = "__ABS_SLOT_ENQUEUE__";
@@ -1935,6 +1937,13 @@ var injectHtmlIntoHead = (html, injection) => {
1935
1937
  }
1936
1938
  return `${html}${injection}`;
1937
1939
  };
1940
+ var injectHtmlIntoBody = (html, injection) => {
1941
+ const closingBodyIndex = html.indexOf(CLOSING_BODY_TAG);
1942
+ if (closingBodyIndex >= 0) {
1943
+ return `${html.slice(0, closingBodyIndex)}${injection}${html.slice(closingBodyIndex)}`;
1944
+ }
1945
+ return `${html}${injection}`;
1946
+ };
1938
1947
  var toUint8 = (value, encoder) => encoder.encode(value);
1939
1948
  var currentStreamingSlotPolicy = {
1940
1949
  timeoutMs: STREAMING_SLOT_TIMEOUT_MS,
@@ -2199,11 +2208,12 @@ var streamOutOfOrderSlots = ({
2199
2208
  }
2200
2209
  });
2201
2210
  };
2202
- var injectStreamingRuntimeIntoStream = (stream, nonce) => {
2211
+ var injectStreamingRuntimeIntoStream = (stream, nonce, runtimePlacement = "head") => {
2203
2212
  const runtimeTag = renderStreamingSlotsRuntimeTag(nonce);
2204
2213
  const encoder = new TextEncoder;
2205
2214
  const decoder = new TextDecoder;
2206
- const lookbehind = CLOSING_HEAD_TAG_LENGTH - 1;
2215
+ const closingTag = runtimePlacement === "body" ? CLOSING_BODY_TAG : CLOSING_HEAD_TAG;
2216
+ const lookbehind = (runtimePlacement === "body" ? CLOSING_BODY_TAG_LENGTH : CLOSING_HEAD_TAG_LENGTH) - 1;
2207
2217
  return new ReadableStream({
2208
2218
  async start(controller) {
2209
2219
  const reader = stream.getReader();
@@ -2222,9 +2232,9 @@ var injectStreamingRuntimeIntoStream = (stream, nonce) => {
2222
2232
  pending = "";
2223
2233
  continue;
2224
2234
  }
2225
- const headIndex = pending.indexOf(CLOSING_HEAD_TAG);
2226
- if (headIndex >= 0) {
2227
- const withRuntime = `${pending.slice(0, headIndex)}${runtimeTag}${pending.slice(headIndex)}`;
2235
+ const closingTagIndex = pending.indexOf(closingTag);
2236
+ if (closingTagIndex >= 0) {
2237
+ const withRuntime = `${pending.slice(0, closingTagIndex)}${runtimeTag}${pending.slice(closingTagIndex)}`;
2228
2238
  controller.enqueue(encoder.encode(withRuntime));
2229
2239
  pending = "";
2230
2240
  injected = true;
@@ -2238,7 +2248,7 @@ var injectStreamingRuntimeIntoStream = (stream, nonce) => {
2238
2248
  }
2239
2249
  pending += decoder.decode();
2240
2250
  if (!injected) {
2241
- pending = injectHtmlIntoHead(pending, runtimeTag);
2251
+ pending = runtimePlacement === "body" ? injectHtmlIntoBody(pending, runtimeTag) : injectHtmlIntoHead(pending, runtimeTag);
2242
2252
  }
2243
2253
  if (pending.length > 0) {
2244
2254
  controller.enqueue(encoder.encode(pending));
@@ -2255,7 +2265,8 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
2255
2265
  nonce,
2256
2266
  onError,
2257
2267
  onSlotMetric,
2258
- policy
2268
+ policy,
2269
+ runtimePlacement = "head"
2259
2270
  } = {}) => {
2260
2271
  const resolvedPolicy = resolveStreamingSlotPolicy(policy);
2261
2272
  const combinedOnError = createCombinedSlotErrorHandler(resolvedPolicy.onError, onError);
@@ -2272,7 +2283,7 @@ var appendStreamingSlotPatchesToStream = (stream, slots = [], {
2272
2283
  });
2273
2284
  if (preparedSlots.length === 0)
2274
2285
  return stream;
2275
- const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce) : stream;
2286
+ const source = injectRuntime ? injectStreamingRuntimeIntoStream(stream, nonce, runtimePlacement) : stream;
2276
2287
  const encoder = new TextEncoder;
2277
2288
  const decoder = new TextDecoder;
2278
2289
  const reader = source.getReader();
@@ -2391,7 +2402,7 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
2391
2402
  };
2392
2403
 
2393
2404
  // src/core/wrapPageHandlerWithStreamingSlots.ts
2394
- var wrapPageHandlerWithStreamingSlots = (handler) => (...args) => withRegisteredStreamingSlots(() => handler(...args));
2405
+ var wrapPageHandlerWithStreamingSlots = (handler, options) => (...args) => withRegisteredStreamingSlots(() => handler(...args), options);
2395
2406
 
2396
2407
  // src/vue/index.ts
2397
2408
  init_pageHandler();
@@ -2715,5 +2726,5 @@ export {
2715
2726
  Image_default as Image
2716
2727
  };
2717
2728
 
2718
- //# debugId=5D420BC80207597464756E2164756E21
2729
+ //# debugId=AE47E67E221F96DC64756E2164756E21
2719
2730
  //# sourceMappingURL=index.js.map