├── ANGULAR_PACKAGE
├── BUILD_INFO
├── LICENSE
├── README.md
├── fesm2022
├── init.mjs
├── init.mjs.map
├── platform-server.mjs
├── platform-server.mjs.map
├── server-BVfcFHaW.mjs
├── server-BVfcFHaW.mjs.map
├── testing.mjs
└── testing.mjs.map
├── index.d.ts
├── init
└── index.d.ts
├── package.json
└── testing
└── index.d.ts
/ANGULAR_PACKAGE:
--------------------------------------------------------------------------------
1 | This file is used by the npm/yarn_install rule to detect APF. See https://github.com/bazelbuild/rules_nodejs/issues/927
2 |
--------------------------------------------------------------------------------
/BUILD_INFO:
--------------------------------------------------------------------------------
1 | Fri Jun 6 22:27:39 UTC 2025
2 | 21fc93bf4b2183114d7703dbea4e57c30b54c66e
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010-2025 Google LLC. https://angular.dev/license
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Angular
2 | =======
3 |
4 | The sources for this package are in the main [Angular](https://github.com/angular/angular) repo. Please file issues and pull requests against that repo.
5 |
6 | Usage information and reference details can be found in [Angular documentation](https://angular.dev/overview).
7 |
8 | License: MIT
9 |
--------------------------------------------------------------------------------
/fesm2022/platform-server.mjs:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Angular v20.1.0-next.0+sha-21fc93b
3 | * (c) 2010-2025 Google LLC. https://angular.io/
4 | * License: MIT
5 | */
6 |
7 | import { PLATFORM_SERVER_PROVIDERS, PlatformState, BEFORE_APP_SERIALIZED, platformServer, INITIAL_CONFIG, createScript } from './server-BVfcFHaW.mjs';
8 | export { ServerModule, DominoAdapter as ɵDominoAdapter, ENABLE_DOM_EMULATION as ɵENABLE_DOM_EMULATION, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS } from './server-BVfcFHaW.mjs';
9 | import { makeEnvironmentProviders, InjectionToken, ApplicationRef, ɵstartMeasuring as _startMeasuring, ɵstopMeasuring as _stopMeasuring, ɵIS_HYDRATION_DOM_REUSE_ENABLED as _IS_HYDRATION_DOM_REUSE_ENABLED, ɵannotateForHydration as _annotateForHydration, CSP_NONCE, APP_ID, ɵSSR_CONTENT_INTEGRITY_MARKER as _SSR_CONTENT_INTEGRITY_MARKER, Renderer2, Version } from '@angular/core';
10 | import '@angular/common';
11 | import '@angular/platform-browser';
12 | import '@angular/common/http';
13 | import 'rxjs';
14 |
15 | /**
16 | * Sets up providers necessary to enable server rendering functionality for the application.
17 | *
18 | * @usageNotes
19 | *
20 | * Basic example of how you can add server support to your application:
21 | * ```ts
22 | * bootstrapApplication(AppComponent, {
23 | * providers: [provideServerRendering()]
24 | * });
25 | * ```
26 | *
27 | * @publicApi
28 | * @returns A set of providers to setup the server.
29 | */
30 | function provideServerRendering() {
31 | if (typeof ngServerMode === 'undefined') {
32 | globalThis['ngServerMode'] = true;
33 | }
34 | return makeEnvironmentProviders([...PLATFORM_SERVER_PROVIDERS]);
35 | }
36 |
37 | /**
38 | * Event dispatch (JSAction) script is inlined into the HTML by the build
39 | * process to avoid extra blocking request on a page. The script looks like this:
40 | * ```html
41 | *
42 | * ```
43 | * This const represents the "id" attribute value.
44 | */
45 | const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';
46 | /**
47 | * Creates an instance of a server platform (with or without JIT compiler support
48 | * depending on the `ngJitMode` global const value), using provided options.
49 | */
50 | function createServerPlatform(options) {
51 | const extraProviders = options.platformProviders ?? [];
52 | const measuringLabel = 'createServerPlatform';
53 | _startMeasuring(measuringLabel);
54 | const platform = platformServer([
55 | { provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
56 | extraProviders,
57 | ]);
58 | _stopMeasuring(measuringLabel);
59 | return platform;
60 | }
61 | /**
62 | * Finds and returns inlined event dispatch script if it exists.
63 | * See the `EVENT_DISPATCH_SCRIPT_ID` const docs for additional info.
64 | */
65 | function findEventDispatchScript(doc) {
66 | return doc.getElementById(EVENT_DISPATCH_SCRIPT_ID);
67 | }
68 | /**
69 | * Removes inlined event dispatch script if it exists.
70 | * See the `EVENT_DISPATCH_SCRIPT_ID` const docs for additional info.
71 | */
72 | function removeEventDispatchScript(doc) {
73 | findEventDispatchScript(doc)?.remove();
74 | }
75 | /**
76 | * Annotate nodes for hydration and remove event dispatch script when not needed.
77 | */
78 | function prepareForHydration(platformState, applicationRef) {
79 | const measuringLabel = 'prepareForHydration';
80 | _startMeasuring(measuringLabel);
81 | const environmentInjector = applicationRef.injector;
82 | const doc = platformState.getDocument();
83 | if (!environmentInjector.get(_IS_HYDRATION_DOM_REUSE_ENABLED, false)) {
84 | // Hydration is diabled, remove inlined event dispatch script.
85 | // (which was injected by the build process) from the HTML.
86 | removeEventDispatchScript(doc);
87 | return;
88 | }
89 | appendSsrContentIntegrityMarker(doc);
90 | const eventTypesToReplay = _annotateForHydration(applicationRef, doc);
91 | if (eventTypesToReplay.regular.size || eventTypesToReplay.capture.size) {
92 | insertEventRecordScript(environmentInjector.get(APP_ID), doc, eventTypesToReplay, environmentInjector.get(CSP_NONCE, null));
93 | }
94 | else {
95 | // No events to replay, we should remove inlined event dispatch script
96 | // (which was injected by the build process) from the HTML.
97 | removeEventDispatchScript(doc);
98 | }
99 | _stopMeasuring(measuringLabel);
100 | }
101 | /**
102 | * Creates a marker comment node and append it into the `
`.
103 | * Some CDNs have mechanisms to remove all comment node from HTML.
104 | * This behaviour breaks hydration, so we'll detect on the client side if this
105 | * marker comment is still available or else throw an error
106 | */
107 | function appendSsrContentIntegrityMarker(doc) {
108 | // Adding a ng hydration marker comment
109 | const comment = doc.createComment(_SSR_CONTENT_INTEGRITY_MARKER);
110 | doc.body.firstChild
111 | ? doc.body.insertBefore(comment, doc.body.firstChild)
112 | : doc.body.append(comment);
113 | }
114 | /**
115 | * Adds the `ng-server-context` attribute to host elements of all bootstrapped components
116 | * within a given application.
117 | */
118 | function appendServerContextInfo(applicationRef) {
119 | const injector = applicationRef.injector;
120 | let serverContext = sanitizeServerContext(injector.get(SERVER_CONTEXT, DEFAULT_SERVER_CONTEXT));
121 | applicationRef.components.forEach((componentRef) => {
122 | const renderer = componentRef.injector.get(Renderer2);
123 | const element = componentRef.location.nativeElement;
124 | if (element) {
125 | renderer.setAttribute(element, 'ng-server-context', serverContext);
126 | }
127 | });
128 | }
129 | function insertEventRecordScript(appId, doc, eventTypesToReplay, nonce) {
130 | const measuringLabel = 'insertEventRecordScript';
131 | _startMeasuring(measuringLabel);
132 | const { regular, capture } = eventTypesToReplay;
133 | const eventDispatchScript = findEventDispatchScript(doc);
134 | // Note: this is only true when build with the CLI tooling, which inserts the script in the HTML
135 | if (eventDispatchScript) {
136 | // This is defined in packages/core/primitives/event-dispatch/contract_binary.ts
137 | const replayScriptContents = `window.__jsaction_bootstrap(` +
138 | `document.body,` +
139 | `"${appId}",` +
140 | `${JSON.stringify(Array.from(regular))},` +
141 | `${JSON.stringify(Array.from(capture))}` +
142 | `);`;
143 | const replayScript = createScript(doc, replayScriptContents, nonce);
144 | // Insert replay script right after inlined event dispatch script, since it
145 | // relies on `__jsaction_bootstrap` to be defined in the global scope.
146 | eventDispatchScript.after(replayScript);
147 | }
148 | _stopMeasuring(measuringLabel);
149 | }
150 | /**
151 | * Renders an Angular application to a string.
152 | *
153 | * @private
154 | *
155 | * @param platformRef - Reference to the Angular platform.
156 | * @param applicationRef - Reference to the Angular application.
157 | * @returns A promise that resolves to the rendered string.
158 | */
159 | async function renderInternal(platformRef, applicationRef) {
160 | const platformState = platformRef.injector.get(PlatformState);
161 | prepareForHydration(platformState, applicationRef);
162 | appendServerContextInfo(applicationRef);
163 | // Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
164 | const environmentInjector = applicationRef.injector;
165 | const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);
166 | if (callbacks) {
167 | const asyncCallbacks = [];
168 | for (const callback of callbacks) {
169 | try {
170 | const callbackResult = callback();
171 | if (callbackResult) {
172 | asyncCallbacks.push(callbackResult);
173 | }
174 | }
175 | catch (e) {
176 | // Ignore exceptions.
177 | console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);
178 | }
179 | }
180 | if (asyncCallbacks.length) {
181 | for (const result of await Promise.allSettled(asyncCallbacks)) {
182 | if (result.status === 'rejected') {
183 | console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', result.reason);
184 | }
185 | }
186 | }
187 | }
188 | return platformState.renderToString();
189 | }
190 | /**
191 | * Destroy the application in a macrotask, this allows pending promises to be settled and errors
192 | * to be surfaced to the users.
193 | */
194 | function asyncDestroyPlatform(platformRef) {
195 | return new Promise((resolve) => {
196 | setTimeout(() => {
197 | platformRef.destroy();
198 | resolve();
199 | }, 0);
200 | });
201 | }
202 | /**
203 | * Specifies the value that should be used if no server context value has been provided.
204 | */
205 | const DEFAULT_SERVER_CONTEXT = 'other';
206 | /**
207 | * An internal token that allows providing extra information about the server context
208 | * (e.g. whether SSR or SSG was used). The value is a string and characters other
209 | * than [a-zA-Z0-9\-] are removed. See the default value in `DEFAULT_SERVER_CONTEXT` const.
210 | */
211 | const SERVER_CONTEXT = new InjectionToken('SERVER_CONTEXT');
212 | /**
213 | * Sanitizes provided server context:
214 | * - removes all characters other than a-z, A-Z, 0-9 and `-`
215 | * - returns `other` if nothing is provided or the string is empty after sanitization
216 | */
217 | function sanitizeServerContext(serverContext) {
218 | const context = serverContext.replace(/[^a-zA-Z0-9\-]/g, '');
219 | return context.length > 0 ? context : DEFAULT_SERVER_CONTEXT;
220 | }
221 | /**
222 | * Bootstraps an application using provided NgModule and serializes the page content to string.
223 | *
224 | * @param moduleType A reference to an NgModule that should be used for bootstrap.
225 | * @param options Additional configuration for the render operation:
226 | * - `document` - the document of the page to render, either as an HTML string or
227 | * as a reference to the `document` instance.
228 | * - `url` - the URL for the current render request.
229 | * - `extraProviders` - set of platform level providers for the current render request.
230 | *
231 | * @publicApi
232 | */
233 | async function renderModule(moduleType, options) {
234 | const { document, url, extraProviders: platformProviders } = options;
235 | const platformRef = createServerPlatform({ document, url, platformProviders });
236 | try {
237 | const moduleRef = await platformRef.bootstrapModule(moduleType);
238 | const applicationRef = moduleRef.injector.get(ApplicationRef);
239 | const measuringLabel = 'whenStable';
240 | _startMeasuring(measuringLabel);
241 | // Block until application is stable.
242 | await applicationRef.whenStable();
243 | _stopMeasuring(measuringLabel);
244 | return await renderInternal(platformRef, applicationRef);
245 | }
246 | finally {
247 | await asyncDestroyPlatform(platformRef);
248 | }
249 | }
250 | /**
251 | * Bootstraps an instance of an Angular application and renders it to a string.
252 |
253 | * ```ts
254 | * const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
255 | * const output: string = await renderApplication(bootstrap);
256 | * ```
257 | *
258 | * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
259 | * instance once resolved.
260 | * @param options Additional configuration for the render operation:
261 | * - `document` - the document of the page to render, either as an HTML string or
262 | * as a reference to the `document` instance.
263 | * - `url` - the URL for the current render request.
264 | * - `platformProviders` - the platform level providers for the current render request.
265 | *
266 | * @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
267 | *
268 | * @publicApi
269 | */
270 | async function renderApplication(bootstrap, options) {
271 | const renderAppLabel = 'renderApplication';
272 | const bootstrapLabel = 'bootstrap';
273 | const _renderLabel = '_render';
274 | _startMeasuring(renderAppLabel);
275 | const platformRef = createServerPlatform(options);
276 | try {
277 | _startMeasuring(bootstrapLabel);
278 | const applicationRef = await bootstrap();
279 | _stopMeasuring(bootstrapLabel);
280 | _startMeasuring(_renderLabel);
281 | const measuringLabel = 'whenStable';
282 | _startMeasuring(measuringLabel);
283 | // Block until application is stable.
284 | await applicationRef.whenStable();
285 | _stopMeasuring(measuringLabel);
286 | const rendered = await renderInternal(platformRef, applicationRef);
287 | _stopMeasuring(_renderLabel);
288 | return rendered;
289 | }
290 | finally {
291 | await asyncDestroyPlatform(platformRef);
292 | _stopMeasuring(renderAppLabel);
293 | }
294 | }
295 |
296 | /**
297 | * @module
298 | * @description
299 | * Entry point for all public APIs of the platform-server package.
300 | */
301 | /**
302 | * @publicApi
303 | */
304 | const VERSION = new Version('20.1.0-next.0+sha-21fc93b');
305 |
306 | export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, VERSION, platformServer, provideServerRendering, renderApplication, renderModule, SERVER_CONTEXT as ɵSERVER_CONTEXT, renderInternal as ɵrenderInternal };
307 | //# sourceMappingURL=platform-server.mjs.map
308 |
--------------------------------------------------------------------------------
/fesm2022/platform-server.mjs.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"platform-server.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/platform-server/src/provide_server.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/platform-server/src/utils.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/platform-server/src/version.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {EnvironmentProviders, makeEnvironmentProviders} from '@angular/core';\n\nimport {PLATFORM_SERVER_PROVIDERS} from './server';\n\n/**\n * Sets up providers necessary to enable server rendering functionality for the application.\n *\n * @usageNotes\n *\n * Basic example of how you can add server support to your application:\n * ```ts\n * bootstrapApplication(AppComponent, {\n * providers: [provideServerRendering()]\n * });\n * ```\n *\n * @publicApi\n * @returns A set of providers to setup the server.\n */\nexport function provideServerRendering(): EnvironmentProviders {\n if (typeof ngServerMode === 'undefined') {\n globalThis['ngServerMode'] = true;\n }\n\n return makeEnvironmentProviders([...PLATFORM_SERVER_PROVIDERS]);\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n APP_ID,\n ApplicationRef,\n CSP_NONCE,\n InjectionToken,\n PlatformRef,\n Provider,\n Renderer2,\n StaticProvider,\n Type,\n ɵannotateForHydration as annotateForHydration,\n ɵIS_HYDRATION_DOM_REUSE_ENABLED as IS_HYDRATION_DOM_REUSE_ENABLED,\n ɵSSR_CONTENT_INTEGRITY_MARKER as SSR_CONTENT_INTEGRITY_MARKER,\n ɵstartMeasuring as startMeasuring,\n ɵstopMeasuring as stopMeasuring,\n} from '@angular/core';\n\nimport {PlatformState} from './platform_state';\nimport {platformServer} from './server';\nimport {BEFORE_APP_SERIALIZED, INITIAL_CONFIG} from './tokens';\nimport {createScript} from './transfer_state';\n\n/**\n * Event dispatch (JSAction) script is inlined into the HTML by the build\n * process to avoid extra blocking request on a page. The script looks like this:\n * ```html\n * \n * ```\n * This const represents the \"id\" attribute value.\n */\nexport const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';\n\ninterface PlatformOptions {\n document?: string | Document;\n url?: string;\n platformProviders?: Provider[];\n}\n\n/**\n * Creates an instance of a server platform (with or without JIT compiler support\n * depending on the `ngJitMode` global const value), using provided options.\n */\nfunction createServerPlatform(options: PlatformOptions): PlatformRef {\n const extraProviders = options.platformProviders ?? [];\n const measuringLabel = 'createServerPlatform';\n startMeasuring(measuringLabel);\n\n const platform = platformServer([\n {provide: INITIAL_CONFIG, useValue: {document: options.document, url: options.url}},\n extraProviders,\n ]);\n\n stopMeasuring(measuringLabel);\n return platform;\n}\n\n/**\n * Finds and returns inlined event dispatch script if it exists.\n * See the `EVENT_DISPATCH_SCRIPT_ID` const docs for additional info.\n */\nfunction findEventDispatchScript(doc: Document) {\n return doc.getElementById(EVENT_DISPATCH_SCRIPT_ID);\n}\n\n/**\n * Removes inlined event dispatch script if it exists.\n * See the `EVENT_DISPATCH_SCRIPT_ID` const docs for additional info.\n */\nfunction removeEventDispatchScript(doc: Document) {\n findEventDispatchScript(doc)?.remove();\n}\n\n/**\n * Annotate nodes for hydration and remove event dispatch script when not needed.\n */\nfunction prepareForHydration(platformState: PlatformState, applicationRef: ApplicationRef): void {\n const measuringLabel = 'prepareForHydration';\n startMeasuring(measuringLabel);\n const environmentInjector = applicationRef.injector;\n const doc = platformState.getDocument();\n\n if (!environmentInjector.get(IS_HYDRATION_DOM_REUSE_ENABLED, false)) {\n // Hydration is diabled, remove inlined event dispatch script.\n // (which was injected by the build process) from the HTML.\n removeEventDispatchScript(doc);\n\n return;\n }\n\n appendSsrContentIntegrityMarker(doc);\n\n const eventTypesToReplay = annotateForHydration(applicationRef, doc);\n if (eventTypesToReplay.regular.size || eventTypesToReplay.capture.size) {\n insertEventRecordScript(\n environmentInjector.get(APP_ID),\n doc,\n eventTypesToReplay,\n environmentInjector.get(CSP_NONCE, null),\n );\n } else {\n // No events to replay, we should remove inlined event dispatch script\n // (which was injected by the build process) from the HTML.\n removeEventDispatchScript(doc);\n }\n stopMeasuring(measuringLabel);\n}\n\n/**\n * Creates a marker comment node and append it into the ``.\n * Some CDNs have mechanisms to remove all comment node from HTML.\n * This behaviour breaks hydration, so we'll detect on the client side if this\n * marker comment is still available or else throw an error\n */\nfunction appendSsrContentIntegrityMarker(doc: Document) {\n // Adding a ng hydration marker comment\n const comment = doc.createComment(SSR_CONTENT_INTEGRITY_MARKER);\n doc.body.firstChild\n ? doc.body.insertBefore(comment, doc.body.firstChild)\n : doc.body.append(comment);\n}\n\n/**\n * Adds the `ng-server-context` attribute to host elements of all bootstrapped components\n * within a given application.\n */\nfunction appendServerContextInfo(applicationRef: ApplicationRef) {\n const injector = applicationRef.injector;\n let serverContext = sanitizeServerContext(injector.get(SERVER_CONTEXT, DEFAULT_SERVER_CONTEXT));\n applicationRef.components.forEach((componentRef) => {\n const renderer = componentRef.injector.get(Renderer2);\n const element = componentRef.location.nativeElement;\n if (element) {\n renderer.setAttribute(element, 'ng-server-context', serverContext);\n }\n });\n}\n\nfunction insertEventRecordScript(\n appId: string,\n doc: Document,\n eventTypesToReplay: {regular: Set; capture: Set},\n nonce: string | null,\n): void {\n const measuringLabel = 'insertEventRecordScript';\n startMeasuring(measuringLabel);\n const {regular, capture} = eventTypesToReplay;\n const eventDispatchScript = findEventDispatchScript(doc);\n\n // Note: this is only true when build with the CLI tooling, which inserts the script in the HTML\n if (eventDispatchScript) {\n // This is defined in packages/core/primitives/event-dispatch/contract_binary.ts\n const replayScriptContents =\n `window.__jsaction_bootstrap(` +\n `document.body,` +\n `\"${appId}\",` +\n `${JSON.stringify(Array.from(regular))},` +\n `${JSON.stringify(Array.from(capture))}` +\n `);`;\n\n const replayScript = createScript(doc, replayScriptContents, nonce);\n\n // Insert replay script right after inlined event dispatch script, since it\n // relies on `__jsaction_bootstrap` to be defined in the global scope.\n eventDispatchScript.after(replayScript);\n }\n stopMeasuring(measuringLabel);\n}\n\n/**\n * Renders an Angular application to a string.\n *\n * @private\n *\n * @param platformRef - Reference to the Angular platform.\n * @param applicationRef - Reference to the Angular application.\n * @returns A promise that resolves to the rendered string.\n */\nexport async function renderInternal(\n platformRef: PlatformRef,\n applicationRef: ApplicationRef,\n): Promise {\n const platformState = platformRef.injector.get(PlatformState);\n prepareForHydration(platformState, applicationRef);\n appendServerContextInfo(applicationRef);\n\n // Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.\n const environmentInjector = applicationRef.injector;\n const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);\n if (callbacks) {\n const asyncCallbacks: Promise[] = [];\n for (const callback of callbacks) {\n try {\n const callbackResult = callback();\n if (callbackResult) {\n asyncCallbacks.push(callbackResult);\n }\n } catch (e) {\n // Ignore exceptions.\n console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);\n }\n }\n\n if (asyncCallbacks.length) {\n for (const result of await Promise.allSettled(asyncCallbacks)) {\n if (result.status === 'rejected') {\n console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', result.reason);\n }\n }\n }\n }\n\n return platformState.renderToString();\n}\n\n/**\n * Destroy the application in a macrotask, this allows pending promises to be settled and errors\n * to be surfaced to the users.\n */\nfunction asyncDestroyPlatform(platformRef: PlatformRef): Promise {\n return new Promise((resolve) => {\n setTimeout(() => {\n platformRef.destroy();\n resolve();\n }, 0);\n });\n}\n\n/**\n * Specifies the value that should be used if no server context value has been provided.\n */\nconst DEFAULT_SERVER_CONTEXT = 'other';\n\n/**\n * An internal token that allows providing extra information about the server context\n * (e.g. whether SSR or SSG was used). The value is a string and characters other\n * than [a-zA-Z0-9\\-] are removed. See the default value in `DEFAULT_SERVER_CONTEXT` const.\n */\nexport const SERVER_CONTEXT = new InjectionToken('SERVER_CONTEXT');\n\n/**\n * Sanitizes provided server context:\n * - removes all characters other than a-z, A-Z, 0-9 and `-`\n * - returns `other` if nothing is provided or the string is empty after sanitization\n */\nfunction sanitizeServerContext(serverContext: string): string {\n const context = serverContext.replace(/[^a-zA-Z0-9\\-]/g, '');\n return context.length > 0 ? context : DEFAULT_SERVER_CONTEXT;\n}\n\n/**\n * Bootstraps an application using provided NgModule and serializes the page content to string.\n *\n * @param moduleType A reference to an NgModule that should be used for bootstrap.\n * @param options Additional configuration for the render operation:\n * - `document` - the document of the page to render, either as an HTML string or\n * as a reference to the `document` instance.\n * - `url` - the URL for the current render request.\n * - `extraProviders` - set of platform level providers for the current render request.\n *\n * @publicApi\n */\nexport async function renderModule(\n moduleType: Type,\n options: {document?: string | Document; url?: string; extraProviders?: StaticProvider[]},\n): Promise {\n const {document, url, extraProviders: platformProviders} = options;\n const platformRef = createServerPlatform({document, url, platformProviders});\n try {\n const moduleRef = await platformRef.bootstrapModule(moduleType);\n const applicationRef = moduleRef.injector.get(ApplicationRef);\n\n const measuringLabel = 'whenStable';\n startMeasuring(measuringLabel);\n // Block until application is stable.\n await applicationRef.whenStable();\n stopMeasuring(measuringLabel);\n\n return await renderInternal(platformRef, applicationRef);\n } finally {\n await asyncDestroyPlatform(platformRef);\n }\n}\n\n/**\n * Bootstraps an instance of an Angular application and renders it to a string.\n\n * ```ts\n * const bootstrap = () => bootstrapApplication(RootComponent, appConfig);\n * const output: string = await renderApplication(bootstrap);\n * ```\n *\n * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`\n * instance once resolved.\n * @param options Additional configuration for the render operation:\n * - `document` - the document of the page to render, either as an HTML string or\n * as a reference to the `document` instance.\n * - `url` - the URL for the current render request.\n * - `platformProviders` - the platform level providers for the current render request.\n *\n * @returns A Promise, that returns serialized (to a string) rendered page, once resolved.\n *\n * @publicApi\n */\nexport async function renderApplication(\n bootstrap: () => Promise,\n options: {document?: string | Document; url?: string; platformProviders?: Provider[]},\n): Promise {\n const renderAppLabel = 'renderApplication';\n const bootstrapLabel = 'bootstrap';\n const _renderLabel = '_render';\n\n startMeasuring(renderAppLabel);\n const platformRef = createServerPlatform(options);\n try {\n startMeasuring(bootstrapLabel);\n const applicationRef = await bootstrap();\n stopMeasuring(bootstrapLabel);\n\n startMeasuring(_renderLabel);\n\n const measuringLabel = 'whenStable';\n startMeasuring(measuringLabel);\n // Block until application is stable.\n await applicationRef.whenStable();\n stopMeasuring(measuringLabel);\n\n const rendered = await renderInternal(platformRef, applicationRef);\n stopMeasuring(_renderLabel);\n return rendered;\n } finally {\n await asyncDestroyPlatform(platformRef);\n stopMeasuring(renderAppLabel);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the platform-server package.\n */\n\nimport {Version} from '@angular/core';\n\n/**\n * @publicApi\n */\nexport const VERSION = new Version('20.1.0-next.0+sha-21fc93b');\n"],"names":["startMeasuring","stopMeasuring","IS_HYDRATION_DOM_REUSE_ENABLED","annotateForHydration","SSR_CONTENT_INTEGRITY_MARKER"],"mappings":";;;;;;;;;;;;;;AAYA;;;;;;;;;;;;;;AAcG;SACa,sBAAsB,GAAA;AACpC,IAAA,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE;AACvC,QAAA,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI;;AAGnC,IAAA,OAAO,wBAAwB,CAAC,CAAC,GAAG,yBAAyB,CAAC,CAAC;AACjE;;ACHA;;;;;;;AAOG;AACI,MAAM,wBAAwB,GAAG,4BAA4B;AAQpE;;;AAGG;AACH,SAAS,oBAAoB,CAAC,OAAwB,EAAA;AACpD,IAAA,MAAM,cAAc,GAAG,OAAO,CAAC,iBAAiB,IAAI,EAAE;IACtD,MAAM,cAAc,GAAG,sBAAsB;IAC7CA,eAAc,CAAC,cAAc,CAAC;IAE9B,MAAM,QAAQ,GAAG,cAAc,CAAC;AAC9B,QAAA,EAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAC,EAAC;QACnF,cAAc;AACf,KAAA,CAAC;IAEFC,cAAa,CAAC,cAAc,CAAC;AAC7B,IAAA,OAAO,QAAQ;AACjB;AAEA;;;AAGG;AACH,SAAS,u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EAAA;IAErF,MAAM,cAAc,GAAG,mBAAmB;IAC1C,MAAM,cAAc,GAAG,WAAW;IAClC,MAAM,YAAY,GAAG,SAAS;IAE9BD,eAAc,CAAC,cAAc,CAAC;AAC9B,IAAA,MAAM,WAAW,GAAG,oBAAoB,CAAC,OAAO,CAAC;AACjD,IAAA,IAAI;QACFA,eAAc,CAAC,cAAc,CAAC;AAC9B,QAAA,MAAM,cAAc,GAAG,MAAM,SAAS,EAAE;QACxCC,cAAa,CAAC,cAAc,CAAC;QAE7BD,eAAc,CAAC,YAAY,CAAC;QAE5B,MAAM,cAAc,GAAG,YAAY;QACnCA,eAAc,CAAC,cAAc,CAAC;;AAE9B,QAAA,MAAM,cAAc,CAAC,UAAU,EAAE;QACjCC,cAAa,CAAC,cAAc,CAAC;QAE7B,MAAM,QAAQ,GAAG,MAAM,cAAc,CAAC,WAAW,EAAE,cAAc,CAAC;QAClEA,cAAa,CAAC,YAAY,CAAC;AAC3B,QAAA,OAAO,QAAQ;;YACP;AACR,QAAA,MAAM,oBAAoB,CAAC,WAAW,CAAC;QACvCA,cAAa,CAAC,cAAc,CAAC;;AAEjC;;AC7UA;;;;AAIG;AAIH;;AAEG;MACU,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB;;;;"}
--------------------------------------------------------------------------------
/fesm2022/testing.mjs:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Angular v20.1.0-next.0+sha-21fc93b
3 | * (c) 2010-2025 Google LLC. https://angular.io/
4 | * License: MIT
5 | */
6 |
7 | import * as i0 from '@angular/core';
8 | import { createPlatformFactory, platformCore, NgModule } from '@angular/core';
9 | import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
10 | import { SERVER_RENDER_PROVIDERS, INTERNAL_SERVER_PLATFORM_PROVIDERS } from './server-BVfcFHaW.mjs';
11 | import '@angular/common';
12 | import '@angular/platform-browser';
13 | import '@angular/common/http';
14 | import 'rxjs';
15 |
16 | const INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS = [
17 | ...INTERNAL_SERVER_PLATFORM_PROVIDERS,
18 | ];
19 | /**
20 | * Platform for testing
21 | *
22 | * @publicApi
23 | * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.
24 | */
25 | const platformServerTesting = createPlatformFactory(platformCore, 'serverTesting', INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS);
26 | /**
27 | * NgModule for testing.
28 | *
29 | * @publicApi
30 | * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.
31 | */
32 | class ServerTestingModule {
33 | static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.0+sha-21fc93b", ngImport: i0, type: ServerTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
34 | static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.0+sha-21fc93b", ngImport: i0, type: ServerTestingModule, exports: [BrowserDynamicTestingModule] });
35 | static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.0+sha-21fc93b", ngImport: i0, type: ServerTestingModule, providers: SERVER_RENDER_PROVIDERS, imports: [BrowserDynamicTestingModule] });
36 | }
37 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.0+sha-21fc93b", ngImport: i0, type: ServerTestingModule, decorators: [{
38 | type: NgModule,
39 | args: [{
40 | exports: [BrowserDynamicTestingModule],
41 | providers: SERVER_RENDER_PROVIDERS,
42 | }]
43 | }] });
44 |
45 | export { ServerTestingModule, platformServerTesting };
46 | //# sourceMappingURL=testing.mjs.map
47 |
--------------------------------------------------------------------------------
/fesm2022/testing.mjs.map:
--------------------------------------------------------------------------------
1 | {"version":3,"file":"testing.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/platform-server/testing/src/server.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n createPlatformFactory,\n NgModule,\n platformCore,\n PlatformRef,\n StaticProvider,\n} from '@angular/core';\nimport {BrowserDynamicTestingModule} from '@angular/platform-browser-dynamic/testing';\nimport {\n ɵINTERNAL_SERVER_PLATFORM_PROVIDERS as INTERNAL_SERVER_PLATFORM_PROVIDERS,\n ɵSERVER_RENDER_PROVIDERS as SERVER_RENDER_PROVIDERS,\n} from '../../index';\n\nconst INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS: StaticProvider[] = [\n ...INTERNAL_SERVER_PLATFORM_PROVIDERS,\n];\n\n/**\n * Platform for testing\n *\n * @publicApi\n * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.\n */\nexport const platformServerTesting: (extraProviders?: StaticProvider[]) => PlatformRef =\n createPlatformFactory(\n platformCore,\n 'serverTesting',\n INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS,\n );\n\n/**\n * NgModule for testing.\n *\n * @publicApi\n * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.\n */\n@NgModule({\n exports: [BrowserDynamicTestingModule],\n providers: SERVER_RENDER_PROVIDERS,\n})\nexport class ServerTestingModule {}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAM,kDAAkD,GAAqB;AAC3E,IAAA,GAAG,kCAAkC;CACtC;AAED;;;;;AAKG;AACI,MAAM,qBAAqB,GAChC,qBAAqB,CACnB,YAAY,EACZ,eAAe,EACf,kDAAkD;AAGtD;;;;;AAKG;MAKU,mBAAmB,CAAA;kHAAnB,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YAHpB,2BAA2B,CAAA,EAAA,CAAA;mHAG1B,mBAAmB,EAAA,SAAA,EAFnB,uBAAuB,EAAA,OAAA,EAAA,CADxB,2BAA2B,CAAA,EAAA,CAAA;;sGAG1B,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAJ/B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,2BAA2B,CAAC;AACtC,oBAAA,SAAS,EAAE,uBAAuB;AACnC,iBAAA;;;;;"}
--------------------------------------------------------------------------------
/index.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Angular v20.1.0-next.0+sha-21fc93b
3 | * (c) 2010-2025 Google LLC. https://angular.io/
4 | * License: MIT
5 | */
6 |
7 | import * as i0 from '@angular/core';
8 | import { EnvironmentProviders, StaticProvider, Provider, PlatformRef, InjectionToken, ApplicationRef, Type, Version } from '@angular/core';
9 | import * as i1 from '@angular/platform-browser';
10 | import { ɵBrowserDomAdapter as _BrowserDomAdapter } from '@angular/platform-browser';
11 |
12 | /**
13 | * Representation of the current platform state.
14 | *
15 | * @publicApi
16 | */
17 | declare class PlatformState {
18 | private _doc;
19 | constructor(_doc: any);
20 | /**
21 | * Renders the current state of the platform to string.
22 | */
23 | renderToString(): string;
24 | /**
25 | * Returns the current DOM state.
26 | */
27 | getDocument(): any;
28 | static ɵfac: i0.ɵɵFactoryDeclaration;
29 | static ɵprov: i0.ɵɵInjectableDeclaration;
30 | }
31 |
32 | /**
33 | * Sets up providers necessary to enable server rendering functionality for the application.
34 | *
35 | * @usageNotes
36 | *
37 | * Basic example of how you can add server support to your application:
38 | * ```ts
39 | * bootstrapApplication(AppComponent, {
40 | * providers: [provideServerRendering()]
41 | * });
42 | * ```
43 | *
44 | * @publicApi
45 | * @returns A set of providers to setup the server.
46 | */
47 | declare function provideServerRendering(): EnvironmentProviders;
48 |
49 | declare const INTERNAL_SERVER_PLATFORM_PROVIDERS: StaticProvider[];
50 | declare const SERVER_RENDER_PROVIDERS: Provider[];
51 | /**
52 | * The ng module for the server.
53 | *
54 | * @publicApi
55 | */
56 | declare class ServerModule {
57 | static ɵfac: i0.ɵɵFactoryDeclaration;
58 | static ɵmod: i0.ɵɵNgModuleDeclaration;
59 | static ɵinj: i0.ɵɵInjectorDeclaration;
60 | }
61 | /**
62 | * @publicApi
63 | */
64 | declare function platformServer(extraProviders?: StaticProvider[] | undefined): PlatformRef;
65 |
66 | /**
67 | * Config object passed to initialize the platform.
68 | *
69 | * @publicApi
70 | */
71 | interface PlatformConfig {
72 | /**
73 | * The initial DOM to use to bootstrap the server application.
74 | * @default create a new DOM using Domino
75 | */
76 | document?: string;
77 | /**
78 | * The URL for the current application state. This is used for initializing
79 | * the platform's location. `protocol`, `hostname`, and `port` will be
80 | * overridden if `baseUrl` is set.
81 | * @default none
82 | */
83 | url?: string;
84 | }
85 | /**
86 | * The DI token for setting the initial config for the platform.
87 | *
88 | * @publicApi
89 | */
90 | declare const INITIAL_CONFIG: InjectionToken;
91 | /**
92 | * A function that will be executed when calling `renderApplication` or
93 | * `renderModule` just before current platform state is rendered to string.
94 | *
95 | * @publicApi
96 | */
97 | declare const BEFORE_APP_SERIALIZED: InjectionToken void | Promise)[]>;
98 | declare const ENABLE_DOM_EMULATION: InjectionToken;
99 |
100 | /**
101 | * Renders an Angular application to a string.
102 | *
103 | * @private
104 | *
105 | * @param platformRef - Reference to the Angular platform.
106 | * @param applicationRef - Reference to the Angular application.
107 | * @returns A promise that resolves to the rendered string.
108 | */
109 | declare function renderInternal(platformRef: PlatformRef, applicationRef: ApplicationRef): Promise;
110 | /**
111 | * An internal token that allows providing extra information about the server context
112 | * (e.g. whether SSR or SSG was used). The value is a string and characters other
113 | * than [a-zA-Z0-9\-] are removed. See the default value in `DEFAULT_SERVER_CONTEXT` const.
114 | */
115 | declare const SERVER_CONTEXT: InjectionToken;
116 | /**
117 | * Bootstraps an application using provided NgModule and serializes the page content to string.
118 | *
119 | * @param moduleType A reference to an NgModule that should be used for bootstrap.
120 | * @param options Additional configuration for the render operation:
121 | * - `document` - the document of the page to render, either as an HTML string or
122 | * as a reference to the `document` instance.
123 | * - `url` - the URL for the current render request.
124 | * - `extraProviders` - set of platform level providers for the current render request.
125 | *
126 | * @publicApi
127 | */
128 | declare function renderModule(moduleType: Type, options: {
129 | document?: string | Document;
130 | url?: string;
131 | extraProviders?: StaticProvider[];
132 | }): Promise;
133 | /**
134 | * Bootstraps an instance of an Angular application and renders it to a string.
135 |
136 | * ```ts
137 | * const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
138 | * const output: string = await renderApplication(bootstrap);
139 | * ```
140 | *
141 | * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
142 | * instance once resolved.
143 | * @param options Additional configuration for the render operation:
144 | * - `document` - the document of the page to render, either as an HTML string or
145 | * as a reference to the `document` instance.
146 | * - `url` - the URL for the current render request.
147 | * - `platformProviders` - the platform level providers for the current render request.
148 | *
149 | * @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
150 | *
151 | * @publicApi
152 | */
153 | declare function renderApplication(bootstrap: () => Promise, options: {
154 | document?: string | Document;
155 | url?: string;
156 | platformProviders?: Provider[];
157 | }): Promise;
158 |
159 | /**
160 | * DOM Adapter for the server platform based on https://github.com/fgnass/domino.
161 | */
162 | declare class DominoAdapter extends _BrowserDomAdapter {
163 | static makeCurrent(): void;
164 | readonly supportsDOMEvents = false;
165 | private static defaultDoc;
166 | createHtmlDocument(): Document;
167 | getDefaultDocument(): Document;
168 | isElementNode(node: any): boolean;
169 | isShadowRoot(node: any): boolean;
170 | /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
171 | getGlobalEventTarget(doc: Document, target: string): EventTarget | null;
172 | getBaseHref(doc: Document): string;
173 | dispatchEvent(el: Node, evt: any): void;
174 | getUserAgent(): string;
175 | getCookie(name: string): string;
176 | }
177 |
178 | /**
179 | * @module
180 | * @description
181 | * Entry point for all public APIs of the platform-server package.
182 | */
183 |
184 | /**
185 | * @publicApi
186 | */
187 | declare const VERSION: Version;
188 |
189 | export { BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformState, ServerModule, VERSION, platformServer, provideServerRendering, renderApplication, renderModule, DominoAdapter as ɵDominoAdapter, ENABLE_DOM_EMULATION as ɵENABLE_DOM_EMULATION, INTERNAL_SERVER_PLATFORM_PROVIDERS as ɵINTERNAL_SERVER_PLATFORM_PROVIDERS, SERVER_CONTEXT as ɵSERVER_CONTEXT, SERVER_RENDER_PROVIDERS as ɵSERVER_RENDER_PROVIDERS, renderInternal as ɵrenderInternal };
190 | export type { PlatformConfig };
191 |
--------------------------------------------------------------------------------
/init/index.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Angular v20.1.0-next.0+sha-21fc93b
3 | * (c) 2010-2025 Google LLC. https://angular.io/
4 | * License: MIT
5 | */
6 |
7 | declare const ɵɵmoduleMarker = true;
8 |
9 | export { ɵɵmoduleMarker };
10 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@angular/platform-server",
3 | "version": "20.1.0-next.0+sha-21fc93b",
4 | "description": "Angular - library for using Angular in Node.js",
5 | "author": "angular",
6 | "license": "MIT",
7 | "engines": {
8 | "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
9 | },
10 | "peerDependencies": {
11 | "@angular/common": "20.1.0-next.0+sha-21fc93b",
12 | "@angular/compiler": "20.1.0-next.0+sha-21fc93b",
13 | "@angular/core": "20.1.0-next.0+sha-21fc93b",
14 | "@angular/platform-browser": "20.1.0-next.0+sha-21fc93b",
15 | "rxjs": "^6.5.3 || ^7.4.0"
16 | },
17 | "dependencies": {
18 | "tslib": "^2.3.0",
19 | "xhr2": "^0.2.0"
20 | },
21 | "repository": {
22 | "type": "git",
23 | "url": "https://github.com/angular/angular.git",
24 | "directory": "packages/platform-server"
25 | },
26 | "ng-update": {
27 | "packageGroup": [
28 | "@angular/core",
29 | "@angular/bazel",
30 | "@angular/common",
31 | "@angular/compiler",
32 | "@angular/compiler-cli",
33 | "@angular/animations",
34 | "@angular/elements",
35 | "@angular/platform-browser",
36 | "@angular/platform-browser-dynamic",
37 | "@angular/forms",
38 | "@angular/platform-server",
39 | "@angular/upgrade",
40 | "@angular/router",
41 | "@angular/language-service",
42 | "@angular/localize",
43 | "@angular/service-worker"
44 | ]
45 | },
46 | "sideEffects": [
47 | "./fesm2022/init.mjs"
48 | ],
49 | "module": "./fesm2022/platform-server.mjs",
50 | "typings": "./index.d.ts",
51 | "type": "module",
52 | "exports": {
53 | "./package.json": {
54 | "default": "./package.json"
55 | },
56 | ".": {
57 | "types": "./index.d.ts",
58 | "default": "./fesm2022/platform-server.mjs"
59 | },
60 | "./init": {
61 | "types": "./init/index.d.ts",
62 | "default": "./fesm2022/init.mjs"
63 | },
64 | "./testing": {
65 | "types": "./testing/index.d.ts",
66 | "default": "./fesm2022/testing.mjs"
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/testing/index.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * @license Angular v20.1.0-next.0+sha-21fc93b
3 | * (c) 2010-2025 Google LLC. https://angular.io/
4 | * License: MIT
5 | */
6 |
7 | import * as i0 from '@angular/core';
8 | import { StaticProvider, PlatformRef } from '@angular/core';
9 | import * as i1 from '@angular/platform-browser-dynamic/testing';
10 |
11 | /**
12 | * Platform for testing
13 | *
14 | * @publicApi
15 | * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.
16 | */
17 | declare const platformServerTesting: (extraProviders?: StaticProvider[]) => PlatformRef;
18 | /**
19 | * NgModule for testing.
20 | *
21 | * @publicApi
22 | * @deprecated from v20.0.0, use e2e testing to verify SSR behavior.
23 | */
24 | declare class ServerTestingModule {
25 | static ɵfac: i0.ɵɵFactoryDeclaration;
26 | static ɵmod: i0.ɵɵNgModuleDeclaration;
27 | static ɵinj: i0.ɵɵInjectorDeclaration;
28 | }
29 |
30 | export { ServerTestingModule, platformServerTesting };
31 |
--------------------------------------------------------------------------------