@angular/platform-server 22.0.0 → 22.1.0-next.0
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/fesm2022/_server-chunk.mjs +49 -34
- package/fesm2022/_server-chunk.mjs.map +1 -1
- package/fesm2022/init.mjs +1 -1
- package/fesm2022/platform-server.mjs +4 -4
- package/fesm2022/platform-server.mjs.map +1 -1
- package/fesm2022/testing.mjs +5 -5
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +5 -5
- package/third_party/domino/bundled-domino.mjs +22 -22
- package/third_party/domino/bundled-domino.mjs.map +1 -1
- package/types/init.d.ts +1 -1
- package/types/platform-server.d.ts +16 -2
- package/types/testing.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-server.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/platform-server/src/provide_server.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/bin/packages/platform-server/src/utils.ts","../../../../../darwin_arm64-fastbuild-ST-fdfa778d11ba/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 {ɵHTTP_FETCH_MAX_RESPONSE_SIZE as HTTP_FETCH_MAX_RESPONSE_SIZE} from '@angular/common/http';\nimport {PLATFORM_SERVER_PROVIDERS} from './server';\n\n/**\n * Sets up providers necessary to enable server rendering functionality for the application.\n *\n * @param options An object to configure the server providers. Currently supports the following options:\n * - `maxResponseBodySize`: The maximum allowed response body size when using the Fetch API.\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(options?: {\n maxResponseBodySize: number;\n}): EnvironmentProviders {\n if (typeof ngServerMode === 'undefined') {\n globalThis['ngServerMode'] = true;\n }\n\n const providers = [...PLATFORM_SERVER_PROVIDERS];\n if (options?.maxResponseBodySize) {\n providers.push({provide: HTTP_FETCH_MAX_RESPONSE_SIZE, useValue: options.maxResponseBodySize});\n }\n\n return makeEnvironmentProviders(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 ɵINTERNAL_APPLICATION_ERROR_HANDLER as INTERNAL_APPLICATION_ERROR_HANDLER,\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';\nimport {BootstrapContext} from '@angular/platform-browser';\n\nimport {platformServer} from './server';\nimport {PlatformState} from './platform_state';\nimport {BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformConfig} from './tokens';\nimport {createScript} from './transfer_state';\nimport {resolveUrl} from './url';\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 * <script type=\"text/javascript\" id=\"ng-event-dispatch-contract\">...</script>\n * ```\n * This const represents the \"id\" attribute value.\n */\nexport const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';\n\ninterface PlatformOptions extends Omit<PlatformConfig, 'document'> {\n document?: string | Document;\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 const {document, url} = options;\n\n const platform = platformServer([\n {\n provide: INITIAL_CONFIG,\n useValue: {\n document,\n url,\n },\n },\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 `<body>`.\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<string>; capture: Set<string>},\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<string> {\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 errorHandler = environmentInjector.get(INTERNAL_APPLICATION_ERROR_HANDLER);\n const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);\n if (callbacks) {\n const asyncCallbacks: Promise<void>[] = [];\n for (const callback of callbacks) {\n try {\n const callbackResult = callback();\n if (callbackResult) {\n asyncCallbacks.push(callbackResult);\n }\n } catch (e) {\n // Delegate to the application's ErrorHandler so custom handlers\n // (e.g. Sentry) are notified, rather than writing directly to console.\n errorHandler(e);\n }\n }\n\n if (asyncCallbacks.length) {\n for (const result of await Promise.allSettled(asyncCallbacks)) {\n if (result.status === 'rejected') {\n errorHandler(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<void> {\n return new Promise<void>((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<string>('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 * - `allowedHosts` - the allowed hosts list for host validation in server-side rendering.\n * @publicApi\n */\nexport async function renderModule<T>(\n moduleType: Type<T>,\n options: {\n document?: string | Document;\n url?: string;\n extraProviders?: StaticProvider[];\n allowedHosts?: Readonly<string>[];\n },\n): Promise<string> {\n const {document, url, extraProviders: platformProviders, allowedHosts} = options;\n validateAllowedHosts(url, allowedHosts);\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 * @usageNotes\n *\n * ```ts\n * import { BootstrapContext, bootstrapApplication } from '@angular/platform-browser';\n * import { renderApplication } from '@angular/platform-server';\n * import { ApplicationConfig } from '@angular/core';\n * import { AppComponent } from './app.component';\n *\n * const appConfig: ApplicationConfig = { providers: [...] };\n * const bootstrap = (context: BootstrapContext) =>\n * bootstrapApplication(AppComponent, config, context);\n * const output = await renderApplication(bootstrap);\n * ```\n *\n * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`\n * instance once resolved. The method is invoked with an `Injector` instance that\n * provides access to the platform-level dependency injection context.\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 * - `allowedHosts` - the allowed hosts list for host validation in server-side rendering.\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: (context: BootstrapContext) => Promise<ApplicationRef>,\n options: {\n document?: string | Document;\n url?: string;\n platformProviders?: Provider[];\n allowedHosts?: Readonly<string>[];\n },\n): Promise<string> {\n const renderAppLabel = 'renderApplication';\n const bootstrapLabel = 'bootstrap';\n const _renderLabel = '_render';\n const {url, allowedHosts} = options;\n\n validateAllowedHosts(url, allowedHosts);\n\n startMeasuring(renderAppLabel);\n const platformRef = createServerPlatform(options);\n try {\n startMeasuring(bootstrapLabel);\n const applicationRef = await bootstrap({platformRef});\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\nfunction validateAllowedHosts(url: string | undefined, allowedHosts: string[] | undefined) {\n if (typeof url === 'string') {\n const parsedUrl = resolveUrl(url);\n if (parsedUrl !== null) {\n const hostname = parsedUrl.hostname;\n const allowedHostsSet: ReadonlySet<string> = new Set(allowedHosts);\n if (!isHostAllowed(hostname, allowedHostsSet)) {\n throw new Error(`Host ${url} is not allowed. You can configure \\`allowedHosts\\` option.`);\n }\n }\n }\n}\n\n/**\n * Checks if the hostname is allowed.\n * @param hostname - The hostname to check.\n * @param allowedHosts - A set of allowed hostnames.\n * @returns `true` if the hostname is allowed, `false` otherwise.\n * @note Used also in `@angular/ssr`.\n * @private\n */\nexport function isHostAllowed(hostname: string, allowedHosts: ReadonlySet<string>): boolean {\n if (allowedHosts.has('*') || allowedHosts.has(hostname)) {\n return true;\n }\n\n for (const allowedHost of allowedHosts) {\n if (!allowedHost.startsWith('*.')) {\n continue;\n }\n\n const domain = allowedHost.slice(1);\n if (hostname.endsWith(domain)) {\n return true;\n }\n }\n\n return false;\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 = /* @__PURE__ */ new Version('22.0.0');\n"],"names":["provideServerRendering","options","ngServerMode","globalThis","providers","PLATFORM_SERVER_PROVIDERS","maxResponseBodySize","push","provide","HTTP_FETCH_MAX_RESPONSE_SIZE","useValue","makeEnvironmentProviders","EVENT_DISPATCH_SCRIPT_ID","createServerPlatform","extraProviders","platformProviders","measuringLabel","startMeasuring","document","url","platform","platformServer","INITIAL_CONFIG","stopMeasuring","findEventDispatchScript","doc","getElementById","removeEventDispatchScript","remove","prepareForHydration","platformState","applicationRef","environmentInjector","injector","getDocument","get","IS_HYDRATION_DOM_REUSE_ENABLED","appendSsrContentIntegrityMarker","eventTypesToReplay","annotateForHydration","regular","size","capture","insertEventRecordScript","APP_ID","CSP_NONCE","comment","createComment","SSR_CONTENT_INTEGRITY_MARKER","body","firstChild","insertBefore","append","appendServerContextInfo","serverContext","sanitizeServerContext","SERVER_CONTEXT","DEFAULT_SERVER_CONTEXT","components","forEach","componentRef","renderer","Renderer2","element","location","nativeElement","setAttribute","appId","nonce","eventDispatchScript","replayScriptContents","JSON","stringify","Array","from","replayScript","createScript","after","renderInternal","platformRef","PlatformState","errorHandler","INTERNAL_APPLICATION_ERROR_HANDLER","callbacks","BEFORE_APP_SERIALIZED","asyncCallbacks","callback","callbackResult","e","length","result","Promise","allSettled","status","reason","renderToString","asyncDestroyPlatform","resolve","setTimeout","destroy","InjectionToken","context","replace","renderModule","moduleType","allowedHosts","validateAllowedHosts","moduleRef","bootstrapModule","ApplicationRef","whenStable","renderApplication","bootstrap","renderAppLabel","bootstrapLabel","_renderLabel","rendered","parsedUrl","resolveUrl","hostname","allowedHostsSet","Set","isHostAllowed","Error","has","allowedHost","startsWith","domain","slice","endsWith","VERSION","Version"],"mappings":";;;;;;;;;;;;;;;AA+BM,SAAUA,sBAAsBA,CAACC,OAEtC,EAAA;AACC,EAAA,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;AACvCC,IAAAA,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI;AACnC,EAAA;AAEA,EAAA,MAAMC,SAAS,GAAG,CAAC,GAAGC,yBAAyB,CAAC;EAChD,IAAIJ,OAAO,EAAEK,mBAAmB,EAAE;IAChCF,SAAS,CAACG,IAAI,CAAC;AAACC,MAAAA,OAAO,EAAEC,6BAA4B;MAAEC,QAAQ,EAAET,OAAO,CAACK;AAAmB,KAAC,CAAC;AAChG,EAAA;EAEA,OAAOK,wBAAwB,CAACP,SAAS,CAAC;AAC5C;;ACHO,MAAMQ,wBAAwB,GAAG,4BAA4B;AAWpE,SAASC,oBAAoBA,CAACZ,OAAwB,EAAA;AACpD,EAAA,MAAMa,cAAc,GAAGb,OAAO,CAACc,iBAAiB,IAAI,EAAE;EACtD,MAAMC,cAAc,GAAG,sBAAsB;EAC7CC,eAAc,CAACD,cAAc,CAAC;EAC9B,MAAM;IAACE,QAAQ;AAAEC,IAAAA;AAAG,GAAC,GAAGlB,OAAO;AAE/B,EAAA,MAAMmB,QAAQ,GAAGC,cAAc,CAAC,CAC9B;AACEb,IAAAA,OAAO,EAAEc,cAAc;AACvBZ,IAAAA,QAAQ,EAAE;MACRQ,QAAQ;AACRC,MAAAA;AACD;GACF,EACDL,cAAc,CACf,CAAC;EAEFS,cAAa,CAACP,cAAc,CAAC;AAC7B,EAAA,OAAOI,QAAQ;AACjB;AAMA,SAASI,uBAAuBA,CAACC,GAAa,EAAA;AAC5C,EAAA,OAAOA,GAAG,CAACC,cAAc,CAACd,wBAAwB,CAAC;AACrD;AAMA,SAASe,yBAAyBA,CAACF,GAAa,EAAA;AAC9CD,EAAAA,uBAAuB,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K,QAAQ,EAAE;AAC3B,IAAA,MAAMkG,SAAS,GAAGC,UAAU,CAACnG,GAAG,CAAC;IACjC,IAAIkG,SAAS,KAAK,IAAI,EAAE;AACtB,MAAA,MAAME,QAAQ,GAAGF,SAAS,CAACE,QAAQ;AACnC,MAAA,MAAMC,eAAe,GAAwB,IAAIC,GAAG,CAAChB,YAAY,CAAC;AAClE,MAAA,IAAI,CAACiB,aAAa,CAACH,QAAQ,EAAEC,eAAe,CAAC,EAAE;AAC7C,QAAA,MAAM,IAAIG,KAAK,CAAC,CAAA,KAAA,EAAQxG,GAAG,6DAA6D,CAAC;AAC3F,MAAA;AACF,IAAA;AACF,EAAA;AACF;AAUM,SAAUuG,aAAaA,CAACH,QAAgB,EAAEd,YAAiC,EAAA;AAC/E,EAAA,IAAIA,YAAY,CAACmB,GAAG,CAAC,GAAG,CAAC,IAAInB,YAAY,CAACmB,GAAG,CAACL,QAAQ,CAAC,EAAE;AACvD,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,KAAK,MAAMM,WAAW,IAAIpB,YAAY,EAAE;AACtC,IAAA,IAAI,CAACoB,WAAW,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;AACjC,MAAA;AACF,IAAA;AAEA,IAAA,MAAMC,MAAM,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC,CAAC;AACnC,IAAA,IAAIT,QAAQ,CAACU,QAAQ,CAACF,MAAM,CAAC,EAAE;AAC7B,MAAA,OAAO,IAAI;AACb,IAAA;AACF,EAAA;AAEA,EAAA,OAAO,KAAK;AACd;;AC9YO,MAAMG,OAAO,kBAAmB,IAAIC,OAAO,CAAC,mBAAmB;;;;"}
|
|
1
|
+
{"version":3,"file":"platform-server.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-server/src/provide_server.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-server/src/utils.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/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 {ɵHTTP_FETCH_MAX_RESPONSE_SIZE as HTTP_FETCH_MAX_RESPONSE_SIZE} from '@angular/common/http';\nimport {PLATFORM_SERVER_PROVIDERS} from './server';\n\n/**\n * Sets up providers necessary to enable server rendering functionality for the application.\n *\n * @param options An object to configure the server providers. Currently supports the following options:\n * - `maxResponseBodySize`: The maximum allowed response body size when using the Fetch API.\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(options?: {\n maxResponseBodySize: number;\n}): EnvironmentProviders {\n if (typeof ngServerMode === 'undefined') {\n globalThis['ngServerMode'] = true;\n }\n\n const providers = [...PLATFORM_SERVER_PROVIDERS];\n if (options?.maxResponseBodySize) {\n providers.push({provide: HTTP_FETCH_MAX_RESPONSE_SIZE, useValue: options.maxResponseBodySize});\n }\n\n return makeEnvironmentProviders(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 ɵINTERNAL_APPLICATION_ERROR_HANDLER as INTERNAL_APPLICATION_ERROR_HANDLER,\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 ɵRuntimeError as RuntimeError,\n} from '@angular/core';\nimport {BootstrapContext} from '@angular/platform-browser';\n\nimport {RuntimeErrorCode} from './errors';\nimport {platformServer} from './server';\nimport {PlatformState} from './platform_state';\nimport {BEFORE_APP_SERIALIZED, INITIAL_CONFIG, PlatformConfig} from './tokens';\nimport {createScript} from './transfer_state';\nimport {resolveUrl} from './url';\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 * <script type=\"text/javascript\" id=\"ng-event-dispatch-contract\">...</script>\n * ```\n * This const represents the \"id\" attribute value.\n */\nexport const EVENT_DISPATCH_SCRIPT_ID = 'ng-event-dispatch-contract';\n\ninterface PlatformOptions extends Omit<PlatformConfig, 'document'> {\n document?: string | Document;\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 const {document, url} = options;\n\n const platform = platformServer([\n {\n provide: INITIAL_CONFIG,\n useValue: {\n document,\n url,\n },\n },\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 `<body>`.\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<string>; capture: Set<string>},\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<string> {\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 errorHandler = environmentInjector.get(INTERNAL_APPLICATION_ERROR_HANDLER);\n const callbacks = environmentInjector.get(BEFORE_APP_SERIALIZED, null);\n if (callbacks) {\n const asyncCallbacks: Promise<void>[] = [];\n for (const callback of callbacks) {\n try {\n const callbackResult = callback();\n if (callbackResult) {\n asyncCallbacks.push(callbackResult);\n }\n } catch (e) {\n // Delegate to the application's ErrorHandler so custom handlers\n // (e.g. Sentry) are notified, rather than writing directly to console.\n errorHandler(e);\n }\n }\n\n if (asyncCallbacks.length) {\n for (const result of await Promise.allSettled(asyncCallbacks)) {\n if (result.status === 'rejected') {\n errorHandler(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<void> {\n return new Promise<void>((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<string>('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 * - `allowedHosts` - the allowed hosts list for host validation in server-side rendering.\n * @publicApi\n */\nexport async function renderModule<T>(\n moduleType: Type<T>,\n options: {\n document?: string | Document;\n url?: string;\n extraProviders?: StaticProvider[];\n allowedHosts?: Readonly<string>[];\n },\n): Promise<string> {\n const {document, url, extraProviders: platformProviders, allowedHosts} = options;\n validateAllowedHosts(url, allowedHosts);\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 * @usageNotes\n *\n * ```ts\n * import { BootstrapContext, bootstrapApplication } from '@angular/platform-browser';\n * import { renderApplication } from '@angular/platform-server';\n * import { ApplicationConfig } from '@angular/core';\n * import { AppComponent } from './app.component';\n *\n * const appConfig: ApplicationConfig = { providers: [...] };\n * const bootstrap = (context: BootstrapContext) =>\n * bootstrapApplication(AppComponent, config, context);\n * const output = await renderApplication(bootstrap);\n * ```\n *\n * @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`\n * instance once resolved. The method is invoked with an `Injector` instance that\n * provides access to the platform-level dependency injection context.\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 * - `allowedHosts` - the allowed hosts list for host validation in server-side rendering.\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: (context: BootstrapContext) => Promise<ApplicationRef>,\n options: {\n document?: string | Document;\n url?: string;\n platformProviders?: Provider[];\n allowedHosts?: Readonly<string>[];\n },\n): Promise<string> {\n const renderAppLabel = 'renderApplication';\n const bootstrapLabel = 'bootstrap';\n const _renderLabel = '_render';\n const {url, allowedHosts} = options;\n\n validateAllowedHosts(url, allowedHosts);\n\n startMeasuring(renderAppLabel);\n const platformRef = createServerPlatform(options);\n try {\n startMeasuring(bootstrapLabel);\n const applicationRef = await bootstrap({platformRef});\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\nfunction validateAllowedHosts(url: string | undefined, allowedHosts: string[] | undefined) {\n if (typeof url === 'string') {\n const parsedUrl = resolveUrl(url);\n if (parsedUrl !== null) {\n const hostname = parsedUrl.hostname;\n const allowedHostsSet: ReadonlySet<string> = new Set(allowedHosts);\n if (!isHostAllowed(hostname, allowedHostsSet)) {\n throw new RuntimeError(\n RuntimeErrorCode.HOST_NOT_ALLOWED,\n typeof ngDevMode === 'undefined' || ngDevMode\n ? `Host ${url} is not allowed. You can configure \\`allowedHosts\\` option.`\n : url,\n );\n }\n }\n }\n}\n\n/**\n * Checks if the hostname is allowed.\n * @param hostname - The hostname to check.\n * @param allowedHosts - A set of allowed hostnames.\n * @returns `true` if the hostname is allowed, `false` otherwise.\n * @note Used also in `@angular/ssr`.\n * @private\n */\nexport function isHostAllowed(hostname: string, allowedHosts: ReadonlySet<string>): boolean {\n if (allowedHosts.has('*') || allowedHosts.has(hostname)) {\n return true;\n }\n\n for (const allowedHost of allowedHosts) {\n if (!allowedHost.startsWith('*.')) {\n continue;\n }\n\n const domain = allowedHost.slice(1);\n if (hostname.endsWith(domain)) {\n return true;\n }\n }\n\n return false;\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 = /* @__PURE__ */ new Version('22.1.0-next.0');\n"],"names":["provideServerRendering","options","ngServerMode","globalThis","providers","PLATFORM_SERVER_PROVIDERS","maxResponseBodySize","push","provide","HTTP_FETCH_MAX_RESPONSE_SIZE","useValue","makeEnvironmentProviders","EVENT_DISPATCH_SCRIPT_ID","createServerPlatform","extraProviders","platformProviders","measuringLabel","startMeasuring","document","url","platform","platformServer","INITIAL_CONFIG","stopMeasuring","findEventDispatchScript","doc","getElementById","removeEventDispatchScript","remove","prepareForHydration","platformState","applicationRef","environmentInjector","injector","getDocument","get","IS_HYDRATION_DOM_REUSE_ENABLED","appendSsrContentIntegrityMarker","eventTypesToReplay","annotateForHydration","regular","size","capture","insertEventRecordScript","APP_ID","CSP_NONCE","comment","createComment","SSR_CONTENT_INTEGRITY_MARKER","body","firstChild","insertBefore","append","appendServerContextInfo","serverContext","sanitizeServerContext","SERVER_CONTEXT","DEFAULT_SERVER_CONTEXT","components","forEach","componentRef","renderer","Renderer2","element","location","nativeElement","setAttribute","appId","nonce","eventDispatchScript","replayScriptContents","JSON","stringify","Array","from","replayScript","createScript","after","renderInternal","platformRef","PlatformState","errorHandler","INTERNAL_APPLICATION_ERROR_HANDLER","callbacks","BEFORE_APP_SERIALIZED","asyncCallbacks","callback","callbackResult","e","length","result","Promise","allSettled","status","reason","renderToString","asyncDestroyPlatform","resolve","setTimeout","destroy","InjectionToken","context","replace","renderModule","moduleType","allowedHosts","validateAllowedHosts","moduleRef","bootstrapModule","ApplicationRef","whenStable","renderApplication","bootstrap","renderAppLabel","bootstrapLabel","_renderLabel","rendered","parsedUrl","resolveUrl","hostname","allowedHostsSet","Set","isHostAllowed","RuntimeError","ngDevMode","has","allowedHost","startsWith","domain","slice","endsWith","VERSION","Version"],"mappings":";;;;;;;;;;;;;;;AA+BM,SAAUA,sBAAsBA,CAACC,OAEtC,EAAA;AACC,EAAA,IAAI,OAAOC,YAAY,KAAK,WAAW,EAAE;AACvCC,IAAAA,UAAU,CAAC,cAAc,CAAC,GAAG,IAAI;AACnC,EAAA;AAEA,EAAA,MAAMC,SAAS,GAAG,CAAC,GAAGC,yBAAyB,CAAC;EAChD,IAAIJ,OAAO,EAAEK,mBAAmB,EAAE;IAChCF,SAAS,CAACG,IAAI,CAAC;AAACC,MAAAA,OAAO,EAAEC,6BAA4B;MAAEC,QAAQ,EAAET,OAAO,CAACK;AAAmB,KAAC,CAAC;AAChG,EAAA;EAEA,OAAOK,wBAAwB,CAACP,SAAS,CAAC;AAC5C;;AC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,EAAA;AAC/E,EAAA,IAAIA,YAAY,CAACoB,GAAG,CAAC,GAAG,CAAC,IAAIpB,YAAY,CAACoB,GAAG,CAACN,QAAQ,CAAC,EAAE;AACvD,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,KAAK,MAAMO,WAAW,IAAIrB,YAAY,EAAE;AACtC,IAAA,IAAI,CAACqB,WAAW,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE;AACjC,MAAA;AACF,IAAA;AAEA,IAAA,MAAMC,MAAM,GAAGF,WAAW,CAACG,KAAK,CAAC,CAAC,CAAC;AACnC,IAAA,IAAIV,QAAQ,CAACW,QAAQ,CAACF,MAAM,CAAC,EAAE;AAC7B,MAAA,OAAO,IAAI;AACb,IAAA;AACF,EAAA;AAEA,EAAA,OAAO,KAAK;AACd;;ACrZO,MAAMG,OAAO,kBAAmB,IAAIC,OAAO,CAAC,mBAAmB;;;;"}
|
package/fesm2022/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v22.0.0
|
|
2
|
+
* @license Angular v22.1.0-next.0
|
|
3
3
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -19,7 +19,7 @@ const platformServerTesting = createPlatformFactory(platformCore, 'serverTesting
|
|
|
19
19
|
class ServerTestingModule {
|
|
20
20
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
21
21
|
minVersion: "12.0.0",
|
|
22
|
-
version: "22.0.0",
|
|
22
|
+
version: "22.1.0-next.0",
|
|
23
23
|
ngImport: i0,
|
|
24
24
|
type: ServerTestingModule,
|
|
25
25
|
deps: [],
|
|
@@ -27,14 +27,14 @@ class ServerTestingModule {
|
|
|
27
27
|
});
|
|
28
28
|
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
29
29
|
minVersion: "14.0.0",
|
|
30
|
-
version: "22.0.0",
|
|
30
|
+
version: "22.1.0-next.0",
|
|
31
31
|
ngImport: i0,
|
|
32
32
|
type: ServerTestingModule,
|
|
33
33
|
exports: [BrowserDynamicTestingModule]
|
|
34
34
|
});
|
|
35
35
|
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
36
36
|
minVersion: "12.0.0",
|
|
37
|
-
version: "22.0.0",
|
|
37
|
+
version: "22.1.0-next.0",
|
|
38
38
|
ngImport: i0,
|
|
39
39
|
type: ServerTestingModule,
|
|
40
40
|
providers: SERVER_RENDER_PROVIDERS,
|
|
@@ -43,7 +43,7 @@ class ServerTestingModule {
|
|
|
43
43
|
}
|
|
44
44
|
i0.ɵɵngDeclareClassMetadata({
|
|
45
45
|
minVersion: "12.0.0",
|
|
46
|
-
version: "22.0.0",
|
|
46
|
+
version: "22.1.0-next.0",
|
|
47
47
|
ngImport: i0,
|
|
48
48
|
type: ServerTestingModule,
|
|
49
49
|
decorators: [{
|
package/fesm2022/testing.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.mjs","sources":["../../../../../
|
|
1
|
+
{"version":3,"file":"testing.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/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":["INTERNAL_SERVER_DYNAMIC_PLATFORM_TESTING_PROVIDERS","INTERNAL_SERVER_PLATFORM_PROVIDERS","platformServerTesting","createPlatformFactory","platformCore","ServerTestingModule","deps","target","i0","ɵɵFactoryTarget","NgModule","ɵmod","ɵɵngDeclareNgModule","minVersion","version","ngImport","type","BrowserDynamicTestingModule","providers","SERVER_RENDER_PROVIDERS","imports","decorators","args","exports"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,kDAAkD,GAAqB,CAC3E,GAAGC,kCAAkC,CACtC;AAQM,MAAMC,qBAAqB,GAChCC,qBAAqB,CACnBC,YAAY,EACZ,eAAe,EACfJ,kDAAkD;MAazCK,mBAAmB,CAAA;;;;;UAAnBA,mBAAmB;AAAAC,IAAAA,IAAA,EAAA,EAAA;AAAAC,IAAAA,MAAA,EAAAC,EAAA,CAAAC,eAAA,CAAAC;AAAA,GAAA,CAAA;AAAnB,EAAA,OAAAC,IAAA,GAAAH,EAAA,CAAAI,mBAAA,CAAA;AAAAC,IAAAA,UAAA,EAAA,QAAA;AAAAC,IAAAA,OAAA,EAAA,mBAAA;AAAAC,IAAAA,QAAA,EAAAP,EAAA;AAAAQ,IAAAA,IAAA,EAAAX,mBAAmB;cAHpBY,2BAA2B;AAAA,GAAA,CAAA;;;;;UAG1BZ,mBAAmB;AAAAa,IAAAA,SAAA,EAFnBC,uBAAuB;IAAAC,OAAA,EAAA,CADxBH,2BAA2B;AAAA,GAAA,CAAA;;;;;;QAG1BZ,mBAAmB;AAAAgB,EAAAA,UAAA,EAAA,CAAA;UAJ/BX,QAAQ;AAACY,IAAAA,IAAA,EAAA,CAAA;MACRC,OAAO,EAAE,CAACN,2BAA2B,CAAC;AACtCC,MAAAA,SAAS,EAAEC;KACZ;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/platform-server",
|
|
3
|
-
"version": "22.0.0",
|
|
3
|
+
"version": "22.1.0-next.0",
|
|
4
4
|
"description": "Angular - library for using Angular in Node.js",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"node": "^22.22.3 || ^24.15.0 || >=26.0.0"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/common": "22.0.0",
|
|
12
|
-
"@angular/compiler": "22.0.0",
|
|
13
|
-
"@angular/core": "22.0.0",
|
|
14
|
-
"@angular/platform-browser": "22.0.0",
|
|
11
|
+
"@angular/common": "22.1.0-next.0",
|
|
12
|
+
"@angular/compiler": "22.1.0-next.0",
|
|
13
|
+
"@angular/core": "22.1.0-next.0",
|
|
14
|
+
"@angular/platform-browser": "22.1.0-next.0",
|
|
15
15
|
"rxjs": "^6.5.3 || ^7.4.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
@@ -2442,7 +2442,7 @@ var hasRequiredSelect;
|
|
|
2442
2442
|
function requireSelect () {
|
|
2443
2443
|
if (hasRequiredSelect) return select.exports;
|
|
2444
2444
|
hasRequiredSelect = 1;
|
|
2445
|
-
(function (module, exports
|
|
2445
|
+
(function (module, exports) {
|
|
2446
2446
|
/* jshint eqnull: true */
|
|
2447
2447
|
/**
|
|
2448
2448
|
* Zest (https://github.com/chjj/zest)
|
|
@@ -3330,7 +3330,7 @@ function requireSelect () {
|
|
|
3330
3330
|
* Expose
|
|
3331
3331
|
*/
|
|
3332
3332
|
|
|
3333
|
-
module.exports = exports
|
|
3333
|
+
module.exports = exports = function(sel, context) {
|
|
3334
3334
|
/* when context isn't a DocumentFragment and the selector is simple: */
|
|
3335
3335
|
var id, r;
|
|
3336
3336
|
if (context.nodeType !== 11 && sel.indexOf(' ') === -1) {
|
|
@@ -3354,11 +3354,11 @@ function requireSelect () {
|
|
|
3354
3354
|
return find(sel, context);
|
|
3355
3355
|
};
|
|
3356
3356
|
|
|
3357
|
-
exports
|
|
3358
|
-
exports
|
|
3359
|
-
exports
|
|
3357
|
+
exports.selectors = selectors;
|
|
3358
|
+
exports.operators = operators;
|
|
3359
|
+
exports.combinators = combinators;
|
|
3360
3360
|
|
|
3361
|
-
exports
|
|
3361
|
+
exports.matches = function(el, sel) {
|
|
3362
3362
|
var test = { sel: sel };
|
|
3363
3363
|
do {
|
|
3364
3364
|
test = compile(test.sel);
|
|
@@ -8424,16 +8424,16 @@ var hasRequiredSvg;
|
|
|
8424
8424
|
function requireSvg () {
|
|
8425
8425
|
if (hasRequiredSvg) return svg;
|
|
8426
8426
|
hasRequiredSvg = 1;
|
|
8427
|
-
(function (exports
|
|
8427
|
+
(function (exports) {
|
|
8428
8428
|
var Element = requireElement();
|
|
8429
8429
|
var defineElement = requireDefineElement();
|
|
8430
8430
|
var utils = requireUtils();
|
|
8431
8431
|
var CSSStyleDeclaration = requireCSSStyleDeclaration();
|
|
8432
8432
|
|
|
8433
|
-
var svgElements = exports
|
|
8433
|
+
var svgElements = exports.elements = {};
|
|
8434
8434
|
var svgNameToImpl = Object.create(null);
|
|
8435
8435
|
|
|
8436
|
-
exports
|
|
8436
|
+
exports.createElement = function(doc, localName, prefix) {
|
|
8437
8437
|
var impl = svgNameToImpl[localName] || SVGElement;
|
|
8438
8438
|
return new impl(doc, localName, prefix);
|
|
8439
8439
|
};
|
|
@@ -8465,7 +8465,7 @@ function requireSvg () {
|
|
|
8465
8465
|
tag: 'svg',
|
|
8466
8466
|
props: {
|
|
8467
8467
|
createSVGRect: { value: function () {
|
|
8468
|
-
return exports
|
|
8468
|
+
return exports.createElement(this.ownerDocument, 'rect', null);
|
|
8469
8469
|
} }
|
|
8470
8470
|
}
|
|
8471
8471
|
});
|
|
@@ -16902,10 +16902,10 @@ var hasRequiredImpl;
|
|
|
16902
16902
|
function requireImpl () {
|
|
16903
16903
|
if (hasRequiredImpl) return impl.exports;
|
|
16904
16904
|
hasRequiredImpl = 1;
|
|
16905
|
-
(function (module, exports
|
|
16905
|
+
(function (module, exports) {
|
|
16906
16906
|
var utils = requireUtils();
|
|
16907
16907
|
|
|
16908
|
-
exports
|
|
16908
|
+
exports = module.exports = {
|
|
16909
16909
|
CSSStyleDeclaration: requireCSSStyleDeclaration(),
|
|
16910
16910
|
CharacterData: requireCharacterData(),
|
|
16911
16911
|
Comment: requireComment(),
|
|
@@ -16925,9 +16925,9 @@ function requireImpl () {
|
|
|
16925
16925
|
Window: requireWindow()
|
|
16926
16926
|
};
|
|
16927
16927
|
|
|
16928
|
-
utils.merge(exports
|
|
16929
|
-
utils.merge(exports
|
|
16930
|
-
utils.merge(exports
|
|
16928
|
+
utils.merge(exports, requireEvents());
|
|
16929
|
+
utils.merge(exports, requireHtmlelts().elements);
|
|
16930
|
+
utils.merge(exports, requireSvg().elements);
|
|
16931
16931
|
} (impl, impl.exports));
|
|
16932
16932
|
return impl.exports;
|
|
16933
16933
|
}
|
|
@@ -17005,17 +17005,17 @@ var hasRequiredLib;
|
|
|
17005
17005
|
function requireLib () {
|
|
17006
17006
|
if (hasRequiredLib) return lib;
|
|
17007
17007
|
hasRequiredLib = 1;
|
|
17008
|
-
(function (exports
|
|
17008
|
+
(function (exports) {
|
|
17009
17009
|
var DOMImplementation = requireDOMImplementation();
|
|
17010
17010
|
var HTMLParser = requireHTMLParser();
|
|
17011
17011
|
requireWindow();
|
|
17012
17012
|
var impl = requireImpl();
|
|
17013
17013
|
|
|
17014
|
-
exports
|
|
17014
|
+
exports.createDOMImplementation = function() {
|
|
17015
17015
|
return new DOMImplementation(null);
|
|
17016
17016
|
};
|
|
17017
17017
|
|
|
17018
|
-
exports
|
|
17018
|
+
exports.createDocument = function(html, force) {
|
|
17019
17019
|
// Previous API couldn't let you pass '' as a document, and that
|
|
17020
17020
|
// yields a slightly different document than createHTMLDocument('')
|
|
17021
17021
|
// does. The new `force` parameter lets you pass '' if you want to.
|
|
@@ -17027,7 +17027,7 @@ function requireLib () {
|
|
|
17027
17027
|
return new DOMImplementation(null).createHTMLDocument("");
|
|
17028
17028
|
};
|
|
17029
17029
|
|
|
17030
|
-
exports
|
|
17030
|
+
exports.createIncrementalHTMLParser = function() {
|
|
17031
17031
|
var parser = new HTMLParser();
|
|
17032
17032
|
/** API for incremental parser. */
|
|
17033
17033
|
return {
|
|
@@ -17078,13 +17078,13 @@ function requireLib () {
|
|
|
17078
17078
|
};
|
|
17079
17079
|
};
|
|
17080
17080
|
|
|
17081
|
-
exports
|
|
17082
|
-
var document = exports
|
|
17081
|
+
exports.createWindow = function(html, address) {
|
|
17082
|
+
var document = exports.createDocument(html);
|
|
17083
17083
|
if (address !== undefined) { document._address = address; }
|
|
17084
17084
|
return new impl.Window(document);
|
|
17085
17085
|
};
|
|
17086
17086
|
|
|
17087
|
-
exports
|
|
17087
|
+
exports.impl = impl;
|
|
17088
17088
|
} (lib));
|
|
17089
17089
|
return lib;
|
|
17090
17090
|
}
|