@absolutejs/absolute 0.19.0-beta.741 → 0.19.0-beta.743

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.
@@ -0,0 +1,2 @@
1
+ import type { EnvironmentProviders, Provider } from '@angular/core';
2
+ export declare const buildServerAnimationProviders: (usesLegacyAnimations: boolean) => Promise<(Provider | EnvironmentProviders)[]>;
@@ -1,4 +1,8 @@
1
+ export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCacheOptions } from './httpTransferCache';
2
+ export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
1
3
  export { Island } from './Island.browser';
4
+ export { withPendingTask } from './pendingTask';
5
+ export { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from './requestProviders';
2
6
  export { createTypedIsland } from './createIsland.browser';
3
7
  export declare const renderIsland: () => Promise<never>;
4
8
  export { IslandStore } from './islandStore';
@@ -0,0 +1,26 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export type DeterministicRandom = () => number;
3
+ export type DeterministicEnvOptions = {
4
+ now?: Date | number | string;
5
+ seed?: number | string;
6
+ };
7
+ export declare const DETERMINISTIC_NOW: InjectionToken<number>;
8
+ export declare const DETERMINISTIC_RANDOM: InjectionToken<DeterministicRandom>;
9
+ export declare const DETERMINISTIC_SEED: InjectionToken<string>;
10
+ export declare const createDeterministicRandom: (seed?: number | string) => () => number;
11
+ export declare const provideDeterministicEnv: (options?: DeterministicEnvOptions) => ({
12
+ provide: InjectionToken<string>;
13
+ useValue: string;
14
+ deps?: undefined;
15
+ useFactory?: undefined;
16
+ } | {
17
+ provide: InjectionToken<number>;
18
+ useValue: number;
19
+ deps?: undefined;
20
+ useFactory?: undefined;
21
+ } | {
22
+ deps: InjectionToken<string>[];
23
+ provide: InjectionToken<DeterministicRandom>;
24
+ useFactory: (seed?: number | string) => () => number;
25
+ useValue?: undefined;
26
+ })[];
@@ -0,0 +1,12 @@
1
+ import type { HttpTransferCacheOptions } from '@angular/common/http';
2
+ export declare const ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache";
3
+ export type AbsoluteHttpTransferCacheOptions = Omit<HttpTransferCacheOptions, 'filter'> & {
4
+ filter?: NonNullable<HttpTransferCacheOptions['filter']>;
5
+ skipHeader?: string;
6
+ };
7
+ export declare const buildAbsoluteHttpTransferCacheOptions: (options?: AbsoluteHttpTransferCacheOptions) => {
8
+ filter: (request: import("@angular/common/http").HttpRequest<unknown>) => boolean;
9
+ includeHeaders?: string[] | undefined;
10
+ includePostRequests: boolean;
11
+ includeRequestsWithAuthHeaders: boolean;
12
+ };
@@ -1,5 +1,9 @@
1
1
  import '@angular/compiler';
2
+ export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCacheOptions } from './httpTransferCache';
3
+ export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
2
4
  export { handleAngularPageRequest } from './pageHandler';
5
+ export { withPendingTask } from './pendingTask';
6
+ export { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from './requestProviders';
3
7
  export { createTypedIsland } from './createIsland';
4
8
  export { getCachedRouteData } from './ssrRender';
5
9
  export { Island } from './Island';
@@ -1,4 +1,3 @@
1
- import type { EnvironmentProviders, Provider } from '@angular/core';
2
1
  import type { AngularPagePropsOf } from '../../types/angular';
3
2
  import { type StreamingSlotEnhancerOptions } from '../core/responseEnhancers';
4
3
  type AngularPageRenderOptions = StreamingSlotEnhancerOptions & {
@@ -15,12 +14,15 @@ export type AngularPageRequestInput<Page = {
15
14
  headTag?: `<head>${string}</head>`;
16
15
  indexPath: string;
17
16
  pagePath: string;
18
- providers?: ReadonlyArray<Provider | EnvironmentProviders>;
19
17
  /** The incoming request. When provided, its URL is forwarded to
20
18
  * Angular's `renderApplication`, so `LocationStrategy.path()` and
21
19
  * Angular Router both see the real URL instead of `/`. Without it,
22
20
  * Router-based pages can't match anything but the root route. */
23
21
  request?: Request;
22
+ /** Per-request context made available through Angular's REQUEST_CONTEXT token. */
23
+ requestContext?: unknown;
24
+ /** Mutable response init made available through Angular's RESPONSE_INIT token. */
25
+ responseInit?: ResponseInit;
24
26
  } & (AngularPageHasOptionalProps<Page> extends true ? {
25
27
  props?: NoInfer<AngularPagePropsOf<Page>>;
26
28
  } : {
@@ -0,0 +1 @@
1
+ export declare const withPendingTask: <Value>(work: () => Promise<Value>) => Promise<Value>;
@@ -0,0 +1,6 @@
1
+ import type { AngularDeps } from '../../types/angular';
2
+ export { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from '@angular/core';
3
+ export declare const buildRequestProviders: (deps: AngularDeps, request: Request | undefined, requestContext: unknown, responseInit: ResponseInit | undefined) => {
4
+ provide: import("@angular/core").InjectionToken<unknown>;
5
+ useValue: {} | null;
6
+ }[];
@@ -0,0 +1,6 @@
1
+ import type { AngularDeps } from '../../types/angular';
2
+ export declare const buildRouterRedirectProviders: (deps: AngularDeps, responseInit: ResponseInit | undefined) => Promise<{
3
+ multi: true;
4
+ provide: import("@angular/core").InjectionToken<readonly (() => void)[]>;
5
+ useValue: () => void;
6
+ }[]>;
@@ -1 +1,5 @@
1
+ export { ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER, buildAbsoluteHttpTransferCacheOptions } from './httpTransferCache';
2
+ export { createDeterministicRandom, DETERMINISTIC_NOW, DETERMINISTIC_RANDOM, DETERMINISTIC_SEED, provideDeterministicEnv } from './deterministicEnv';
1
3
  export { handleAngularPageRequest } from './pageHandler';
4
+ export { withPendingTask } from './pendingTask';
5
+ export { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from './requestProviders';
@@ -3,7 +3,7 @@ import type { AngularDeps, CachedRouteData, SsrDepsResult } from '../../types/an
3
3
  export declare const cacheRouteData: (pagePath: string, data: CachedRouteData) => void;
4
4
  export declare const getCachedRouteData: (pagePath: string) => CachedRouteData | undefined;
5
5
  export declare const buildDeps: (ssrResult: SsrDepsResult | null, baseDeps: AngularDeps) => AngularDeps;
6
- export declare const buildProviders: (deps: AngularDeps, sanitizer: InstanceType<AngularDeps["DomSanitizer"]>, maybeProps: Record<string, unknown> | undefined, tokenMap: Map<string, unknown>, userProviders?: ReadonlyArray<Provider | EnvironmentProviders>) => (Provider | EnvironmentProviders | {
6
+ export declare const buildProviders: (deps: AngularDeps, sanitizer: InstanceType<AngularDeps["DomSanitizer"]>, maybeProps: Record<string, unknown> | undefined, tokenMap: Map<string, unknown>, request: Request | undefined, requestContext: unknown, responseInit: ResponseInit | undefined, userProviders?: ReadonlyArray<Provider | EnvironmentProviders>) => (Provider | EnvironmentProviders | {
7
7
  provide: unknown;
8
8
  useValue: unknown;
9
9
  })[];
@@ -2089,13 +2089,19 @@ var initDominoAdapter = (platformServer) => {
2089
2089
  APP_BASE_HREF: common.APP_BASE_HREF,
2090
2090
  bootstrapApplication: platformBrowser.bootstrapApplication,
2091
2091
  DomSanitizer: platformBrowser.DomSanitizer,
2092
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
2093
+ inject: core.inject,
2092
2094
  provideClientHydration: platformBrowser.provideClientHydration,
2093
2095
  provideServerRendering: platformServer.provideServerRendering,
2094
2096
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
2095
2097
  reflectComponentType: core.reflectComponentType,
2096
2098
  renderApplication: platformServer.renderApplication,
2099
+ REQUEST: core.REQUEST,
2100
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT,
2101
+ RESPONSE_INIT: core.RESPONSE_INIT,
2097
2102
  Sanitizer: core.Sanitizer,
2098
- SecurityContext: core.SecurityContext
2103
+ SecurityContext: core.SecurityContext,
2104
+ withHttpTransferCacheOptions: platformBrowser.withHttpTransferCacheOptions
2099
2105
  };
2100
2106
  }, angularDeps = null, getAngularDeps = () => {
2101
2107
  if (!angularDeps) {
@@ -2187,6 +2193,30 @@ var init_registerClientScript = __esm(() => {
2187
2193
  }
2188
2194
  });
2189
2195
 
2196
+ // src/angular/httpTransferCache.ts
2197
+ var ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER = "x-skip-transfer-cache", buildAbsoluteHttpTransferCacheOptions = (options = {}) => {
2198
+ const {
2199
+ filter: userFilter,
2200
+ skipHeader = ABSOLUTE_HTTP_TRANSFER_CACHE_SKIP_HEADER,
2201
+ ...angularOptions
2202
+ } = options;
2203
+ return {
2204
+ includePostRequests: false,
2205
+ includeRequestsWithAuthHeaders: false,
2206
+ ...angularOptions,
2207
+ filter: (request) => !request.headers.has(skipHeader) && (userFilter?.(request) ?? true)
2208
+ };
2209
+ };
2210
+
2211
+ // src/angular/requestProviders.ts
2212
+ import { REQUEST, REQUEST_CONTEXT, RESPONSE_INIT } from "@angular/core";
2213
+ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
2214
+ { provide: deps.REQUEST, useValue: request ?? null },
2215
+ { provide: deps.REQUEST_CONTEXT, useValue: requestContext ?? null },
2216
+ { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
2217
+ ];
2218
+ var init_requestProviders = () => {};
2219
+
2190
2220
  // src/angular/ssrRender.ts
2191
2221
  var routePropsCache, cacheRouteData = (pagePath, data) => {
2192
2222
  const cacheKey = pagePath.split("?")[0] ?? pagePath;
@@ -2200,18 +2230,24 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2200
2230
  APP_BASE_HREF: common?.APP_BASE_HREF ?? baseDeps.APP_BASE_HREF,
2201
2231
  bootstrapApplication: platformBrowser?.bootstrapApplication ?? baseDeps.bootstrapApplication,
2202
2232
  DomSanitizer: platformBrowser?.DomSanitizer ?? baseDeps.DomSanitizer,
2233
+ ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER ?? baseDeps.ENVIRONMENT_INITIALIZER,
2234
+ inject: core.inject ?? baseDeps.inject,
2203
2235
  provideClientHydration: platformBrowser?.provideClientHydration ?? baseDeps.provideClientHydration,
2204
2236
  provideServerRendering: platformServer?.provideServerRendering ?? baseDeps.provideServerRendering,
2205
2237
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
2206
2238
  reflectComponentType: core.reflectComponentType,
2207
2239
  renderApplication: platformServer?.renderApplication ?? baseDeps.renderApplication,
2240
+ REQUEST: core.REQUEST ?? baseDeps.REQUEST,
2241
+ REQUEST_CONTEXT: core.REQUEST_CONTEXT ?? baseDeps.REQUEST_CONTEXT,
2242
+ RESPONSE_INIT: core.RESPONSE_INIT ?? baseDeps.RESPONSE_INIT,
2208
2243
  Sanitizer: core.Sanitizer,
2209
- SecurityContext: core.SecurityContext
2244
+ SecurityContext: core.SecurityContext,
2245
+ withHttpTransferCacheOptions: platformBrowser?.withHttpTransferCacheOptions ?? baseDeps.withHttpTransferCacheOptions
2210
2246
  };
2211
- }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, userProviders = []) => {
2247
+ }, buildProviders = (deps, sanitizer, maybeProps, tokenMap, request, requestContext, responseInit, userProviders = []) => {
2212
2248
  const providers = [
2213
2249
  deps.provideServerRendering(),
2214
- deps.provideClientHydration(),
2250
+ deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
2215
2251
  deps.provideZonelessChangeDetection(),
2216
2252
  { provide: deps.APP_BASE_HREF, useValue: "/" },
2217
2253
  {
@@ -2219,6 +2255,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2219
2255
  useValue: sanitizer
2220
2256
  },
2221
2257
  { provide: deps.Sanitizer, useValue: sanitizer },
2258
+ ...buildRequestProviders(deps, request, requestContext, responseInit),
2222
2259
  ...userProviders
2223
2260
  ];
2224
2261
  if (!maybeProps) {
@@ -2301,6 +2338,7 @@ var routePropsCache, cacheRouteData = (pagePath, data) => {
2301
2338
  };
2302
2339
  var init_ssrRender = __esm(() => {
2303
2340
  init_registerClientScript();
2341
+ init_requestProviders();
2304
2342
  routePropsCache = new Map;
2305
2343
  selectorCache = new Map;
2306
2344
  });
@@ -3628,5 +3666,5 @@ export {
3628
3666
  createTypedIsland
3629
3667
  };
3630
3668
 
3631
- //# debugId=E87AF2D8D9A384F364756E2164756E21
3669
+ //# debugId=C0DAD6F288DBF86E64756E2164756E21
3632
3670
  //# sourceMappingURL=index.js.map