@angular/ssr
Advanced tools
Comparing version 19.0.0-next.1 to 19.0.0-next.2
195
index.d.ts
@@ -1,4 +0,4 @@ | ||
import { ApplicationRef } from '@angular/core'; | ||
import { StaticProvider } from '@angular/core'; | ||
import { Type } from '@angular/core'; | ||
import type { ApplicationRef } from '@angular/core'; | ||
import { default as default_2 } from 'critters'; | ||
import type { Type } from '@angular/core'; | ||
@@ -115,2 +115,6 @@ /** | ||
/** | ||
* The `inlineCriticalCssProcessor` is responsible for handling critical CSS inlining. | ||
*/ | ||
private inlineCriticalCssProcessor; | ||
/** | ||
* Renders a response for the given HTTP request using the server application. | ||
@@ -148,52 +152,45 @@ * | ||
/** | ||
* A common engine to use to server render an application. | ||
* Angular server application engine. | ||
* Manages Angular server applications (including localized ones) and handles rendering requests. | ||
* @developerPreview | ||
*/ | ||
export declare class CommonEngine { | ||
private options?; | ||
private readonly templateCache; | ||
private readonly inlineCriticalCssProcessor; | ||
private readonly pageIsSSG; | ||
constructor(options?: CommonEngineOptions | undefined); | ||
export declare interface AngularServerAppManager { | ||
/** | ||
* Render an HTML document for a specific URL with specified | ||
* render options | ||
* Renders a response for the given HTTP request using the server application. | ||
* | ||
* This method processes the request, determines the appropriate route and rendering context, | ||
* and returns an HTTP response. | ||
* | ||
* If the request URL appears to be for a file (excluding `/index.html`), the method returns `null`. | ||
* A request to `https://www.example.com/page/index.html` will render the Angular route | ||
* corresponding to `https://www.example.com/page`. | ||
* | ||
* @param request - The incoming HTTP request object to be rendered. | ||
* @param requestContext - Optional additional context for the request, such as metadata. | ||
* @returns A promise that resolves to a Response object, or `null` if the request URL represents a file (e.g., `./logo.png`) | ||
* rather than an application route. | ||
*/ | ||
render(opts: CommonEngineRenderOptions): Promise<string>; | ||
private inlineCriticalCss; | ||
private retrieveSSGPage; | ||
private renderApplication; | ||
/** Retrieve the document from the cache or the filesystem */ | ||
private getDocument; | ||
render(request: Request, requestContext?: unknown): Promise<Response | null>; | ||
} | ||
export declare interface CommonEngineOptions { | ||
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */ | ||
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>); | ||
/** A set of platform level providers for all requests. */ | ||
providers?: StaticProvider[]; | ||
/** Enable request performance profiling data collection and printing the results in the server console. */ | ||
enablePerformanceProfiler?: boolean; | ||
declare interface CrittersBase { | ||
embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>; | ||
} | ||
export declare interface CommonEngineRenderOptions { | ||
/** A method that when invoked returns a promise that returns an `ApplicationRef` instance once resolved or an NgModule. */ | ||
bootstrap?: Type<{}> | (() => Promise<ApplicationRef>); | ||
/** A set of platform level providers for the current request. */ | ||
providers?: StaticProvider[]; | ||
url?: string; | ||
document?: string; | ||
documentFilePath?: string; | ||
/** | ||
* Reduce render blocking requests by inlining critical CSS. | ||
* Defaults to true. | ||
*/ | ||
inlineCriticalCss?: boolean; | ||
/** | ||
* Base path location of index file. | ||
* Defaults to the 'documentFilePath' dirname when not provided. | ||
*/ | ||
publicPath?: string; | ||
declare class CrittersBase extends default_2 { | ||
} | ||
/** | ||
* Destroys the current `AngularAppEngine` instance, releasing any associated resources. | ||
* | ||
* This method resets the reference to the `AngularAppEngine` instance to `undefined`, allowing | ||
* a new instance to be created on the next call to `getOrCreateAngularAppEngine()`. It is typically | ||
* used when reinitializing the server environment or refreshing the application state is necessary. | ||
* | ||
* @developerPreview | ||
*/ | ||
export declare function destroyAngularAppEngine(): void; | ||
/** | ||
* Represents the exports of an Angular server application entry point. | ||
@@ -204,11 +201,25 @@ */ | ||
* A reference to the function that creates an Angular server application instance. | ||
* | ||
* @note The return type is `unknown` to prevent circular dependency issues. | ||
*/ | ||
ɵgetOrCreateAngularServerApp: typeof ɵgetOrCreateAngularServerApp; | ||
ɵgetOrCreateAngularServerApp: () => unknown; | ||
/** | ||
* A reference to the function that destroys the `AngularServerApp` instance. | ||
*/ | ||
ɵdestroyAngularServerApp: typeof ɵdestroyAngularServerApp; | ||
ɵdestroyAngularServerApp: () => void; | ||
} | ||
/** | ||
* Retrieves an existing `AngularAppEngine` instance or creates a new one if none exists. | ||
* | ||
* This method ensures that only a single instance of `AngularAppEngine` is created and reused across | ||
* the application lifecycle, providing efficient resource management. If the instance does not exist, | ||
* it will be instantiated upon the first call. | ||
* | ||
* @developerPreview | ||
* @returns The existing or newly created instance of `AngularAppEngine`. | ||
*/ | ||
export declare function getOrCreateAngularAppEngine(): AngularServerAppManager; | ||
/** | ||
* Defines the names of available hooks for registering and triggering custom logic within the application. | ||
@@ -277,2 +288,26 @@ */ | ||
/** Partial representation of an HTML `Document`. */ | ||
declare interface PartialDocument { | ||
head: PartialHTMLElement; | ||
createElement(tagName: string): PartialHTMLElement; | ||
querySelector(selector: string): PartialHTMLElement | null; | ||
} | ||
/** Partial representation of an `HTMLElement`. */ | ||
declare interface PartialHTMLElement { | ||
getAttribute(name: string): string | null; | ||
setAttribute(name: string, value: string): void; | ||
hasAttribute(name: string): boolean; | ||
removeAttribute(name: string): void; | ||
appendChild(child: PartialHTMLElement): void; | ||
insertBefore(newNode: PartialHTMLElement, referenceNode?: PartialHTMLElement): void; | ||
remove(): void; | ||
name: string; | ||
textContent: string; | ||
tagName: string | null; | ||
children: PartialHTMLElement[]; | ||
next: PartialHTMLElement | null; | ||
prev: PartialHTMLElement | null; | ||
} | ||
/** | ||
@@ -337,2 +372,50 @@ * Represents the result of processing a route. | ||
/** | ||
* Angular server application engine. | ||
* Manages Angular server applications (including localized ones), handles rendering requests, | ||
* and optionally transforms index HTML before rendering. | ||
*/ | ||
export declare class ɵAngularAppEngine implements AngularServerAppManager { | ||
/** | ||
* Hooks for extending or modifying the behavior of the server application. | ||
* These hooks are used by the Angular CLI when running the development server and | ||
* provide extensibility points for the application lifecycle. | ||
* | ||
* @private | ||
*/ | ||
static ɵhooks: Hooks; | ||
/** | ||
* The manifest for the server application. | ||
*/ | ||
private readonly manifest; | ||
/** | ||
* Renders a response for the given HTTP request using the server application. | ||
* | ||
* This method processes the request, determines the appropriate route and rendering context, | ||
* and returns an HTTP response. | ||
* | ||
* If the request URL appears to be for a file (excluding `/index.html`), the method returns `null`. | ||
* A request to `https://www.example.com/page/index.html` will render the Angular route | ||
* corresponding to `https://www.example.com/page`. | ||
* | ||
* @param request - The incoming HTTP request object to be rendered. | ||
* @param requestContext - Optional additional context for the request, such as metadata. | ||
* @returns A promise that resolves to a Response object, or `null` if the request URL represents a file (e.g., `./logo.png`) | ||
* rather than an application route. | ||
*/ | ||
render(request: Request, requestContext?: unknown): Promise<Response | null>; | ||
/** | ||
* Retrieves the entry point path and locale for the Angular server application based on the provided URL. | ||
* | ||
* This method determines the appropriate entry point and locale for rendering the application by examining the URL. | ||
* If there is only one entry point available, it is returned regardless of the URL. | ||
* Otherwise, the method extracts a potential locale identifier from the URL and looks up the corresponding entry point. | ||
* | ||
* @param url - The URL used to derive the locale and determine the appropriate entry point. | ||
* @returns A function that returns a promise resolving to an object with the `EntryPointExports` type, | ||
* or `undefined` if no matching entry point is found for the extracted locale. | ||
*/ | ||
private getEntryPointFromUrl; | ||
} | ||
/** | ||
* Destroys the existing `AngularServerApp` instance, releasing associated resources and resetting the | ||
@@ -373,2 +456,24 @@ * reference to `undefined`. | ||
export declare class ɵInlineCriticalCssProcessor extends CrittersBase { | ||
readFile: (path: string) => Promise<string>; | ||
readonly outputPath?: string | undefined; | ||
private addedCspScriptsDocuments; | ||
private documentNonces; | ||
constructor(readFile: (path: string) => Promise<string>, outputPath?: string | undefined); | ||
/** | ||
* Override of the Critters `embedLinkedStylesheet` method | ||
* that makes it work with Angular's CSP APIs. | ||
*/ | ||
embedLinkedStylesheet(link: PartialHTMLElement, document: PartialDocument): Promise<unknown>; | ||
/** | ||
* Finds the CSP nonce for a specific document. | ||
*/ | ||
private findCspNonce; | ||
/** | ||
* Inserts the `script` tag that swaps the critical CSS at runtime, | ||
* if one hasn't been inserted into the document already. | ||
*/ | ||
private conditionallyInsertCspLoadingScript; | ||
} | ||
/** | ||
@@ -375,0 +480,0 @@ * Enum representing the different contexts in which server rendering can occur. |
{ | ||
"name": "@angular/ssr", | ||
"version": "19.0.0-next.1", | ||
"version": "19.0.0-next.2", | ||
"description": "Angular server side rendering utilities", | ||
@@ -16,3 +16,2 @@ "license": "MIT", | ||
"dependencies": { | ||
"critters": "0.0.24", | ||
"tslib": "^2.3.0" | ||
@@ -23,2 +22,3 @@ }, | ||
"@angular/core": "^19.0.0-next.0", | ||
"@angular/platform-server": "^19.0.0-next.0", | ||
"@angular/router": "^19.0.0-next.0" | ||
@@ -33,2 +33,3 @@ }, | ||
"@angular/router": "19.0.0-next.1", | ||
"@bazel/runfiles": "^5.8.1", | ||
"zone.js": "^0.15.0" | ||
@@ -50,7 +51,9 @@ }, | ||
"types": "./index.d.ts", | ||
"esm2022": "./esm2022/index.mjs", | ||
"esm": "./esm2022/index.mjs", | ||
"default": "./fesm2022/ssr.mjs" | ||
}, | ||
"./node": { | ||
"types": "./node/index.d.ts", | ||
"default": "./fesm2022/node.mjs" | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
1375171
15302
8
21
9
+ Added@angular/animations@19.0.4(transitive)
+ Added@angular/compiler@19.0.4(transitive)
+ Added@angular/platform-server@19.0.4(transitive)
+ Addedxhr2@0.2.1(transitive)
- Removedcritters@0.0.24
- Removedansi-styles@4.3.0(transitive)
- Removedboolbase@1.0.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcritters@0.0.24(transitive)
- Removedcss-select@5.1.0(transitive)
- Removedcss-what@6.1.0(transitive)
- Removeddom-serializer@2.0.0(transitive)
- Removeddomelementtype@2.3.0(transitive)
- Removeddomhandler@5.0.3(transitive)
- Removeddomutils@3.1.0(transitive)
- Removedentities@4.5.0(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhtmlparser2@8.0.2(transitive)
- Removednanoid@3.3.8(transitive)
- Removednth-check@2.1.1(transitive)
- Removedpicocolors@1.1.1(transitive)
- Removedpostcss@8.4.49(transitive)
- Removedpostcss-media-query-parser@0.2.3(transitive)
- Removedsource-map-js@1.2.1(transitive)
- Removedsupports-color@7.2.0(transitive)