@angular/router 0.1.0 → 2.0.0-rc.2

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.
Files changed (190) hide show
  1. package/bundles/router.umd.js +1812 -0
  2. package/bundles/router.umd.min.js +2 -0
  3. package/esm/index.d.ts +15 -0
  4. package/esm/index.js +15 -0
  5. package/esm/index.js.map +1 -0
  6. package/esm/src/constants.d.ts +5 -0
  7. package/esm/src/constants.js +6 -0
  8. package/esm/src/constants.js.map +1 -0
  9. package/esm/src/constants.metadata.json +1 -0
  10. package/esm/src/core_private.d.ts +3 -0
  11. package/esm/src/core_private.js +4 -0
  12. package/esm/src/core_private.js.map +1 -0
  13. package/esm/src/core_private.metadata.json +1 -0
  14. package/esm/src/directives/router_directives.d.ts +21 -0
  15. package/esm/src/directives/router_directives.js +24 -0
  16. package/esm/src/directives/router_directives.js.map +1 -0
  17. package/esm/src/directives/router_directives.metadata.json +1 -0
  18. package/esm/src/directives/router_link.d.ts +49 -0
  19. package/esm/src/directives/router_link.js +68 -0
  20. package/esm/src/directives/router_link.js.map +1 -0
  21. package/esm/src/directives/router_link.metadata.json +1 -0
  22. package/esm/src/directives/router_outlet.d.ts +36 -0
  23. package/esm/src/directives/router_outlet.js +42 -0
  24. package/esm/src/directives/router_outlet.js.map +1 -0
  25. package/esm/src/directives/router_outlet.metadata.json +1 -0
  26. package/esm/src/facade/async.d.ts +90 -0
  27. package/esm/src/facade/async.js +137 -0
  28. package/esm/src/facade/async.js.map +1 -0
  29. package/esm/src/facade/base_wrapped_exception.d.ts +14 -0
  30. package/esm/src/facade/base_wrapped_exception.js +17 -0
  31. package/esm/src/facade/base_wrapped_exception.js.map +1 -0
  32. package/esm/src/facade/collection.d.ts +103 -0
  33. package/esm/src/facade/collection.js +343 -0
  34. package/esm/src/facade/collection.js.map +1 -0
  35. package/esm/src/facade/collection.metadata.json +1 -0
  36. package/esm/src/facade/exception_handler.d.ts +29 -0
  37. package/esm/src/facade/exception_handler.js +124 -0
  38. package/esm/src/facade/exception_handler.js.map +1 -0
  39. package/esm/src/facade/exceptions.d.ts +32 -0
  40. package/esm/src/facade/exceptions.js +42 -0
  41. package/esm/src/facade/exceptions.js.map +1 -0
  42. package/esm/src/facade/exceptions.metadata.json +1 -0
  43. package/esm/src/facade/lang.d.ts +158 -0
  44. package/esm/src/facade/lang.js +386 -0
  45. package/esm/src/facade/lang.js.map +1 -0
  46. package/esm/src/facade/lang.metadata.json +1 -0
  47. package/esm/src/facade/promise.d.ts +17 -0
  48. package/esm/src/facade/promise.js +41 -0
  49. package/esm/src/facade/promise.js.map +1 -0
  50. package/esm/src/interfaces.d.ts +23 -0
  51. package/esm/src/interfaces.js +1 -0
  52. package/esm/src/interfaces.js.map +1 -0
  53. package/esm/src/lifecycle_reflector.d.ts +1 -0
  54. package/esm/src/lifecycle_reflector.js +10 -0
  55. package/esm/src/lifecycle_reflector.js.map +1 -0
  56. package/esm/src/link.d.ts +2 -0
  57. package/esm/src/link.js +183 -0
  58. package/esm/src/link.js.map +1 -0
  59. package/esm/src/metadata/decorators.d.ts +16 -0
  60. package/esm/src/metadata/decorators.js +9 -0
  61. package/esm/src/metadata/decorators.js.map +1 -0
  62. package/esm/src/metadata/decorators.metadata.json +1 -0
  63. package/esm/src/metadata/metadata.d.ts +48 -0
  64. package/esm/src/metadata/metadata.js +48 -0
  65. package/esm/src/metadata/metadata.js.map +1 -0
  66. package/esm/src/recognize.d.ts +4 -0
  67. package/esm/src/recognize.js +164 -0
  68. package/esm/src/recognize.js.map +1 -0
  69. package/esm/src/router.d.ts +95 -0
  70. package/esm/src/router.js +243 -0
  71. package/esm/src/router.js.map +1 -0
  72. package/esm/src/router_providers.d.ts +23 -0
  73. package/esm/src/router_providers.js +26 -0
  74. package/esm/src/router_providers.js.map +1 -0
  75. package/esm/src/router_providers.metadata.json +1 -0
  76. package/esm/src/router_providers_common.d.ts +11 -0
  77. package/esm/src/router_providers_common.js +32 -0
  78. package/esm/src/router_providers_common.js.map +1 -0
  79. package/esm/src/router_providers_common.metadata.json +1 -0
  80. package/esm/src/router_url_serializer.d.ts +21 -0
  81. package/esm/src/router_url_serializer.js +164 -0
  82. package/esm/src/router_url_serializer.js.map +1 -0
  83. package/esm/src/segments.d.ts +51 -0
  84. package/esm/src/segments.js +137 -0
  85. package/esm/src/segments.js.map +1 -0
  86. package/esm/src/segments.metadata.json +1 -0
  87. package/esm/testing/router_testing_providers.d.ts +1 -0
  88. package/esm/testing/router_testing_providers.js +31 -0
  89. package/esm/testing/router_testing_providers.js.map +1 -0
  90. package/esm/testing/router_testing_providers.metadata.json +1 -0
  91. package/esm/testing.d.ts +1 -0
  92. package/esm/testing.js +2 -0
  93. package/esm/testing.js.map +1 -0
  94. package/index.d.ts +15 -0
  95. package/index.js +31 -0
  96. package/index.js.map +1 -0
  97. package/package.json +16 -1
  98. package/src/constants.d.ts +5 -0
  99. package/src/constants.js +7 -0
  100. package/src/constants.js.map +1 -0
  101. package/src/constants.metadata.json +1 -0
  102. package/src/core_private.d.ts +3 -0
  103. package/src/core_private.js +5 -0
  104. package/src/core_private.js.map +1 -0
  105. package/src/core_private.metadata.json +1 -0
  106. package/src/directives/router_directives.d.ts +21 -0
  107. package/src/directives/router_directives.js +25 -0
  108. package/src/directives/router_directives.js.map +1 -0
  109. package/src/directives/router_directives.metadata.json +1 -0
  110. package/src/directives/router_link.d.ts +49 -0
  111. package/src/directives/router_link.js +76 -0
  112. package/src/directives/router_link.js.map +1 -0
  113. package/src/directives/router_link.metadata.json +1 -0
  114. package/src/directives/router_outlet.d.ts +36 -0
  115. package/src/directives/router_outlet.js +53 -0
  116. package/src/directives/router_outlet.js.map +1 -0
  117. package/src/directives/router_outlet.metadata.json +1 -0
  118. package/src/facade/async.d.ts +90 -0
  119. package/src/facade/async.js +160 -0
  120. package/src/facade/async.js.map +1 -0
  121. package/src/facade/base_wrapped_exception.d.ts +14 -0
  122. package/src/facade/base_wrapped_exception.js +50 -0
  123. package/src/facade/base_wrapped_exception.js.map +1 -0
  124. package/src/facade/collection.d.ts +103 -0
  125. package/src/facade/collection.js +368 -0
  126. package/src/facade/collection.js.map +1 -0
  127. package/src/facade/collection.metadata.json +1 -0
  128. package/src/facade/exception_handler.d.ts +29 -0
  129. package/src/facade/exception_handler.js +133 -0
  130. package/src/facade/exception_handler.js.map +1 -0
  131. package/src/facade/exceptions.d.ts +32 -0
  132. package/src/facade/exceptions.js +82 -0
  133. package/src/facade/exceptions.js.map +1 -0
  134. package/src/facade/exceptions.metadata.json +1 -0
  135. package/src/facade/lang.d.ts +158 -0
  136. package/src/facade/lang.js +480 -0
  137. package/src/facade/lang.js.map +1 -0
  138. package/src/facade/lang.metadata.json +1 -0
  139. package/src/facade/promise.d.ts +17 -0
  140. package/src/facade/promise.js +49 -0
  141. package/src/facade/promise.js.map +1 -0
  142. package/src/interfaces.d.ts +23 -0
  143. package/src/interfaces.js +2 -0
  144. package/src/interfaces.js.map +1 -0
  145. package/src/lifecycle_reflector.d.ts +1 -0
  146. package/src/lifecycle_reflector.js +12 -0
  147. package/src/lifecycle_reflector.js.map +1 -0
  148. package/src/link.d.ts +2 -0
  149. package/src/link.js +189 -0
  150. package/src/link.js.map +1 -0
  151. package/src/metadata/decorators.d.ts +16 -0
  152. package/src/metadata/decorators.js +10 -0
  153. package/src/metadata/decorators.js.map +1 -0
  154. package/src/metadata/decorators.metadata.json +1 -0
  155. package/src/metadata/metadata.d.ts +48 -0
  156. package/src/metadata/metadata.js +66 -0
  157. package/src/metadata/metadata.js.map +1 -0
  158. package/src/recognize.d.ts +4 -0
  159. package/src/recognize.js +172 -0
  160. package/src/recognize.js.map +1 -0
  161. package/src/router.d.ts +95 -0
  162. package/src/router.js +276 -0
  163. package/src/router.js.map +1 -0
  164. package/src/router_providers.d.ts +23 -0
  165. package/src/router_providers.js +27 -0
  166. package/src/router_providers.js.map +1 -0
  167. package/src/router_providers.metadata.json +1 -0
  168. package/src/router_providers_common.d.ts +11 -0
  169. package/src/router_providers_common.js +35 -0
  170. package/src/router_providers_common.js.map +1 -0
  171. package/src/router_providers_common.metadata.json +1 -0
  172. package/src/router_url_serializer.d.ts +21 -0
  173. package/src/router_url_serializer.js +184 -0
  174. package/src/router_url_serializer.js.map +1 -0
  175. package/src/segments.d.ts +51 -0
  176. package/src/segments.js +181 -0
  177. package/src/segments.js.map +1 -0
  178. package/src/segments.metadata.json +1 -0
  179. package/testing/router_testing_providers.d.ts +1 -0
  180. package/testing/router_testing_providers.js +35 -0
  181. package/testing/router_testing_providers.js.map +1 -0
  182. package/testing/router_testing_providers.metadata.json +1 -0
  183. package/testing.d.ts +1 -0
  184. package/testing.js +6 -0
  185. package/testing.js.map +1 -0
  186. package/angular1/angular_1_router.js +0 -2922
  187. package/angular1/ng_route_shim.js +0 -349
  188. package/angular2/router.dev.js +0 -3107
  189. package/angular2/router.js +0 -3107
  190. package/angular2/router.min.js +0 -3
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ var base_wrapped_exception_1 = require('./base_wrapped_exception');
3
+ var collection_1 = require('./collection');
4
+ var lang_1 = require('./lang');
5
+ var _ArrayLogger = (function () {
6
+ function _ArrayLogger() {
7
+ this.res = [];
8
+ }
9
+ _ArrayLogger.prototype.log = function (s) { this.res.push(s); };
10
+ _ArrayLogger.prototype.logError = function (s) { this.res.push(s); };
11
+ _ArrayLogger.prototype.logGroup = function (s) { this.res.push(s); };
12
+ _ArrayLogger.prototype.logGroupEnd = function () { };
13
+ ;
14
+ return _ArrayLogger;
15
+ }());
16
+ /**
17
+ * Provides a hook for centralized exception handling.
18
+ *
19
+ * The default implementation of `ExceptionHandler` prints error messages to the `Console`. To
20
+ * intercept error handling,
21
+ * write a custom exception handler that replaces this default as appropriate for your app.
22
+ *
23
+ * ### Example
24
+ *
25
+ * ```javascript
26
+ *
27
+ * class MyExceptionHandler implements ExceptionHandler {
28
+ * call(error, stackTrace = null, reason = null) {
29
+ * // do something with the exception
30
+ * }
31
+ * }
32
+ *
33
+ * bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}])
34
+ *
35
+ * ```
36
+ * @stable
37
+ */
38
+ var ExceptionHandler = (function () {
39
+ function ExceptionHandler(_logger, _rethrowException) {
40
+ if (_rethrowException === void 0) { _rethrowException = true; }
41
+ this._logger = _logger;
42
+ this._rethrowException = _rethrowException;
43
+ }
44
+ ExceptionHandler.exceptionToString = function (exception, stackTrace, reason) {
45
+ if (stackTrace === void 0) { stackTrace = null; }
46
+ if (reason === void 0) { reason = null; }
47
+ var l = new _ArrayLogger();
48
+ var e = new ExceptionHandler(l, false);
49
+ e.call(exception, stackTrace, reason);
50
+ return l.res.join('\n');
51
+ };
52
+ ExceptionHandler.prototype.call = function (exception, stackTrace, reason) {
53
+ if (stackTrace === void 0) { stackTrace = null; }
54
+ if (reason === void 0) { reason = null; }
55
+ var originalException = this._findOriginalException(exception);
56
+ var originalStack = this._findOriginalStack(exception);
57
+ var context = this._findContext(exception);
58
+ this._logger.logGroup("EXCEPTION: " + this._extractMessage(exception));
59
+ if (lang_1.isPresent(stackTrace) && lang_1.isBlank(originalStack)) {
60
+ this._logger.logError('STACKTRACE:');
61
+ this._logger.logError(this._longStackTrace(stackTrace));
62
+ }
63
+ if (lang_1.isPresent(reason)) {
64
+ this._logger.logError("REASON: " + reason);
65
+ }
66
+ if (lang_1.isPresent(originalException)) {
67
+ this._logger.logError("ORIGINAL EXCEPTION: " + this._extractMessage(originalException));
68
+ }
69
+ if (lang_1.isPresent(originalStack)) {
70
+ this._logger.logError('ORIGINAL STACKTRACE:');
71
+ this._logger.logError(this._longStackTrace(originalStack));
72
+ }
73
+ if (lang_1.isPresent(context)) {
74
+ this._logger.logError('ERROR CONTEXT:');
75
+ this._logger.logError(context);
76
+ }
77
+ this._logger.logGroupEnd();
78
+ // We rethrow exceptions, so operations like 'bootstrap' will result in an error
79
+ // when an exception happens. If we do not rethrow, bootstrap will always succeed.
80
+ if (this._rethrowException)
81
+ throw exception;
82
+ };
83
+ /** @internal */
84
+ ExceptionHandler.prototype._extractMessage = function (exception) {
85
+ return exception instanceof base_wrapped_exception_1.BaseWrappedException ? exception.wrapperMessage :
86
+ exception.toString();
87
+ };
88
+ /** @internal */
89
+ ExceptionHandler.prototype._longStackTrace = function (stackTrace) {
90
+ return collection_1.isListLikeIterable(stackTrace) ? stackTrace.join('\n\n-----async gap-----\n') :
91
+ stackTrace.toString();
92
+ };
93
+ /** @internal */
94
+ ExceptionHandler.prototype._findContext = function (exception) {
95
+ try {
96
+ if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
97
+ return null;
98
+ return lang_1.isPresent(exception.context) ? exception.context :
99
+ this._findContext(exception.originalException);
100
+ }
101
+ catch (e) {
102
+ // exception.context can throw an exception. if it happens, we ignore the context.
103
+ return null;
104
+ }
105
+ };
106
+ /** @internal */
107
+ ExceptionHandler.prototype._findOriginalException = function (exception) {
108
+ if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
109
+ return null;
110
+ var e = exception.originalException;
111
+ while (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
112
+ e = e.originalException;
113
+ }
114
+ return e;
115
+ };
116
+ /** @internal */
117
+ ExceptionHandler.prototype._findOriginalStack = function (exception) {
118
+ if (!(exception instanceof base_wrapped_exception_1.BaseWrappedException))
119
+ return null;
120
+ var e = exception;
121
+ var stack = exception.originalStack;
122
+ while (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
123
+ e = e.originalException;
124
+ if (e instanceof base_wrapped_exception_1.BaseWrappedException && lang_1.isPresent(e.originalException)) {
125
+ stack = e.originalStack;
126
+ }
127
+ }
128
+ return stack;
129
+ };
130
+ return ExceptionHandler;
131
+ }());
132
+ exports.ExceptionHandler = ExceptionHandler;
133
+ //# sourceMappingURL=exception_handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exception_handler.js","sourceRoot":"","sources":["../../../../../modules/@angular/router/src/facade/exception_handler.ts"],"names":[],"mappings":";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C,GAAG,SAAS,CAAC,iBAAiB,CAAC;QACpC,OAAO,CAAC,YAAY,6CAAoB,IAAI,gBAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC3E,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC;QAC1B,CAAC;QAED,MAAM,CAAC,CAAC,CAAC;IACX,CAAC;IAED,gBAAgB;IAChB,6CAAkB,GAAlB,UAAmB,SAAc;QAC/B,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,YAAY,6CAAoB,CAAC,CAAC;YAAC,MAAM,CAAC,IAAI,CAAC;QAE9D,IAAI,CAAC,GAAG,SAAS,CAAC;QAClB,IAAI,KAAK,GAAG,SAAS,CAAC,aAAa,CAAC;QACpC,OAAO,CAAC,YAAY,6CAAoB,IAAI,gBAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,EAAE,CAAC;YAC3E,CAAC,GAAG,CAAC,CAAC,iBAAiB,CAAC;YACxB,EAAE,CAAC,CAAC,CAAC,YAAY,6CAAoB,IAAI,gBAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;gBACxE,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,MAAM,CAAC,KAAK,CAAC;IACf,CAAC;IACH,uBAAC;AAAD,CAAC,AAlGD,IAkGC;AAlGY,wBAAgB,mBAkG5B,CAAA","sourcesContent":["import {BaseWrappedException} from './base_wrapped_exception';\nimport {isListLikeIterable} from './collection';\nimport {isBlank, isPresent} from './lang';\n\nclass _ArrayLogger {\n res: any[] = [];\n log(s: any): void { this.res.push(s); }\n logError(s: any): void { this.res.push(s); }\n logGroup(s: any): void { this.res.push(s); }\n logGroupEnd(){};\n}\n\n/**\n * Provides a hook for centralized exception handling.\n *\n * The default implementation of `ExceptionHandler` prints error messages to the `Console`. To\n * intercept error handling,\n * write a custom exception handler that replaces this default as appropriate for your app.\n *\n * ### Example\n *\n * ```javascript\n *\n * class MyExceptionHandler implements ExceptionHandler {\n * call(error, stackTrace = null, reason = null) {\n * // do something with the exception\n * }\n * }\n *\n * bootstrap(MyApp, {provide: ExceptionHandler, useClass: MyExceptionHandler}])\n *\n * ```\n * @stable\n */\nexport class ExceptionHandler {\n constructor(private _logger: any, private _rethrowException: boolean = true) {}\n\n static exceptionToString(exception: any, stackTrace: any = null, reason: string = null): string {\n var l = new _ArrayLogger();\n var e = new ExceptionHandler(l, false);\n e.call(exception, stackTrace, reason);\n return l.res.join('\\n');\n }\n\n call(exception: any, stackTrace: any = null, reason: string = null): void {\n var originalException = this._findOriginalException(exception);\n var originalStack = this._findOriginalStack(exception);\n var context = this._findContext(exception);\n\n this._logger.logGroup(`EXCEPTION: ${this._extractMessage(exception)}`);\n\n if (isPresent(stackTrace) && isBlank(originalStack)) {\n this._logger.logError('STACKTRACE:');\n this._logger.logError(this._longStackTrace(stackTrace));\n }\n\n if (isPresent(reason)) {\n this._logger.logError(`REASON: ${reason}`);\n }\n\n if (isPresent(originalException)) {\n this._logger.logError(`ORIGINAL EXCEPTION: ${this._extractMessage(originalException)}`);\n }\n\n if (isPresent(originalStack)) {\n this._logger.logError('ORIGINAL STACKTRACE:');\n this._logger.logError(this._longStackTrace(originalStack));\n }\n\n if (isPresent(context)) {\n this._logger.logError('ERROR CONTEXT:');\n this._logger.logError(context);\n }\n\n this._logger.logGroupEnd();\n\n // We rethrow exceptions, so operations like 'bootstrap' will result in an error\n // when an exception happens. If we do not rethrow, bootstrap will always succeed.\n if (this._rethrowException) throw exception;\n }\n\n /** @internal */\n _extractMessage(exception: any): string {\n return exception instanceof BaseWrappedException ? exception.wrapperMessage :\n exception.toString();\n }\n\n /** @internal */\n _longStackTrace(stackTrace: any): any {\n return isListLikeIterable(stackTrace) ? (<any[]>stackTrace).join('\\n\\n-----async gap-----\\n') :\n stackTrace.toString();\n }\n\n /** @internal */\n _findContext(exception: any): any {\n try {\n if (!(exception instanceof BaseWrappedException)) return null;\n return isPresent(exception.context) ? exception.context :\n this._findContext(exception.originalException);\n } catch (e) {\n // exception.context can throw an exception. if it happens, we ignore the context.\n return null;\n }\n }\n\n /** @internal */\n _findOriginalException(exception: any): any {\n if (!(exception instanceof BaseWrappedException)) return null;\n\n var e = exception.originalException;\n while (e instanceof BaseWrappedException && isPresent(e.originalException)) {\n e = e.originalException;\n }\n\n return e;\n }\n\n /** @internal */\n _findOriginalStack(exception: any): any {\n if (!(exception instanceof BaseWrappedException)) return null;\n\n var e = exception;\n var stack = exception.originalStack;\n while (e instanceof BaseWrappedException && isPresent(e.originalException)) {\n e = e.originalException;\n if (e instanceof BaseWrappedException && isPresent(e.originalException)) {\n stack = e.originalStack;\n }\n }\n\n return stack;\n }\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { BaseWrappedException } from './base_wrapped_exception';
2
+ export { ExceptionHandler } from './exception_handler';
3
+ /**
4
+ * @stable
5
+ */
6
+ export declare class BaseException extends Error {
7
+ message: string;
8
+ stack: any;
9
+ constructor(message?: string);
10
+ toString(): string;
11
+ }
12
+ /**
13
+ * Wraps an exception and provides additional context or information.
14
+ * @stable
15
+ */
16
+ export declare class WrappedException extends BaseWrappedException {
17
+ private _wrapperMessage;
18
+ private _originalException;
19
+ private _originalStack;
20
+ private _context;
21
+ private _wrapperStack;
22
+ constructor(_wrapperMessage: string, _originalException: any, _originalStack?: any, _context?: any);
23
+ wrapperMessage: string;
24
+ wrapperStack: any;
25
+ originalException: any;
26
+ originalStack: any;
27
+ context: any;
28
+ message: string;
29
+ toString(): string;
30
+ }
31
+ export declare function makeTypeError(message?: string): Error;
32
+ export declare function unimplemented(): any;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || function (d, b) {
3
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
4
+ function __() { this.constructor = d; }
5
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6
+ };
7
+ var base_wrapped_exception_1 = require('./base_wrapped_exception');
8
+ var exception_handler_1 = require('./exception_handler');
9
+ var exception_handler_2 = require('./exception_handler');
10
+ exports.ExceptionHandler = exception_handler_2.ExceptionHandler;
11
+ /**
12
+ * @stable
13
+ */
14
+ var BaseException = (function (_super) {
15
+ __extends(BaseException, _super);
16
+ function BaseException(message) {
17
+ if (message === void 0) { message = '--'; }
18
+ _super.call(this, message);
19
+ this.message = message;
20
+ this.stack = (new Error(message)).stack;
21
+ }
22
+ BaseException.prototype.toString = function () { return this.message; };
23
+ return BaseException;
24
+ }(Error));
25
+ exports.BaseException = BaseException;
26
+ /**
27
+ * Wraps an exception and provides additional context or information.
28
+ * @stable
29
+ */
30
+ var WrappedException = (function (_super) {
31
+ __extends(WrappedException, _super);
32
+ function WrappedException(_wrapperMessage, _originalException /** TODO #9100 */, _originalStack /** TODO #9100 */, _context /** TODO #9100 */) {
33
+ _super.call(this, _wrapperMessage);
34
+ this._wrapperMessage = _wrapperMessage;
35
+ this._originalException = _originalException;
36
+ this._originalStack = _originalStack;
37
+ this._context = _context;
38
+ this._wrapperStack = (new Error(_wrapperMessage)).stack;
39
+ }
40
+ Object.defineProperty(WrappedException.prototype, "wrapperMessage", {
41
+ get: function () { return this._wrapperMessage; },
42
+ enumerable: true,
43
+ configurable: true
44
+ });
45
+ Object.defineProperty(WrappedException.prototype, "wrapperStack", {
46
+ get: function () { return this._wrapperStack; },
47
+ enumerable: true,
48
+ configurable: true
49
+ });
50
+ Object.defineProperty(WrappedException.prototype, "originalException", {
51
+ get: function () { return this._originalException; },
52
+ enumerable: true,
53
+ configurable: true
54
+ });
55
+ Object.defineProperty(WrappedException.prototype, "originalStack", {
56
+ get: function () { return this._originalStack; },
57
+ enumerable: true,
58
+ configurable: true
59
+ });
60
+ Object.defineProperty(WrappedException.prototype, "context", {
61
+ get: function () { return this._context; },
62
+ enumerable: true,
63
+ configurable: true
64
+ });
65
+ Object.defineProperty(WrappedException.prototype, "message", {
66
+ get: function () { return exception_handler_1.ExceptionHandler.exceptionToString(this); },
67
+ enumerable: true,
68
+ configurable: true
69
+ });
70
+ WrappedException.prototype.toString = function () { return this.message; };
71
+ return WrappedException;
72
+ }(base_wrapped_exception_1.BaseWrappedException));
73
+ exports.WrappedException = WrappedException;
74
+ function makeTypeError(message) {
75
+ return new TypeError(message);
76
+ }
77
+ exports.makeTypeError = makeTypeError;
78
+ function unimplemented() {
79
+ throw new BaseException('unimplemented');
80
+ }
81
+ exports.unimplemented = unimplemented;
82
+ //# sourceMappingURL=exceptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../../../modules/@angular/router/src/facade/exceptions.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAmC,0BAA0B,CAAC,CAAA;AAC9D,kCAA+B,qBAAqB,CAAC,CAAA;AAErD,kCAA+B,qBAAqB,CAAC;AAA7C,gEAA6C;AAErD;;GAEG;AACH;IAAmC,iCAAK;IAEtC,uBAAmB,OAAsB;QAA7B,uBAA6B,GAA7B,cAA6B;QACvC,kBAAM,OAAO,CAAC,CAAC;QADE,YAAO,GAAP,OAAO,CAAe;QAEvC,IAAI,CAAC,KAAK,GAAG,CAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/C,CAAC;IAED,gCAAQ,GAAR,cAAqB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,oBAAC;AAAD,CAAC,AARD,CAAmC,KAAK,GAQvC;AARY,qBAAa,gBAQzB,CAAA;AAED;;;GAGG;AACH;IAAsC,oCAAoB;IAGxD,0BACY,eAAuB,EAAU,kBAAuB,CAAC,iBAAiB,EAC1E,cAAoB,CAAC,iBAAiB,EAAU,QAAc,CAAC,iBAAiB;QAC1F,kBAAM,eAAe,CAAC,CAAC;QAFb,oBAAe,GAAf,eAAe,CAAQ;QAAU,uBAAkB,GAAlB,kBAAkB,CAAK;QACxD,mBAAc,GAAd,cAAc,CAAM;QAA4B,aAAQ,GAAR,QAAQ,CAAM;QAExE,IAAI,CAAC,aAAa,GAAG,CAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC;IAC/D,CAAC;IAED,sBAAI,4CAAc;aAAlB,cAA+B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;;;OAAA;IAE7D,sBAAI,0CAAY;aAAhB,cAA0B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;;;OAAA;IAGtD,sBAAI,+CAAiB;aAArB,cAA+B,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,CAAC;;;OAAA;IAEhE,sBAAI,2CAAa;aAAjB,cAA2B,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;;;OAAA;IAGxD,sBAAI,qCAAO;aAAX,cAAqB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;;;OAAA;IAE5C,sBAAI,qCAAO;aAAX,cAAwB,MAAM,CAAC,oCAAgB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;OAAA;IAE1E,mCAAQ,GAAR,cAAqB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,uBAAC;AAAD,CAAC,AAzBD,CAAsC,6CAAoB,GAyBzD;AAzBY,wBAAgB,mBAyB5B,CAAA;AAED,uBAA8B,OAAgB;IAC5C,MAAM,CAAC,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAFe,qBAAa,gBAE5B,CAAA;AAED;IACE,MAAM,IAAI,aAAa,CAAC,eAAe,CAAC,CAAC;AAC3C,CAAC;AAFe,qBAAa,gBAE5B,CAAA","sourcesContent":["import {BaseWrappedException} from './base_wrapped_exception';\nimport {ExceptionHandler} from './exception_handler';\n\nexport {ExceptionHandler} from './exception_handler';\n\n/**\n * @stable\n */\nexport class BaseException extends Error {\n public stack: any;\n constructor(public message: string = '--') {\n super(message);\n this.stack = (<any>new Error(message)).stack;\n }\n\n toString(): string { return this.message; }\n}\n\n/**\n * Wraps an exception and provides additional context or information.\n * @stable\n */\nexport class WrappedException extends BaseWrappedException {\n private _wrapperStack: any;\n\n constructor(\n private _wrapperMessage: string, private _originalException: any /** TODO #9100 */,\n private _originalStack?: any /** TODO #9100 */, private _context?: any /** TODO #9100 */) {\n super(_wrapperMessage);\n this._wrapperStack = (<any>new Error(_wrapperMessage)).stack;\n }\n\n get wrapperMessage(): string { return this._wrapperMessage; }\n\n get wrapperStack(): any { return this._wrapperStack; }\n\n\n get originalException(): any { return this._originalException; }\n\n get originalStack(): any { return this._originalStack; }\n\n\n get context(): any { return this._context; }\n\n get message(): string { return ExceptionHandler.exceptionToString(this); }\n\n toString(): string { return this.message; }\n}\n\nexport function makeTypeError(message?: string): Error {\n return new TypeError(message);\n}\n\nexport function unimplemented(): any {\n throw new BaseException('unimplemented');\n}\n\ninterface DecoratorInvocation {\n type: Function;\n args?: any[];\n}\n"]}
@@ -0,0 +1 @@
1
+ {"__symbolic":"module","version":1,"metadata":{"makeTypeError":{"__symbolic":"function","parameters":["message"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","name":"TypeError"},"arguments":[{"__symbolic":"reference","name":"message"}]}}}}
@@ -0,0 +1,158 @@
1
+ export interface BrowserNodeGlobal {
2
+ Object: typeof Object;
3
+ Array: typeof Array;
4
+ Map: typeof Map;
5
+ Set: typeof Set;
6
+ Date: DateConstructor;
7
+ RegExp: RegExpConstructor;
8
+ JSON: typeof JSON;
9
+ Math: any;
10
+ assert(condition: any): void;
11
+ Reflect: any;
12
+ getAngularTestability: Function;
13
+ getAllAngularTestabilities: Function;
14
+ getAllAngularRootElements: Function;
15
+ frameworkStabilizers: Array<Function>;
16
+ setTimeout: Function;
17
+ clearTimeout: Function;
18
+ setInterval: Function;
19
+ clearInterval: Function;
20
+ encodeURI: Function;
21
+ }
22
+ export declare function scheduleMicroTask(fn: Function): void;
23
+ export declare const IS_DART: boolean;
24
+ declare var _global: BrowserNodeGlobal;
25
+ export { _global as global };
26
+ export declare var Type: FunctionConstructor;
27
+ /**
28
+ * Runtime representation a type that a Component or other object is instances of.
29
+ *
30
+ * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
31
+ * the `MyCustomComponent` constructor function.
32
+ */
33
+ export interface Type extends Function {
34
+ }
35
+ /**
36
+ * Runtime representation of a type that is constructable (non-abstract).
37
+ */
38
+ export interface ConcreteType extends Type {
39
+ new (...args: any[]): any;
40
+ }
41
+ export declare function getTypeNameForDebugging(type: Type): string;
42
+ export declare var Math: any;
43
+ export declare var Date: DateConstructor;
44
+ export declare function lockMode(): void;
45
+ /**
46
+ * Disable Angular's development mode, which turns off assertions and other
47
+ * checks within the framework.
48
+ *
49
+ * One important assertion this disables verifies that a change detection pass
50
+ * does not result in additional changes to any bindings (also known as
51
+ * unidirectional data flow).
52
+ * @stable
53
+ */
54
+ export declare function enableProdMode(): void;
55
+ export declare function assertionsEnabled(): boolean;
56
+ export declare function isPresent(obj: any): boolean;
57
+ export declare function isBlank(obj: any): boolean;
58
+ export declare function isBoolean(obj: any): boolean;
59
+ export declare function isNumber(obj: any): boolean;
60
+ export declare function isString(obj: any): obj is String;
61
+ export declare function isFunction(obj: any): boolean;
62
+ export declare function isType(obj: any): boolean;
63
+ export declare function isStringMap(obj: any): boolean;
64
+ export declare function isStrictStringMap(obj: any): boolean;
65
+ export declare function isPromise(obj: any): boolean;
66
+ export declare function isArray(obj: any): boolean;
67
+ export declare function isDate(obj: any): obj is Date;
68
+ export declare function noop(): void;
69
+ export declare function stringify(token: any): string;
70
+ export declare function serializeEnum(val: any): number;
71
+ export declare function deserializeEnum(val: any, values: Map<number, any>): any;
72
+ export declare function resolveEnumToken(enumValue: any, val: any): string;
73
+ export declare class StringWrapper {
74
+ static fromCharCode(code: number): string;
75
+ static charCodeAt(s: string, index: number): number;
76
+ static split(s: string, regExp: RegExp): string[];
77
+ static equals(s: string, s2: string): boolean;
78
+ static stripLeft(s: string, charVal: string): string;
79
+ static stripRight(s: string, charVal: string): string;
80
+ static replace(s: string, from: string, replace: string): string;
81
+ static replaceAll(s: string, from: RegExp, replace: string): string;
82
+ static slice<T>(s: string, from?: number, to?: number): string;
83
+ static replaceAllMapped(s: string, from: RegExp, cb: Function): string;
84
+ static contains(s: string, substr: string): boolean;
85
+ static compare(a: string, b: string): number;
86
+ }
87
+ export declare class StringJoiner {
88
+ parts: string[];
89
+ constructor(parts?: string[]);
90
+ add(part: string): void;
91
+ toString(): string;
92
+ }
93
+ export declare class NumberParseError extends Error {
94
+ message: string;
95
+ name: string;
96
+ constructor(message: string);
97
+ toString(): string;
98
+ }
99
+ export declare class NumberWrapper {
100
+ static toFixed(n: number, fractionDigits: number): string;
101
+ static equal(a: number, b: number): boolean;
102
+ static parseIntAutoRadix(text: string): number;
103
+ static parseInt(text: string, radix: number): number;
104
+ static parseFloat(text: string): number;
105
+ static NaN: number;
106
+ static isNaN(value: any): boolean;
107
+ static isInteger(value: any): boolean;
108
+ }
109
+ export declare var RegExp: RegExpConstructor;
110
+ export declare class RegExpWrapper {
111
+ static create(regExpStr: string, flags?: string): RegExp;
112
+ static firstMatch(regExp: RegExp, input: string): RegExpExecArray;
113
+ static test(regExp: RegExp, input: string): boolean;
114
+ static matcher(regExp: RegExp, input: string): {
115
+ re: RegExp;
116
+ input: string;
117
+ };
118
+ static replaceAll(regExp: RegExp, input: string, replace: Function): string;
119
+ }
120
+ export declare class RegExpMatcherWrapper {
121
+ static next(matcher: {
122
+ re: RegExp;
123
+ input: string;
124
+ }): RegExpExecArray;
125
+ }
126
+ export declare class FunctionWrapper {
127
+ static apply(fn: Function, posArgs: any): any;
128
+ static bind(fn: Function, scope: any): Function;
129
+ }
130
+ export declare function looseIdentical(a: any, b: any): boolean;
131
+ export declare function getMapKey<T>(value: T): T;
132
+ export declare function normalizeBlank(obj: Object): any;
133
+ export declare function normalizeBool(obj: boolean): boolean;
134
+ export declare function isJsObject(o: any): boolean;
135
+ export declare function print(obj: Error | Object): void;
136
+ export declare function warn(obj: Error | Object): void;
137
+ export declare class Json {
138
+ static parse(s: string): Object;
139
+ static stringify(data: Object): string;
140
+ }
141
+ export declare class DateWrapper {
142
+ static create(year: number, month?: number, day?: number, hour?: number, minutes?: number, seconds?: number, milliseconds?: number): Date;
143
+ static fromISOString(str: string): Date;
144
+ static fromMillis(ms: number): Date;
145
+ static toMillis(date: Date): number;
146
+ static now(): Date;
147
+ static toJson(date: Date): string;
148
+ }
149
+ export declare function setValueOnPath(global: any, path: string, value: any): void;
150
+ export declare function getSymbolIterator(): string | symbol;
151
+ export declare function evalExpression(sourceUrl: string, expr: string, declarations: string, vars: {
152
+ [key: string]: any;
153
+ }): any;
154
+ export declare function isPrimitive(obj: any): boolean;
155
+ export declare function hasConstructor(value: Object, type: Type): boolean;
156
+ export declare function bitWiseOr(values: number[]): number;
157
+ export declare function bitWiseAnd(values: number[]): number;
158
+ export declare function escape(s: string): string;