@angular/router 5.2.7 → 5.2.8
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/bundles/router-testing.umd.js +2 -2
- package/bundles/router-testing.umd.min.js +2 -2
- package/bundles/router-testing.umd.min.js.map +1 -1
- package/bundles/router-upgrade.umd.js +2 -2
- package/bundles/router-upgrade.umd.min.js +2 -2
- package/bundles/router-upgrade.umd.min.js.map +1 -1
- package/bundles/router.umd.js +51 -18
- package/bundles/router.umd.js.map +1 -1
- package/bundles/router.umd.min.js +5 -5
- package/bundles/router.umd.min.js.map +1 -1
- package/esm2015/router.js +50 -17
- package/esm2015/router.js.map +1 -1
- package/esm2015/testing.js +1 -1
- package/esm2015/upgrade.js +1 -1
- package/esm5/router.js +50 -17
- package/esm5/router.js.map +1 -1
- package/esm5/testing.js +1 -1
- package/esm5/upgrade.js +1 -1
- package/package.json +4 -4
- package/router.metadata.json +1 -1
- package/src/url_tree.d.ts +14 -10
- package/testing.d.ts +1 -1
- package/upgrade.d.ts +1 -1
package/esm2015/router.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v5.2.
|
|
2
|
+
* @license Angular v5.2.8
|
|
3
3
|
* (c) 2010-2018 Google, Inc. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1156,7 +1156,7 @@ class DefaultUrlSerializer {
|
|
|
1156
1156
|
serialize(tree) {
|
|
1157
1157
|
const /** @type {?} */ segment = `/${serializeSegment(tree.root, true)}`;
|
|
1158
1158
|
const /** @type {?} */ query = serializeQueryParams(tree.queryParams);
|
|
1159
|
-
const /** @type {?} */ fragment = typeof tree.fragment === `string` ? `#${
|
|
1159
|
+
const /** @type {?} */ fragment = typeof tree.fragment === `string` ? `#${encodeUriQuery((/** @type {?} */ ((tree.fragment))))}` : '';
|
|
1160
1160
|
return `${segment}${query}${fragment}`;
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
@@ -1200,9 +1200,10 @@ function serializeSegment(segment, root) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
}
|
|
1202
1202
|
/**
|
|
1203
|
-
*
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1203
|
+
* Encodes a URI string with the default encoding. This function will only ever be called from
|
|
1204
|
+
* `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need
|
|
1205
|
+
* a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't
|
|
1206
|
+
* have to be encoded per http://tools.ietf.org/html/rfc3986:
|
|
1206
1207
|
* query = *( pchar / "/" / "?" )
|
|
1207
1208
|
* pchar = unreserved / pct-encoded / sub-delims / ":" / "\@"
|
|
1208
1209
|
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
@@ -1212,13 +1213,35 @@ function serializeSegment(segment, root) {
|
|
|
1212
1213
|
* @param {?} s
|
|
1213
1214
|
* @return {?}
|
|
1214
1215
|
*/
|
|
1215
|
-
function
|
|
1216
|
+
function encodeUriString(s) {
|
|
1216
1217
|
return encodeURIComponent(s)
|
|
1217
1218
|
.replace(/%40/g, '@')
|
|
1218
1219
|
.replace(/%3A/gi, ':')
|
|
1219
1220
|
.replace(/%24/g, '$')
|
|
1220
|
-
.replace(/%2C/gi, ',')
|
|
1221
|
-
|
|
1221
|
+
.replace(/%2C/gi, ',');
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* This function should be used to encode both keys and values in a query string key/value or the
|
|
1225
|
+
* URL fragment. In the following URL, you need to call encodeUriQuery on "k", "v" and "f":
|
|
1226
|
+
*
|
|
1227
|
+
* http://www.site.org/html;mk=mv?k=v#f
|
|
1228
|
+
* @param {?} s
|
|
1229
|
+
* @return {?}
|
|
1230
|
+
*/
|
|
1231
|
+
function encodeUriQuery(s) {
|
|
1232
|
+
return encodeUriString(s).replace(/%3B/gi, ';');
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* This function should be run on any URI segment as well as the key and value in a key/value
|
|
1236
|
+
* pair for matrix params. In the following URL, you need to call encodeUriSegment on "html",
|
|
1237
|
+
* "mk", and "mv":
|
|
1238
|
+
*
|
|
1239
|
+
* http://www.site.org/html;mk=mv?k=v#f
|
|
1240
|
+
* @param {?} s
|
|
1241
|
+
* @return {?}
|
|
1242
|
+
*/
|
|
1243
|
+
function encodeUriSegment(s) {
|
|
1244
|
+
return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
|
|
1222
1245
|
}
|
|
1223
1246
|
/**
|
|
1224
1247
|
* @param {?} s
|
|
@@ -1227,19 +1250,28 @@ function encode(s) {
|
|
|
1227
1250
|
function decode(s) {
|
|
1228
1251
|
return decodeURIComponent(s);
|
|
1229
1252
|
}
|
|
1253
|
+
/**
|
|
1254
|
+
* @param {?} s
|
|
1255
|
+
* @return {?}
|
|
1256
|
+
*/
|
|
1257
|
+
function decodeQuery(s) {
|
|
1258
|
+
return decode(s.replace(/\+/g, '%20'));
|
|
1259
|
+
}
|
|
1230
1260
|
/**
|
|
1231
1261
|
* @param {?} path
|
|
1232
1262
|
* @return {?}
|
|
1233
1263
|
*/
|
|
1234
1264
|
function serializePath(path) {
|
|
1235
|
-
return `${
|
|
1265
|
+
return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;
|
|
1236
1266
|
}
|
|
1237
1267
|
/**
|
|
1238
1268
|
* @param {?} params
|
|
1239
1269
|
* @return {?}
|
|
1240
1270
|
*/
|
|
1241
|
-
function
|
|
1242
|
-
return Object.keys(params)
|
|
1271
|
+
function serializeMatrixParams(params) {
|
|
1272
|
+
return Object.keys(params)
|
|
1273
|
+
.map(key => `;${encodeUriSegment(key)}=${encodeUriSegment(params[key])}`)
|
|
1274
|
+
.join('');
|
|
1243
1275
|
}
|
|
1244
1276
|
/**
|
|
1245
1277
|
* @param {?} params
|
|
@@ -1248,8 +1280,9 @@ function serializeParams(params) {
|
|
|
1248
1280
|
function serializeQueryParams(params) {
|
|
1249
1281
|
const /** @type {?} */ strParams = Object.keys(params).map((name) => {
|
|
1250
1282
|
const /** @type {?} */ value = params[name];
|
|
1251
|
-
return Array.isArray(value) ?
|
|
1252
|
-
`${
|
|
1283
|
+
return Array.isArray(value) ?
|
|
1284
|
+
value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') :
|
|
1285
|
+
`${encodeUriQuery(name)}=${encodeUriQuery(value)}`;
|
|
1253
1286
|
});
|
|
1254
1287
|
return strParams.length ? `?${strParams.join("&")}` : '';
|
|
1255
1288
|
}
|
|
@@ -1315,7 +1348,7 @@ class UrlParser {
|
|
|
1315
1348
|
* @return {?}
|
|
1316
1349
|
*/
|
|
1317
1350
|
parseFragment() {
|
|
1318
|
-
return this.consumeOptional('#') ?
|
|
1351
|
+
return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
|
|
1319
1352
|
}
|
|
1320
1353
|
/**
|
|
1321
1354
|
* @return {?}
|
|
@@ -1406,8 +1439,8 @@ class UrlParser {
|
|
|
1406
1439
|
this.capture(value);
|
|
1407
1440
|
}
|
|
1408
1441
|
}
|
|
1409
|
-
const /** @type {?} */ decodedKey =
|
|
1410
|
-
const /** @type {?} */ decodedVal =
|
|
1442
|
+
const /** @type {?} */ decodedKey = decodeQuery(key);
|
|
1443
|
+
const /** @type {?} */ decodedVal = decodeQuery(value);
|
|
1411
1444
|
if (params.hasOwnProperty(decodedKey)) {
|
|
1412
1445
|
// Append to existing values
|
|
1413
1446
|
let /** @type {?} */ currentVal = params[decodedKey];
|
|
@@ -6257,7 +6290,7 @@ function provideRouterInitializer() {
|
|
|
6257
6290
|
/**
|
|
6258
6291
|
* \@stable
|
|
6259
6292
|
*/
|
|
6260
|
-
const VERSION = new Version('5.2.
|
|
6293
|
+
const VERSION = new Version('5.2.8');
|
|
6261
6294
|
|
|
6262
6295
|
/**
|
|
6263
6296
|
* @fileoverview added by tsickle
|