@absolutejs/absolute 0.19.0-beta.1073 → 0.19.0-beta.1075
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +52 -7
- package/dist/angular/index.js.map +6 -5
- package/dist/angular/server.js +52 -7
- package/dist/angular/server.js.map +6 -5
- package/dist/build.js +45 -6
- package/dist/build.js.map +5 -4
- package/dist/cli/config/server.js +53 -7
- package/dist/index.js +54 -11
- package/dist/index.js.map +7 -6
- package/dist/react/index.js +55 -10
- package/dist/react/index.js.map +6 -5
- package/dist/react/server.js +53 -8
- package/dist/react/server.js.map +6 -5
- package/dist/src/core/pageResponseCache.d.ts +23 -0
- package/dist/src/react/pageHandler.d.ts +5 -0
- package/dist/src/svelte/pageHandler.d.ts +5 -0
- package/dist/src/vue/pageHandler.d.ts +5 -0
- package/dist/svelte/index.js +53 -8
- package/dist/svelte/index.js.map +6 -5
- package/dist/svelte/server.js +53 -8
- package/dist/svelte/server.js.map +6 -5
- package/dist/vue/index.js +55 -10
- package/dist/vue/index.js.map +6 -5
- package/dist/vue/server.js +53 -8
- package/dist/vue/server.js.map +6 -5
- package/package.json +5 -1
|
@@ -37362,6 +37362,46 @@ var getRouteCallsiteStorage = () => {
|
|
|
37362
37362
|
};
|
|
37363
37363
|
var getCurrentRouteRegistrationCallsite = () => getRouteCallsiteStorage()?.getStore()?.callsite;
|
|
37364
37364
|
|
|
37365
|
+
// src/core/pageResponseCache.ts
|
|
37366
|
+
import { createHash } from "crypto";
|
|
37367
|
+
var STREAMING_PAGE_HEADER = "x-absolute-stream";
|
|
37368
|
+
var HTML_CONTENT_TYPE = "text/html";
|
|
37369
|
+
var streamingPageHeaders = (extra) => {
|
|
37370
|
+
const headers = new Headers(extra);
|
|
37371
|
+
headers.set("content-type", HTML_CONTENT_TYPE);
|
|
37372
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
37373
|
+
return headers;
|
|
37374
|
+
};
|
|
37375
|
+
var computeEtag = (html) => `W/"${createHash("sha1").update(html).digest("base64url")}"`;
|
|
37376
|
+
var withPageCacheHeaders = async (response, request, options) => {
|
|
37377
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
37378
|
+
if (!contentType.includes(HTML_CONTENT_TYPE))
|
|
37379
|
+
return response;
|
|
37380
|
+
const isStreaming = response.headers.get(STREAMING_PAGE_HEADER) === "1";
|
|
37381
|
+
if (isStreaming && !options?.bufferStreamForEtag || !response.body) {
|
|
37382
|
+
response.headers.delete(STREAMING_PAGE_HEADER);
|
|
37383
|
+
response.headers.set("cache-control", "no-cache");
|
|
37384
|
+
return response;
|
|
37385
|
+
}
|
|
37386
|
+
const html = await response.text();
|
|
37387
|
+
const etag = computeEtag(html);
|
|
37388
|
+
if (request?.headers.get("if-none-match") === etag) {
|
|
37389
|
+
return new Response(null, {
|
|
37390
|
+
headers: { "cache-control": "no-cache", etag },
|
|
37391
|
+
status: 304
|
|
37392
|
+
});
|
|
37393
|
+
}
|
|
37394
|
+
const headers = new Headers(response.headers);
|
|
37395
|
+
headers.delete(STREAMING_PAGE_HEADER);
|
|
37396
|
+
headers.set("cache-control", "no-cache");
|
|
37397
|
+
headers.set("etag", etag);
|
|
37398
|
+
return new Response(html, {
|
|
37399
|
+
headers,
|
|
37400
|
+
status: response.status,
|
|
37401
|
+
statusText: response.statusText
|
|
37402
|
+
});
|
|
37403
|
+
};
|
|
37404
|
+
|
|
37365
37405
|
// src/client/streamSwap.ts
|
|
37366
37406
|
var streamSwapRuntime = () => {
|
|
37367
37407
|
const absoluteWindow = window;
|
|
@@ -38095,8 +38135,10 @@ var enhanceHtmlResponseWithStreamingSlots = (response, {
|
|
|
38095
38135
|
runtimePlacement,
|
|
38096
38136
|
runtimePreludeScript
|
|
38097
38137
|
});
|
|
38138
|
+
const headers = cloneHeaders(response);
|
|
38139
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
38098
38140
|
return new Response(body, {
|
|
38099
|
-
headers
|
|
38141
|
+
headers,
|
|
38100
38142
|
status: response.status,
|
|
38101
38143
|
statusText: response.statusText
|
|
38102
38144
|
});
|
|
@@ -38565,19 +38607,23 @@ var handleReactPageRequest = async (input) => {
|
|
|
38565
38607
|
});
|
|
38566
38608
|
}
|
|
38567
38609
|
return new Response(htmlStream, {
|
|
38568
|
-
headers:
|
|
38610
|
+
headers: streamingPageHeaders()
|
|
38569
38611
|
});
|
|
38570
38612
|
};
|
|
38571
|
-
|
|
38613
|
+
const pageResponse = await runWithStreamingSlotWarningScope(() => options?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, options) : renderPageResponse(), { handlerCallsite });
|
|
38614
|
+
return withPageCacheHeaders(pageResponse, input.request, {
|
|
38615
|
+
bufferStreamForEtag: input.bufferStreamForEtag
|
|
38616
|
+
});
|
|
38572
38617
|
} catch (error) {
|
|
38573
38618
|
console.error("[SSR] React render error:", error);
|
|
38574
38619
|
const conventionResponse = await renderConventionError("react", pageName, error);
|
|
38575
|
-
if (conventionResponse)
|
|
38576
|
-
return conventionResponse;
|
|
38577
|
-
|
|
38620
|
+
if (conventionResponse) {
|
|
38621
|
+
return withPageCacheHeaders(conventionResponse, input.request);
|
|
38622
|
+
}
|
|
38623
|
+
return withPageCacheHeaders(new Response(ssrErrorPage("react", error), {
|
|
38578
38624
|
headers: { "Content-Type": "text/html" },
|
|
38579
38625
|
status: 500
|
|
38580
|
-
});
|
|
38626
|
+
}), input.request);
|
|
38581
38627
|
}
|
|
38582
38628
|
};
|
|
38583
38629
|
|
package/dist/index.js
CHANGED
|
@@ -8678,6 +8678,43 @@ var init_staticIslandPages = __esm(() => {
|
|
|
8678
8678
|
HTMX_STREAM_SLOT_TAG_RE = /<abs-htmx-stream-slot\b([^>]*?)(?:\/>|>([\s\S]*?)<\/abs-htmx-stream-slot>)/gi;
|
|
8679
8679
|
});
|
|
8680
8680
|
|
|
8681
|
+
// src/core/pageResponseCache.ts
|
|
8682
|
+
import { createHash as createHash3 } from "crypto";
|
|
8683
|
+
var STREAMING_PAGE_HEADER = "x-absolute-stream", HTML_CONTENT_TYPE = "text/html", streamingPageHeaders = (extra) => {
|
|
8684
|
+
const headers = new Headers(extra);
|
|
8685
|
+
headers.set("content-type", HTML_CONTENT_TYPE);
|
|
8686
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
8687
|
+
return headers;
|
|
8688
|
+
}, computeEtag = (html) => `W/"${createHash3("sha1").update(html).digest("base64url")}"`, withPageCacheHeaders = async (response, request, options) => {
|
|
8689
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
8690
|
+
if (!contentType.includes(HTML_CONTENT_TYPE))
|
|
8691
|
+
return response;
|
|
8692
|
+
const isStreaming = response.headers.get(STREAMING_PAGE_HEADER) === "1";
|
|
8693
|
+
if (isStreaming && !options?.bufferStreamForEtag || !response.body) {
|
|
8694
|
+
response.headers.delete(STREAMING_PAGE_HEADER);
|
|
8695
|
+
response.headers.set("cache-control", "no-cache");
|
|
8696
|
+
return response;
|
|
8697
|
+
}
|
|
8698
|
+
const html = await response.text();
|
|
8699
|
+
const etag = computeEtag(html);
|
|
8700
|
+
if (request?.headers.get("if-none-match") === etag) {
|
|
8701
|
+
return new Response(null, {
|
|
8702
|
+
headers: { "cache-control": "no-cache", etag },
|
|
8703
|
+
status: 304
|
|
8704
|
+
});
|
|
8705
|
+
}
|
|
8706
|
+
const headers = new Headers(response.headers);
|
|
8707
|
+
headers.delete(STREAMING_PAGE_HEADER);
|
|
8708
|
+
headers.set("cache-control", "no-cache");
|
|
8709
|
+
headers.set("etag", etag);
|
|
8710
|
+
return new Response(html, {
|
|
8711
|
+
headers,
|
|
8712
|
+
status: response.status,
|
|
8713
|
+
statusText: response.statusText
|
|
8714
|
+
});
|
|
8715
|
+
};
|
|
8716
|
+
var init_pageResponseCache = () => {};
|
|
8717
|
+
|
|
8681
8718
|
// node_modules/@elysiajs/openapi/dist/index.mjs
|
|
8682
8719
|
var exports_dist = {};
|
|
8683
8720
|
__export(exports_dist, {
|
|
@@ -21379,7 +21416,7 @@ var devVendorPaths = null, getDevVendorPaths = () => devVendorPaths, setDevVendo
|
|
|
21379
21416
|
// src/build/angularLinkerPlugin.ts
|
|
21380
21417
|
import { existsSync as existsSync21, mkdirSync as mkdirSync5, readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "fs";
|
|
21381
21418
|
import { dirname as dirname11, join as join23, relative as relative7, resolve as resolve17 } from "path";
|
|
21382
|
-
import { createHash as
|
|
21419
|
+
import { createHash as createHash4 } from "crypto";
|
|
21383
21420
|
var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linkerJitMode) => ({
|
|
21384
21421
|
name: "angular-linker",
|
|
21385
21422
|
setup(bld) {
|
|
@@ -21398,7 +21435,7 @@ var CACHE_ROOT, ANGULAR_LINKER_CANDIDATE_RE, createAngularLinkerPlugin = (linker
|
|
|
21398
21435
|
if (!checkLink || !checkLink(args.path, source)) {
|
|
21399
21436
|
return;
|
|
21400
21437
|
}
|
|
21401
|
-
const hash =
|
|
21438
|
+
const hash = createHash4("md5").update(source).digest("hex");
|
|
21402
21439
|
const cachePath = join23(cacheDir, `${hash}.js`);
|
|
21403
21440
|
if (existsSync21(cachePath)) {
|
|
21404
21441
|
return {
|
|
@@ -34264,18 +34301,20 @@ var resolveRequestPathname = (request) => {
|
|
|
34264
34301
|
}
|
|
34265
34302
|
const innerHtml = bundle.renderToHTML(props ?? {});
|
|
34266
34303
|
const html = buildHtmlShell(resolvedHeadTag, innerHtml.replace(/^<div>|<\/div>$/g, ""), indexPath, props);
|
|
34267
|
-
return new Response(html, {
|
|
34304
|
+
return withPageCacheHeaders(new Response(html, {
|
|
34268
34305
|
headers: { "Content-Type": "text/html" }
|
|
34269
|
-
});
|
|
34306
|
+
}), input.request);
|
|
34270
34307
|
} catch (error) {
|
|
34271
34308
|
console.error("[SSR] Ember render error:", error);
|
|
34272
|
-
return new Response(ssrErrorPage("ember", error), {
|
|
34309
|
+
return withPageCacheHeaders(new Response(ssrErrorPage("ember", error), {
|
|
34273
34310
|
headers: { "Content-Type": "text/html" },
|
|
34274
34311
|
status: 500
|
|
34275
|
-
});
|
|
34312
|
+
}), input.request);
|
|
34276
34313
|
}
|
|
34277
34314
|
};
|
|
34278
|
-
var init_pageHandler = () => {
|
|
34315
|
+
var init_pageHandler = __esm(() => {
|
|
34316
|
+
init_pageResponseCache();
|
|
34317
|
+
});
|
|
34279
34318
|
|
|
34280
34319
|
// src/ember/index.ts
|
|
34281
34320
|
var exports_ember = {};
|
|
@@ -38965,10 +39004,12 @@ var setCurrentIslandManifest = (manifest) => {
|
|
|
38965
39004
|
};
|
|
38966
39005
|
|
|
38967
39006
|
// src/core/pageHandlers.ts
|
|
39007
|
+
init_pageResponseCache();
|
|
38968
39008
|
init_staticStreaming();
|
|
38969
39009
|
|
|
38970
39010
|
// src/core/responseEnhancers.ts
|
|
38971
39011
|
init_streamingSlots();
|
|
39012
|
+
init_pageResponseCache();
|
|
38972
39013
|
var toResponse = async (responseLike) => responseLike;
|
|
38973
39014
|
var cloneHeaders = (response) => {
|
|
38974
39015
|
const headers = new Headers(response.headers);
|
|
@@ -38992,8 +39033,10 @@ var enhanceHtmlResponseWithStreamingSlots = (response, {
|
|
|
38992
39033
|
runtimePlacement,
|
|
38993
39034
|
runtimePreludeScript
|
|
38994
39035
|
});
|
|
39036
|
+
const headers = cloneHeaders(response);
|
|
39037
|
+
headers.set(STREAMING_PAGE_HEADER, "1");
|
|
38995
39038
|
return new Response(body, {
|
|
38996
|
-
headers
|
|
39039
|
+
headers,
|
|
38997
39040
|
status: response.status,
|
|
38998
39041
|
statusText: response.statusText
|
|
38999
39042
|
});
|
|
@@ -39020,12 +39063,12 @@ var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
|
|
|
39020
39063
|
var handleStaticPageRequest = async (pagePath, options = {}, settings = {}) => {
|
|
39021
39064
|
const html = await file(pagePath).text();
|
|
39022
39065
|
const transformedHtml = await transformCurrentStaticPageHtml(html, settings);
|
|
39023
|
-
return withStreamingSlots(new Response(injectIslandPageContext(transformedHtml), {
|
|
39066
|
+
return withPageCacheHeaders(await withStreamingSlots(new Response(injectIslandPageContext(transformedHtml), {
|
|
39024
39067
|
headers: { "Content-Type": "text/html" }
|
|
39025
39068
|
}), {
|
|
39026
39069
|
...options,
|
|
39027
39070
|
streamingSlots: options.streamingSlots ?? []
|
|
39028
|
-
});
|
|
39071
|
+
}));
|
|
39029
39072
|
};
|
|
39030
39073
|
var handleHTMLPageRequest = (pagePath, options) => {
|
|
39031
39074
|
const htmlFile = file(pagePath);
|
|
@@ -46670,5 +46713,5 @@ export {
|
|
|
46670
46713
|
ANGULAR_INIT_TIMEOUT_MS
|
|
46671
46714
|
};
|
|
46672
46715
|
|
|
46673
|
-
//# debugId=
|
|
46716
|
+
//# debugId=F6FD2F06153BC10064756E2164756E21
|
|
46674
46717
|
//# sourceMappingURL=index.js.map
|