@angular/platform-server 12.2.8 → 13.0.0-next.11
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/{esm2015/index.js → esm2020/index.mjs} +0 -0
- package/{esm2015/init/index.js → esm2020/init/index.mjs} +0 -0
- package/{esm2015/init/init.js → esm2020/init/init.mjs} +0 -0
- package/{esm2015/init/public_api.js → esm2020/init/public_api.mjs} +0 -0
- package/{esm2015/init/src/init.js → esm2020/init/src/init.mjs} +0 -0
- package/{esm2015/init/src/shims.js → esm2020/init/src/shims.mjs} +0 -0
- package/esm2020/platform-server.mjs +5 -0
- package/{esm2015/public_api.js → esm2020/public_api.mjs} +0 -0
- package/esm2020/src/domino_adapter.mjs +90 -0
- package/esm2020/src/http.mjs +125 -0
- package/esm2020/src/location.mjs +125 -0
- package/{esm2015/src/platform-server.js → esm2020/src/platform-server.mjs} +0 -0
- package/esm2020/src/platform_state.mjs +42 -0
- package/{esm2015/src/private_export.js → esm2020/src/private_export.mjs} +0 -0
- package/esm2020/src/server.mjs +104 -0
- package/esm2020/src/server_events.mjs +39 -0
- package/esm2020/src/server_renderer.mjs +273 -0
- package/esm2020/src/styles_host.mjs +51 -0
- package/{esm2015/src/tokens.js → esm2020/src/tokens.mjs} +0 -0
- package/esm2020/src/transfer_state.mjs +53 -0
- package/{esm2015/src/utils.js → esm2020/src/utils.mjs} +0 -0
- package/{esm2015/src/version.js → esm2020/src/version.mjs} +1 -1
- package/{esm2015/testing/index.js → esm2020/testing/index.mjs} +0 -0
- package/{esm2015/testing/public_api.js → esm2020/testing/public_api.mjs} +0 -0
- package/esm2020/testing/src/server.mjs +37 -0
- package/{esm2015/testing/src/testing.js → esm2020/testing/src/testing.mjs} +0 -0
- package/{esm2015/testing/testing.js → esm2020/testing/testing.mjs} +0 -0
- package/fesm2015/{init.js → init.mjs} +4 -4
- package/fesm2015/init.mjs.map +1 -0
- package/fesm2015/platform-server.mjs +1047 -0
- package/fesm2015/platform-server.mjs.map +1 -0
- package/fesm2015/{testing.js → testing.mjs} +14 -9
- package/fesm2015/testing.mjs.map +1 -0
- package/fesm2020/init.mjs +141 -0
- package/fesm2020/init.mjs.map +1 -0
- package/{fesm2015/platform-server.js → fesm2020/platform-server.mjs} +113 -74
- package/fesm2020/platform-server.mjs.map +1 -0
- package/fesm2020/testing.mjs +75 -0
- package/fesm2020/testing.mjs.map +1 -0
- package/init/init.d.ts +1 -1
- package/init/package.json +5 -5
- package/package.json +40 -20
- package/platform-server.d.ts +15 -59
- package/testing/package.json +5 -5
- package/testing/testing.d.ts +7 -1
- package/bundles/platform-server-init.umd.js +0 -469
- package/bundles/platform-server-init.umd.js.map +0 -1
- package/bundles/platform-server-testing.umd.js +0 -79
- package/bundles/platform-server-testing.umd.js.map +0 -1
- package/bundles/platform-server.umd.js +0 -1350
- package/bundles/platform-server.umd.js.map +0 -1
- package/esm2015/init/init.externs.js +0 -6
- package/esm2015/platform-server.externs.js +0 -6
- package/esm2015/platform-server.js +0 -10
- package/esm2015/src/domino_adapter.js +0 -91
- package/esm2015/src/http.js +0 -122
- package/esm2015/src/location.js +0 -118
- package/esm2015/src/platform_state.js +0 -39
- package/esm2015/src/server.js +0 -94
- package/esm2015/src/server_events.js +0 -36
- package/esm2015/src/server_renderer.js +0 -271
- package/esm2015/src/styles_host.js +0 -44
- package/esm2015/src/transfer_state.js +0 -41
- package/esm2015/testing/src/server.js +0 -32
- package/esm2015/testing/testing.externs.js +0 -6
- package/fesm2015/init.js.map +0 -1
- package/fesm2015/platform-server.js.map +0 -1
- package/fesm2015/testing.js.map +0 -1
- package/init/init.metadata.json +0 -1
- package/init.d.ts +0 -7
- package/init.metadata.json +0 -1
- package/platform-server.metadata.json +0 -1
- package/testing/testing.metadata.json +0 -1
- package/testing.d.ts +0 -7
- package/testing.metadata.json +0 -1
|
@@ -1,1350 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Angular v12.2.8
|
|
3
|
-
* (c) 2010-2021 Google LLC. https://angular.io/
|
|
4
|
-
* License: MIT
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
(function (global, factory) {
|
|
8
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/platform-browser'), require('@angular/animations/browser'), require('@angular/common/http'), require('@angular/platform-browser-dynamic'), require('@angular/platform-browser/animations'), require('rxjs'), require('url'), require('@angular/compiler'), require('rxjs/operators')) :
|
|
9
|
-
typeof define === 'function' && define.amd ? define('@angular/platform-server', ['exports', '@angular/common', '@angular/core', '@angular/platform-browser', '@angular/animations/browser', '@angular/common/http', '@angular/platform-browser-dynamic', '@angular/platform-browser/animations', 'rxjs', 'url', '@angular/compiler', 'rxjs/operators'], factory) :
|
|
10
|
-
(global = global || self, factory((global.ng = global.ng || {}, global.ng.platformServer = {}), global.ng.common, global.ng.core, global.ng.platformBrowser, global.ng.animations.browser, global.ng.common.http, global.ng.platformBrowserDynamic, global.ng.platformBrowser.animations, global.rxjs, global.url, global.ng.compiler, global.rxjs.operators));
|
|
11
|
-
}(this, (function (exports, common, core, platformBrowser, browser, http, platformBrowserDynamic, animations, rxjs, url, compiler, operators) { 'use strict';
|
|
12
|
-
|
|
13
|
-
/*! *****************************************************************************
|
|
14
|
-
Copyright (c) Microsoft Corporation.
|
|
15
|
-
|
|
16
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
17
|
-
purpose with or without fee is hereby granted.
|
|
18
|
-
|
|
19
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
20
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
21
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
22
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
23
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
24
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
25
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
26
|
-
***************************************************************************** */
|
|
27
|
-
/* global Reflect, Promise */
|
|
28
|
-
var extendStatics = function (d, b) {
|
|
29
|
-
extendStatics = Object.setPrototypeOf ||
|
|
30
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
31
|
-
function (d, b) { for (var p in b)
|
|
32
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
33
|
-
d[p] = b[p]; };
|
|
34
|
-
return extendStatics(d, b);
|
|
35
|
-
};
|
|
36
|
-
function __extends(d, b) {
|
|
37
|
-
if (typeof b !== "function" && b !== null)
|
|
38
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
39
|
-
extendStatics(d, b);
|
|
40
|
-
function __() { this.constructor = d; }
|
|
41
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
42
|
-
}
|
|
43
|
-
var __assign = function () {
|
|
44
|
-
__assign = Object.assign || function __assign(t) {
|
|
45
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
46
|
-
s = arguments[i];
|
|
47
|
-
for (var p in s)
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
49
|
-
t[p] = s[p];
|
|
50
|
-
}
|
|
51
|
-
return t;
|
|
52
|
-
};
|
|
53
|
-
return __assign.apply(this, arguments);
|
|
54
|
-
};
|
|
55
|
-
function __rest(s, e) {
|
|
56
|
-
var t = {};
|
|
57
|
-
for (var p in s)
|
|
58
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
59
|
-
t[p] = s[p];
|
|
60
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
61
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
62
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
63
|
-
t[p[i]] = s[p[i]];
|
|
64
|
-
}
|
|
65
|
-
return t;
|
|
66
|
-
}
|
|
67
|
-
function __decorate(decorators, target, key, desc) {
|
|
68
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
69
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
70
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
71
|
-
else
|
|
72
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
73
|
-
if (d = decorators[i])
|
|
74
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
75
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
76
|
-
}
|
|
77
|
-
function __param(paramIndex, decorator) {
|
|
78
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
79
|
-
}
|
|
80
|
-
function __metadata(metadataKey, metadataValue) {
|
|
81
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
82
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
83
|
-
}
|
|
84
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
85
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
86
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
87
|
-
function fulfilled(value) { try {
|
|
88
|
-
step(generator.next(value));
|
|
89
|
-
}
|
|
90
|
-
catch (e) {
|
|
91
|
-
reject(e);
|
|
92
|
-
} }
|
|
93
|
-
function rejected(value) { try {
|
|
94
|
-
step(generator["throw"](value));
|
|
95
|
-
}
|
|
96
|
-
catch (e) {
|
|
97
|
-
reject(e);
|
|
98
|
-
} }
|
|
99
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
100
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
function __generator(thisArg, body) {
|
|
104
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
105
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
106
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
107
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
108
|
-
function step(op) {
|
|
109
|
-
if (f)
|
|
110
|
-
throw new TypeError("Generator is already executing.");
|
|
111
|
-
while (_)
|
|
112
|
-
try {
|
|
113
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
114
|
-
return t;
|
|
115
|
-
if (y = 0, t)
|
|
116
|
-
op = [op[0] & 2, t.value];
|
|
117
|
-
switch (op[0]) {
|
|
118
|
-
case 0:
|
|
119
|
-
case 1:
|
|
120
|
-
t = op;
|
|
121
|
-
break;
|
|
122
|
-
case 4:
|
|
123
|
-
_.label++;
|
|
124
|
-
return { value: op[1], done: false };
|
|
125
|
-
case 5:
|
|
126
|
-
_.label++;
|
|
127
|
-
y = op[1];
|
|
128
|
-
op = [0];
|
|
129
|
-
continue;
|
|
130
|
-
case 7:
|
|
131
|
-
op = _.ops.pop();
|
|
132
|
-
_.trys.pop();
|
|
133
|
-
continue;
|
|
134
|
-
default:
|
|
135
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
136
|
-
_ = 0;
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
140
|
-
_.label = op[1];
|
|
141
|
-
break;
|
|
142
|
-
}
|
|
143
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
144
|
-
_.label = t[1];
|
|
145
|
-
t = op;
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
if (t && _.label < t[2]) {
|
|
149
|
-
_.label = t[2];
|
|
150
|
-
_.ops.push(op);
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
if (t[2])
|
|
154
|
-
_.ops.pop();
|
|
155
|
-
_.trys.pop();
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
op = body.call(thisArg, _);
|
|
159
|
-
}
|
|
160
|
-
catch (e) {
|
|
161
|
-
op = [6, e];
|
|
162
|
-
y = 0;
|
|
163
|
-
}
|
|
164
|
-
finally {
|
|
165
|
-
f = t = 0;
|
|
166
|
-
}
|
|
167
|
-
if (op[0] & 5)
|
|
168
|
-
throw op[1];
|
|
169
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
173
|
-
if (k2 === undefined)
|
|
174
|
-
k2 = k;
|
|
175
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
176
|
-
}) : (function (o, m, k, k2) {
|
|
177
|
-
if (k2 === undefined)
|
|
178
|
-
k2 = k;
|
|
179
|
-
o[k2] = m[k];
|
|
180
|
-
});
|
|
181
|
-
function __exportStar(m, o) {
|
|
182
|
-
for (var p in m)
|
|
183
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
184
|
-
__createBinding(o, m, p);
|
|
185
|
-
}
|
|
186
|
-
function __values(o) {
|
|
187
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
188
|
-
if (m)
|
|
189
|
-
return m.call(o);
|
|
190
|
-
if (o && typeof o.length === "number")
|
|
191
|
-
return {
|
|
192
|
-
next: function () {
|
|
193
|
-
if (o && i >= o.length)
|
|
194
|
-
o = void 0;
|
|
195
|
-
return { value: o && o[i++], done: !o };
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
199
|
-
}
|
|
200
|
-
function __read(o, n) {
|
|
201
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
202
|
-
if (!m)
|
|
203
|
-
return o;
|
|
204
|
-
var i = m.call(o), r, ar = [], e;
|
|
205
|
-
try {
|
|
206
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
207
|
-
ar.push(r.value);
|
|
208
|
-
}
|
|
209
|
-
catch (error) {
|
|
210
|
-
e = { error: error };
|
|
211
|
-
}
|
|
212
|
-
finally {
|
|
213
|
-
try {
|
|
214
|
-
if (r && !r.done && (m = i["return"]))
|
|
215
|
-
m.call(i);
|
|
216
|
-
}
|
|
217
|
-
finally {
|
|
218
|
-
if (e)
|
|
219
|
-
throw e.error;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
return ar;
|
|
223
|
-
}
|
|
224
|
-
/** @deprecated */
|
|
225
|
-
function __spread() {
|
|
226
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
227
|
-
ar = ar.concat(__read(arguments[i]));
|
|
228
|
-
return ar;
|
|
229
|
-
}
|
|
230
|
-
/** @deprecated */
|
|
231
|
-
function __spreadArrays() {
|
|
232
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
233
|
-
s += arguments[i].length;
|
|
234
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
235
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
236
|
-
r[k] = a[j];
|
|
237
|
-
return r;
|
|
238
|
-
}
|
|
239
|
-
function __spreadArray(to, from, pack) {
|
|
240
|
-
if (pack || arguments.length === 2)
|
|
241
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
242
|
-
if (ar || !(i in from)) {
|
|
243
|
-
if (!ar)
|
|
244
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
245
|
-
ar[i] = from[i];
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
249
|
-
}
|
|
250
|
-
function __await(v) {
|
|
251
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
252
|
-
}
|
|
253
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
254
|
-
if (!Symbol.asyncIterator)
|
|
255
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
256
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
257
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
258
|
-
function verb(n) { if (g[n])
|
|
259
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
260
|
-
function resume(n, v) { try {
|
|
261
|
-
step(g[n](v));
|
|
262
|
-
}
|
|
263
|
-
catch (e) {
|
|
264
|
-
settle(q[0][3], e);
|
|
265
|
-
} }
|
|
266
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
267
|
-
function fulfill(value) { resume("next", value); }
|
|
268
|
-
function reject(value) { resume("throw", value); }
|
|
269
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
270
|
-
resume(q[0][0], q[0][1]); }
|
|
271
|
-
}
|
|
272
|
-
function __asyncDelegator(o) {
|
|
273
|
-
var i, p;
|
|
274
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
275
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
276
|
-
}
|
|
277
|
-
function __asyncValues(o) {
|
|
278
|
-
if (!Symbol.asyncIterator)
|
|
279
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
280
|
-
var m = o[Symbol.asyncIterator], i;
|
|
281
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
282
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
283
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
284
|
-
}
|
|
285
|
-
function __makeTemplateObject(cooked, raw) {
|
|
286
|
-
if (Object.defineProperty) {
|
|
287
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
288
|
-
}
|
|
289
|
-
else {
|
|
290
|
-
cooked.raw = raw;
|
|
291
|
-
}
|
|
292
|
-
return cooked;
|
|
293
|
-
}
|
|
294
|
-
;
|
|
295
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
296
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
297
|
-
}) : function (o, v) {
|
|
298
|
-
o["default"] = v;
|
|
299
|
-
};
|
|
300
|
-
function __importStar(mod) {
|
|
301
|
-
if (mod && mod.__esModule)
|
|
302
|
-
return mod;
|
|
303
|
-
var result = {};
|
|
304
|
-
if (mod != null)
|
|
305
|
-
for (var k in mod)
|
|
306
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
307
|
-
__createBinding(result, mod, k);
|
|
308
|
-
__setModuleDefault(result, mod);
|
|
309
|
-
return result;
|
|
310
|
-
}
|
|
311
|
-
function __importDefault(mod) {
|
|
312
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
313
|
-
}
|
|
314
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
315
|
-
if (kind === "a" && !f)
|
|
316
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
317
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
318
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
319
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
320
|
-
}
|
|
321
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
322
|
-
if (kind === "m")
|
|
323
|
-
throw new TypeError("Private method is not writable");
|
|
324
|
-
if (kind === "a" && !f)
|
|
325
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
326
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
327
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
328
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* @license
|
|
333
|
-
* Copyright Google LLC All Rights Reserved.
|
|
334
|
-
*
|
|
335
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
336
|
-
* found in the LICENSE file at https://angular.io/license
|
|
337
|
-
*/
|
|
338
|
-
var domino = require('domino');
|
|
339
|
-
function setDomTypes() {
|
|
340
|
-
// Make all Domino types available in the global env.
|
|
341
|
-
Object.assign(global, domino.impl);
|
|
342
|
-
global['KeyboardEvent'] = domino.impl.Event;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Parses a document string to a Document object.
|
|
346
|
-
*/
|
|
347
|
-
function parseDocument(html, url) {
|
|
348
|
-
if (url === void 0) { url = '/'; }
|
|
349
|
-
var window = domino.createWindow(html, url);
|
|
350
|
-
var doc = window.document;
|
|
351
|
-
return doc;
|
|
352
|
-
}
|
|
353
|
-
/**
|
|
354
|
-
* Serializes a document to string.
|
|
355
|
-
*/
|
|
356
|
-
function serializeDocument(doc) {
|
|
357
|
-
return doc.serialize();
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* DOM Adapter for the server platform based on https://github.com/fgnass/domino.
|
|
361
|
-
*/
|
|
362
|
-
var DominoAdapter = /** @class */ (function (_super) {
|
|
363
|
-
__extends(DominoAdapter, _super);
|
|
364
|
-
function DominoAdapter() {
|
|
365
|
-
var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
|
|
366
|
-
_this.supportsDOMEvents = false;
|
|
367
|
-
return _this;
|
|
368
|
-
}
|
|
369
|
-
DominoAdapter.makeCurrent = function () {
|
|
370
|
-
setDomTypes();
|
|
371
|
-
common.ɵsetRootDomAdapter(new DominoAdapter());
|
|
372
|
-
};
|
|
373
|
-
DominoAdapter.prototype.createHtmlDocument = function () {
|
|
374
|
-
return parseDocument('<html><head><title>fakeTitle</title></head><body></body></html>');
|
|
375
|
-
};
|
|
376
|
-
DominoAdapter.prototype.getDefaultDocument = function () {
|
|
377
|
-
if (!DominoAdapter.defaultDoc) {
|
|
378
|
-
DominoAdapter.defaultDoc = domino.createDocument();
|
|
379
|
-
}
|
|
380
|
-
return DominoAdapter.defaultDoc;
|
|
381
|
-
};
|
|
382
|
-
DominoAdapter.prototype.isElementNode = function (node) {
|
|
383
|
-
return node ? node.nodeType === DominoAdapter.defaultDoc.ELEMENT_NODE : false;
|
|
384
|
-
};
|
|
385
|
-
DominoAdapter.prototype.isShadowRoot = function (node) {
|
|
386
|
-
return node.shadowRoot == node;
|
|
387
|
-
};
|
|
388
|
-
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
|
389
|
-
DominoAdapter.prototype.getGlobalEventTarget = function (doc, target) {
|
|
390
|
-
if (target === 'window') {
|
|
391
|
-
return doc.defaultView;
|
|
392
|
-
}
|
|
393
|
-
if (target === 'document') {
|
|
394
|
-
return doc;
|
|
395
|
-
}
|
|
396
|
-
if (target === 'body') {
|
|
397
|
-
return doc.body;
|
|
398
|
-
}
|
|
399
|
-
return null;
|
|
400
|
-
};
|
|
401
|
-
DominoAdapter.prototype.getBaseHref = function (doc) {
|
|
402
|
-
var _a;
|
|
403
|
-
// TODO(alxhub): Need relative path logic from BrowserDomAdapter here?
|
|
404
|
-
return ((_a = doc.documentElement.querySelector('base')) === null || _a === void 0 ? void 0 : _a.getAttribute('href')) || '';
|
|
405
|
-
};
|
|
406
|
-
DominoAdapter.prototype.dispatchEvent = function (el, evt) {
|
|
407
|
-
el.dispatchEvent(evt);
|
|
408
|
-
// Dispatch the event to the window also.
|
|
409
|
-
var doc = el.ownerDocument || el;
|
|
410
|
-
var win = doc.defaultView;
|
|
411
|
-
if (win) {
|
|
412
|
-
win.dispatchEvent(evt);
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
DominoAdapter.prototype.getUserAgent = function () {
|
|
416
|
-
return 'Fake user agent';
|
|
417
|
-
};
|
|
418
|
-
DominoAdapter.prototype.getCookie = function (name) {
|
|
419
|
-
throw new Error('getCookie has not been implemented');
|
|
420
|
-
};
|
|
421
|
-
return DominoAdapter;
|
|
422
|
-
}(platformBrowser.ɵBrowserDomAdapter));
|
|
423
|
-
|
|
424
|
-
/**
|
|
425
|
-
* @license
|
|
426
|
-
* Copyright Google LLC All Rights Reserved.
|
|
427
|
-
*
|
|
428
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
429
|
-
* found in the LICENSE file at https://angular.io/license
|
|
430
|
-
*/
|
|
431
|
-
/**
|
|
432
|
-
* Representation of the current platform state.
|
|
433
|
-
*
|
|
434
|
-
* @publicApi
|
|
435
|
-
*/
|
|
436
|
-
var PlatformState = /** @class */ (function () {
|
|
437
|
-
function PlatformState(_doc) {
|
|
438
|
-
this._doc = _doc;
|
|
439
|
-
}
|
|
440
|
-
/**
|
|
441
|
-
* Renders the current state of the platform to string.
|
|
442
|
-
*/
|
|
443
|
-
PlatformState.prototype.renderToString = function () {
|
|
444
|
-
return serializeDocument(this._doc);
|
|
445
|
-
};
|
|
446
|
-
/**
|
|
447
|
-
* Returns the current DOM state.
|
|
448
|
-
*/
|
|
449
|
-
PlatformState.prototype.getDocument = function () {
|
|
450
|
-
return this._doc;
|
|
451
|
-
};
|
|
452
|
-
return PlatformState;
|
|
453
|
-
}());
|
|
454
|
-
PlatformState.decorators = [
|
|
455
|
-
{ type: core.Injectable }
|
|
456
|
-
];
|
|
457
|
-
PlatformState.ctorParameters = function () { return [
|
|
458
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
|
|
459
|
-
]; };
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* @license
|
|
463
|
-
* Copyright Google LLC All Rights Reserved.
|
|
464
|
-
*
|
|
465
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
466
|
-
* found in the LICENSE file at https://angular.io/license
|
|
467
|
-
*/
|
|
468
|
-
/**
|
|
469
|
-
* The DI token for setting the initial config for the platform.
|
|
470
|
-
*
|
|
471
|
-
* @publicApi
|
|
472
|
-
*/
|
|
473
|
-
var INITIAL_CONFIG = new core.InjectionToken('Server.INITIAL_CONFIG');
|
|
474
|
-
/**
|
|
475
|
-
* A function that will be executed when calling `renderModuleFactory` or `renderModule` just
|
|
476
|
-
* before current platform state is rendered to string.
|
|
477
|
-
*
|
|
478
|
-
* @publicApi
|
|
479
|
-
*/
|
|
480
|
-
var BEFORE_APP_SERIALIZED = new core.InjectionToken('Server.RENDER_MODULE_HOOK');
|
|
481
|
-
|
|
482
|
-
var xhr2 = require('xhr2');
|
|
483
|
-
// @see https://www.w3.org/Protocols/HTTP/1.1/draft-ietf-http-v11-spec-01#URI-syntax
|
|
484
|
-
var isAbsoluteUrl = /^[a-zA-Z\-\+.]+:\/\//;
|
|
485
|
-
var ServerXhr = /** @class */ (function () {
|
|
486
|
-
function ServerXhr() {
|
|
487
|
-
}
|
|
488
|
-
ServerXhr.prototype.build = function () {
|
|
489
|
-
return new xhr2.XMLHttpRequest();
|
|
490
|
-
};
|
|
491
|
-
return ServerXhr;
|
|
492
|
-
}());
|
|
493
|
-
ServerXhr.decorators = [
|
|
494
|
-
{ type: core.Injectable }
|
|
495
|
-
];
|
|
496
|
-
var ZoneMacroTaskWrapper = /** @class */ (function () {
|
|
497
|
-
function ZoneMacroTaskWrapper() {
|
|
498
|
-
}
|
|
499
|
-
ZoneMacroTaskWrapper.prototype.wrap = function (request) {
|
|
500
|
-
var _this = this;
|
|
501
|
-
return new rxjs.Observable(function (observer) {
|
|
502
|
-
var task = null;
|
|
503
|
-
var scheduled = false;
|
|
504
|
-
var sub = null;
|
|
505
|
-
var savedResult = null;
|
|
506
|
-
var savedError = null;
|
|
507
|
-
var scheduleTask = function (_task) {
|
|
508
|
-
task = _task;
|
|
509
|
-
scheduled = true;
|
|
510
|
-
var delegate = _this.delegate(request);
|
|
511
|
-
sub = delegate.subscribe(function (res) { return savedResult = res; }, function (err) {
|
|
512
|
-
if (!scheduled) {
|
|
513
|
-
throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.');
|
|
514
|
-
}
|
|
515
|
-
savedError = err;
|
|
516
|
-
scheduled = false;
|
|
517
|
-
task.invoke();
|
|
518
|
-
}, function () {
|
|
519
|
-
if (!scheduled) {
|
|
520
|
-
throw new Error('An http observable was completed twice. This shouldn\'t happen, please file a bug.');
|
|
521
|
-
}
|
|
522
|
-
scheduled = false;
|
|
523
|
-
task.invoke();
|
|
524
|
-
});
|
|
525
|
-
};
|
|
526
|
-
var cancelTask = function (_task) {
|
|
527
|
-
if (!scheduled) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
scheduled = false;
|
|
531
|
-
if (sub) {
|
|
532
|
-
sub.unsubscribe();
|
|
533
|
-
sub = null;
|
|
534
|
-
}
|
|
535
|
-
};
|
|
536
|
-
var onComplete = function () {
|
|
537
|
-
if (savedError !== null) {
|
|
538
|
-
observer.error(savedError);
|
|
539
|
-
}
|
|
540
|
-
else {
|
|
541
|
-
observer.next(savedResult);
|
|
542
|
-
observer.complete();
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
// MockBackend for Http is synchronous, which means that if scheduleTask is by
|
|
546
|
-
// scheduleMacroTask, the request will hit MockBackend and the response will be
|
|
547
|
-
// sent, causing task.invoke() to be called.
|
|
548
|
-
var _task = Zone.current.scheduleMacroTask('ZoneMacroTaskWrapper.subscribe', onComplete, {}, function () { return null; }, cancelTask);
|
|
549
|
-
scheduleTask(_task);
|
|
550
|
-
return function () {
|
|
551
|
-
if (scheduled && task) {
|
|
552
|
-
task.zone.cancelTask(task);
|
|
553
|
-
scheduled = false;
|
|
554
|
-
}
|
|
555
|
-
if (sub) {
|
|
556
|
-
sub.unsubscribe();
|
|
557
|
-
sub = null;
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
});
|
|
561
|
-
};
|
|
562
|
-
return ZoneMacroTaskWrapper;
|
|
563
|
-
}());
|
|
564
|
-
var ZoneClientBackend = /** @class */ (function (_super) {
|
|
565
|
-
__extends(ZoneClientBackend, _super);
|
|
566
|
-
function ZoneClientBackend(backend, platformLocation, config) {
|
|
567
|
-
var _this = _super.call(this) || this;
|
|
568
|
-
_this.backend = backend;
|
|
569
|
-
_this.platformLocation = platformLocation;
|
|
570
|
-
_this.config = config;
|
|
571
|
-
return _this;
|
|
572
|
-
}
|
|
573
|
-
ZoneClientBackend.prototype.handle = function (request) {
|
|
574
|
-
var _a = this.platformLocation, href = _a.href, protocol = _a.protocol, hostname = _a.hostname, port = _a.port;
|
|
575
|
-
if (this.config.useAbsoluteUrl && !isAbsoluteUrl.test(request.url) &&
|
|
576
|
-
isAbsoluteUrl.test(href)) {
|
|
577
|
-
var baseHref = this.platformLocation.getBaseHrefFromDOM() || href;
|
|
578
|
-
var urlPrefix = protocol + "//" + hostname + (port ? ":" + port : '');
|
|
579
|
-
var baseUrl = new URL(baseHref, urlPrefix);
|
|
580
|
-
var url = new URL(request.url, baseUrl);
|
|
581
|
-
return this.wrap(request.clone({ url: url.toString() }));
|
|
582
|
-
}
|
|
583
|
-
return this.wrap(request);
|
|
584
|
-
};
|
|
585
|
-
ZoneClientBackend.prototype.delegate = function (request) {
|
|
586
|
-
return this.backend.handle(request);
|
|
587
|
-
};
|
|
588
|
-
return ZoneClientBackend;
|
|
589
|
-
}(ZoneMacroTaskWrapper));
|
|
590
|
-
function zoneWrappedInterceptingHandler(backend, injector, platformLocation, config) {
|
|
591
|
-
var realBackend = new http.ɵHttpInterceptingHandler(backend, injector);
|
|
592
|
-
return new ZoneClientBackend(realBackend, platformLocation, config);
|
|
593
|
-
}
|
|
594
|
-
var SERVER_HTTP_PROVIDERS = [
|
|
595
|
-
{ provide: common.XhrFactory, useClass: ServerXhr }, {
|
|
596
|
-
provide: http.HttpHandler,
|
|
597
|
-
useFactory: zoneWrappedInterceptingHandler,
|
|
598
|
-
deps: [http.HttpBackend, core.Injector, common.PlatformLocation, INITIAL_CONFIG]
|
|
599
|
-
}
|
|
600
|
-
];
|
|
601
|
-
|
|
602
|
-
/**
|
|
603
|
-
* @license
|
|
604
|
-
* Copyright Google LLC All Rights Reserved.
|
|
605
|
-
*
|
|
606
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
607
|
-
* found in the LICENSE file at https://angular.io/license
|
|
608
|
-
*/
|
|
609
|
-
function parseUrl(urlStr) {
|
|
610
|
-
var parsedUrl = url.parse(urlStr);
|
|
611
|
-
return {
|
|
612
|
-
hostname: parsedUrl.hostname || '',
|
|
613
|
-
protocol: parsedUrl.protocol || '',
|
|
614
|
-
port: parsedUrl.port || '',
|
|
615
|
-
pathname: parsedUrl.pathname || '',
|
|
616
|
-
search: parsedUrl.search || '',
|
|
617
|
-
hash: parsedUrl.hash || '',
|
|
618
|
-
};
|
|
619
|
-
}
|
|
620
|
-
/**
|
|
621
|
-
* Server-side implementation of URL state. Implements `pathname`, `search`, and `hash`
|
|
622
|
-
* but not the state stack.
|
|
623
|
-
*/
|
|
624
|
-
var ServerPlatformLocation = /** @class */ (function () {
|
|
625
|
-
function ServerPlatformLocation(_doc, _config) {
|
|
626
|
-
this._doc = _doc;
|
|
627
|
-
this.href = '/';
|
|
628
|
-
this.hostname = '/';
|
|
629
|
-
this.protocol = '/';
|
|
630
|
-
this.port = '/';
|
|
631
|
-
this.pathname = '/';
|
|
632
|
-
this.search = '';
|
|
633
|
-
this.hash = '';
|
|
634
|
-
this._hashUpdate = new rxjs.Subject();
|
|
635
|
-
var config = _config;
|
|
636
|
-
if (!config) {
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
if (config.url) {
|
|
640
|
-
var url_1 = parseUrl(config.url);
|
|
641
|
-
this.protocol = url_1.protocol;
|
|
642
|
-
this.hostname = url_1.hostname;
|
|
643
|
-
this.port = url_1.port;
|
|
644
|
-
this.pathname = url_1.pathname;
|
|
645
|
-
this.search = url_1.search;
|
|
646
|
-
this.hash = url_1.hash;
|
|
647
|
-
this.href = _doc.location.href;
|
|
648
|
-
}
|
|
649
|
-
if (config.useAbsoluteUrl) {
|
|
650
|
-
if (!config.baseUrl) {
|
|
651
|
-
throw new Error("\"PlatformConfig.baseUrl\" must be set if \"useAbsoluteUrl\" is true");
|
|
652
|
-
}
|
|
653
|
-
var url_2 = parseUrl(config.baseUrl);
|
|
654
|
-
this.protocol = url_2.protocol;
|
|
655
|
-
this.hostname = url_2.hostname;
|
|
656
|
-
this.port = url_2.port;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
ServerPlatformLocation.prototype.getBaseHrefFromDOM = function () {
|
|
660
|
-
return common.ɵgetDOM().getBaseHref(this._doc);
|
|
661
|
-
};
|
|
662
|
-
ServerPlatformLocation.prototype.onPopState = function (fn) {
|
|
663
|
-
// No-op: a state stack is not implemented, so
|
|
664
|
-
// no events will ever come.
|
|
665
|
-
return function () { };
|
|
666
|
-
};
|
|
667
|
-
ServerPlatformLocation.prototype.onHashChange = function (fn) {
|
|
668
|
-
var subscription = this._hashUpdate.subscribe(fn);
|
|
669
|
-
return function () { return subscription.unsubscribe(); };
|
|
670
|
-
};
|
|
671
|
-
Object.defineProperty(ServerPlatformLocation.prototype, "url", {
|
|
672
|
-
get: function () {
|
|
673
|
-
return "" + this.pathname + this.search + this.hash;
|
|
674
|
-
},
|
|
675
|
-
enumerable: false,
|
|
676
|
-
configurable: true
|
|
677
|
-
});
|
|
678
|
-
ServerPlatformLocation.prototype.setHash = function (value, oldUrl) {
|
|
679
|
-
var _this = this;
|
|
680
|
-
if (this.hash === value) {
|
|
681
|
-
// Don't fire events if the hash has not changed.
|
|
682
|
-
return;
|
|
683
|
-
}
|
|
684
|
-
this.hash = value;
|
|
685
|
-
var newUrl = this.url;
|
|
686
|
-
scheduleMicroTask(function () { return _this._hashUpdate.next({ type: 'hashchange', state: null, oldUrl: oldUrl, newUrl: newUrl }); });
|
|
687
|
-
};
|
|
688
|
-
ServerPlatformLocation.prototype.replaceState = function (state, title, newUrl) {
|
|
689
|
-
var oldUrl = this.url;
|
|
690
|
-
var parsedUrl = parseUrl(newUrl);
|
|
691
|
-
this.pathname = parsedUrl.pathname;
|
|
692
|
-
this.search = parsedUrl.search;
|
|
693
|
-
this.setHash(parsedUrl.hash, oldUrl);
|
|
694
|
-
};
|
|
695
|
-
ServerPlatformLocation.prototype.pushState = function (state, title, newUrl) {
|
|
696
|
-
this.replaceState(state, title, newUrl);
|
|
697
|
-
};
|
|
698
|
-
ServerPlatformLocation.prototype.forward = function () {
|
|
699
|
-
throw new Error('Not implemented');
|
|
700
|
-
};
|
|
701
|
-
ServerPlatformLocation.prototype.back = function () {
|
|
702
|
-
throw new Error('Not implemented');
|
|
703
|
-
};
|
|
704
|
-
// History API isn't available on server, therefore return undefined
|
|
705
|
-
ServerPlatformLocation.prototype.getState = function () {
|
|
706
|
-
return undefined;
|
|
707
|
-
};
|
|
708
|
-
return ServerPlatformLocation;
|
|
709
|
-
}());
|
|
710
|
-
ServerPlatformLocation.decorators = [
|
|
711
|
-
{ type: core.Injectable }
|
|
712
|
-
];
|
|
713
|
-
ServerPlatformLocation.ctorParameters = function () { return [
|
|
714
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
715
|
-
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [INITIAL_CONFIG,] }] }
|
|
716
|
-
]; };
|
|
717
|
-
function scheduleMicroTask(fn) {
|
|
718
|
-
Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* @license
|
|
723
|
-
* Copyright Google LLC All Rights Reserved.
|
|
724
|
-
*
|
|
725
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
726
|
-
* found in the LICENSE file at https://angular.io/license
|
|
727
|
-
*/
|
|
728
|
-
var ServerEventManagerPlugin /* extends EventManagerPlugin which is private */ = /** @class */ (function () {
|
|
729
|
-
function ServerEventManagerPlugin(doc) {
|
|
730
|
-
this.doc = doc;
|
|
731
|
-
}
|
|
732
|
-
// Handle all events on the server.
|
|
733
|
-
ServerEventManagerPlugin.prototype.supports = function (eventName) {
|
|
734
|
-
return true;
|
|
735
|
-
};
|
|
736
|
-
ServerEventManagerPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
|
737
|
-
return common.ɵgetDOM().onAndCancel(element, eventName, handler);
|
|
738
|
-
};
|
|
739
|
-
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
|
|
740
|
-
ServerEventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
|
|
741
|
-
var target = common.ɵgetDOM().getGlobalEventTarget(this.doc, element);
|
|
742
|
-
if (!target) {
|
|
743
|
-
throw new Error("Unsupported event target " + target + " for event " + eventName);
|
|
744
|
-
}
|
|
745
|
-
return this.addEventListener(target, eventName, handler);
|
|
746
|
-
};
|
|
747
|
-
return ServerEventManagerPlugin;
|
|
748
|
-
}());
|
|
749
|
-
ServerEventManagerPlugin.decorators = [
|
|
750
|
-
{ type: core.Injectable }
|
|
751
|
-
];
|
|
752
|
-
ServerEventManagerPlugin.ctorParameters = function () { return [
|
|
753
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
|
|
754
|
-
]; };
|
|
755
|
-
|
|
756
|
-
var EMPTY_ARRAY = [];
|
|
757
|
-
var DEFAULT_SCHEMA = new compiler.DomElementSchemaRegistry();
|
|
758
|
-
var ServerRendererFactory2 = /** @class */ (function () {
|
|
759
|
-
function ServerRendererFactory2(eventManager, ngZone, document, sharedStylesHost) {
|
|
760
|
-
this.eventManager = eventManager;
|
|
761
|
-
this.ngZone = ngZone;
|
|
762
|
-
this.document = document;
|
|
763
|
-
this.sharedStylesHost = sharedStylesHost;
|
|
764
|
-
this.rendererByCompId = new Map();
|
|
765
|
-
this.schema = DEFAULT_SCHEMA;
|
|
766
|
-
this.defaultRenderer = new DefaultServerRenderer2(eventManager, document, ngZone, this.schema);
|
|
767
|
-
}
|
|
768
|
-
ServerRendererFactory2.prototype.createRenderer = function (element, type) {
|
|
769
|
-
if (!element || !type) {
|
|
770
|
-
return this.defaultRenderer;
|
|
771
|
-
}
|
|
772
|
-
switch (type.encapsulation) {
|
|
773
|
-
case core.ViewEncapsulation.Emulated: {
|
|
774
|
-
var renderer = this.rendererByCompId.get(type.id);
|
|
775
|
-
if (!renderer) {
|
|
776
|
-
renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type);
|
|
777
|
-
this.rendererByCompId.set(type.id, renderer);
|
|
778
|
-
}
|
|
779
|
-
renderer.applyToHost(element);
|
|
780
|
-
return renderer;
|
|
781
|
-
}
|
|
782
|
-
default: {
|
|
783
|
-
if (!this.rendererByCompId.has(type.id)) {
|
|
784
|
-
var styles = platformBrowser.ɵflattenStyles(type.id, type.styles, []);
|
|
785
|
-
this.sharedStylesHost.addStyles(styles);
|
|
786
|
-
this.rendererByCompId.set(type.id, this.defaultRenderer);
|
|
787
|
-
}
|
|
788
|
-
return this.defaultRenderer;
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
ServerRendererFactory2.prototype.begin = function () { };
|
|
793
|
-
ServerRendererFactory2.prototype.end = function () { };
|
|
794
|
-
return ServerRendererFactory2;
|
|
795
|
-
}());
|
|
796
|
-
ServerRendererFactory2.decorators = [
|
|
797
|
-
{ type: core.Injectable }
|
|
798
|
-
];
|
|
799
|
-
ServerRendererFactory2.ctorParameters = function () { return [
|
|
800
|
-
{ type: platformBrowser.EventManager },
|
|
801
|
-
{ type: core.NgZone },
|
|
802
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
803
|
-
{ type: platformBrowser.ɵSharedStylesHost }
|
|
804
|
-
]; };
|
|
805
|
-
var DefaultServerRenderer2 = /** @class */ (function () {
|
|
806
|
-
function DefaultServerRenderer2(eventManager, document, ngZone, schema) {
|
|
807
|
-
this.eventManager = eventManager;
|
|
808
|
-
this.document = document;
|
|
809
|
-
this.ngZone = ngZone;
|
|
810
|
-
this.schema = schema;
|
|
811
|
-
this.data = Object.create(null);
|
|
812
|
-
}
|
|
813
|
-
DefaultServerRenderer2.prototype.destroy = function () { };
|
|
814
|
-
DefaultServerRenderer2.prototype.createElement = function (name, namespace, debugInfo) {
|
|
815
|
-
if (namespace) {
|
|
816
|
-
var doc = this.document || common.ɵgetDOM().getDefaultDocument();
|
|
817
|
-
// TODO(FW-811): Ivy may cause issues here because it's passing around
|
|
818
|
-
// full URIs for namespaces, therefore this lookup will fail.
|
|
819
|
-
return doc.createElementNS(platformBrowser.ɵNAMESPACE_URIS[namespace], name);
|
|
820
|
-
}
|
|
821
|
-
return common.ɵgetDOM().createElement(name, this.document);
|
|
822
|
-
};
|
|
823
|
-
DefaultServerRenderer2.prototype.createComment = function (value, debugInfo) {
|
|
824
|
-
return common.ɵgetDOM().getDefaultDocument().createComment(value);
|
|
825
|
-
};
|
|
826
|
-
DefaultServerRenderer2.prototype.createText = function (value, debugInfo) {
|
|
827
|
-
var doc = common.ɵgetDOM().getDefaultDocument();
|
|
828
|
-
return doc.createTextNode(value);
|
|
829
|
-
};
|
|
830
|
-
DefaultServerRenderer2.prototype.appendChild = function (parent, newChild) {
|
|
831
|
-
parent.appendChild(newChild);
|
|
832
|
-
};
|
|
833
|
-
DefaultServerRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
|
834
|
-
if (parent) {
|
|
835
|
-
parent.insertBefore(newChild, refChild);
|
|
836
|
-
}
|
|
837
|
-
};
|
|
838
|
-
DefaultServerRenderer2.prototype.removeChild = function (parent, oldChild) {
|
|
839
|
-
if (parent) {
|
|
840
|
-
parent.removeChild(oldChild);
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
DefaultServerRenderer2.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
|
|
844
|
-
var el;
|
|
845
|
-
if (typeof selectorOrNode === 'string') {
|
|
846
|
-
el = this.document.querySelector(selectorOrNode);
|
|
847
|
-
if (!el) {
|
|
848
|
-
throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
else {
|
|
852
|
-
el = selectorOrNode;
|
|
853
|
-
}
|
|
854
|
-
while (el.firstChild) {
|
|
855
|
-
el.removeChild(el.firstChild);
|
|
856
|
-
}
|
|
857
|
-
return el;
|
|
858
|
-
};
|
|
859
|
-
DefaultServerRenderer2.prototype.parentNode = function (node) {
|
|
860
|
-
return node.parentNode;
|
|
861
|
-
};
|
|
862
|
-
DefaultServerRenderer2.prototype.nextSibling = function (node) {
|
|
863
|
-
return node.nextSibling;
|
|
864
|
-
};
|
|
865
|
-
DefaultServerRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
|
866
|
-
if (namespace) {
|
|
867
|
-
// TODO(FW-811): Ivy may cause issues here because it's passing around
|
|
868
|
-
// full URIs for namespaces, therefore this lookup will fail.
|
|
869
|
-
el.setAttributeNS(platformBrowser.ɵNAMESPACE_URIS[namespace], namespace + ':' + name, value);
|
|
870
|
-
}
|
|
871
|
-
else {
|
|
872
|
-
el.setAttribute(name, value);
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
DefaultServerRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
|
876
|
-
if (namespace) {
|
|
877
|
-
// TODO(FW-811): Ivy may cause issues here because it's passing around
|
|
878
|
-
// full URIs for namespaces, therefore this lookup will fail.
|
|
879
|
-
el.removeAttributeNS(platformBrowser.ɵNAMESPACE_URIS[namespace], name);
|
|
880
|
-
}
|
|
881
|
-
else {
|
|
882
|
-
el.removeAttribute(name);
|
|
883
|
-
}
|
|
884
|
-
};
|
|
885
|
-
DefaultServerRenderer2.prototype.addClass = function (el, name) {
|
|
886
|
-
el.classList.add(name);
|
|
887
|
-
};
|
|
888
|
-
DefaultServerRenderer2.prototype.removeClass = function (el, name) {
|
|
889
|
-
el.classList.remove(name);
|
|
890
|
-
};
|
|
891
|
-
DefaultServerRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
|
892
|
-
style = style.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
893
|
-
var styleMap = _readStyleAttribute(el);
|
|
894
|
-
if (flags & core.RendererStyleFlags2.Important) {
|
|
895
|
-
value += ' !important';
|
|
896
|
-
}
|
|
897
|
-
styleMap[style] = value == null ? '' : value;
|
|
898
|
-
_writeStyleAttribute(el, styleMap);
|
|
899
|
-
};
|
|
900
|
-
DefaultServerRenderer2.prototype.removeStyle = function (el, style, flags) {
|
|
901
|
-
// IE requires '' instead of null
|
|
902
|
-
// see https://github.com/angular/angular/issues/7916
|
|
903
|
-
this.setStyle(el, style, '', flags);
|
|
904
|
-
};
|
|
905
|
-
// The value was validated already as a property binding, against the property name.
|
|
906
|
-
// To know this value is safe to use as an attribute, the security context of the
|
|
907
|
-
// attribute with the given name is checked against that security context of the
|
|
908
|
-
// property.
|
|
909
|
-
DefaultServerRenderer2.prototype._isSafeToReflectProperty = function (tagName, propertyName) {
|
|
910
|
-
return this.schema.securityContext(tagName, propertyName, true) ===
|
|
911
|
-
this.schema.securityContext(tagName, propertyName, false);
|
|
912
|
-
};
|
|
913
|
-
DefaultServerRenderer2.prototype.setProperty = function (el, name, value) {
|
|
914
|
-
checkNoSyntheticProp(name, 'property');
|
|
915
|
-
if (name === 'innerText') {
|
|
916
|
-
// Domino does not support innerText. Just map it to textContent.
|
|
917
|
-
el.textContent = value;
|
|
918
|
-
}
|
|
919
|
-
el[name] = value;
|
|
920
|
-
// Mirror property values for known HTML element properties in the attributes.
|
|
921
|
-
// Skip `innerhtml` which is conservatively marked as an attribute for security
|
|
922
|
-
// purposes but is not actually an attribute.
|
|
923
|
-
var tagName = el.tagName.toLowerCase();
|
|
924
|
-
if (value != null && (typeof value === 'number' || typeof value == 'string') &&
|
|
925
|
-
name.toLowerCase() !== 'innerhtml' && this.schema.hasElement(tagName, EMPTY_ARRAY) &&
|
|
926
|
-
this.schema.hasProperty(tagName, name, EMPTY_ARRAY) &&
|
|
927
|
-
this._isSafeToReflectProperty(tagName, name)) {
|
|
928
|
-
this.setAttribute(el, name, value.toString());
|
|
929
|
-
}
|
|
930
|
-
};
|
|
931
|
-
DefaultServerRenderer2.prototype.setValue = function (node, value) {
|
|
932
|
-
node.textContent = value;
|
|
933
|
-
};
|
|
934
|
-
DefaultServerRenderer2.prototype.listen = function (target, eventName, callback) {
|
|
935
|
-
checkNoSyntheticProp(eventName, 'listener');
|
|
936
|
-
if (typeof target === 'string') {
|
|
937
|
-
return this.eventManager.addGlobalEventListener(target, eventName, this.decoratePreventDefault(callback));
|
|
938
|
-
}
|
|
939
|
-
return this.eventManager.addEventListener(target, eventName, this.decoratePreventDefault(callback));
|
|
940
|
-
};
|
|
941
|
-
DefaultServerRenderer2.prototype.decoratePreventDefault = function (eventHandler) {
|
|
942
|
-
var _this = this;
|
|
943
|
-
return function (event) {
|
|
944
|
-
// Ivy uses `Function` as a special token that allows us to unwrap the function
|
|
945
|
-
// so that it can be invoked programmatically by `DebugNode.triggerEventHandler`.
|
|
946
|
-
if (event === Function) {
|
|
947
|
-
return eventHandler;
|
|
948
|
-
}
|
|
949
|
-
// Run the event handler inside the ngZone because event handlers are not patched
|
|
950
|
-
// by Zone on the server. This is required only for tests.
|
|
951
|
-
var allowDefaultBehavior = _this.ngZone.runGuarded(function () { return eventHandler(event); });
|
|
952
|
-
if (allowDefaultBehavior === false) {
|
|
953
|
-
event.preventDefault();
|
|
954
|
-
event.returnValue = false;
|
|
955
|
-
}
|
|
956
|
-
return undefined;
|
|
957
|
-
};
|
|
958
|
-
};
|
|
959
|
-
return DefaultServerRenderer2;
|
|
960
|
-
}());
|
|
961
|
-
var AT_CHARCODE = '@'.charCodeAt(0);
|
|
962
|
-
function checkNoSyntheticProp(name, nameKind) {
|
|
963
|
-
if (name.charCodeAt(0) === AT_CHARCODE) {
|
|
964
|
-
throw new Error("Unexpected synthetic " + nameKind + " " + name + " found. Please make sure that:\n - Either `BrowserAnimationsModule` or `NoopAnimationsModule` are imported in your application.\n - There is corresponding configuration for the animation named `" + name + "` defined in the `animations` field of the `@Component` decorator (see https://angular.io/api/core/Component#animations).");
|
|
965
|
-
}
|
|
966
|
-
}
|
|
967
|
-
var EmulatedEncapsulationServerRenderer2 = /** @class */ (function (_super) {
|
|
968
|
-
__extends(EmulatedEncapsulationServerRenderer2, _super);
|
|
969
|
-
function EmulatedEncapsulationServerRenderer2(eventManager, document, ngZone, sharedStylesHost, schema, component) {
|
|
970
|
-
var _this = _super.call(this, eventManager, document, ngZone, schema) || this;
|
|
971
|
-
_this.component = component;
|
|
972
|
-
// Add a 's' prefix to style attributes to indicate server.
|
|
973
|
-
var componentId = 's' + component.id;
|
|
974
|
-
var styles = platformBrowser.ɵflattenStyles(componentId, component.styles, []);
|
|
975
|
-
sharedStylesHost.addStyles(styles);
|
|
976
|
-
_this.contentAttr = platformBrowser.ɵshimContentAttribute(componentId);
|
|
977
|
-
_this.hostAttr = platformBrowser.ɵshimHostAttribute(componentId);
|
|
978
|
-
return _this;
|
|
979
|
-
}
|
|
980
|
-
EmulatedEncapsulationServerRenderer2.prototype.applyToHost = function (element) {
|
|
981
|
-
_super.prototype.setAttribute.call(this, element, this.hostAttr, '');
|
|
982
|
-
};
|
|
983
|
-
EmulatedEncapsulationServerRenderer2.prototype.createElement = function (parent, name) {
|
|
984
|
-
var el = _super.prototype.createElement.call(this, parent, name, this.document);
|
|
985
|
-
_super.prototype.setAttribute.call(this, el, this.contentAttr, '');
|
|
986
|
-
return el;
|
|
987
|
-
};
|
|
988
|
-
return EmulatedEncapsulationServerRenderer2;
|
|
989
|
-
}(DefaultServerRenderer2));
|
|
990
|
-
function _readStyleAttribute(element) {
|
|
991
|
-
var styleMap = {};
|
|
992
|
-
var styleAttribute = element.getAttribute('style');
|
|
993
|
-
if (styleAttribute) {
|
|
994
|
-
var styleList = styleAttribute.split(/;+/g);
|
|
995
|
-
for (var i = 0; i < styleList.length; i++) {
|
|
996
|
-
var style = styleList[i].trim();
|
|
997
|
-
if (style.length > 0) {
|
|
998
|
-
var colonIndex = style.indexOf(':');
|
|
999
|
-
if (colonIndex === -1) {
|
|
1000
|
-
throw new Error("Invalid CSS style: " + style);
|
|
1001
|
-
}
|
|
1002
|
-
var name = style.substr(0, colonIndex).trim();
|
|
1003
|
-
styleMap[name] = style.substr(colonIndex + 1).trim();
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
return styleMap;
|
|
1008
|
-
}
|
|
1009
|
-
function _writeStyleAttribute(element, styleMap) {
|
|
1010
|
-
var styleAttrValue = '';
|
|
1011
|
-
for (var key in styleMap) {
|
|
1012
|
-
var newValue = styleMap[key];
|
|
1013
|
-
if (newValue != null) {
|
|
1014
|
-
styleAttrValue += key + ':' + styleMap[key] + ';';
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
element.setAttribute('style', styleAttrValue);
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
var ServerStylesHost = /** @class */ (function (_super) {
|
|
1021
|
-
__extends(ServerStylesHost, _super);
|
|
1022
|
-
function ServerStylesHost(doc, transitionId) {
|
|
1023
|
-
var _this = _super.call(this) || this;
|
|
1024
|
-
_this.doc = doc;
|
|
1025
|
-
_this.transitionId = transitionId;
|
|
1026
|
-
_this.head = null;
|
|
1027
|
-
_this._styleNodes = new Set();
|
|
1028
|
-
_this.head = doc.getElementsByTagName('head')[0];
|
|
1029
|
-
return _this;
|
|
1030
|
-
}
|
|
1031
|
-
ServerStylesHost.prototype._addStyle = function (style) {
|
|
1032
|
-
var adapter = common.ɵgetDOM();
|
|
1033
|
-
var el = adapter.createElement('style');
|
|
1034
|
-
el.textContent = style;
|
|
1035
|
-
if (!!this.transitionId) {
|
|
1036
|
-
el.setAttribute('ng-transition', this.transitionId);
|
|
1037
|
-
}
|
|
1038
|
-
this.head.appendChild(el);
|
|
1039
|
-
this._styleNodes.add(el);
|
|
1040
|
-
};
|
|
1041
|
-
ServerStylesHost.prototype.onStylesAdded = function (additions) {
|
|
1042
|
-
var _this = this;
|
|
1043
|
-
additions.forEach(function (style) { return _this._addStyle(style); });
|
|
1044
|
-
};
|
|
1045
|
-
ServerStylesHost.prototype.ngOnDestroy = function () {
|
|
1046
|
-
this._styleNodes.forEach(function (styleNode) { return styleNode.remove(); });
|
|
1047
|
-
};
|
|
1048
|
-
return ServerStylesHost;
|
|
1049
|
-
}(platformBrowser.ɵSharedStylesHost));
|
|
1050
|
-
ServerStylesHost.decorators = [
|
|
1051
|
-
{ type: core.Injectable }
|
|
1052
|
-
];
|
|
1053
|
-
ServerStylesHost.ctorParameters = function () { return [
|
|
1054
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
|
|
1055
|
-
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [platformBrowser.ɵTRANSITION_ID,] }] }
|
|
1056
|
-
]; };
|
|
1057
|
-
|
|
1058
|
-
/**
|
|
1059
|
-
* @license
|
|
1060
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1061
|
-
*
|
|
1062
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1063
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1064
|
-
*/
|
|
1065
|
-
function notSupported(feature) {
|
|
1066
|
-
throw new Error("platform-server does not support '" + feature + "'.");
|
|
1067
|
-
}
|
|
1068
|
-
var INTERNAL_SERVER_PLATFORM_PROVIDERS = [
|
|
1069
|
-
{ provide: common.DOCUMENT, useFactory: _document, deps: [core.Injector] },
|
|
1070
|
-
{ provide: core.PLATFORM_ID, useValue: common.ɵPLATFORM_SERVER_ID },
|
|
1071
|
-
{ provide: core.PLATFORM_INITIALIZER, useFactory: initDominoAdapter, multi: true, deps: [core.Injector] }, {
|
|
1072
|
-
provide: common.PlatformLocation,
|
|
1073
|
-
useClass: ServerPlatformLocation,
|
|
1074
|
-
deps: [common.DOCUMENT, [core.Optional, INITIAL_CONFIG]]
|
|
1075
|
-
},
|
|
1076
|
-
{ provide: PlatformState, deps: [common.DOCUMENT] },
|
|
1077
|
-
// Add special provider that allows multiple instances of platformServer* to be created.
|
|
1078
|
-
{ provide: core.ɵALLOW_MULTIPLE_PLATFORMS, useValue: true }
|
|
1079
|
-
];
|
|
1080
|
-
function initDominoAdapter(injector) {
|
|
1081
|
-
return function () {
|
|
1082
|
-
DominoAdapter.makeCurrent();
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
function instantiateServerRendererFactory(renderer, engine, zone) {
|
|
1086
|
-
return new animations.ɵAnimationRendererFactory(renderer, engine, zone);
|
|
1087
|
-
}
|
|
1088
|
-
var SERVER_RENDER_PROVIDERS = [
|
|
1089
|
-
ServerRendererFactory2,
|
|
1090
|
-
{
|
|
1091
|
-
provide: core.RendererFactory2,
|
|
1092
|
-
useFactory: instantiateServerRendererFactory,
|
|
1093
|
-
deps: [ServerRendererFactory2, browser.ɵAnimationEngine, core.NgZone]
|
|
1094
|
-
},
|
|
1095
|
-
ServerStylesHost,
|
|
1096
|
-
{ provide: platformBrowser.ɵSharedStylesHost, useExisting: ServerStylesHost },
|
|
1097
|
-
{ provide: platformBrowser.EVENT_MANAGER_PLUGINS, multi: true, useClass: ServerEventManagerPlugin },
|
|
1098
|
-
];
|
|
1099
|
-
/**
|
|
1100
|
-
* The ng module for the server.
|
|
1101
|
-
*
|
|
1102
|
-
* @publicApi
|
|
1103
|
-
*/
|
|
1104
|
-
var ServerModule = /** @class */ (function () {
|
|
1105
|
-
function ServerModule() {
|
|
1106
|
-
}
|
|
1107
|
-
return ServerModule;
|
|
1108
|
-
}());
|
|
1109
|
-
ServerModule.decorators = [
|
|
1110
|
-
{ type: core.NgModule, args: [{
|
|
1111
|
-
exports: [platformBrowser.BrowserModule],
|
|
1112
|
-
imports: [http.HttpClientModule, animations.NoopAnimationsModule],
|
|
1113
|
-
providers: [
|
|
1114
|
-
SERVER_RENDER_PROVIDERS,
|
|
1115
|
-
SERVER_HTTP_PROVIDERS,
|
|
1116
|
-
{ provide: core.Testability, useValue: null },
|
|
1117
|
-
{ provide: common.ViewportScroller, useClass: common.ɵNullViewportScroller },
|
|
1118
|
-
],
|
|
1119
|
-
},] }
|
|
1120
|
-
];
|
|
1121
|
-
function _document(injector) {
|
|
1122
|
-
var config = injector.get(INITIAL_CONFIG, null);
|
|
1123
|
-
var document = config && config.document ? parseDocument(config.document, config.url) :
|
|
1124
|
-
common.ɵgetDOM().createHtmlDocument();
|
|
1125
|
-
// Tell ivy about the global document
|
|
1126
|
-
core.ɵsetDocument(document);
|
|
1127
|
-
return document;
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* @publicApi
|
|
1131
|
-
*/
|
|
1132
|
-
var platformServer = core.createPlatformFactory(core.platformCore, 'server', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
1133
|
-
/**
|
|
1134
|
-
* The server platform that supports the runtime compiler.
|
|
1135
|
-
*
|
|
1136
|
-
* @publicApi
|
|
1137
|
-
*/
|
|
1138
|
-
var platformDynamicServer = core.createPlatformFactory(platformBrowserDynamic.ɵplatformCoreDynamic, 'serverDynamic', INTERNAL_SERVER_PLATFORM_PROVIDERS);
|
|
1139
|
-
|
|
1140
|
-
/**
|
|
1141
|
-
* @license
|
|
1142
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1143
|
-
*
|
|
1144
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1145
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1146
|
-
*/
|
|
1147
|
-
function serializeTransferStateFactory(doc, appId, transferStore) {
|
|
1148
|
-
return function () {
|
|
1149
|
-
var script = doc.createElement('script');
|
|
1150
|
-
script.id = appId + '-state';
|
|
1151
|
-
script.setAttribute('type', 'application/json');
|
|
1152
|
-
script.textContent = platformBrowser.ɵescapeHtml(transferStore.toJson());
|
|
1153
|
-
doc.body.appendChild(script);
|
|
1154
|
-
};
|
|
1155
|
-
}
|
|
1156
|
-
/**
|
|
1157
|
-
* NgModule to install on the server side while using the `TransferState` to transfer state from
|
|
1158
|
-
* server to client.
|
|
1159
|
-
*
|
|
1160
|
-
* @publicApi
|
|
1161
|
-
*/
|
|
1162
|
-
var ServerTransferStateModule = /** @class */ (function () {
|
|
1163
|
-
function ServerTransferStateModule() {
|
|
1164
|
-
}
|
|
1165
|
-
return ServerTransferStateModule;
|
|
1166
|
-
}());
|
|
1167
|
-
ServerTransferStateModule.decorators = [
|
|
1168
|
-
{ type: core.NgModule, args: [{
|
|
1169
|
-
providers: [
|
|
1170
|
-
platformBrowser.TransferState, {
|
|
1171
|
-
provide: BEFORE_APP_SERIALIZED,
|
|
1172
|
-
useFactory: serializeTransferStateFactory,
|
|
1173
|
-
deps: [common.DOCUMENT, core.APP_ID, platformBrowser.TransferState],
|
|
1174
|
-
multi: true,
|
|
1175
|
-
}
|
|
1176
|
-
]
|
|
1177
|
-
},] }
|
|
1178
|
-
];
|
|
1179
|
-
|
|
1180
|
-
function _getPlatform(platformFactory, options) {
|
|
1181
|
-
var extraProviders = options.extraProviders ? options.extraProviders : [];
|
|
1182
|
-
return platformFactory([
|
|
1183
|
-
{ provide: INITIAL_CONFIG, useValue: { document: options.document, url: options.url } },
|
|
1184
|
-
extraProviders
|
|
1185
|
-
]);
|
|
1186
|
-
}
|
|
1187
|
-
function _render(platform, moduleRefPromise) {
|
|
1188
|
-
return moduleRefPromise.then(function (moduleRef) {
|
|
1189
|
-
var transitionId = moduleRef.injector.get(platformBrowser.ɵTRANSITION_ID, null);
|
|
1190
|
-
if (!transitionId) {
|
|
1191
|
-
throw new Error("renderModule[Factory]() requires the use of BrowserModule.withServerTransition() to ensure\nthe server-rendered app can be properly bootstrapped into a client app.");
|
|
1192
|
-
}
|
|
1193
|
-
var applicationRef = moduleRef.injector.get(core.ApplicationRef);
|
|
1194
|
-
return applicationRef.isStable.pipe((operators.first(function (isStable) { return isStable; })))
|
|
1195
|
-
.toPromise()
|
|
1196
|
-
.then(function () {
|
|
1197
|
-
var e_1, _a;
|
|
1198
|
-
var platformState = platform.injector.get(PlatformState);
|
|
1199
|
-
var asyncPromises = [];
|
|
1200
|
-
// Run any BEFORE_APP_SERIALIZED callbacks just before rendering to string.
|
|
1201
|
-
var callbacks = moduleRef.injector.get(BEFORE_APP_SERIALIZED, null);
|
|
1202
|
-
if (callbacks) {
|
|
1203
|
-
try {
|
|
1204
|
-
for (var callbacks_1 = __values(callbacks), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) {
|
|
1205
|
-
var callback = callbacks_1_1.value;
|
|
1206
|
-
try {
|
|
1207
|
-
var callbackResult = callback();
|
|
1208
|
-
if (core.ɵisPromise(callbackResult)) {
|
|
1209
|
-
// TODO: in TS3.7, callbackResult is void.
|
|
1210
|
-
asyncPromises.push(callbackResult);
|
|
1211
|
-
}
|
|
1212
|
-
}
|
|
1213
|
-
catch (e) {
|
|
1214
|
-
// Ignore exceptions.
|
|
1215
|
-
console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);
|
|
1216
|
-
}
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1220
|
-
finally {
|
|
1221
|
-
try {
|
|
1222
|
-
if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1);
|
|
1223
|
-
}
|
|
1224
|
-
finally { if (e_1) throw e_1.error; }
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1227
|
-
var complete = function () {
|
|
1228
|
-
var output = platformState.renderToString();
|
|
1229
|
-
platform.destroy();
|
|
1230
|
-
return output;
|
|
1231
|
-
};
|
|
1232
|
-
if (asyncPromises.length === 0) {
|
|
1233
|
-
return complete();
|
|
1234
|
-
}
|
|
1235
|
-
return Promise
|
|
1236
|
-
.all(asyncPromises.map(function (asyncPromise) {
|
|
1237
|
-
return asyncPromise.catch(function (e) {
|
|
1238
|
-
console.warn('Ignoring BEFORE_APP_SERIALIZED Exception: ', e);
|
|
1239
|
-
});
|
|
1240
|
-
}))
|
|
1241
|
-
.then(complete);
|
|
1242
|
-
});
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
/**
|
|
1246
|
-
* Renders a Module to string.
|
|
1247
|
-
*
|
|
1248
|
-
* `document` is the full document HTML of the page to render, as a string.
|
|
1249
|
-
* `url` is the URL for the current render request.
|
|
1250
|
-
* `extraProviders` are the platform level providers for the current render request.
|
|
1251
|
-
*
|
|
1252
|
-
* If compiling with the ViewEngine renderer, do not use this in a production server environment.
|
|
1253
|
-
* Use pre-compiled {@link NgModuleFactory} with {@link renderModuleFactory} instead. If
|
|
1254
|
-
* compiling with the Ivy renderer, this method is the recommended rendering method for
|
|
1255
|
-
* platform-server.
|
|
1256
|
-
*
|
|
1257
|
-
* @publicApi
|
|
1258
|
-
*/
|
|
1259
|
-
function renderModule(module, options) {
|
|
1260
|
-
var platform = _getPlatform(platformDynamicServer, options);
|
|
1261
|
-
return _render(platform, platform.bootstrapModule(module));
|
|
1262
|
-
}
|
|
1263
|
-
/**
|
|
1264
|
-
* Renders a {@link NgModuleFactory} to string.
|
|
1265
|
-
*
|
|
1266
|
-
* `document` is the full document HTML of the page to render, as a string.
|
|
1267
|
-
* `url` is the URL for the current render request.
|
|
1268
|
-
* `extraProviders` are the platform level providers for the current render request.
|
|
1269
|
-
*
|
|
1270
|
-
* @publicApi
|
|
1271
|
-
*/
|
|
1272
|
-
function renderModuleFactory(moduleFactory, options) {
|
|
1273
|
-
var platform = _getPlatform(platformServer, options);
|
|
1274
|
-
return _render(platform, platform.bootstrapModuleFactory(moduleFactory));
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* @license
|
|
1279
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1280
|
-
*
|
|
1281
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1282
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1283
|
-
*/
|
|
1284
|
-
|
|
1285
|
-
/**
|
|
1286
|
-
* @license
|
|
1287
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1288
|
-
*
|
|
1289
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1290
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1291
|
-
*/
|
|
1292
|
-
/**
|
|
1293
|
-
* @publicApi
|
|
1294
|
-
*/
|
|
1295
|
-
var VERSION = new core.Version('12.2.8');
|
|
1296
|
-
|
|
1297
|
-
/**
|
|
1298
|
-
* @license
|
|
1299
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1300
|
-
*
|
|
1301
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1302
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1303
|
-
*/
|
|
1304
|
-
|
|
1305
|
-
/**
|
|
1306
|
-
* @license
|
|
1307
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1308
|
-
*
|
|
1309
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1310
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1311
|
-
*/
|
|
1312
|
-
// This file only reexports content of the `src` folder. Keep it that way.
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* @license
|
|
1316
|
-
* Copyright Google LLC All Rights Reserved.
|
|
1317
|
-
*
|
|
1318
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
1319
|
-
* found in the LICENSE file at https://angular.io/license
|
|
1320
|
-
*/
|
|
1321
|
-
|
|
1322
|
-
/**
|
|
1323
|
-
* Generated bundle index. Do not edit.
|
|
1324
|
-
*/
|
|
1325
|
-
|
|
1326
|
-
exports.BEFORE_APP_SERIALIZED = BEFORE_APP_SERIALIZED;
|
|
1327
|
-
exports.INITIAL_CONFIG = INITIAL_CONFIG;
|
|
1328
|
-
exports.PlatformState = PlatformState;
|
|
1329
|
-
exports.ServerModule = ServerModule;
|
|
1330
|
-
exports.ServerTransferStateModule = ServerTransferStateModule;
|
|
1331
|
-
exports.VERSION = VERSION;
|
|
1332
|
-
exports.platformDynamicServer = platformDynamicServer;
|
|
1333
|
-
exports.platformServer = platformServer;
|
|
1334
|
-
exports.renderModule = renderModule;
|
|
1335
|
-
exports.renderModuleFactory = renderModuleFactory;
|
|
1336
|
-
exports.ɵINTERNAL_SERVER_PLATFORM_PROVIDERS = INTERNAL_SERVER_PLATFORM_PROVIDERS;
|
|
1337
|
-
exports.ɵSERVER_RENDER_PROVIDERS = SERVER_RENDER_PROVIDERS;
|
|
1338
|
-
exports.ɵServerRendererFactory2 = ServerRendererFactory2;
|
|
1339
|
-
exports.ɵangular_packages_platform_server_platform_server_a = instantiateServerRendererFactory;
|
|
1340
|
-
exports.ɵangular_packages_platform_server_platform_server_b = serializeTransferStateFactory;
|
|
1341
|
-
exports.ɵangular_packages_platform_server_platform_server_c = ServerStylesHost;
|
|
1342
|
-
exports.ɵangular_packages_platform_server_platform_server_d = ServerEventManagerPlugin;
|
|
1343
|
-
exports.ɵangular_packages_platform_server_platform_server_e = ServerXhr;
|
|
1344
|
-
exports.ɵangular_packages_platform_server_platform_server_f = zoneWrappedInterceptingHandler;
|
|
1345
|
-
exports.ɵangular_packages_platform_server_platform_server_g = SERVER_HTTP_PROVIDERS;
|
|
1346
|
-
|
|
1347
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1348
|
-
|
|
1349
|
-
})));
|
|
1350
|
-
//# sourceMappingURL=platform-server.umd.js.map
|