@absolutejs/absolute 0.19.0-beta.966 → 0.19.0-beta.967
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/browser.js +24 -20
- package/dist/angular/browser.js.map +5 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +59 -84
- package/dist/angular/index.js.map +8 -7
- package/dist/angular/server.js +42 -71
- package/dist/angular/server.js.map +5 -5
- package/dist/build.js +38 -66
- package/dist/build.js.map +4 -4
- package/dist/client/index.js +17 -43
- package/dist/client/index.js.map +4 -5
- package/dist/index.js +45 -73
- package/dist/index.js.map +6 -6
- package/dist/islands/index.js +17 -43
- package/dist/islands/index.js.map +4 -5
- package/dist/react/index.js +18 -36
- package/dist/react/index.js.map +3 -3
- package/dist/react/server.js +2 -2
- package/dist/react/server.js.map +2 -2
- package/dist/src/angular/browser.d.ts +1 -2
- package/dist/src/angular/composables/index.d.ts +1 -0
- package/dist/src/angular/composables/usePageContext.d.ts +16 -0
- package/dist/src/angular/index.d.ts +1 -2
- package/dist/src/angular/pageHandler.d.ts +9 -12
- package/dist/src/angular/server.d.ts +0 -1
- package/dist/src/angular/ssrRender.d.ts +2 -6
- package/dist/svelte/index.js +18 -36
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +2 -2
- package/dist/svelte/server.js.map +2 -2
- package/dist/types/angular.d.ts +4 -46
- package/dist/types/ember.d.ts +1 -3
- package/dist/vue/index.js +18 -36
- package/dist/vue/index.js.map +3 -3
- package/dist/vue/server.js +2 -2
- package/dist/vue/server.js.map +2 -2
- package/package.json +1 -1
package/dist/angular/server.js
CHANGED
|
@@ -174,7 +174,7 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
|
|
|
174
174
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
175
175
|
}
|
|
176
176
|
return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
|
|
177
|
-
}
|
|
177
|
+
};
|
|
178
178
|
|
|
179
179
|
// src/utils/registerClientScript.ts
|
|
180
180
|
var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_${++requestCounter}`, ssrContextGetter = null, getSsrContextId = () => ssrContextGetter?.() || Object.getOwnPropertyDescriptor(globalThis, "__absolutejs_requestId")?.value, registerClientScript = (script, requestId) => {
|
|
@@ -512,37 +512,19 @@ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
|
|
|
512
512
|
];
|
|
513
513
|
|
|
514
514
|
// src/angular/ssrRender.ts
|
|
515
|
-
var
|
|
515
|
+
var routeContextCache, cacheRouteData = (pagePath, data) => {
|
|
516
516
|
const cacheKey = pagePath.split("?")[0] ?? pagePath;
|
|
517
|
-
|
|
518
|
-
}, getCachedRouteData = (pagePath) =>
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
{ provide: deps.Sanitizer, useValue: sanitizer },
|
|
529
|
-
...buildRequestProviders(deps, request, requestContext, responseInit),
|
|
530
|
-
...userProviders
|
|
531
|
-
];
|
|
532
|
-
if (!maybeProps) {
|
|
533
|
-
return providers;
|
|
534
|
-
}
|
|
535
|
-
const propProviders = Object.entries(maybeProps).map(([propName, propValue]) => ({
|
|
536
|
-
token: tokenMap.get(toScreamingSnake(propName)),
|
|
537
|
-
value: propValue
|
|
538
|
-
})).filter((entry) => entry.token).map((entry) => ({ provide: entry.token, useValue: entry.value }));
|
|
539
|
-
return [...providers, ...propProviders];
|
|
540
|
-
}, isInjectionToken = (value) => {
|
|
541
|
-
if (!value || typeof value !== "object") {
|
|
542
|
-
return false;
|
|
543
|
-
}
|
|
544
|
-
return "ngMetadataName" in value && value.ngMetadataName === "InjectionToken";
|
|
545
|
-
}, discoverTokens = (pageModule) => new Map(Object.entries(pageModule).filter(([, value]) => isInjectionToken(value))), resolveSelector = (deps, pagePath, PageComponent) => {
|
|
517
|
+
routeContextCache.set(cacheKey, data);
|
|
518
|
+
}, getCachedRouteData = (pagePath) => routeContextCache.get(pagePath), selectorCache, buildProviders = (deps, sanitizer, request, requestContext, responseInit, userProviders = []) => [
|
|
519
|
+
deps.provideServerRendering(),
|
|
520
|
+
deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
|
|
521
|
+
deps.provideZonelessChangeDetection(),
|
|
522
|
+
{ provide: deps.APP_BASE_HREF, useValue: "/" },
|
|
523
|
+
{ provide: deps.DomSanitizer, useValue: sanitizer },
|
|
524
|
+
{ provide: deps.Sanitizer, useValue: sanitizer },
|
|
525
|
+
...buildRequestProviders(deps, request, requestContext, responseInit),
|
|
526
|
+
...userProviders
|
|
527
|
+
], resolveSelector = (deps, pagePath, PageComponent) => {
|
|
546
528
|
const cached = selectorCache.get(pagePath);
|
|
547
529
|
if (cached) {
|
|
548
530
|
return cached;
|
|
@@ -558,14 +540,14 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
|
|
|
558
540
|
return html.replace("</html>", `${snippet}</html>`);
|
|
559
541
|
}
|
|
560
542
|
return html + snippet;
|
|
561
|
-
}, injectSsrScripts = (html, requestId, indexPath,
|
|
543
|
+
}, injectSsrScripts = (html, requestId, indexPath, requestContext) => {
|
|
562
544
|
let result = html;
|
|
563
545
|
const registeredScripts = getAndClearClientScripts(requestId);
|
|
564
546
|
if (registeredScripts.length > 0) {
|
|
565
547
|
result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
|
|
566
548
|
}
|
|
567
|
-
if (
|
|
568
|
-
result = injectBeforeClose(result, `<script>window.
|
|
549
|
+
if (requestContext !== undefined) {
|
|
550
|
+
result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${JSON.stringify(requestContext)};</script>`);
|
|
569
551
|
}
|
|
570
552
|
if (indexPath) {
|
|
571
553
|
const escapedIndexPath = JSON.stringify(indexPath);
|
|
@@ -595,7 +577,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
|
|
|
595
577
|
};
|
|
596
578
|
var init_ssrRender = __esm(() => {
|
|
597
579
|
init_registerClientScript();
|
|
598
|
-
|
|
580
|
+
routeContextCache = new Map;
|
|
599
581
|
selectorCache = new Map;
|
|
600
582
|
});
|
|
601
583
|
|
|
@@ -4541,26 +4523,21 @@ import '@angular/compiler';
|
|
|
4541
4523
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
4542
4524
|
import { provideClientHydration } from '@angular/platform-browser';
|
|
4543
4525
|
import { withHttpTransferCacheOptions } from '@angular/platform-browser';
|
|
4544
|
-
import { provideZonelessChangeDetection } from '@angular/core';
|
|
4526
|
+
import { provideZonelessChangeDetection, REQUEST_CONTEXT } from '@angular/core';
|
|
4545
4527
|
import * as pageModule from '${normalizedImportPath}';
|
|
4546
4528
|
|
|
4547
4529
|
var ${componentClassName} = pageModule.default;
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4530
|
+
// REQUEST_CONTEXT is hydrated from the SSR-serialized payload so client-side
|
|
4531
|
+
// \`inject(REQUEST_CONTEXT)\` (or \`usePageContext<T>()\`) returns the same
|
|
4532
|
+
// object the server rendered with \u2014 no second round-trip, no transferState
|
|
4533
|
+
// dance for callers.
|
|
4534
|
+
var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR_REQUEST_CONTEXT__')
|
|
4535
|
+
? window.__ABS_ANGULAR_REQUEST_CONTEXT__
|
|
4536
|
+
: null;
|
|
4555
4537
|
var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
|
|
4556
4538
|
var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
|
|
4557
4539
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
4558
|
-
var
|
|
4559
|
-
var propName = entry[0];
|
|
4560
|
-
var propValue = entry[1];
|
|
4561
|
-
var token = pageModule[toScreamingSnake(propName)];
|
|
4562
|
-
return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
|
|
4563
|
-
}).filter(Boolean);
|
|
4540
|
+
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
4564
4541
|
// Page-level providers, opt-in via \`export const providers = [...]\` in the
|
|
4565
4542
|
// page module. Required so DI tokens that the component (or any service it
|
|
4566
4543
|
// injects) needs are available client-side too \u2014 without these, services
|
|
@@ -4613,7 +4590,7 @@ if (!window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
|
|
|
4613
4590
|
}
|
|
4614
4591
|
delete window.__HMR_SKIP_HYDRATION__;
|
|
4615
4592
|
providers.push.apply(providers, pageProviders);
|
|
4616
|
-
providers.push.apply(providers,
|
|
4593
|
+
providers.push.apply(providers, contextProviders);
|
|
4617
4594
|
window.__ABS_SLOT_HYDRATION_PENDING__ = pageHasRawStreamingSlots;
|
|
4618
4595
|
|
|
4619
4596
|
if (pageHasRawStreamingSlots) {
|
|
@@ -4641,26 +4618,21 @@ import '@angular/compiler';
|
|
|
4641
4618
|
import { bootstrapApplication } from '@angular/platform-browser';
|
|
4642
4619
|
import { provideClientHydration } from '@angular/platform-browser';
|
|
4643
4620
|
import { withHttpTransferCacheOptions } from '@angular/platform-browser';
|
|
4644
|
-
import { enableProdMode, provideZonelessChangeDetection } from '@angular/core';
|
|
4621
|
+
import { enableProdMode, provideZonelessChangeDetection, REQUEST_CONTEXT } from '@angular/core';
|
|
4645
4622
|
import * as pageModule from '${normalizedImportPath}';
|
|
4646
4623
|
|
|
4647
4624
|
var ${componentClassName} = pageModule.default;
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4625
|
+
// REQUEST_CONTEXT is hydrated from the SSR-serialized payload so client-side
|
|
4626
|
+
// \`inject(REQUEST_CONTEXT)\` (or \`usePageContext<T>()\`) returns the same
|
|
4627
|
+
// object the server rendered with \u2014 no second round-trip, no transferState
|
|
4628
|
+
// dance for callers.
|
|
4629
|
+
var requestContext = Object.prototype.hasOwnProperty.call(window, '__ABS_ANGULAR_REQUEST_CONTEXT__')
|
|
4630
|
+
? window.__ABS_ANGULAR_REQUEST_CONTEXT__
|
|
4631
|
+
: null;
|
|
4655
4632
|
var pageHasIslands = Boolean(pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__) || Boolean(document.querySelector('[data-island="true"]'));
|
|
4656
4633
|
var pageHasRawStreamingSlots = Boolean(document.querySelector('[data-absolute-raw-slot="true"]'));
|
|
4657
4634
|
var pageHasStreamingSlots = Boolean(document.querySelector('[data-absolute-slot="true"]'));
|
|
4658
|
-
var
|
|
4659
|
-
var propName = entry[0];
|
|
4660
|
-
var propValue = entry[1];
|
|
4661
|
-
var token = pageModule[toScreamingSnake(propName)];
|
|
4662
|
-
return isInjectionToken(token) ? { provide: token, useValue: propValue } : null;
|
|
4663
|
-
}).filter(Boolean);
|
|
4635
|
+
var contextProviders = [{ provide: REQUEST_CONTEXT, useValue: requestContext }];
|
|
4664
4636
|
// Page-level providers, opt-in via \`export const providers = [...]\` in the
|
|
4665
4637
|
// page module. Required so DI tokens that the component (or any service it
|
|
4666
4638
|
// injects) needs are available client-side too \u2014 without these, services
|
|
@@ -4677,7 +4649,7 @@ var absoluteHttpTransferCacheOptions = {
|
|
|
4677
4649
|
|
|
4678
4650
|
enableProdMode();
|
|
4679
4651
|
|
|
4680
|
-
var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(
|
|
4652
|
+
var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(contextProviders);
|
|
4681
4653
|
if (!pageHasIslands) {
|
|
4682
4654
|
providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
|
|
4683
4655
|
}
|
|
@@ -5856,12 +5828,12 @@ var handleAngularPageRequest = async (input) => {
|
|
|
5856
5828
|
const resolvedIndexPath = input.indexPath;
|
|
5857
5829
|
const options = input;
|
|
5858
5830
|
const resolvedPagePath = input.pagePath;
|
|
5859
|
-
const
|
|
5831
|
+
const maybeRequestContext = input.requestContext;
|
|
5860
5832
|
const responseInit = input.responseInit ?? {};
|
|
5861
5833
|
const resolvedUrl = resolveRequestRenderUrl(input.request);
|
|
5862
5834
|
cacheRouteData(resolvedPagePath, {
|
|
5863
5835
|
headTag: resolvedHeadTag,
|
|
5864
|
-
|
|
5836
|
+
requestContext: maybeRequestContext
|
|
5865
5837
|
});
|
|
5866
5838
|
try {
|
|
5867
5839
|
assertNoHandlerProviders(input);
|
|
@@ -5881,7 +5853,6 @@ var handleAngularPageRequest = async (input) => {
|
|
|
5881
5853
|
const hasIslands = typeof pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__ === "boolean" ? pageModule.__ABSOLUTE_PAGE_HAS_ISLANDS__ : false;
|
|
5882
5854
|
const usesLegacyAnimations = pageModule.__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ === true;
|
|
5883
5855
|
const deps = baseDeps;
|
|
5884
|
-
const tokenMap = discoverTokens(pageModule);
|
|
5885
5856
|
const selector = resolveSelector(deps, resolvedPagePath, PageComponent);
|
|
5886
5857
|
lastSelector = selector;
|
|
5887
5858
|
const htmlString = `<!DOCTYPE html><html>${resolvedHeadTag}<body><${selector}></${selector}></body></html>`;
|
|
@@ -5894,11 +5865,11 @@ var handleAngularPageRequest = async (input) => {
|
|
|
5894
5865
|
...pageProviders,
|
|
5895
5866
|
...await buildServerAnimationProviders(usesLegacyAnimations)
|
|
5896
5867
|
];
|
|
5897
|
-
const providers = buildProviders(deps, sanitizer,
|
|
5868
|
+
const providers = buildProviders(deps, sanitizer, input.request, maybeRequestContext, responseInit, combinedProviders);
|
|
5898
5869
|
const rawHtml = await renderAngularApp(deps, PageComponent, providers, htmlString, resolvedUrl);
|
|
5899
5870
|
const shouldProcessIslands = hasIslands || rawHtml.includes("<absolute-island");
|
|
5900
5871
|
const htmlWithLoweredIslands = shouldProcessIslands ? await lowerAngularServerIslands(rawHtml) : rawHtml;
|
|
5901
|
-
const html = injectIslandPageContext(injectSsrScripts(htmlWithLoweredIslands, requestId, resolvedIndexPath,
|
|
5872
|
+
const html = injectIslandPageContext(injectSsrScripts(htmlWithLoweredIslands, requestId, resolvedIndexPath, maybeRequestContext), { hasIslands: shouldProcessIslands });
|
|
5902
5873
|
return new Response(html, withHtmlContentType(responseInit));
|
|
5903
5874
|
};
|
|
5904
5875
|
return await runWithStreamingSlotWarningScope(() => options?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, options) : renderPageResponse(), { handlerCallsite });
|
|
@@ -5937,5 +5908,5 @@ export {
|
|
|
5937
5908
|
ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER
|
|
5938
5909
|
};
|
|
5939
5910
|
|
|
5940
|
-
//# debugId=
|
|
5911
|
+
//# debugId=FD8A1A3E7357C71B64756E2164756E21
|
|
5941
5912
|
//# sourceMappingURL=server.js.map
|