typespeed 2.0.21 → 2.0.23

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 (219) hide show
  1. package/dist/core.decorator.js +1 -30
  2. package/dist/default/default-authentication.class.js +25 -0
  3. package/dist/default/express-server.class.js +11 -4
  4. package/dist/default/log-default.class.js +0 -6
  5. package/dist/factory/authentication-factory.class.js +11 -0
  6. package/dist/factory/log-factory.class.js +9 -0
  7. package/dist/route.decorator.js +92 -2
  8. package/dist/typespeed.d.ts +40 -3
  9. package/dist/typespeed.js +3 -1
  10. package/package.json +1 -1
  11. package/src/core.decorator.ts +1 -29
  12. package/src/default/default-authentication.class.ts +10 -0
  13. package/src/default/express-server.class.ts +12 -5
  14. package/src/default/log-default.class.ts +0 -10
  15. package/src/factory/authentication-factory.class.ts +9 -0
  16. package/src/factory/log-factory.class.ts +9 -2
  17. package/src/route.decorator.ts +91 -3
  18. package/src/typespeed.d.ts +40 -3
  19. package/src/typespeed.ts +1 -0
  20. package/test/node_modules/.package-lock.json +65 -101
  21. package/test/node_modules/@types/body-parser/LICENSE +21 -0
  22. package/test/node_modules/@types/body-parser/README.md +16 -0
  23. package/test/node_modules/@types/body-parser/index.d.ts +107 -0
  24. package/test/node_modules/@types/body-parser/package.json +58 -0
  25. package/test/node_modules/@types/connect/LICENSE +21 -0
  26. package/test/node_modules/@types/connect/README.md +16 -0
  27. package/test/node_modules/@types/connect/index.d.ts +93 -0
  28. package/test/node_modules/@types/connect/package.json +32 -0
  29. package/test/node_modules/@types/express/LICENSE +21 -0
  30. package/test/node_modules/@types/express/README.md +16 -0
  31. package/test/node_modules/@types/express/index.d.ts +136 -0
  32. package/test/node_modules/@types/express/package.json +45 -0
  33. package/test/node_modules/@types/express-serve-static-core/LICENSE +21 -0
  34. package/test/node_modules/@types/express-serve-static-core/README.md +16 -0
  35. package/test/node_modules/@types/express-serve-static-core/index.d.ts +1281 -0
  36. package/test/node_modules/@types/express-serve-static-core/package.json +55 -0
  37. package/test/node_modules/@types/mime/LICENSE +21 -0
  38. package/test/node_modules/@types/mime/Mime.d.ts +10 -0
  39. package/test/node_modules/@types/mime/README.md +16 -0
  40. package/test/node_modules/@types/mime/index.d.ts +35 -0
  41. package/test/node_modules/@types/mime/lite.d.ts +7 -0
  42. package/test/node_modules/@types/mime/package.json +29 -0
  43. package/test/node_modules/@types/qs/LICENSE +21 -0
  44. package/test/node_modules/@types/qs/README.md +16 -0
  45. package/test/node_modules/@types/qs/index.d.ts +62 -0
  46. package/test/node_modules/@types/qs/package.json +65 -0
  47. package/test/node_modules/@types/range-parser/LICENSE +21 -0
  48. package/test/node_modules/@types/range-parser/README.md +55 -0
  49. package/test/node_modules/@types/range-parser/index.d.ts +35 -0
  50. package/test/node_modules/@types/range-parser/package.json +25 -0
  51. package/test/node_modules/@types/send/LICENSE +21 -0
  52. package/test/node_modules/@types/send/README.md +16 -0
  53. package/test/node_modules/@types/send/index.d.ts +231 -0
  54. package/test/node_modules/@types/send/package.json +33 -0
  55. package/test/node_modules/@types/serve-static/LICENSE +21 -0
  56. package/test/node_modules/@types/serve-static/README.md +16 -0
  57. package/test/node_modules/@types/serve-static/index.d.ts +113 -0
  58. package/test/node_modules/@types/serve-static/package.json +38 -0
  59. package/test/src/config.json +5 -0
  60. package/test/src/custom-log.class.ts +6 -0
  61. package/test/src/jwt-authentication.class.ts +29 -0
  62. package/test/src/test-request.class.ts +36 -0
  63. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-ci.yml +0 -17
  64. package/test/node_modules/@acuminous/bitsyntax/.github/workflows/node-js-publish.yml +0 -30
  65. package/test/node_modules/@acuminous/bitsyntax/LICENSE +0 -6
  66. package/test/node_modules/@acuminous/bitsyntax/LICENSE-MIT +0 -21
  67. package/test/node_modules/@acuminous/bitsyntax/Makefile +0 -15
  68. package/test/node_modules/@acuminous/bitsyntax/README.md +0 -308
  69. package/test/node_modules/@acuminous/bitsyntax/index.js +0 -10
  70. package/test/node_modules/@acuminous/bitsyntax/lib/compile.js +0 -303
  71. package/test/node_modules/@acuminous/bitsyntax/lib/constructor.js +0 -142
  72. package/test/node_modules/@acuminous/bitsyntax/lib/grammar.pegjs +0 -67
  73. package/test/node_modules/@acuminous/bitsyntax/lib/interp.js +0 -232
  74. package/test/node_modules/@acuminous/bitsyntax/lib/parse.js +0 -32
  75. package/test/node_modules/@acuminous/bitsyntax/lib/parser.js +0 -1173
  76. package/test/node_modules/@acuminous/bitsyntax/lib/pattern.js +0 -119
  77. package/test/node_modules/@acuminous/bitsyntax/package.json +0 -36
  78. package/test/node_modules/@acuminous/bitsyntax/test/consing.test.js +0 -50
  79. package/test/node_modules/@acuminous/bitsyntax/test/matching.test.js +0 -193
  80. package/test/node_modules/amqplib/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  81. package/test/node_modules/amqplib/.github/workflows/test.yml +0 -38
  82. package/test/node_modules/amqplib/CHANGELOG.md +0 -430
  83. package/test/node_modules/amqplib/LICENSE +0 -6
  84. package/test/node_modules/amqplib/LICENSE-MIT +0 -21
  85. package/test/node_modules/amqplib/Makefile +0 -47
  86. package/test/node_modules/amqplib/README.md +0 -157
  87. package/test/node_modules/amqplib/bin/generate-defs.js +0 -722
  88. package/test/node_modules/amqplib/callback_api.js +0 -22
  89. package/test/node_modules/amqplib/channel_api.js +0 -16
  90. package/test/node_modules/amqplib/examples/headers.js +0 -42
  91. package/test/node_modules/amqplib/examples/receive_generator.js +0 -39
  92. package/test/node_modules/amqplib/examples/send_generators.js +0 -42
  93. package/test/node_modules/amqplib/examples/ssl.js +0 -64
  94. package/test/node_modules/amqplib/examples/tutorials/README.md +0 -93
  95. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log.js +0 -28
  96. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_direct.js +0 -30
  97. package/test/node_modules/amqplib/examples/tutorials/callback_api/emit_log_topic.js +0 -27
  98. package/test/node_modules/amqplib/examples/tutorials/callback_api/new_task.js +0 -27
  99. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive.js +0 -30
  100. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs.js +0 -36
  101. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_direct.js +0 -56
  102. package/test/node_modules/amqplib/examples/tutorials/callback_api/receive_logs_topic.js +0 -55
  103. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_client.js +0 -49
  104. package/test/node_modules/amqplib/examples/tutorials/callback_api/rpc_server.js +0 -45
  105. package/test/node_modules/amqplib/examples/tutorials/callback_api/send.js +0 -29
  106. package/test/node_modules/amqplib/examples/tutorials/callback_api/worker.js +0 -35
  107. package/test/node_modules/amqplib/examples/tutorials/emit_log.js +0 -19
  108. package/test/node_modules/amqplib/examples/tutorials/emit_log_direct.js +0 -20
  109. package/test/node_modules/amqplib/examples/tutorials/emit_log_topic.js +0 -19
  110. package/test/node_modules/amqplib/examples/tutorials/new_task.js +0 -18
  111. package/test/node_modules/amqplib/examples/tutorials/package.json +0 -16
  112. package/test/node_modules/amqplib/examples/tutorials/receive.js +0 -21
  113. package/test/node_modules/amqplib/examples/tutorials/receive_logs.js +0 -28
  114. package/test/node_modules/amqplib/examples/tutorials/receive_logs_direct.js +0 -44
  115. package/test/node_modules/amqplib/examples/tutorials/receive_logs_topic.js +0 -43
  116. package/test/node_modules/amqplib/examples/tutorials/rpc_client.js +0 -52
  117. package/test/node_modules/amqplib/examples/tutorials/rpc_server.js +0 -39
  118. package/test/node_modules/amqplib/examples/tutorials/send.js +0 -23
  119. package/test/node_modules/amqplib/examples/tutorials/worker.js +0 -28
  120. package/test/node_modules/amqplib/examples/waitForConfirms.js +0 -22
  121. package/test/node_modules/amqplib/lib/api_args.js +0 -314
  122. package/test/node_modules/amqplib/lib/bitset.js +0 -130
  123. package/test/node_modules/amqplib/lib/callback_model.js +0 -327
  124. package/test/node_modules/amqplib/lib/channel.js +0 -499
  125. package/test/node_modules/amqplib/lib/channel_model.js +0 -302
  126. package/test/node_modules/amqplib/lib/codec.js +0 -321
  127. package/test/node_modules/amqplib/lib/connect.js +0 -189
  128. package/test/node_modules/amqplib/lib/connection.js +0 -663
  129. package/test/node_modules/amqplib/lib/credentials.js +0 -42
  130. package/test/node_modules/amqplib/lib/defs.js +0 -4966
  131. package/test/node_modules/amqplib/lib/error.js +0 -24
  132. package/test/node_modules/amqplib/lib/format.js +0 -40
  133. package/test/node_modules/amqplib/lib/frame.js +0 -113
  134. package/test/node_modules/amqplib/lib/heartbeat.js +0 -89
  135. package/test/node_modules/amqplib/lib/mux.js +0 -129
  136. package/test/node_modules/amqplib/package.json +0 -37
  137. package/test/node_modules/amqplib/test/bitset.js +0 -69
  138. package/test/node_modules/amqplib/test/callback_api.js +0 -312
  139. package/test/node_modules/amqplib/test/channel.js +0 -621
  140. package/test/node_modules/amqplib/test/channel_api.js +0 -596
  141. package/test/node_modules/amqplib/test/codec.js +0 -237
  142. package/test/node_modules/amqplib/test/connect.js +0 -197
  143. package/test/node_modules/amqplib/test/connection.js +0 -390
  144. package/test/node_modules/amqplib/test/data.js +0 -254
  145. package/test/node_modules/amqplib/test/frame.js +0 -198
  146. package/test/node_modules/amqplib/test/mux.js +0 -204
  147. package/test/node_modules/amqplib/test/util.js +0 -219
  148. package/test/node_modules/buffer-more-ints/.travis.yml +0 -6
  149. package/test/node_modules/buffer-more-ints/LICENSE +0 -19
  150. package/test/node_modules/buffer-more-ints/README.md +0 -69
  151. package/test/node_modules/buffer-more-ints/buffer-more-ints-tests.js +0 -183
  152. package/test/node_modules/buffer-more-ints/buffer-more-ints.js +0 -432
  153. package/test/node_modules/buffer-more-ints/package.json +0 -19
  154. package/test/node_modules/buffer-more-ints/polyfill.js +0 -71
  155. package/test/node_modules/core-util-is/LICENSE +0 -19
  156. package/test/node_modules/core-util-is/README.md +0 -3
  157. package/test/node_modules/core-util-is/lib/util.js +0 -107
  158. package/test/node_modules/core-util-is/package.json +0 -38
  159. package/test/node_modules/debug/LICENSE +0 -20
  160. package/test/node_modules/debug/README.md +0 -481
  161. package/test/node_modules/debug/package.json +0 -59
  162. package/test/node_modules/debug/src/browser.js +0 -269
  163. package/test/node_modules/debug/src/common.js +0 -274
  164. package/test/node_modules/debug/src/index.js +0 -10
  165. package/test/node_modules/debug/src/node.js +0 -263
  166. package/test/node_modules/inherits/LICENSE +0 -16
  167. package/test/node_modules/inherits/README.md +0 -42
  168. package/test/node_modules/inherits/inherits.js +0 -9
  169. package/test/node_modules/inherits/inherits_browser.js +0 -27
  170. package/test/node_modules/inherits/package.json +0 -29
  171. package/test/node_modules/isarray/README.md +0 -54
  172. package/test/node_modules/isarray/build/build.js +0 -209
  173. package/test/node_modules/isarray/component.json +0 -19
  174. package/test/node_modules/isarray/index.js +0 -3
  175. package/test/node_modules/isarray/package.json +0 -25
  176. package/test/node_modules/ms/index.js +0 -162
  177. package/test/node_modules/ms/license.md +0 -21
  178. package/test/node_modules/ms/package.json +0 -37
  179. package/test/node_modules/ms/readme.md +0 -60
  180. package/test/node_modules/querystringify/LICENSE +0 -22
  181. package/test/node_modules/querystringify/README.md +0 -61
  182. package/test/node_modules/querystringify/index.js +0 -118
  183. package/test/node_modules/querystringify/package.json +0 -38
  184. package/test/node_modules/readable-stream/LICENSE +0 -18
  185. package/test/node_modules/readable-stream/README.md +0 -15
  186. package/test/node_modules/readable-stream/duplex.js +0 -1
  187. package/test/node_modules/readable-stream/float.patch +0 -923
  188. package/test/node_modules/readable-stream/lib/_stream_duplex.js +0 -89
  189. package/test/node_modules/readable-stream/lib/_stream_passthrough.js +0 -46
  190. package/test/node_modules/readable-stream/lib/_stream_readable.js +0 -951
  191. package/test/node_modules/readable-stream/lib/_stream_transform.js +0 -209
  192. package/test/node_modules/readable-stream/lib/_stream_writable.js +0 -477
  193. package/test/node_modules/readable-stream/package.json +0 -32
  194. package/test/node_modules/readable-stream/passthrough.js +0 -1
  195. package/test/node_modules/readable-stream/readable.js +0 -10
  196. package/test/node_modules/readable-stream/transform.js +0 -1
  197. package/test/node_modules/readable-stream/writable.js +0 -1
  198. package/test/node_modules/requires-port/.travis.yml +0 -19
  199. package/test/node_modules/requires-port/LICENSE +0 -22
  200. package/test/node_modules/requires-port/README.md +0 -47
  201. package/test/node_modules/requires-port/index.js +0 -38
  202. package/test/node_modules/requires-port/package.json +0 -47
  203. package/test/node_modules/requires-port/test.js +0 -98
  204. package/test/node_modules/safe-buffer/LICENSE +0 -21
  205. package/test/node_modules/safe-buffer/README.md +0 -584
  206. package/test/node_modules/safe-buffer/index.d.ts +0 -187
  207. package/test/node_modules/safe-buffer/index.js +0 -62
  208. package/test/node_modules/safe-buffer/package.json +0 -37
  209. package/test/node_modules/string_decoder/LICENSE +0 -20
  210. package/test/node_modules/string_decoder/README.md +0 -7
  211. package/test/node_modules/string_decoder/index.js +0 -221
  212. package/test/node_modules/string_decoder/package.json +0 -25
  213. package/test/node_modules/url-parse/LICENSE +0 -22
  214. package/test/node_modules/url-parse/README.md +0 -153
  215. package/test/node_modules/url-parse/dist/url-parse.js +0 -755
  216. package/test/node_modules/url-parse/dist/url-parse.min.js +0 -1
  217. package/test/node_modules/url-parse/dist/url-parse.min.js.map +0 -1
  218. package/test/node_modules/url-parse/index.js +0 -589
  219. package/test/node_modules/url-parse/package.json +0 -49
@@ -1,755 +0,0 @@
1
- (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.URLParse = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
2
- (function (global){(function (){
3
- 'use strict';
4
-
5
- var required = require('requires-port')
6
- , qs = require('querystringify')
7
- , controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/
8
- , CRHTLF = /[\n\r\t]/g
9
- , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//
10
- , port = /:\d+$/
11
- , protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i
12
- , windowsDriveLetter = /^[a-zA-Z]:/;
13
-
14
- /**
15
- * Remove control characters and whitespace from the beginning of a string.
16
- *
17
- * @param {Object|String} str String to trim.
18
- * @returns {String} A new string representing `str` stripped of control
19
- * characters and whitespace from its beginning.
20
- * @public
21
- */
22
- function trimLeft(str) {
23
- return (str ? str : '').toString().replace(controlOrWhitespace, '');
24
- }
25
-
26
- /**
27
- * These are the parse rules for the URL parser, it informs the parser
28
- * about:
29
- *
30
- * 0. The char it Needs to parse, if it's a string it should be done using
31
- * indexOf, RegExp using exec and NaN means set as current value.
32
- * 1. The property we should set when parsing this value.
33
- * 2. Indication if it's backwards or forward parsing, when set as number it's
34
- * the value of extra chars that should be split off.
35
- * 3. Inherit from location if non existing in the parser.
36
- * 4. `toLowerCase` the resulting value.
37
- */
38
- var rules = [
39
- ['#', 'hash'], // Extract from the back.
40
- ['?', 'query'], // Extract from the back.
41
- function sanitize(address, url) { // Sanitize what is left of the address
42
- return isSpecial(url.protocol) ? address.replace(/\\/g, '/') : address;
43
- },
44
- ['/', 'pathname'], // Extract from the back.
45
- ['@', 'auth', 1], // Extract from the front.
46
- [NaN, 'host', undefined, 1, 1], // Set left over value.
47
- [/:(\d*)$/, 'port', undefined, 1], // RegExp the back.
48
- [NaN, 'hostname', undefined, 1, 1] // Set left over.
49
- ];
50
-
51
- /**
52
- * These properties should not be copied or inherited from. This is only needed
53
- * for all non blob URL's as a blob URL does not include a hash, only the
54
- * origin.
55
- *
56
- * @type {Object}
57
- * @private
58
- */
59
- var ignore = { hash: 1, query: 1 };
60
-
61
- /**
62
- * The location object differs when your code is loaded through a normal page,
63
- * Worker or through a worker using a blob. And with the blobble begins the
64
- * trouble as the location object will contain the URL of the blob, not the
65
- * location of the page where our code is loaded in. The actual origin is
66
- * encoded in the `pathname` so we can thankfully generate a good "default"
67
- * location from it so we can generate proper relative URL's again.
68
- *
69
- * @param {Object|String} loc Optional default location object.
70
- * @returns {Object} lolcation object.
71
- * @public
72
- */
73
- function lolcation(loc) {
74
- var globalVar;
75
-
76
- if (typeof window !== 'undefined') globalVar = window;
77
- else if (typeof global !== 'undefined') globalVar = global;
78
- else if (typeof self !== 'undefined') globalVar = self;
79
- else globalVar = {};
80
-
81
- var location = globalVar.location || {};
82
- loc = loc || location;
83
-
84
- var finaldestination = {}
85
- , type = typeof loc
86
- , key;
87
-
88
- if ('blob:' === loc.protocol) {
89
- finaldestination = new Url(unescape(loc.pathname), {});
90
- } else if ('string' === type) {
91
- finaldestination = new Url(loc, {});
92
- for (key in ignore) delete finaldestination[key];
93
- } else if ('object' === type) {
94
- for (key in loc) {
95
- if (key in ignore) continue;
96
- finaldestination[key] = loc[key];
97
- }
98
-
99
- if (finaldestination.slashes === undefined) {
100
- finaldestination.slashes = slashes.test(loc.href);
101
- }
102
- }
103
-
104
- return finaldestination;
105
- }
106
-
107
- /**
108
- * Check whether a protocol scheme is special.
109
- *
110
- * @param {String} The protocol scheme of the URL
111
- * @return {Boolean} `true` if the protocol scheme is special, else `false`
112
- * @private
113
- */
114
- function isSpecial(scheme) {
115
- return (
116
- scheme === 'file:' ||
117
- scheme === 'ftp:' ||
118
- scheme === 'http:' ||
119
- scheme === 'https:' ||
120
- scheme === 'ws:' ||
121
- scheme === 'wss:'
122
- );
123
- }
124
-
125
- /**
126
- * @typedef ProtocolExtract
127
- * @type Object
128
- * @property {String} protocol Protocol matched in the URL, in lowercase.
129
- * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`.
130
- * @property {String} rest Rest of the URL that is not part of the protocol.
131
- */
132
-
133
- /**
134
- * Extract protocol information from a URL with/without double slash ("//").
135
- *
136
- * @param {String} address URL we want to extract from.
137
- * @param {Object} location
138
- * @return {ProtocolExtract} Extracted information.
139
- * @private
140
- */
141
- function extractProtocol(address, location) {
142
- address = trimLeft(address);
143
- address = address.replace(CRHTLF, '');
144
- location = location || {};
145
-
146
- var match = protocolre.exec(address);
147
- var protocol = match[1] ? match[1].toLowerCase() : '';
148
- var forwardSlashes = !!match[2];
149
- var otherSlashes = !!match[3];
150
- var slashesCount = 0;
151
- var rest;
152
-
153
- if (forwardSlashes) {
154
- if (otherSlashes) {
155
- rest = match[2] + match[3] + match[4];
156
- slashesCount = match[2].length + match[3].length;
157
- } else {
158
- rest = match[2] + match[4];
159
- slashesCount = match[2].length;
160
- }
161
- } else {
162
- if (otherSlashes) {
163
- rest = match[3] + match[4];
164
- slashesCount = match[3].length;
165
- } else {
166
- rest = match[4]
167
- }
168
- }
169
-
170
- if (protocol === 'file:') {
171
- if (slashesCount >= 2) {
172
- rest = rest.slice(2);
173
- }
174
- } else if (isSpecial(protocol)) {
175
- rest = match[4];
176
- } else if (protocol) {
177
- if (forwardSlashes) {
178
- rest = rest.slice(2);
179
- }
180
- } else if (slashesCount >= 2 && isSpecial(location.protocol)) {
181
- rest = match[4];
182
- }
183
-
184
- return {
185
- protocol: protocol,
186
- slashes: forwardSlashes || isSpecial(protocol),
187
- slashesCount: slashesCount,
188
- rest: rest
189
- };
190
- }
191
-
192
- /**
193
- * Resolve a relative URL pathname against a base URL pathname.
194
- *
195
- * @param {String} relative Pathname of the relative URL.
196
- * @param {String} base Pathname of the base URL.
197
- * @return {String} Resolved pathname.
198
- * @private
199
- */
200
- function resolve(relative, base) {
201
- if (relative === '') return base;
202
-
203
- var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))
204
- , i = path.length
205
- , last = path[i - 1]
206
- , unshift = false
207
- , up = 0;
208
-
209
- while (i--) {
210
- if (path[i] === '.') {
211
- path.splice(i, 1);
212
- } else if (path[i] === '..') {
213
- path.splice(i, 1);
214
- up++;
215
- } else if (up) {
216
- if (i === 0) unshift = true;
217
- path.splice(i, 1);
218
- up--;
219
- }
220
- }
221
-
222
- if (unshift) path.unshift('');
223
- if (last === '.' || last === '..') path.push('');
224
-
225
- return path.join('/');
226
- }
227
-
228
- /**
229
- * The actual URL instance. Instead of returning an object we've opted-in to
230
- * create an actual constructor as it's much more memory efficient and
231
- * faster and it pleases my OCD.
232
- *
233
- * It is worth noting that we should not use `URL` as class name to prevent
234
- * clashes with the global URL instance that got introduced in browsers.
235
- *
236
- * @constructor
237
- * @param {String} address URL we want to parse.
238
- * @param {Object|String} [location] Location defaults for relative paths.
239
- * @param {Boolean|Function} [parser] Parser for the query string.
240
- * @private
241
- */
242
- function Url(address, location, parser) {
243
- address = trimLeft(address);
244
- address = address.replace(CRHTLF, '');
245
-
246
- if (!(this instanceof Url)) {
247
- return new Url(address, location, parser);
248
- }
249
-
250
- var relative, extracted, parse, instruction, index, key
251
- , instructions = rules.slice()
252
- , type = typeof location
253
- , url = this
254
- , i = 0;
255
-
256
- //
257
- // The following if statements allows this module two have compatibility with
258
- // 2 different API:
259
- //
260
- // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments
261
- // where the boolean indicates that the query string should also be parsed.
262
- //
263
- // 2. The `URL` interface of the browser which accepts a URL, object as
264
- // arguments. The supplied object will be used as default values / fall-back
265
- // for relative paths.
266
- //
267
- if ('object' !== type && 'string' !== type) {
268
- parser = location;
269
- location = null;
270
- }
271
-
272
- if (parser && 'function' !== typeof parser) parser = qs.parse;
273
-
274
- location = lolcation(location);
275
-
276
- //
277
- // Extract protocol information before running the instructions.
278
- //
279
- extracted = extractProtocol(address || '', location);
280
- relative = !extracted.protocol && !extracted.slashes;
281
- url.slashes = extracted.slashes || relative && location.slashes;
282
- url.protocol = extracted.protocol || location.protocol || '';
283
- address = extracted.rest;
284
-
285
- //
286
- // When the authority component is absent the URL starts with a path
287
- // component.
288
- //
289
- if (
290
- extracted.protocol === 'file:' && (
291
- extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||
292
- (!extracted.slashes &&
293
- (extracted.protocol ||
294
- extracted.slashesCount < 2 ||
295
- !isSpecial(url.protocol)))
296
- ) {
297
- instructions[3] = [/(.*)/, 'pathname'];
298
- }
299
-
300
- for (; i < instructions.length; i++) {
301
- instruction = instructions[i];
302
-
303
- if (typeof instruction === 'function') {
304
- address = instruction(address, url);
305
- continue;
306
- }
307
-
308
- parse = instruction[0];
309
- key = instruction[1];
310
-
311
- if (parse !== parse) {
312
- url[key] = address;
313
- } else if ('string' === typeof parse) {
314
- index = parse === '@'
315
- ? address.lastIndexOf(parse)
316
- : address.indexOf(parse);
317
-
318
- if (~index) {
319
- if ('number' === typeof instruction[2]) {
320
- url[key] = address.slice(0, index);
321
- address = address.slice(index + instruction[2]);
322
- } else {
323
- url[key] = address.slice(index);
324
- address = address.slice(0, index);
325
- }
326
- }
327
- } else if ((index = parse.exec(address))) {
328
- url[key] = index[1];
329
- address = address.slice(0, index.index);
330
- }
331
-
332
- url[key] = url[key] || (
333
- relative && instruction[3] ? location[key] || '' : ''
334
- );
335
-
336
- //
337
- // Hostname, host and protocol should be lowercased so they can be used to
338
- // create a proper `origin`.
339
- //
340
- if (instruction[4]) url[key] = url[key].toLowerCase();
341
- }
342
-
343
- //
344
- // Also parse the supplied query string in to an object. If we're supplied
345
- // with a custom parser as function use that instead of the default build-in
346
- // parser.
347
- //
348
- if (parser) url.query = parser(url.query);
349
-
350
- //
351
- // If the URL is relative, resolve the pathname against the base URL.
352
- //
353
- if (
354
- relative
355
- && location.slashes
356
- && url.pathname.charAt(0) !== '/'
357
- && (url.pathname !== '' || location.pathname !== '')
358
- ) {
359
- url.pathname = resolve(url.pathname, location.pathname);
360
- }
361
-
362
- //
363
- // Default to a / for pathname if none exists. This normalizes the URL
364
- // to always have a /
365
- //
366
- if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {
367
- url.pathname = '/' + url.pathname;
368
- }
369
-
370
- //
371
- // We should not add port numbers if they are already the default port number
372
- // for a given protocol. As the host also contains the port number we're going
373
- // override it with the hostname which contains no port number.
374
- //
375
- if (!required(url.port, url.protocol)) {
376
- url.host = url.hostname;
377
- url.port = '';
378
- }
379
-
380
- //
381
- // Parse down the `auth` for the username and password.
382
- //
383
- url.username = url.password = '';
384
-
385
- if (url.auth) {
386
- index = url.auth.indexOf(':');
387
-
388
- if (~index) {
389
- url.username = url.auth.slice(0, index);
390
- url.username = encodeURIComponent(decodeURIComponent(url.username));
391
-
392
- url.password = url.auth.slice(index + 1);
393
- url.password = encodeURIComponent(decodeURIComponent(url.password))
394
- } else {
395
- url.username = encodeURIComponent(decodeURIComponent(url.auth));
396
- }
397
-
398
- url.auth = url.password ? url.username +':'+ url.password : url.username;
399
- }
400
-
401
- url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host
402
- ? url.protocol +'//'+ url.host
403
- : 'null';
404
-
405
- //
406
- // The href is just the compiled result.
407
- //
408
- url.href = url.toString();
409
- }
410
-
411
- /**
412
- * This is convenience method for changing properties in the URL instance to
413
- * insure that they all propagate correctly.
414
- *
415
- * @param {String} part Property we need to adjust.
416
- * @param {Mixed} value The newly assigned value.
417
- * @param {Boolean|Function} fn When setting the query, it will be the function
418
- * used to parse the query.
419
- * When setting the protocol, double slash will be
420
- * removed from the final url if it is true.
421
- * @returns {URL} URL instance for chaining.
422
- * @public
423
- */
424
- function set(part, value, fn) {
425
- var url = this;
426
-
427
- switch (part) {
428
- case 'query':
429
- if ('string' === typeof value && value.length) {
430
- value = (fn || qs.parse)(value);
431
- }
432
-
433
- url[part] = value;
434
- break;
435
-
436
- case 'port':
437
- url[part] = value;
438
-
439
- if (!required(value, url.protocol)) {
440
- url.host = url.hostname;
441
- url[part] = '';
442
- } else if (value) {
443
- url.host = url.hostname +':'+ value;
444
- }
445
-
446
- break;
447
-
448
- case 'hostname':
449
- url[part] = value;
450
-
451
- if (url.port) value += ':'+ url.port;
452
- url.host = value;
453
- break;
454
-
455
- case 'host':
456
- url[part] = value;
457
-
458
- if (port.test(value)) {
459
- value = value.split(':');
460
- url.port = value.pop();
461
- url.hostname = value.join(':');
462
- } else {
463
- url.hostname = value;
464
- url.port = '';
465
- }
466
-
467
- break;
468
-
469
- case 'protocol':
470
- url.protocol = value.toLowerCase();
471
- url.slashes = !fn;
472
- break;
473
-
474
- case 'pathname':
475
- case 'hash':
476
- if (value) {
477
- var char = part === 'pathname' ? '/' : '#';
478
- url[part] = value.charAt(0) !== char ? char + value : value;
479
- } else {
480
- url[part] = value;
481
- }
482
- break;
483
-
484
- case 'username':
485
- case 'password':
486
- url[part] = encodeURIComponent(value);
487
- break;
488
-
489
- case 'auth':
490
- var index = value.indexOf(':');
491
-
492
- if (~index) {
493
- url.username = value.slice(0, index);
494
- url.username = encodeURIComponent(decodeURIComponent(url.username));
495
-
496
- url.password = value.slice(index + 1);
497
- url.password = encodeURIComponent(decodeURIComponent(url.password));
498
- } else {
499
- url.username = encodeURIComponent(decodeURIComponent(value));
500
- }
501
- }
502
-
503
- for (var i = 0; i < rules.length; i++) {
504
- var ins = rules[i];
505
-
506
- if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
507
- }
508
-
509
- url.auth = url.password ? url.username +':'+ url.password : url.username;
510
-
511
- url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host
512
- ? url.protocol +'//'+ url.host
513
- : 'null';
514
-
515
- url.href = url.toString();
516
-
517
- return url;
518
- }
519
-
520
- /**
521
- * Transform the properties back in to a valid and full URL string.
522
- *
523
- * @param {Function} stringify Optional query stringify function.
524
- * @returns {String} Compiled version of the URL.
525
- * @public
526
- */
527
- function toString(stringify) {
528
- if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;
529
-
530
- var query
531
- , url = this
532
- , host = url.host
533
- , protocol = url.protocol;
534
-
535
- if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';
536
-
537
- var result =
538
- protocol +
539
- ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');
540
-
541
- if (url.username) {
542
- result += url.username;
543
- if (url.password) result += ':'+ url.password;
544
- result += '@';
545
- } else if (url.password) {
546
- result += ':'+ url.password;
547
- result += '@';
548
- } else if (
549
- url.protocol !== 'file:' &&
550
- isSpecial(url.protocol) &&
551
- !host &&
552
- url.pathname !== '/'
553
- ) {
554
- //
555
- // Add back the empty userinfo, otherwise the original invalid URL
556
- // might be transformed into a valid one with `url.pathname` as host.
557
- //
558
- result += '@';
559
- }
560
-
561
- //
562
- // Trailing colon is removed from `url.host` when it is parsed. If it still
563
- // ends with a colon, then add back the trailing colon that was removed. This
564
- // prevents an invalid URL from being transformed into a valid one.
565
- //
566
- if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {
567
- host += ':';
568
- }
569
-
570
- result += host + url.pathname;
571
-
572
- query = 'object' === typeof url.query ? stringify(url.query) : url.query;
573
- if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;
574
-
575
- if (url.hash) result += url.hash;
576
-
577
- return result;
578
- }
579
-
580
- Url.prototype = { set: set, toString: toString };
581
-
582
- //
583
- // Expose the URL parser and some additional properties that might be useful for
584
- // others or testing.
585
- //
586
- Url.extractProtocol = extractProtocol;
587
- Url.location = lolcation;
588
- Url.trimLeft = trimLeft;
589
- Url.qs = qs;
590
-
591
- module.exports = Url;
592
-
593
- }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
594
- },{"querystringify":2,"requires-port":3}],2:[function(require,module,exports){
595
- 'use strict';
596
-
597
- var has = Object.prototype.hasOwnProperty
598
- , undef;
599
-
600
- /**
601
- * Decode a URI encoded string.
602
- *
603
- * @param {String} input The URI encoded string.
604
- * @returns {String|Null} The decoded string.
605
- * @api private
606
- */
607
- function decode(input) {
608
- try {
609
- return decodeURIComponent(input.replace(/\+/g, ' '));
610
- } catch (e) {
611
- return null;
612
- }
613
- }
614
-
615
- /**
616
- * Attempts to encode a given input.
617
- *
618
- * @param {String} input The string that needs to be encoded.
619
- * @returns {String|Null} The encoded string.
620
- * @api private
621
- */
622
- function encode(input) {
623
- try {
624
- return encodeURIComponent(input);
625
- } catch (e) {
626
- return null;
627
- }
628
- }
629
-
630
- /**
631
- * Simple query string parser.
632
- *
633
- * @param {String} query The query string that needs to be parsed.
634
- * @returns {Object}
635
- * @api public
636
- */
637
- function querystring(query) {
638
- var parser = /([^=?#&]+)=?([^&]*)/g
639
- , result = {}
640
- , part;
641
-
642
- while (part = parser.exec(query)) {
643
- var key = decode(part[1])
644
- , value = decode(part[2]);
645
-
646
- //
647
- // Prevent overriding of existing properties. This ensures that build-in
648
- // methods like `toString` or __proto__ are not overriden by malicious
649
- // querystrings.
650
- //
651
- // In the case if failed decoding, we want to omit the key/value pairs
652
- // from the result.
653
- //
654
- if (key === null || value === null || key in result) continue;
655
- result[key] = value;
656
- }
657
-
658
- return result;
659
- }
660
-
661
- /**
662
- * Transform a query string to an object.
663
- *
664
- * @param {Object} obj Object that should be transformed.
665
- * @param {String} prefix Optional prefix.
666
- * @returns {String}
667
- * @api public
668
- */
669
- function querystringify(obj, prefix) {
670
- prefix = prefix || '';
671
-
672
- var pairs = []
673
- , value
674
- , key;
675
-
676
- //
677
- // Optionally prefix with a '?' if needed
678
- //
679
- if ('string' !== typeof prefix) prefix = '?';
680
-
681
- for (key in obj) {
682
- if (has.call(obj, key)) {
683
- value = obj[key];
684
-
685
- //
686
- // Edge cases where we actually want to encode the value to an empty
687
- // string instead of the stringified value.
688
- //
689
- if (!value && (value === null || value === undef || isNaN(value))) {
690
- value = '';
691
- }
692
-
693
- key = encode(key);
694
- value = encode(value);
695
-
696
- //
697
- // If we failed to encode the strings, we should bail out as we don't
698
- // want to add invalid strings to the query.
699
- //
700
- if (key === null || value === null) continue;
701
- pairs.push(key +'='+ value);
702
- }
703
- }
704
-
705
- return pairs.length ? prefix + pairs.join('&') : '';
706
- }
707
-
708
- //
709
- // Expose the module.
710
- //
711
- exports.stringify = querystringify;
712
- exports.parse = querystring;
713
-
714
- },{}],3:[function(require,module,exports){
715
- 'use strict';
716
-
717
- /**
718
- * Check if we're required to add a port number.
719
- *
720
- * @see https://url.spec.whatwg.org/#default-port
721
- * @param {Number|String} port Port number we need to check
722
- * @param {String} protocol Protocol we need to check against.
723
- * @returns {Boolean} Is it a default port for the given protocol
724
- * @api private
725
- */
726
- module.exports = function required(port, protocol) {
727
- protocol = protocol.split(':')[0];
728
- port = +port;
729
-
730
- if (!port) return false;
731
-
732
- switch (protocol) {
733
- case 'http':
734
- case 'ws':
735
- return port !== 80;
736
-
737
- case 'https':
738
- case 'wss':
739
- return port !== 443;
740
-
741
- case 'ftp':
742
- return port !== 21;
743
-
744
- case 'gopher':
745
- return port !== 70;
746
-
747
- case 'file':
748
- return false;
749
- }
750
-
751
- return port !== 0;
752
- };
753
-
754
- },{}]},{},[1])(1)
755
- });