react-router 4.3.0 → 4.3.1
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/es/RouterContext.js +5 -0
- package/package.json +4 -4
- package/umd/react-router.js +158 -136
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-router",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "Declarative routing for React",
|
|
5
5
|
"repository": "ReactTraining/react-router",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"invariant": "^2.2.4",
|
|
44
44
|
"loose-envify": "^1.3.1",
|
|
45
45
|
"path-to-regexp": "^1.7.0",
|
|
46
|
-
"prop-types": "^15.6.1"
|
|
46
|
+
"prop-types": "^15.6.1",
|
|
47
|
+
"warning": "^4.0.1"
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"babel-cli": "^6.26.0",
|
|
@@ -70,8 +71,7 @@
|
|
|
70
71
|
"rollup-plugin-commonjs": "^9.1.3",
|
|
71
72
|
"rollup-plugin-node-resolve": "^3.3.0",
|
|
72
73
|
"rollup-plugin-replace": "^2.0.0",
|
|
73
|
-
"rollup-plugin-uglify": "^3.0.0"
|
|
74
|
-
"warning": "^4.0.1"
|
|
74
|
+
"rollup-plugin-uglify": "^3.0.0"
|
|
75
75
|
},
|
|
76
76
|
"browserify": {
|
|
77
77
|
"transform": [
|
package/umd/react-router.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* @providesModule warning
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
var warning = function
|
|
18
|
+
var warning = function() {};
|
|
19
19
|
|
|
20
20
|
{
|
|
21
21
|
var printWarning = function printWarning(format, args) {
|
|
@@ -25,9 +25,10 @@
|
|
|
25
25
|
args[key - 2] = arguments[key];
|
|
26
26
|
}
|
|
27
27
|
var argIndex = 0;
|
|
28
|
-
var message = 'Warning: ' +
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
var message = 'Warning: ' +
|
|
29
|
+
format.replace(/%s/g, function() {
|
|
30
|
+
return args[argIndex++];
|
|
31
|
+
});
|
|
31
32
|
if (typeof console !== 'undefined') {
|
|
32
33
|
console.error(message);
|
|
33
34
|
}
|
|
@@ -39,14 +40,17 @@
|
|
|
39
40
|
} catch (x) {}
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
warning = function
|
|
43
|
+
warning = function(condition, format, args) {
|
|
43
44
|
var len = arguments.length;
|
|
44
45
|
args = new Array(len > 2 ? len - 2 : 0);
|
|
45
46
|
for (var key = 2; key < len; key++) {
|
|
46
47
|
args[key - 2] = arguments[key];
|
|
47
48
|
}
|
|
48
49
|
if (format === undefined) {
|
|
49
|
-
throw new Error(
|
|
50
|
+
throw new Error(
|
|
51
|
+
'`warning(condition, format, ...args)` requires a warning ' +
|
|
52
|
+
'message argument'
|
|
53
|
+
);
|
|
50
54
|
}
|
|
51
55
|
if (!condition) {
|
|
52
56
|
printWarning.apply(null, [format].concat(args));
|
|
@@ -206,7 +210,6 @@
|
|
|
206
210
|
@license MIT
|
|
207
211
|
*/
|
|
208
212
|
/* eslint-disable no-unused-vars */
|
|
209
|
-
|
|
210
213
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
211
214
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
212
215
|
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
|
@@ -228,7 +231,7 @@
|
|
|
228
231
|
// Detect buggy property enumeration order in older V8 versions.
|
|
229
232
|
|
|
230
233
|
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
|
231
|
-
var test1 = new String('abc');
|
|
234
|
+
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
|
232
235
|
test1[5] = 'de';
|
|
233
236
|
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
|
234
237
|
return false;
|
|
@@ -251,7 +254,8 @@
|
|
|
251
254
|
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
|
252
255
|
test3[letter] = letter;
|
|
253
256
|
});
|
|
254
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
257
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
|
258
|
+
'abcdefghijklmnopqrst') {
|
|
255
259
|
return false;
|
|
256
260
|
}
|
|
257
261
|
|
|
@@ -351,7 +355,7 @@
|
|
|
351
355
|
|
|
352
356
|
var checkPropTypes_1 = checkPropTypes;
|
|
353
357
|
|
|
354
|
-
var factoryWithTypeCheckers = function
|
|
358
|
+
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
|
|
355
359
|
/* global Symbol */
|
|
356
360
|
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
357
361
|
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
@@ -446,7 +450,7 @@
|
|
|
446
450
|
oneOf: createEnumTypeChecker,
|
|
447
451
|
oneOfType: createUnionTypeChecker,
|
|
448
452
|
shape: createShapeTypeChecker,
|
|
449
|
-
exact: createStrictShapeTypeChecker
|
|
453
|
+
exact: createStrictShapeTypeChecker,
|
|
450
454
|
};
|
|
451
455
|
|
|
452
456
|
/**
|
|
@@ -493,14 +497,30 @@
|
|
|
493
497
|
if (secret !== ReactPropTypesSecret_1) {
|
|
494
498
|
if (throwOnDirectAccess) {
|
|
495
499
|
// New behavior only for users of `prop-types` package
|
|
496
|
-
invariant_1(
|
|
500
|
+
invariant_1(
|
|
501
|
+
false,
|
|
502
|
+
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
|
503
|
+
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
|
504
|
+
'Read more at http://fb.me/use-check-prop-types'
|
|
505
|
+
);
|
|
497
506
|
} else if (typeof console !== 'undefined') {
|
|
498
507
|
// Old behavior for people using React.PropTypes
|
|
499
508
|
var cacheKey = componentName + ':' + propName;
|
|
500
|
-
if (
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
509
|
+
if (
|
|
510
|
+
!manualPropTypeCallCache[cacheKey] &&
|
|
511
|
+
// Avoid spamming the console because they are often not actionable except for lib authors
|
|
512
|
+
manualPropTypeWarningCount < 3
|
|
513
|
+
) {
|
|
514
|
+
warning_1$1(
|
|
515
|
+
false,
|
|
516
|
+
'You are manually calling a React.PropTypes validation ' +
|
|
517
|
+
'function for the `%s` prop on `%s`. This is deprecated ' +
|
|
518
|
+
'and will throw in the standalone `prop-types` package. ' +
|
|
519
|
+
'You may be seeing this warning due to a third-party PropTypes ' +
|
|
520
|
+
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
|
521
|
+
propFullName,
|
|
522
|
+
componentName
|
|
523
|
+
);
|
|
504
524
|
manualPropTypeCallCache[cacheKey] = true;
|
|
505
525
|
manualPropTypeWarningCount++;
|
|
506
526
|
}
|
|
@@ -643,7 +663,13 @@
|
|
|
643
663
|
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
|
644
664
|
var checker = arrayOfTypeCheckers[i];
|
|
645
665
|
if (typeof checker !== 'function') {
|
|
646
|
-
warning_1$1(
|
|
666
|
+
warning_1$1(
|
|
667
|
+
false,
|
|
668
|
+
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
|
669
|
+
'received %s at index %s.',
|
|
670
|
+
getPostfixForTypeWarning(checker),
|
|
671
|
+
i
|
|
672
|
+
);
|
|
647
673
|
return emptyFunction_1.thatReturnsNull;
|
|
648
674
|
}
|
|
649
675
|
}
|
|
@@ -706,7 +732,11 @@
|
|
|
706
732
|
for (var key in allKeys) {
|
|
707
733
|
var checker = shapeTypes[key];
|
|
708
734
|
if (!checker) {
|
|
709
|
-
return new PropTypeError(
|
|
735
|
+
return new PropTypeError(
|
|
736
|
+
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
|
737
|
+
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
|
738
|
+
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
|
739
|
+
);
|
|
710
740
|
}
|
|
711
741
|
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1);
|
|
712
742
|
if (error) {
|
|
@@ -860,10 +890,15 @@
|
|
|
860
890
|
*/
|
|
861
891
|
|
|
862
892
|
{
|
|
863
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' &&
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
893
|
+
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
|
894
|
+
Symbol.for &&
|
|
895
|
+
Symbol.for('react.element')) ||
|
|
896
|
+
0xeac7;
|
|
897
|
+
|
|
898
|
+
var isValidElement = function(object) {
|
|
899
|
+
return typeof object === 'object' &&
|
|
900
|
+
object !== null &&
|
|
901
|
+
object.$$typeof === REACT_ELEMENT_TYPE;
|
|
867
902
|
};
|
|
868
903
|
|
|
869
904
|
// By explicitly using `prop-types` you are opting into new development behavior.
|
|
@@ -882,28 +917,35 @@
|
|
|
882
917
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
883
918
|
*/
|
|
884
919
|
|
|
885
|
-
var warning$3 = function
|
|
920
|
+
var warning$3 = function() {};
|
|
886
921
|
|
|
887
922
|
{
|
|
888
|
-
warning$3 = function
|
|
923
|
+
warning$3 = function(condition, format, args) {
|
|
889
924
|
var len = arguments.length;
|
|
890
925
|
args = new Array(len > 2 ? len - 2 : 0);
|
|
891
926
|
for (var key = 2; key < len; key++) {
|
|
892
927
|
args[key - 2] = arguments[key];
|
|
893
928
|
}
|
|
894
929
|
if (format === undefined) {
|
|
895
|
-
throw new Error(
|
|
930
|
+
throw new Error(
|
|
931
|
+
'`warning(condition, format, ...args)` requires a warning ' +
|
|
932
|
+
'message argument'
|
|
933
|
+
);
|
|
896
934
|
}
|
|
897
935
|
|
|
898
|
-
if (format.length < 10 || /^[s\W]
|
|
899
|
-
throw new Error(
|
|
936
|
+
if (format.length < 10 || (/^[s\W]*$/).test(format)) {
|
|
937
|
+
throw new Error(
|
|
938
|
+
'The warning format should be able to uniquely identify this ' +
|
|
939
|
+
'warning. Please, use a more descriptive format than: ' + format
|
|
940
|
+
);
|
|
900
941
|
}
|
|
901
942
|
|
|
902
943
|
if (!condition) {
|
|
903
944
|
var argIndex = 0;
|
|
904
|
-
var message = 'Warning: ' +
|
|
905
|
-
|
|
906
|
-
|
|
945
|
+
var message = 'Warning: ' +
|
|
946
|
+
format.replace(/%s/g, function() {
|
|
947
|
+
return args[argIndex++];
|
|
948
|
+
});
|
|
907
949
|
if (typeof console !== 'undefined') {
|
|
908
950
|
console.error(message);
|
|
909
951
|
}
|
|
@@ -911,7 +953,7 @@
|
|
|
911
953
|
// This error was thrown as a convenience so that you can use this stack
|
|
912
954
|
// to find the callsite that caused this warning to fire.
|
|
913
955
|
throw new Error(message);
|
|
914
|
-
} catch
|
|
956
|
+
} catch(x) {}
|
|
915
957
|
}
|
|
916
958
|
};
|
|
917
959
|
}
|
|
@@ -925,7 +967,7 @@
|
|
|
925
967
|
* LICENSE file in the root directory of this source tree.
|
|
926
968
|
*/
|
|
927
969
|
|
|
928
|
-
var invariant$2 = function
|
|
970
|
+
var invariant$2 = function(condition, format, a, b, c, d, e, f) {
|
|
929
971
|
{
|
|
930
972
|
if (format === undefined) {
|
|
931
973
|
throw new Error('invariant requires an error message argument');
|
|
@@ -935,13 +977,16 @@
|
|
|
935
977
|
if (!condition) {
|
|
936
978
|
var error;
|
|
937
979
|
if (format === undefined) {
|
|
938
|
-
error = new Error(
|
|
980
|
+
error = new Error(
|
|
981
|
+
'Minified exception occurred; use the non-minified dev environment ' +
|
|
982
|
+
'for the full error message and additional helpful warnings.'
|
|
983
|
+
);
|
|
939
984
|
} else {
|
|
940
985
|
var args = [a, b, c, d, e, f];
|
|
941
986
|
var argIndex = 0;
|
|
942
|
-
error = new Error(
|
|
943
|
-
return args[argIndex++];
|
|
944
|
-
|
|
987
|
+
error = new Error(
|
|
988
|
+
format.replace(/%s/g, function() { return args[argIndex++]; })
|
|
989
|
+
);
|
|
945
990
|
error.name = 'Invariant Violation';
|
|
946
991
|
}
|
|
947
992
|
|
|
@@ -1021,11 +1066,7 @@
|
|
|
1021
1066
|
return result;
|
|
1022
1067
|
}
|
|
1023
1068
|
|
|
1024
|
-
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
1025
|
-
return typeof obj;
|
|
1026
|
-
} : function (obj) {
|
|
1027
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1028
|
-
};
|
|
1069
|
+
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
1029
1070
|
|
|
1030
1071
|
function valueEqual(a, b) {
|
|
1031
1072
|
if (a === b) return true;
|
|
@@ -1091,6 +1132,7 @@
|
|
|
1091
1132
|
search = location.search,
|
|
1092
1133
|
hash = location.hash;
|
|
1093
1134
|
|
|
1135
|
+
|
|
1094
1136
|
var path = pathname || '/';
|
|
1095
1137
|
|
|
1096
1138
|
if (search && search !== '?') path += search.charAt(0) === '?' ? search : '?' + search;
|
|
@@ -1100,15 +1142,7 @@
|
|
|
1100
1142
|
return path;
|
|
1101
1143
|
};
|
|
1102
1144
|
|
|
1103
|
-
var _extends = Object.assign || function (target) {
|
|
1104
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1105
|
-
var source = arguments[i];for (var key in source) {
|
|
1106
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1107
|
-
target[key] = source[key];
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
}return target;
|
|
1111
|
-
};
|
|
1145
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
1112
1146
|
|
|
1113
1147
|
var createLocation = function createLocation(path, state, key, currentLocation) {
|
|
1114
1148
|
var location = void 0;
|
|
@@ -1246,21 +1280,9 @@
|
|
|
1246
1280
|
|
|
1247
1281
|
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
1248
1282
|
|
|
1249
|
-
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
|
1250
|
-
return typeof obj;
|
|
1251
|
-
} : function (obj) {
|
|
1252
|
-
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1253
|
-
};
|
|
1283
|
+
var _typeof$2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
|
1254
1284
|
|
|
1255
|
-
var _extends$3 = Object.assign || function (target) {
|
|
1256
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1257
|
-
var source = arguments[i];for (var key in source) {
|
|
1258
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1259
|
-
target[key] = source[key];
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
}return target;
|
|
1263
|
-
};
|
|
1285
|
+
var _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
1264
1286
|
|
|
1265
1287
|
var clamp = function clamp(n, lowerBound, upperBound) {
|
|
1266
1288
|
return Math.min(Math.max(n, lowerBound), upperBound);
|
|
@@ -1279,6 +1301,7 @@
|
|
|
1279
1301
|
_props$keyLength = props.keyLength,
|
|
1280
1302
|
keyLength = _props$keyLength === undefined ? 6 : _props$keyLength;
|
|
1281
1303
|
|
|
1304
|
+
|
|
1282
1305
|
var transitionManager = createTransitionManager();
|
|
1283
1306
|
|
|
1284
1307
|
var setState = function setState(nextState) {
|
|
@@ -1677,16 +1700,17 @@
|
|
|
1677
1700
|
* @type {RegExp}
|
|
1678
1701
|
*/
|
|
1679
1702
|
var PATH_REGEXP = new RegExp([
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1703
|
+
// Match escaped characters that would otherwise appear in future matches.
|
|
1704
|
+
// This allows the user to escape special characters that won't transform.
|
|
1705
|
+
'(\\\\.)',
|
|
1706
|
+
// Match Express-style parameters and un-named parameters with a prefix
|
|
1707
|
+
// and optional suffixes. Matches appear as:
|
|
1708
|
+
//
|
|
1709
|
+
// "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
|
|
1710
|
+
// "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
|
|
1711
|
+
// "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
|
|
1712
|
+
'([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
|
|
1713
|
+
].join('|'), 'g');
|
|
1690
1714
|
|
|
1691
1715
|
/**
|
|
1692
1716
|
* Parse a string for the raw tokens.
|
|
@@ -1695,7 +1719,7 @@
|
|
|
1695
1719
|
* @param {Object=} options
|
|
1696
1720
|
* @return {!Array}
|
|
1697
1721
|
*/
|
|
1698
|
-
function parse(str, options) {
|
|
1722
|
+
function parse (str, options) {
|
|
1699
1723
|
var tokens = [];
|
|
1700
1724
|
var key = 0;
|
|
1701
1725
|
var index = 0;
|
|
@@ -1713,7 +1737,7 @@
|
|
|
1713
1737
|
// Ignore already escaped sequences.
|
|
1714
1738
|
if (escaped) {
|
|
1715
1739
|
path += escaped[1];
|
|
1716
|
-
continue
|
|
1740
|
+
continue
|
|
1717
1741
|
}
|
|
1718
1742
|
|
|
1719
1743
|
var next = str[index];
|
|
@@ -1744,7 +1768,7 @@
|
|
|
1744
1768
|
repeat: repeat,
|
|
1745
1769
|
partial: partial,
|
|
1746
1770
|
asterisk: !!asterisk,
|
|
1747
|
-
pattern: pattern ? escapeGroup(pattern) : asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?'
|
|
1771
|
+
pattern: pattern ? escapeGroup(pattern) : (asterisk ? '.*' : '[^' + escapeString(delimiter) + ']+?')
|
|
1748
1772
|
});
|
|
1749
1773
|
}
|
|
1750
1774
|
|
|
@@ -1758,7 +1782,7 @@
|
|
|
1758
1782
|
tokens.push(path);
|
|
1759
1783
|
}
|
|
1760
1784
|
|
|
1761
|
-
return tokens
|
|
1785
|
+
return tokens
|
|
1762
1786
|
}
|
|
1763
1787
|
|
|
1764
1788
|
/**
|
|
@@ -1768,8 +1792,8 @@
|
|
|
1768
1792
|
* @param {Object=} options
|
|
1769
1793
|
* @return {!function(Object=, Object=)}
|
|
1770
1794
|
*/
|
|
1771
|
-
function compile(str, options) {
|
|
1772
|
-
return tokensToFunction(parse(str, options))
|
|
1795
|
+
function compile (str, options) {
|
|
1796
|
+
return tokensToFunction(parse(str, options))
|
|
1773
1797
|
}
|
|
1774
1798
|
|
|
1775
1799
|
/**
|
|
@@ -1778,10 +1802,10 @@
|
|
|
1778
1802
|
* @param {string}
|
|
1779
1803
|
* @return {string}
|
|
1780
1804
|
*/
|
|
1781
|
-
function encodeURIComponentPretty(str) {
|
|
1805
|
+
function encodeURIComponentPretty (str) {
|
|
1782
1806
|
return encodeURI(str).replace(/[\/?#]/g, function (c) {
|
|
1783
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
1784
|
-
})
|
|
1807
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
1808
|
+
})
|
|
1785
1809
|
}
|
|
1786
1810
|
|
|
1787
1811
|
/**
|
|
@@ -1790,16 +1814,16 @@
|
|
|
1790
1814
|
* @param {string}
|
|
1791
1815
|
* @return {string}
|
|
1792
1816
|
*/
|
|
1793
|
-
function encodeAsterisk(str) {
|
|
1817
|
+
function encodeAsterisk (str) {
|
|
1794
1818
|
return encodeURI(str).replace(/[?#]/g, function (c) {
|
|
1795
|
-
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
1796
|
-
})
|
|
1819
|
+
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
|
1820
|
+
})
|
|
1797
1821
|
}
|
|
1798
1822
|
|
|
1799
1823
|
/**
|
|
1800
1824
|
* Expose a method for transforming tokens into the path function.
|
|
1801
1825
|
*/
|
|
1802
|
-
function tokensToFunction(tokens) {
|
|
1826
|
+
function tokensToFunction (tokens) {
|
|
1803
1827
|
// Compile all the tokens into regexps.
|
|
1804
1828
|
var matches = new Array(tokens.length);
|
|
1805
1829
|
|
|
@@ -1822,7 +1846,7 @@
|
|
|
1822
1846
|
if (typeof token === 'string') {
|
|
1823
1847
|
path += token;
|
|
1824
1848
|
|
|
1825
|
-
continue
|
|
1849
|
+
continue
|
|
1826
1850
|
}
|
|
1827
1851
|
|
|
1828
1852
|
var value = data[token.name];
|
|
@@ -1835,22 +1859,22 @@
|
|
|
1835
1859
|
path += token.prefix;
|
|
1836
1860
|
}
|
|
1837
1861
|
|
|
1838
|
-
continue
|
|
1862
|
+
continue
|
|
1839
1863
|
} else {
|
|
1840
|
-
throw new TypeError('Expected "' + token.name + '" to be defined')
|
|
1864
|
+
throw new TypeError('Expected "' + token.name + '" to be defined')
|
|
1841
1865
|
}
|
|
1842
1866
|
}
|
|
1843
1867
|
|
|
1844
1868
|
if (isarray(value)) {
|
|
1845
1869
|
if (!token.repeat) {
|
|
1846
|
-
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
|
1870
|
+
throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
|
|
1847
1871
|
}
|
|
1848
1872
|
|
|
1849
1873
|
if (value.length === 0) {
|
|
1850
1874
|
if (token.optional) {
|
|
1851
|
-
continue
|
|
1875
|
+
continue
|
|
1852
1876
|
} else {
|
|
1853
|
-
throw new TypeError('Expected "' + token.name + '" to not be empty')
|
|
1877
|
+
throw new TypeError('Expected "' + token.name + '" to not be empty')
|
|
1854
1878
|
}
|
|
1855
1879
|
}
|
|
1856
1880
|
|
|
@@ -1858,26 +1882,26 @@
|
|
|
1858
1882
|
segment = encode(value[j]);
|
|
1859
1883
|
|
|
1860
1884
|
if (!matches[i].test(segment)) {
|
|
1861
|
-
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
|
|
1885
|
+
throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
|
|
1862
1886
|
}
|
|
1863
1887
|
|
|
1864
1888
|
path += (j === 0 ? token.prefix : token.delimiter) + segment;
|
|
1865
1889
|
}
|
|
1866
1890
|
|
|
1867
|
-
continue
|
|
1891
|
+
continue
|
|
1868
1892
|
}
|
|
1869
1893
|
|
|
1870
1894
|
segment = token.asterisk ? encodeAsterisk(value) : encode(value);
|
|
1871
1895
|
|
|
1872
1896
|
if (!matches[i].test(segment)) {
|
|
1873
|
-
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
|
|
1897
|
+
throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
|
|
1874
1898
|
}
|
|
1875
1899
|
|
|
1876
1900
|
path += token.prefix + segment;
|
|
1877
1901
|
}
|
|
1878
1902
|
|
|
1879
|
-
return path
|
|
1880
|
-
}
|
|
1903
|
+
return path
|
|
1904
|
+
}
|
|
1881
1905
|
}
|
|
1882
1906
|
|
|
1883
1907
|
/**
|
|
@@ -1886,8 +1910,8 @@
|
|
|
1886
1910
|
* @param {string} str
|
|
1887
1911
|
* @return {string}
|
|
1888
1912
|
*/
|
|
1889
|
-
function escapeString(str) {
|
|
1890
|
-
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
|
|
1913
|
+
function escapeString (str) {
|
|
1914
|
+
return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
|
|
1891
1915
|
}
|
|
1892
1916
|
|
|
1893
1917
|
/**
|
|
@@ -1896,8 +1920,8 @@
|
|
|
1896
1920
|
* @param {string} group
|
|
1897
1921
|
* @return {string}
|
|
1898
1922
|
*/
|
|
1899
|
-
function escapeGroup(group) {
|
|
1900
|
-
return group.replace(/([=!:$\/()])/g, '\\$1')
|
|
1923
|
+
function escapeGroup (group) {
|
|
1924
|
+
return group.replace(/([=!:$\/()])/g, '\\$1')
|
|
1901
1925
|
}
|
|
1902
1926
|
|
|
1903
1927
|
/**
|
|
@@ -1907,9 +1931,9 @@
|
|
|
1907
1931
|
* @param {Array} keys
|
|
1908
1932
|
* @return {!RegExp}
|
|
1909
1933
|
*/
|
|
1910
|
-
function attachKeys(re, keys) {
|
|
1934
|
+
function attachKeys (re, keys) {
|
|
1911
1935
|
re.keys = keys;
|
|
1912
|
-
return re
|
|
1936
|
+
return re
|
|
1913
1937
|
}
|
|
1914
1938
|
|
|
1915
1939
|
/**
|
|
@@ -1918,8 +1942,8 @@
|
|
|
1918
1942
|
* @param {Object} options
|
|
1919
1943
|
* @return {string}
|
|
1920
1944
|
*/
|
|
1921
|
-
function flags(options) {
|
|
1922
|
-
return options.sensitive ? '' : 'i'
|
|
1945
|
+
function flags (options) {
|
|
1946
|
+
return options.sensitive ? '' : 'i'
|
|
1923
1947
|
}
|
|
1924
1948
|
|
|
1925
1949
|
/**
|
|
@@ -1929,7 +1953,7 @@
|
|
|
1929
1953
|
* @param {!Array} keys
|
|
1930
1954
|
* @return {!RegExp}
|
|
1931
1955
|
*/
|
|
1932
|
-
function regexpToRegexp(path, keys) {
|
|
1956
|
+
function regexpToRegexp (path, keys) {
|
|
1933
1957
|
// Use a negative lookahead to match only capturing groups.
|
|
1934
1958
|
var groups = path.source.match(/\((?!\?)/g);
|
|
1935
1959
|
|
|
@@ -1948,7 +1972,7 @@
|
|
|
1948
1972
|
}
|
|
1949
1973
|
}
|
|
1950
1974
|
|
|
1951
|
-
return attachKeys(path, keys)
|
|
1975
|
+
return attachKeys(path, keys)
|
|
1952
1976
|
}
|
|
1953
1977
|
|
|
1954
1978
|
/**
|
|
@@ -1959,7 +1983,7 @@
|
|
|
1959
1983
|
* @param {!Object} options
|
|
1960
1984
|
* @return {!RegExp}
|
|
1961
1985
|
*/
|
|
1962
|
-
function arrayToRegexp(path, keys, options) {
|
|
1986
|
+
function arrayToRegexp (path, keys, options) {
|
|
1963
1987
|
var parts = [];
|
|
1964
1988
|
|
|
1965
1989
|
for (var i = 0; i < path.length; i++) {
|
|
@@ -1968,7 +1992,7 @@
|
|
|
1968
1992
|
|
|
1969
1993
|
var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options));
|
|
1970
1994
|
|
|
1971
|
-
return attachKeys(regexp, keys)
|
|
1995
|
+
return attachKeys(regexp, keys)
|
|
1972
1996
|
}
|
|
1973
1997
|
|
|
1974
1998
|
/**
|
|
@@ -1979,8 +2003,8 @@
|
|
|
1979
2003
|
* @param {!Object} options
|
|
1980
2004
|
* @return {!RegExp}
|
|
1981
2005
|
*/
|
|
1982
|
-
function stringToRegexp(path, keys, options) {
|
|
1983
|
-
return tokensToRegExp(parse(path, options), keys, options)
|
|
2006
|
+
function stringToRegexp (path, keys, options) {
|
|
2007
|
+
return tokensToRegExp(parse(path, options), keys, options)
|
|
1984
2008
|
}
|
|
1985
2009
|
|
|
1986
2010
|
/**
|
|
@@ -1991,9 +2015,9 @@
|
|
|
1991
2015
|
* @param {Object=} options
|
|
1992
2016
|
* @return {!RegExp}
|
|
1993
2017
|
*/
|
|
1994
|
-
function tokensToRegExp(tokens, keys, options) {
|
|
2018
|
+
function tokensToRegExp (tokens, keys, options) {
|
|
1995
2019
|
if (!isarray(keys)) {
|
|
1996
|
-
options = /** @type {!Object} */keys || options;
|
|
2020
|
+
options = /** @type {!Object} */ (keys || options);
|
|
1997
2021
|
keys = [];
|
|
1998
2022
|
}
|
|
1999
2023
|
|
|
@@ -2052,7 +2076,7 @@
|
|
|
2052
2076
|
route += strict && endsWithDelimiter ? '' : '(?=' + delimiter + '|$)';
|
|
2053
2077
|
}
|
|
2054
2078
|
|
|
2055
|
-
return attachKeys(new RegExp('^' + route, flags(options)), keys)
|
|
2079
|
+
return attachKeys(new RegExp('^' + route, flags(options)), keys)
|
|
2056
2080
|
}
|
|
2057
2081
|
|
|
2058
2082
|
/**
|
|
@@ -2067,23 +2091,23 @@
|
|
|
2067
2091
|
* @param {Object=} options
|
|
2068
2092
|
* @return {!RegExp}
|
|
2069
2093
|
*/
|
|
2070
|
-
function pathToRegexp(path, keys, options) {
|
|
2094
|
+
function pathToRegexp (path, keys, options) {
|
|
2071
2095
|
if (!isarray(keys)) {
|
|
2072
|
-
options = /** @type {!Object} */keys || options;
|
|
2096
|
+
options = /** @type {!Object} */ (keys || options);
|
|
2073
2097
|
keys = [];
|
|
2074
2098
|
}
|
|
2075
2099
|
|
|
2076
2100
|
options = options || {};
|
|
2077
2101
|
|
|
2078
2102
|
if (path instanceof RegExp) {
|
|
2079
|
-
return regexpToRegexp(path, /** @type {!Array} */keys)
|
|
2103
|
+
return regexpToRegexp(path, /** @type {!Array} */ (keys))
|
|
2080
2104
|
}
|
|
2081
2105
|
|
|
2082
2106
|
if (isarray(path)) {
|
|
2083
|
-
return arrayToRegexp(
|
|
2107
|
+
return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
|
|
2084
2108
|
}
|
|
2085
2109
|
|
|
2086
|
-
return stringToRegexp(
|
|
2110
|
+
return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
|
|
2087
2111
|
}
|
|
2088
2112
|
pathToRegexp_1.parse = parse_1;
|
|
2089
2113
|
pathToRegexp_1.compile = compile_1;
|
|
@@ -2612,8 +2636,8 @@
|
|
|
2612
2636
|
*/
|
|
2613
2637
|
(function (global, factory) {
|
|
2614
2638
|
module.exports = factory();
|
|
2615
|
-
}
|
|
2616
|
-
|
|
2639
|
+
}(commonjsGlobal, (function () {
|
|
2640
|
+
|
|
2617
2641
|
var REACT_STATICS = {
|
|
2618
2642
|
childContextTypes: true,
|
|
2619
2643
|
contextTypes: true,
|
|
@@ -2625,7 +2649,7 @@
|
|
|
2625
2649
|
propTypes: true,
|
|
2626
2650
|
type: true
|
|
2627
2651
|
};
|
|
2628
|
-
|
|
2652
|
+
|
|
2629
2653
|
var KNOWN_STATICS = {
|
|
2630
2654
|
name: true,
|
|
2631
2655
|
length: true,
|
|
@@ -2635,48 +2659,46 @@
|
|
|
2635
2659
|
arguments: true,
|
|
2636
2660
|
arity: true
|
|
2637
2661
|
};
|
|
2638
|
-
|
|
2662
|
+
|
|
2639
2663
|
var defineProperty = Object.defineProperty;
|
|
2640
2664
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
2641
2665
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
2642
2666
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
2643
2667
|
var getPrototypeOf = Object.getPrototypeOf;
|
|
2644
2668
|
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
|
|
2645
|
-
|
|
2669
|
+
|
|
2646
2670
|
return function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
|
|
2647
|
-
if (typeof sourceComponent !== 'string') {
|
|
2648
|
-
|
|
2649
|
-
|
|
2671
|
+
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
|
|
2672
|
+
|
|
2650
2673
|
if (objectPrototype) {
|
|
2651
2674
|
var inheritedComponent = getPrototypeOf(sourceComponent);
|
|
2652
2675
|
if (inheritedComponent && inheritedComponent !== objectPrototype) {
|
|
2653
2676
|
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
|
|
2654
2677
|
}
|
|
2655
2678
|
}
|
|
2656
|
-
|
|
2679
|
+
|
|
2657
2680
|
var keys = getOwnPropertyNames(sourceComponent);
|
|
2658
|
-
|
|
2681
|
+
|
|
2659
2682
|
if (getOwnPropertySymbols) {
|
|
2660
2683
|
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
|
|
2661
2684
|
}
|
|
2662
|
-
|
|
2685
|
+
|
|
2663
2686
|
for (var i = 0; i < keys.length; ++i) {
|
|
2664
2687
|
var key = keys[i];
|
|
2665
2688
|
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
|
|
2666
2689
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
2667
|
-
try {
|
|
2668
|
-
// Avoid failures from read-only properties
|
|
2690
|
+
try { // Avoid failures from read-only properties
|
|
2669
2691
|
defineProperty(targetComponent, key, descriptor);
|
|
2670
2692
|
} catch (e) {}
|
|
2671
2693
|
}
|
|
2672
2694
|
}
|
|
2673
|
-
|
|
2695
|
+
|
|
2674
2696
|
return targetComponent;
|
|
2675
2697
|
}
|
|
2676
|
-
|
|
2698
|
+
|
|
2677
2699
|
return targetComponent;
|
|
2678
2700
|
};
|
|
2679
|
-
});
|
|
2701
|
+
})));
|
|
2680
2702
|
});
|
|
2681
2703
|
|
|
2682
2704
|
/**
|