@angular/platform-server 16.0.0-next.2 → 16.0.0-next.4
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/esm2020/src/http.mjs +3 -3
- package/esm2020/src/location.mjs +3 -3
- package/esm2020/src/platform-server.mjs +2 -1
- package/esm2020/src/platform_state.mjs +3 -3
- package/esm2020/src/provide_server.mjs +34 -0
- package/esm2020/src/server.mjs +15 -24
- package/esm2020/src/server_events.mjs +3 -3
- package/esm2020/src/server_renderer.mjs +18 -15
- package/esm2020/src/transfer_state.mjs +4 -4
- package/esm2020/src/utils.mjs +27 -25
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/server.mjs +4 -4
- package/fesm2015/init.mjs +1 -1
- package/fesm2015/platform-server.mjs +99 -120
- package/fesm2015/platform-server.mjs.map +1 -1
- package/fesm2015/testing.mjs +5 -5
- package/fesm2020/init.mjs +1 -1
- package/fesm2020/platform-server.mjs +99 -117
- package/fesm2020/platform-server.mjs.map +1 -1
- package/fesm2020/testing.mjs +5 -5
- package/index.d.ts +19 -42
- package/init/index.d.ts +1 -1
- package/package.json +7 -7
- package/testing/index.d.ts +1 -1
- package/esm2020/src/styles_host.mjs +0 -51
package/fesm2020/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.0.0-next.
|
|
2
|
+
* @license Angular v16.0.0-next.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -23,10 +23,10 @@ const platformServerTesting = createPlatformFactory(ɵplatformCoreDynamicTesting
|
|
|
23
23
|
*/
|
|
24
24
|
class ServerTestingModule {
|
|
25
25
|
}
|
|
26
|
-
ServerTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
27
|
-
ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.
|
|
28
|
-
ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
29
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.
|
|
26
|
+
ServerTestingModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
27
|
+
ServerTestingModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, imports: [NoopAnimationsModule], exports: [BrowserDynamicTestingModule] });
|
|
28
|
+
ServerTestingModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, providers: ɵSERVER_RENDER_PROVIDERS, imports: [NoopAnimationsModule, BrowserDynamicTestingModule] });
|
|
29
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.4", ngImport: i0, type: ServerTestingModule, decorators: [{
|
|
30
30
|
type: NgModule,
|
|
31
31
|
args: [{
|
|
32
32
|
exports: [BrowserDynamicTestingModule],
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.0.0-next.
|
|
2
|
+
* @license Angular v16.0.0-next.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -106,57 +106,36 @@ export declare class PlatformState {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
* ```typescript
|
|
112
|
-
* const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
|
|
113
|
-
* const output: string = await renderApplication(bootstrap);
|
|
114
|
-
* ```
|
|
109
|
+
* Sets up providers necessary to enable server rendering functionality for the application.
|
|
115
110
|
*
|
|
116
|
-
* @
|
|
117
|
-
* instance once resolved.
|
|
118
|
-
* @param options Additional configuration for the render operation:
|
|
119
|
-
* - `document` - the document of the page to render, either as an HTML string or
|
|
120
|
-
* as a reference to the `document` instance.
|
|
121
|
-
* - `url` - the URL for the current render request.
|
|
122
|
-
* - `platformProviders` - the platform level providers for the current render request.
|
|
111
|
+
* @usageNotes
|
|
123
112
|
*
|
|
124
|
-
*
|
|
113
|
+
* Basic example of how you can add server support to your application:
|
|
114
|
+
* ```ts
|
|
115
|
+
* bootstrapApplication(AppComponent, {
|
|
116
|
+
* providers: [provideServerSupport()]
|
|
117
|
+
* });
|
|
118
|
+
* ```
|
|
125
119
|
*
|
|
126
120
|
* @publicApi
|
|
127
|
-
* @
|
|
121
|
+
* @returns A set of providers to setup the server.
|
|
128
122
|
*/
|
|
129
|
-
export declare function
|
|
130
|
-
document?: string | Document;
|
|
131
|
-
url?: string;
|
|
132
|
-
platformProviders?: Provider[];
|
|
133
|
-
}): Promise<string>;
|
|
123
|
+
export declare function provideServerSupport(): EnvironmentProviders;
|
|
134
124
|
|
|
135
125
|
/**
|
|
136
126
|
* Bootstraps an instance of an Angular application and renders it to a string.
|
|
137
|
-
|
|
138
|
-
* Note: the root component passed into this function *must* be a standalone one (should have
|
|
139
|
-
* the `standalone: true` flag in the `@Component` decorator config).
|
|
140
|
-
*
|
|
127
|
+
|
|
141
128
|
* ```typescript
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* template: 'Hello world!'
|
|
145
|
-
* })
|
|
146
|
-
* class RootComponent {}
|
|
147
|
-
*
|
|
148
|
-
* const output: string = await renderApplication(RootComponent, {appId: 'server-app'});
|
|
129
|
+
* const bootstrap = () => bootstrapApplication(RootComponent, appConfig);
|
|
130
|
+
* const output: string = await renderApplication(bootstrap);
|
|
149
131
|
* ```
|
|
150
132
|
*
|
|
151
|
-
* @param
|
|
133
|
+
* @param bootstrap A method that when invoked returns a promise that returns an `ApplicationRef`
|
|
134
|
+
* instance once resolved.
|
|
152
135
|
* @param options Additional configuration for the render operation:
|
|
153
|
-
* - `appId` - a string identifier of this application. The appId is used to prefix all
|
|
154
|
-
* server-generated stylings and state keys of the application in TransferState
|
|
155
|
-
* use-cases.
|
|
156
136
|
* - `document` - the document of the page to render, either as an HTML string or
|
|
157
137
|
* as a reference to the `document` instance.
|
|
158
138
|
* - `url` - the URL for the current render request.
|
|
159
|
-
* - `providers` - set of application level providers for the current render request.
|
|
160
139
|
* - `platformProviders` - the platform level providers for the current render request.
|
|
161
140
|
*
|
|
162
141
|
* @returns A Promise, that returns serialized (to a string) rendered page, once resolved.
|
|
@@ -164,12 +143,9 @@ export declare function renderApplication<T>(bootstrap: () => Promise<Applicatio
|
|
|
164
143
|
* @publicApi
|
|
165
144
|
* @developerPreview
|
|
166
145
|
*/
|
|
167
|
-
export declare function renderApplication<T>(
|
|
168
|
-
/** @deprecated use `APP_ID` token to set the application ID. */
|
|
169
|
-
appId: string;
|
|
146
|
+
export declare function renderApplication<T>(bootstrap: () => Promise<ApplicationRef>, options: {
|
|
170
147
|
document?: string | Document;
|
|
171
148
|
url?: string;
|
|
172
|
-
providers?: Array<Provider | EnvironmentProviders>;
|
|
173
149
|
platformProviders?: Provider[];
|
|
174
150
|
}): Promise<string>;
|
|
175
151
|
|
|
@@ -240,10 +216,11 @@ export declare class ɵServerRendererFactory2 implements RendererFactory2 {
|
|
|
240
216
|
private ngZone;
|
|
241
217
|
private document;
|
|
242
218
|
private sharedStylesHost;
|
|
219
|
+
private appId;
|
|
243
220
|
private rendererByCompId;
|
|
244
221
|
private defaultRenderer;
|
|
245
222
|
private schema;
|
|
246
|
-
constructor(eventManager: EventManager, ngZone: NgZone, document:
|
|
223
|
+
constructor(eventManager: EventManager, ngZone: NgZone, document: Document, sharedStylesHost: ɵSharedStylesHost, appId: string);
|
|
247
224
|
createRenderer(element: any, type: RendererType2 | null): Renderer2;
|
|
248
225
|
begin(): void;
|
|
249
226
|
end(): void;
|
package/init/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/platform-server",
|
|
3
|
-
"version": "16.0.0-next.
|
|
3
|
+
"version": "16.0.0-next.4",
|
|
4
4
|
"description": "Angular - library for using Angular in Node.js",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
"node": "^16.13.0 || >=18.10.0"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
-
"@angular/animations": "16.0.0-next.
|
|
12
|
-
"@angular/common": "16.0.0-next.
|
|
13
|
-
"@angular/compiler": "16.0.0-next.
|
|
14
|
-
"@angular/core": "16.0.0-next.
|
|
15
|
-
"@angular/platform-browser": "16.0.0-next.
|
|
16
|
-
"@angular/platform-browser-dynamic": "16.0.0-next.
|
|
11
|
+
"@angular/animations": "16.0.0-next.4",
|
|
12
|
+
"@angular/common": "16.0.0-next.4",
|
|
13
|
+
"@angular/compiler": "16.0.0-next.4",
|
|
14
|
+
"@angular/core": "16.0.0-next.4",
|
|
15
|
+
"@angular/platform-browser": "16.0.0-next.4",
|
|
16
|
+
"@angular/platform-browser-dynamic": "16.0.0-next.4"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"tslib": "^2.3.0",
|
package/testing/index.d.ts
CHANGED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4
|
-
*
|
|
5
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.io/license
|
|
7
|
-
*/
|
|
8
|
-
import { DOCUMENT, ɵgetDOM as getDOM } from '@angular/common';
|
|
9
|
-
import { Inject, Injectable, Optional } from '@angular/core';
|
|
10
|
-
import { ɵSharedStylesHost as SharedStylesHost, ɵTRANSITION_ID } from '@angular/platform-browser';
|
|
11
|
-
import * as i0 from "@angular/core";
|
|
12
|
-
class ServerStylesHost extends SharedStylesHost {
|
|
13
|
-
constructor(doc, transitionId) {
|
|
14
|
-
super();
|
|
15
|
-
this.doc = doc;
|
|
16
|
-
this.transitionId = transitionId;
|
|
17
|
-
this.head = null;
|
|
18
|
-
this._styleNodes = new Set();
|
|
19
|
-
this.head = doc.getElementsByTagName('head')[0];
|
|
20
|
-
}
|
|
21
|
-
onStyleAdded(style) {
|
|
22
|
-
const adapter = getDOM();
|
|
23
|
-
const el = adapter.createElement('style');
|
|
24
|
-
el.textContent = style;
|
|
25
|
-
if (!!this.transitionId) {
|
|
26
|
-
el.setAttribute('ng-transition', this.transitionId);
|
|
27
|
-
}
|
|
28
|
-
this.head.appendChild(el);
|
|
29
|
-
this._styleNodes.add(el);
|
|
30
|
-
}
|
|
31
|
-
ngOnDestroy() {
|
|
32
|
-
this._styleNodes.forEach(styleNode => styleNode.remove());
|
|
33
|
-
this._styleNodes.clear();
|
|
34
|
-
super.ngOnDestroy();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
ServerStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost, deps: [{ token: DOCUMENT }, { token: ɵTRANSITION_ID, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
38
|
-
ServerStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost });
|
|
39
|
-
export { ServerStylesHost };
|
|
40
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0-next.2", ngImport: i0, type: ServerStylesHost, decorators: [{
|
|
41
|
-
type: Injectable
|
|
42
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
43
|
-
type: Inject,
|
|
44
|
-
args: [DOCUMENT]
|
|
45
|
-
}] }, { type: undefined, decorators: [{
|
|
46
|
-
type: Optional
|
|
47
|
-
}, {
|
|
48
|
-
type: Inject,
|
|
49
|
-
args: [ɵTRANSITION_ID]
|
|
50
|
-
}] }]; } });
|
|
51
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3R5bGVzX2hvc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9wbGF0Zm9ybS1zZXJ2ZXIvc3JjL3N0eWxlc19ob3N0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVILE9BQU8sRUFBQyxRQUFRLEVBQUUsT0FBTyxJQUFJLE1BQU0sRUFBQyxNQUFNLGlCQUFpQixDQUFDO0FBQzVELE9BQU8sRUFBQyxNQUFNLEVBQUUsVUFBVSxFQUFFLFFBQVEsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUMzRCxPQUFPLEVBQUMsaUJBQWlCLElBQUksZ0JBQWdCLEVBQUUsY0FBYyxFQUFDLE1BQU0sMkJBQTJCLENBQUM7O0FBRWhHLE1BQ2EsZ0JBQWlCLFNBQVEsZ0JBQWdCO0lBSXBELFlBQzhCLEdBQVEsRUFDVSxZQUFvQjtRQUNsRSxLQUFLLEVBQUUsQ0FBQztRQUZvQixRQUFHLEdBQUgsR0FBRyxDQUFLO1FBQ1UsaUJBQVksR0FBWixZQUFZLENBQVE7UUFMNUQsU0FBSSxHQUFRLElBQUksQ0FBQztRQUNqQixnQkFBVyxHQUFHLElBQUksR0FBRyxFQUFlLENBQUM7UUFNM0MsSUFBSSxDQUFDLElBQUksR0FBRyxHQUFHLENBQUMsb0JBQW9CLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDbEQsQ0FBQztJQUVRLFlBQVksQ0FBQyxLQUFhO1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