@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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.8
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.8
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/esm5/router.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v5.2.7
2
+ * @license Angular v5.2.8
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1225,7 +1225,7 @@ var DefaultUrlSerializer = /** @class */ (function () {
1225
1225
  function (tree) {
1226
1226
  var /** @type {?} */ segment = "/" + serializeSegment(tree.root, true);
1227
1227
  var /** @type {?} */ query = serializeQueryParams(tree.queryParams);
1228
- var /** @type {?} */ fragment = typeof tree.fragment === "string" ? "#" + encodeURI((/** @type {?} */ ((tree.fragment)))) : '';
1228
+ var /** @type {?} */ fragment = typeof tree.fragment === "string" ? "#" + encodeUriQuery((/** @type {?} */ ((tree.fragment)))) : '';
1229
1229
  return "" + segment + query + fragment;
1230
1230
  };
1231
1231
  return DefaultUrlSerializer;
@@ -1270,9 +1270,10 @@ function serializeSegment(segment, root) {
1270
1270
  }
1271
1271
  }
1272
1272
  /**
1273
- * This method is intended for encoding *key* or *value* parts of query component. We need a custom
1274
- * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
1275
- * encoded per http://tools.ietf.org/html/rfc3986:
1273
+ * Encodes a URI string with the default encoding. This function will only ever be called from
1274
+ * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need
1275
+ * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't
1276
+ * have to be encoded per http://tools.ietf.org/html/rfc3986:
1276
1277
  * query = *( pchar / "/" / "?" )
1277
1278
  * pchar = unreserved / pct-encoded / sub-delims / ":" / "\@"
1278
1279
  * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
@@ -1282,13 +1283,35 @@ function serializeSegment(segment, root) {
1282
1283
  * @param {?} s
1283
1284
  * @return {?}
1284
1285
  */
1285
- function encode(s) {
1286
+ function encodeUriString(s) {
1286
1287
  return encodeURIComponent(s)
1287
1288
  .replace(/%40/g, '@')
1288
1289
  .replace(/%3A/gi, ':')
1289
1290
  .replace(/%24/g, '$')
1290
- .replace(/%2C/gi, ',')
1291
- .replace(/%3B/gi, ';');
1291
+ .replace(/%2C/gi, ',');
1292
+ }
1293
+ /**
1294
+ * This function should be used to encode both keys and values in a query string key/value or the
1295
+ * URL fragment. In the following URL, you need to call encodeUriQuery on "k", "v" and "f":
1296
+ *
1297
+ * http://www.site.org/html;mk=mv?k=v#f
1298
+ * @param {?} s
1299
+ * @return {?}
1300
+ */
1301
+ function encodeUriQuery(s) {
1302
+ return encodeUriString(s).replace(/%3B/gi, ';');
1303
+ }
1304
+ /**
1305
+ * This function should be run on any URI segment as well as the key and value in a key/value
1306
+ * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html",
1307
+ * "mk", and "mv":
1308
+ *
1309
+ * http://www.site.org/html;mk=mv?k=v#f
1310
+ * @param {?} s
1311
+ * @return {?}
1312
+ */
1313
+ function encodeUriSegment(s) {
1314
+ return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
1292
1315
  }
1293
1316
  /**
1294
1317
  * @param {?} s
@@ -1297,19 +1320,28 @@ function encode(s) {
1297
1320
  function decode(s) {
1298
1321
  return decodeURIComponent(s);
1299
1322
  }
1323
+ /**
1324
+ * @param {?} s
1325
+ * @return {?}
1326
+ */
1327
+ function decodeQuery(s) {
1328
+ return decode(s.replace(/\+/g, '%20'));
1329
+ }
1300
1330
  /**
1301
1331
  * @param {?} path
1302
1332
  * @return {?}
1303
1333
  */
1304
1334
  function serializePath(path) {
1305
- return "" + encode(path.path) + serializeParams(path.parameters);
1335
+ return "" + encodeUriSegment(path.path) + serializeMatrixParams(path.parameters);
1306
1336
  }
1307
1337
  /**
1308
1338
  * @param {?} params
1309
1339
  * @return {?}
1310
1340
  */
1311
- function serializeParams(params) {
1312
- return Object.keys(params).map(function (key) { return ";" + encode(key) + "=" + encode(params[key]); }).join('');
1341
+ function serializeMatrixParams(params) {
1342
+ return Object.keys(params)
1343
+ .map(function (key) { return ";" + encodeUriSegment(key) + "=" + encodeUriSegment(params[key]); })
1344
+ .join('');
1313
1345
  }
1314
1346
  /**
1315
1347
  * @param {?} params
@@ -1318,8 +1350,9 @@ function serializeParams(params) {
1318
1350
  function serializeQueryParams(params) {
1319
1351
  var /** @type {?} */ strParams = Object.keys(params).map(function (name) {
1320
1352
  var /** @type {?} */ value = params[name];
1321
- return Array.isArray(value) ? value.map(function (v) { return encode(name) + "=" + encode(v); }).join('&') :
1322
- encode(name) + "=" + encode(value);
1353
+ return Array.isArray(value) ?
1354
+ value.map(function (v) { return encodeUriQuery(name) + "=" + encodeUriQuery(v); }).join('&') :
1355
+ encodeUriQuery(name) + "=" + encodeUriQuery(value);
1323
1356
  });
1324
1357
  return strParams.length ? "?" + strParams.join("&") : '';
1325
1358
  }
@@ -1391,7 +1424,7 @@ var UrlParser = /** @class */ (function () {
1391
1424
  * @return {?}
1392
1425
  */
1393
1426
  function () {
1394
- return this.consumeOptional('#') ? decodeURI(this.remaining) : null;
1427
+ return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
1395
1428
  };
1396
1429
  /**
1397
1430
  * @return {?}
@@ -1499,8 +1532,8 @@ var UrlParser = /** @class */ (function () {
1499
1532
  this.capture(value);
1500
1533
  }
1501
1534
  }
1502
- var /** @type {?} */ decodedKey = decode(key);
1503
- var /** @type {?} */ decodedVal = decode(value);
1535
+ var /** @type {?} */ decodedKey = decodeQuery(key);
1536
+ var /** @type {?} */ decodedVal = decodeQuery(value);
1504
1537
  if (params.hasOwnProperty(decodedKey)) {
1505
1538
  // Append to existing values
1506
1539
  var /** @type {?} */ currentVal = params[decodedKey];
@@ -7445,7 +7478,7 @@ function provideRouterInitializer() {
7445
7478
  /**
7446
7479
  * \@stable
7447
7480
  */
7448
- var VERSION = new Version('5.2.7');
7481
+ var VERSION = new Version('5.2.8');
7449
7482
 
7450
7483
  /**
7451
7484
  * @fileoverview added by tsickle