zmdms-utils 0.0.80 → 0.0.81

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 (165) hide show
  1. package/declarations.d.ts +6 -0
  2. package/dist/es/_virtual/FastBufferList.js +7 -0
  3. package/dist/es/_virtual/_commonjs-dynamic-modules.js +5 -0
  4. package/dist/es/_virtual/browser.js +7 -0
  5. package/dist/es/_virtual/browser2.js +7 -0
  6. package/dist/es/_virtual/debug.js +7 -0
  7. package/dist/es/_virtual/event.js +7 -0
  8. package/dist/es/_virtual/http-parser.js +3 -0
  9. package/dist/es/_virtual/iframe.js +7 -0
  10. package/dist/es/_virtual/index.js +7 -0
  11. package/dist/es/_virtual/index2.js +7 -0
  12. package/dist/es/_virtual/index3.js +7 -0
  13. package/dist/es/_virtual/index4.js +7 -0
  14. package/dist/es/_virtual/index5.js +7 -0
  15. package/dist/es/_virtual/index6.js +7 -0
  16. package/dist/es/_virtual/index7.js +3 -0
  17. package/dist/es/_virtual/index8.js +7 -0
  18. package/dist/es/_virtual/index9.js +7 -0
  19. package/dist/es/_virtual/inherits.js +7 -0
  20. package/dist/es/_virtual/inherits_browser.js +7 -0
  21. package/dist/es/_virtual/json3.js +7 -0
  22. package/dist/es/_virtual/node.js +7 -0
  23. package/dist/es/_virtual/node2.js +7 -0
  24. package/dist/es/_virtual/stomp-node.js +3 -0
  25. package/dist/es/_virtual/stomp.js +3 -0
  26. package/dist/es/_virtual/streams.js +3 -0
  27. package/dist/es/_virtual/utils.js +3 -0
  28. package/dist/es/constants.d.ts +5 -1
  29. package/dist/es/constants.js +5 -1
  30. package/dist/es/node_modules/bufferutil/fallback.js +43 -0
  31. package/dist/es/node_modules/bufferutil/index.js +21 -0
  32. package/dist/es/node_modules/debug/src/browser.js +192 -0
  33. package/dist/es/node_modules/debug/src/common.js +259 -0
  34. package/dist/es/node_modules/debug/src/index.js +25 -0
  35. package/dist/es/node_modules/debug/src/node.js +192 -0
  36. package/dist/es/node_modules/eventsource/lib/eventsource.js +493 -0
  37. package/dist/es/node_modules/faye-websocket/lib/faye/eventsource.js +150 -0
  38. package/dist/es/node_modules/faye-websocket/lib/faye/websocket/api/event.js +31 -0
  39. package/dist/es/node_modules/faye-websocket/lib/faye/websocket/api/event_target.js +41 -0
  40. package/dist/es/node_modules/faye-websocket/lib/faye/websocket/api.js +205 -0
  41. package/dist/es/node_modules/faye-websocket/lib/faye/websocket/client.js +107 -0
  42. package/dist/es/node_modules/faye-websocket/lib/faye/websocket.js +47 -0
  43. package/dist/es/node_modules/has-flag/index.js +17 -0
  44. package/dist/es/node_modules/http-parser-js/http-parser.js +471 -0
  45. package/dist/es/node_modules/inherits/inherits.js +14 -0
  46. package/dist/es/node_modules/inherits/inherits_browser.js +38 -0
  47. package/dist/es/node_modules/is-typedarray/index.js +51 -0
  48. package/dist/es/node_modules/json3/lib/json3.js +937 -0
  49. package/dist/es/node_modules/ms/index.js +172 -0
  50. package/dist/es/node_modules/node-gyp-build/index.js +21 -0
  51. package/dist/es/node_modules/node-gyp-build/node-gyp-build.js +222 -0
  52. package/dist/es/node_modules/querystringify/index.js +120 -0
  53. package/dist/es/node_modules/requires-port/index.js +38 -0
  54. package/dist/es/node_modules/safe-buffer/index.js +71 -0
  55. package/dist/es/node_modules/supports-color/index.js +143 -0
  56. package/dist/es/node_modules/typedarray-to-buffer/index.js +37 -0
  57. package/dist/es/node_modules/url-parse/index.js +594 -0
  58. package/dist/es/node_modules/utf-8-validate/fallback.js +71 -0
  59. package/dist/es/node_modules/utf-8-validate/index.js +21 -0
  60. package/dist/es/node_modules/websocket/index.js +15 -0
  61. package/dist/es/node_modules/websocket/lib/Deprecation.js +42 -0
  62. package/dist/es/node_modules/websocket/lib/W3CWebSocket.js +268 -0
  63. package/dist/es/node_modules/websocket/lib/WebSocketClient.js +380 -0
  64. package/dist/es/node_modules/websocket/lib/WebSocketConnection.js +914 -0
  65. package/dist/es/node_modules/websocket/lib/WebSocketFrame.js +293 -0
  66. package/dist/es/node_modules/websocket/lib/WebSocketRequest.js +543 -0
  67. package/dist/es/node_modules/websocket/lib/WebSocketRouter.js +172 -0
  68. package/dist/es/node_modules/websocket/lib/WebSocketRouterRequest.js +67 -0
  69. package/dist/es/node_modules/websocket/lib/WebSocketServer.js +272 -0
  70. package/dist/es/node_modules/websocket/lib/utils.js +80 -0
  71. package/dist/es/node_modules/websocket/lib/version.js +13 -0
  72. package/dist/es/node_modules/websocket/lib/websocket.js +31 -0
  73. package/dist/es/node_modules/websocket/node_modules/debug/src/browser.js +199 -0
  74. package/dist/es/node_modules/websocket/node_modules/debug/src/debug.js +215 -0
  75. package/dist/es/node_modules/websocket/node_modules/debug/src/index.js +25 -0
  76. package/dist/es/node_modules/websocket/node_modules/debug/src/node.js +266 -0
  77. package/dist/es/node_modules/websocket/node_modules/ms/index.js +162 -0
  78. package/dist/es/node_modules/websocket/package.json.js +77 -0
  79. package/dist/es/node_modules/websocket/vendor/FastBufferList.js +205 -0
  80. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/base.js +202 -0
  81. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/client.js +152 -0
  82. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/draft75.js +128 -0
  83. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/draft76.js +124 -0
  84. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/headers.js +44 -0
  85. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/hybi/frame.js +21 -0
  86. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/hybi/message.js +37 -0
  87. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/hybi.js +492 -0
  88. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/proxy.js +108 -0
  89. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/server.js +119 -0
  90. package/dist/es/node_modules/websocket-driver/lib/websocket/driver/stream_reader.js +72 -0
  91. package/dist/es/node_modules/websocket-driver/lib/websocket/driver.js +47 -0
  92. package/dist/es/node_modules/websocket-driver/lib/websocket/http_parser.js +140 -0
  93. package/dist/es/node_modules/websocket-driver/lib/websocket/streams.js +150 -0
  94. package/dist/es/node_modules/websocket-extensions/lib/parser.js +103 -0
  95. package/dist/es/node_modules/websocket-extensions/lib/pipeline/cell.js +56 -0
  96. package/dist/es/node_modules/websocket-extensions/lib/pipeline/functor.js +74 -0
  97. package/dist/es/node_modules/websocket-extensions/lib/pipeline/index.js +50 -0
  98. package/dist/es/node_modules/websocket-extensions/lib/pipeline/pledge.js +39 -0
  99. package/dist/es/node_modules/websocket-extensions/lib/pipeline/ring_buffer.js +66 -0
  100. package/dist/es/node_modules/websocket-extensions/lib/websocket_extensions.js +165 -0
  101. package/dist/es/node_modules/yaeti/index.js +17 -0
  102. package/dist/es/node_modules/yaeti/lib/Event.js +24 -0
  103. package/dist/es/node_modules/yaeti/lib/EventTarget.js +130 -0
  104. package/dist/es/node_modules/zt-sockjs-client/lib/entry.js +14 -0
  105. package/dist/es/node_modules/zt-sockjs-client/lib/event/close.js +21 -0
  106. package/dist/es/node_modules/zt-sockjs-client/lib/event/event.js +22 -0
  107. package/dist/es/node_modules/zt-sockjs-client/lib/event/eventtarget.js +62 -0
  108. package/dist/es/node_modules/zt-sockjs-client/lib/event/trans-message.js +19 -0
  109. package/dist/es/node_modules/zt-sockjs-client/lib/facade.js +40 -0
  110. package/dist/es/node_modules/zt-sockjs-client/lib/iframe-bootstrap.js +122 -0
  111. package/dist/es/node_modules/zt-sockjs-client/lib/info-ajax.js +57 -0
  112. package/dist/es/node_modules/zt-sockjs-client/lib/info-iframe-receiver.js +50 -0
  113. package/dist/es/node_modules/zt-sockjs-client/lib/info-iframe.js +81 -0
  114. package/dist/es/node_modules/zt-sockjs-client/lib/info-receiver.js +101 -0
  115. package/dist/es/node_modules/zt-sockjs-client/lib/location.js +12 -0
  116. package/dist/es/node_modules/zt-sockjs-client/lib/main.js +413 -0
  117. package/dist/es/node_modules/zt-sockjs-client/lib/shims.js +449 -0
  118. package/dist/es/node_modules/zt-sockjs-client/lib/transport/driver/websocket.js +5 -0
  119. package/dist/es/node_modules/zt-sockjs-client/lib/transport/driver/xhr.js +80 -0
  120. package/dist/es/node_modules/zt-sockjs-client/lib/transport/eventsource.js +34 -0
  121. package/dist/es/node_modules/zt-sockjs-client/lib/transport/htmlfile.js +31 -0
  122. package/dist/es/node_modules/zt-sockjs-client/lib/transport/iframe.js +154 -0
  123. package/dist/es/node_modules/zt-sockjs-client/lib/transport/jsonp-polling.js +41 -0
  124. package/dist/es/node_modules/zt-sockjs-client/lib/transport/lib/ajax-based.js +55 -0
  125. package/dist/es/node_modules/zt-sockjs-client/lib/transport/lib/buffered-sender.js +92 -0
  126. package/dist/es/node_modules/zt-sockjs-client/lib/transport/lib/iframe-wrap.js +39 -0
  127. package/dist/es/node_modules/zt-sockjs-client/lib/transport/lib/polling.js +65 -0
  128. package/dist/es/node_modules/zt-sockjs-client/lib/transport/lib/sender-receiver.js +52 -0
  129. package/dist/es/node_modules/zt-sockjs-client/lib/transport/receiver/eventsource.js +69 -0
  130. package/dist/es/node_modules/zt-sockjs-client/lib/transport/receiver/htmlfile.js +96 -0
  131. package/dist/es/node_modules/zt-sockjs-client/lib/transport/receiver/jsonp.js +193 -0
  132. package/dist/es/node_modules/zt-sockjs-client/lib/transport/receiver/xhr.js +75 -0
  133. package/dist/es/node_modules/zt-sockjs-client/lib/transport/sender/jsonp.js +104 -0
  134. package/dist/es/node_modules/zt-sockjs-client/lib/transport/sender/xdr.js +113 -0
  135. package/dist/es/node_modules/zt-sockjs-client/lib/transport/sender/xhr-cors.js +19 -0
  136. package/dist/es/node_modules/zt-sockjs-client/lib/transport/sender/xhr-fake.js +28 -0
  137. package/dist/es/node_modules/zt-sockjs-client/lib/transport/sender/xhr-local.js +21 -0
  138. package/dist/es/node_modules/zt-sockjs-client/lib/transport/websocket.js +108 -0
  139. package/dist/es/node_modules/zt-sockjs-client/lib/transport/xdr-polling.js +30 -0
  140. package/dist/es/node_modules/zt-sockjs-client/lib/transport/xdr-streaming.js +38 -0
  141. package/dist/es/node_modules/zt-sockjs-client/lib/transport/xhr-polling.js +40 -0
  142. package/dist/es/node_modules/zt-sockjs-client/lib/transport/xhr-streaming.js +50 -0
  143. package/dist/es/node_modules/zt-sockjs-client/lib/transport-list.js +28 -0
  144. package/dist/es/node_modules/zt-sockjs-client/lib/utils/browser.js +29 -0
  145. package/dist/es/node_modules/zt-sockjs-client/lib/utils/escape.js +53 -0
  146. package/dist/es/node_modules/zt-sockjs-client/lib/utils/event.js +78 -0
  147. package/dist/es/node_modules/zt-sockjs-client/lib/utils/iframe.js +205 -0
  148. package/dist/es/node_modules/zt-sockjs-client/lib/utils/log.js +20 -0
  149. package/dist/es/node_modules/zt-sockjs-client/lib/utils/object.js +24 -0
  150. package/dist/es/node_modules/zt-sockjs-client/lib/utils/random.js +30 -0
  151. package/dist/es/node_modules/zt-sockjs-client/lib/utils/transport.js +52 -0
  152. package/dist/es/node_modules/zt-sockjs-client/lib/utils/url.js +54 -0
  153. package/dist/es/node_modules/zt-sockjs-client/lib/version.js +11 -0
  154. package/dist/es/node_modules/zt-stompjs/index.js +23 -0
  155. package/dist/es/node_modules/zt-stompjs/lib/stomp-node.js +117 -0
  156. package/dist/es/node_modules/zt-stompjs/lib/stomp.js +536 -0
  157. package/dist/es/stompClient.d.ts +55 -0
  158. package/dist/es/stompClient.js +379 -0
  159. package/dist/index.d.ts +2 -1
  160. package/dist/index.js +2 -1
  161. package/package.json +6 -2
  162. package/src/constants.ts +5 -0
  163. package/src/index.ts +4 -0
  164. package/src/stompClient.ts +449 -0
  165. package/tsconfig.json +1 -1
@@ -0,0 +1,594 @@
1
+ import { commonjsGlobal } from '../../_virtual/_commonjsHelpers.js';
2
+ import requiresPort from '../requires-port/index.js';
3
+ import '../querystringify/index.js';
4
+ import { __exports as querystringify } from '../../_virtual/index7.js';
5
+
6
+ var required = requiresPort
7
+ , qs = querystringify
8
+ , controlOrWhitespace = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/
9
+ , CRHTLF = /[\n\r\t]/g
10
+ , slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//
11
+ , port = /:\d+$/
12
+ , protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i
13
+ , windowsDriveLetter = /^[a-zA-Z]:/;
14
+
15
+ /**
16
+ * Remove control characters and whitespace from the beginning of a string.
17
+ *
18
+ * @param {Object|String} str String to trim.
19
+ * @returns {String} A new string representing `str` stripped of control
20
+ * characters and whitespace from its beginning.
21
+ * @public
22
+ */
23
+ function trimLeft(str) {
24
+ return (str ? str : '').toString().replace(controlOrWhitespace, '');
25
+ }
26
+
27
+ /**
28
+ * These are the parse rules for the URL parser, it informs the parser
29
+ * about:
30
+ *
31
+ * 0. The char it Needs to parse, if it's a string it should be done using
32
+ * indexOf, RegExp using exec and NaN means set as current value.
33
+ * 1. The property we should set when parsing this value.
34
+ * 2. Indication if it's backwards or forward parsing, when set as number it's
35
+ * the value of extra chars that should be split off.
36
+ * 3. Inherit from location if non existing in the parser.
37
+ * 4. `toLowerCase` the resulting value.
38
+ */
39
+ var rules = [
40
+ ['#', 'hash'], // Extract from the back.
41
+ ['?', 'query'], // Extract from the back.
42
+ function sanitize(address, url) { // Sanitize what is left of the address
43
+ return isSpecial(url.protocol) ? address.replace(/\\/g, '/') : address;
44
+ },
45
+ ['/', 'pathname'], // Extract from the back.
46
+ ['@', 'auth', 1], // Extract from the front.
47
+ [NaN, 'host', undefined, 1, 1], // Set left over value.
48
+ [/:(\d*)$/, 'port', undefined, 1], // RegExp the back.
49
+ [NaN, 'hostname', undefined, 1, 1] // Set left over.
50
+ ];
51
+
52
+ /**
53
+ * These properties should not be copied or inherited from. This is only needed
54
+ * for all non blob URL's as a blob URL does not include a hash, only the
55
+ * origin.
56
+ *
57
+ * @type {Object}
58
+ * @private
59
+ */
60
+ var ignore = { hash: 1, query: 1 };
61
+
62
+ /**
63
+ * The location object differs when your code is loaded through a normal page,
64
+ * Worker or through a worker using a blob. And with the blobble begins the
65
+ * trouble as the location object will contain the URL of the blob, not the
66
+ * location of the page where our code is loaded in. The actual origin is
67
+ * encoded in the `pathname` so we can thankfully generate a good "default"
68
+ * location from it so we can generate proper relative URL's again.
69
+ *
70
+ * @param {Object|String} loc Optional default location object.
71
+ * @returns {Object} lolcation object.
72
+ * @public
73
+ */
74
+ function lolcation(loc) {
75
+ var globalVar;
76
+
77
+ if (typeof window !== 'undefined') globalVar = window;
78
+ else if (typeof commonjsGlobal !== 'undefined') globalVar = commonjsGlobal;
79
+ else if (typeof self !== 'undefined') globalVar = self;
80
+ else globalVar = {};
81
+
82
+ var location = globalVar.location || {};
83
+ loc = loc || location;
84
+
85
+ var finaldestination = {}
86
+ , type = typeof loc
87
+ , key;
88
+
89
+ if ('blob:' === loc.protocol) {
90
+ finaldestination = new Url(unescape(loc.pathname), {});
91
+ } else if ('string' === type) {
92
+ finaldestination = new Url(loc, {});
93
+ for (key in ignore) delete finaldestination[key];
94
+ } else if ('object' === type) {
95
+ for (key in loc) {
96
+ if (key in ignore) continue;
97
+ finaldestination[key] = loc[key];
98
+ }
99
+
100
+ if (finaldestination.slashes === undefined) {
101
+ finaldestination.slashes = slashes.test(loc.href);
102
+ }
103
+ }
104
+
105
+ return finaldestination;
106
+ }
107
+
108
+ /**
109
+ * Check whether a protocol scheme is special.
110
+ *
111
+ * @param {String} The protocol scheme of the URL
112
+ * @return {Boolean} `true` if the protocol scheme is special, else `false`
113
+ * @private
114
+ */
115
+ function isSpecial(scheme) {
116
+ return (
117
+ scheme === 'file:' ||
118
+ scheme === 'ftp:' ||
119
+ scheme === 'http:' ||
120
+ scheme === 'https:' ||
121
+ scheme === 'ws:' ||
122
+ scheme === 'wss:'
123
+ );
124
+ }
125
+
126
+ /**
127
+ * @typedef ProtocolExtract
128
+ * @type Object
129
+ * @property {String} protocol Protocol matched in the URL, in lowercase.
130
+ * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`.
131
+ * @property {String} rest Rest of the URL that is not part of the protocol.
132
+ */
133
+
134
+ /**
135
+ * Extract protocol information from a URL with/without double slash ("//").
136
+ *
137
+ * @param {String} address URL we want to extract from.
138
+ * @param {Object} location
139
+ * @return {ProtocolExtract} Extracted information.
140
+ * @private
141
+ */
142
+ function extractProtocol(address, location) {
143
+ address = trimLeft(address);
144
+ address = address.replace(CRHTLF, '');
145
+ location = location || {};
146
+
147
+ var match = protocolre.exec(address);
148
+ var protocol = match[1] ? match[1].toLowerCase() : '';
149
+ var forwardSlashes = !!match[2];
150
+ var otherSlashes = !!match[3];
151
+ var slashesCount = 0;
152
+ var rest;
153
+
154
+ if (forwardSlashes) {
155
+ if (otherSlashes) {
156
+ rest = match[2] + match[3] + match[4];
157
+ slashesCount = match[2].length + match[3].length;
158
+ } else {
159
+ rest = match[2] + match[4];
160
+ slashesCount = match[2].length;
161
+ }
162
+ } else {
163
+ if (otherSlashes) {
164
+ rest = match[3] + match[4];
165
+ slashesCount = match[3].length;
166
+ } else {
167
+ rest = match[4];
168
+ }
169
+ }
170
+
171
+ if (protocol === 'file:') {
172
+ if (slashesCount >= 2) {
173
+ rest = rest.slice(2);
174
+ }
175
+ } else if (isSpecial(protocol)) {
176
+ rest = match[4];
177
+ } else if (protocol) {
178
+ if (forwardSlashes) {
179
+ rest = rest.slice(2);
180
+ }
181
+ } else if (slashesCount >= 2 && isSpecial(location.protocol)) {
182
+ rest = match[4];
183
+ }
184
+
185
+ return {
186
+ protocol: protocol,
187
+ slashes: forwardSlashes || isSpecial(protocol),
188
+ slashesCount: slashesCount,
189
+ rest: rest
190
+ };
191
+ }
192
+
193
+ /**
194
+ * Resolve a relative URL pathname against a base URL pathname.
195
+ *
196
+ * @param {String} relative Pathname of the relative URL.
197
+ * @param {String} base Pathname of the base URL.
198
+ * @return {String} Resolved pathname.
199
+ * @private
200
+ */
201
+ function resolve(relative, base) {
202
+ if (relative === '') return base;
203
+
204
+ var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/'))
205
+ , i = path.length
206
+ , last = path[i - 1]
207
+ , unshift = false
208
+ , up = 0;
209
+
210
+ while (i--) {
211
+ if (path[i] === '.') {
212
+ path.splice(i, 1);
213
+ } else if (path[i] === '..') {
214
+ path.splice(i, 1);
215
+ up++;
216
+ } else if (up) {
217
+ if (i === 0) unshift = true;
218
+ path.splice(i, 1);
219
+ up--;
220
+ }
221
+ }
222
+
223
+ if (unshift) path.unshift('');
224
+ if (last === '.' || last === '..') path.push('');
225
+
226
+ return path.join('/');
227
+ }
228
+
229
+ /**
230
+ * The actual URL instance. Instead of returning an object we've opted-in to
231
+ * create an actual constructor as it's much more memory efficient and
232
+ * faster and it pleases my OCD.
233
+ *
234
+ * It is worth noting that we should not use `URL` as class name to prevent
235
+ * clashes with the global URL instance that got introduced in browsers.
236
+ *
237
+ * @constructor
238
+ * @param {String} address URL we want to parse.
239
+ * @param {Object|String} [location] Location defaults for relative paths.
240
+ * @param {Boolean|Function} [parser] Parser for the query string.
241
+ * @private
242
+ */
243
+ function Url(address, location, parser) {
244
+ address = trimLeft(address);
245
+ address = address.replace(CRHTLF, '');
246
+
247
+ if (!(this instanceof Url)) {
248
+ return new Url(address, location, parser);
249
+ }
250
+
251
+ var relative, extracted, parse, instruction, index, key
252
+ , instructions = rules.slice()
253
+ , type = typeof location
254
+ , url = this
255
+ , i = 0;
256
+
257
+ //
258
+ // The following if statements allows this module two have compatibility with
259
+ // 2 different API:
260
+ //
261
+ // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments
262
+ // where the boolean indicates that the query string should also be parsed.
263
+ //
264
+ // 2. The `URL` interface of the browser which accepts a URL, object as
265
+ // arguments. The supplied object will be used as default values / fall-back
266
+ // for relative paths.
267
+ //
268
+ if ('object' !== type && 'string' !== type) {
269
+ parser = location;
270
+ location = null;
271
+ }
272
+
273
+ if (parser && 'function' !== typeof parser) parser = qs.parse;
274
+
275
+ location = lolcation(location);
276
+
277
+ //
278
+ // Extract protocol information before running the instructions.
279
+ //
280
+ extracted = extractProtocol(address || '', location);
281
+ relative = !extracted.protocol && !extracted.slashes;
282
+ url.slashes = extracted.slashes || relative && location.slashes;
283
+ url.protocol = extracted.protocol || location.protocol || '';
284
+ address = extracted.rest;
285
+
286
+ //
287
+ // When the authority component is absent the URL starts with a path
288
+ // component.
289
+ //
290
+ if (
291
+ extracted.protocol === 'file:' && (
292
+ extracted.slashesCount !== 2 || windowsDriveLetter.test(address)) ||
293
+ (!extracted.slashes &&
294
+ (extracted.protocol ||
295
+ extracted.slashesCount < 2 ||
296
+ !isSpecial(url.protocol)))
297
+ ) {
298
+ instructions[3] = [/(.*)/, 'pathname'];
299
+ }
300
+
301
+ for (; i < instructions.length; i++) {
302
+ instruction = instructions[i];
303
+
304
+ if (typeof instruction === 'function') {
305
+ address = instruction(address, url);
306
+ continue;
307
+ }
308
+
309
+ parse = instruction[0];
310
+ key = instruction[1];
311
+
312
+ if (parse !== parse) {
313
+ url[key] = address;
314
+ } else if ('string' === typeof parse) {
315
+ index = parse === '@'
316
+ ? address.lastIndexOf(parse)
317
+ : address.indexOf(parse);
318
+
319
+ if (~index) {
320
+ if ('number' === typeof instruction[2]) {
321
+ url[key] = address.slice(0, index);
322
+ address = address.slice(index + instruction[2]);
323
+ } else {
324
+ url[key] = address.slice(index);
325
+ address = address.slice(0, index);
326
+ }
327
+ }
328
+ } else if ((index = parse.exec(address))) {
329
+ url[key] = index[1];
330
+ address = address.slice(0, index.index);
331
+ }
332
+
333
+ url[key] = url[key] || (
334
+ relative && instruction[3] ? location[key] || '' : ''
335
+ );
336
+
337
+ //
338
+ // Hostname, host and protocol should be lowercased so they can be used to
339
+ // create a proper `origin`.
340
+ //
341
+ if (instruction[4]) url[key] = url[key].toLowerCase();
342
+ }
343
+
344
+ //
345
+ // Also parse the supplied query string in to an object. If we're supplied
346
+ // with a custom parser as function use that instead of the default build-in
347
+ // parser.
348
+ //
349
+ if (parser) url.query = parser(url.query);
350
+
351
+ //
352
+ // If the URL is relative, resolve the pathname against the base URL.
353
+ //
354
+ if (
355
+ relative
356
+ && location.slashes
357
+ && url.pathname.charAt(0) !== '/'
358
+ && (url.pathname !== '' || location.pathname !== '')
359
+ ) {
360
+ url.pathname = resolve(url.pathname, location.pathname);
361
+ }
362
+
363
+ //
364
+ // Default to a / for pathname if none exists. This normalizes the URL
365
+ // to always have a /
366
+ //
367
+ if (url.pathname.charAt(0) !== '/' && isSpecial(url.protocol)) {
368
+ url.pathname = '/' + url.pathname;
369
+ }
370
+
371
+ //
372
+ // We should not add port numbers if they are already the default port number
373
+ // for a given protocol. As the host also contains the port number we're going
374
+ // override it with the hostname which contains no port number.
375
+ //
376
+ if (!required(url.port, url.protocol)) {
377
+ url.host = url.hostname;
378
+ url.port = '';
379
+ }
380
+
381
+ //
382
+ // Parse down the `auth` for the username and password.
383
+ //
384
+ url.username = url.password = '';
385
+
386
+ if (url.auth) {
387
+ index = url.auth.indexOf(':');
388
+
389
+ if (~index) {
390
+ url.username = url.auth.slice(0, index);
391
+ url.username = encodeURIComponent(decodeURIComponent(url.username));
392
+
393
+ url.password = url.auth.slice(index + 1);
394
+ url.password = encodeURIComponent(decodeURIComponent(url.password));
395
+ } else {
396
+ url.username = encodeURIComponent(decodeURIComponent(url.auth));
397
+ }
398
+
399
+ url.auth = url.password ? url.username +':'+ url.password : url.username;
400
+ }
401
+
402
+ url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host
403
+ ? url.protocol +'//'+ url.host
404
+ : 'null';
405
+
406
+ //
407
+ // The href is just the compiled result.
408
+ //
409
+ url.href = url.toString();
410
+ }
411
+
412
+ /**
413
+ * This is convenience method for changing properties in the URL instance to
414
+ * insure that they all propagate correctly.
415
+ *
416
+ * @param {String} part Property we need to adjust.
417
+ * @param {Mixed} value The newly assigned value.
418
+ * @param {Boolean|Function} fn When setting the query, it will be the function
419
+ * used to parse the query.
420
+ * When setting the protocol, double slash will be
421
+ * removed from the final url if it is true.
422
+ * @returns {URL} URL instance for chaining.
423
+ * @public
424
+ */
425
+ function set(part, value, fn) {
426
+ var url = this;
427
+
428
+ switch (part) {
429
+ case 'query':
430
+ if ('string' === typeof value && value.length) {
431
+ value = (fn || qs.parse)(value);
432
+ }
433
+
434
+ url[part] = value;
435
+ break;
436
+
437
+ case 'port':
438
+ url[part] = value;
439
+
440
+ if (!required(value, url.protocol)) {
441
+ url.host = url.hostname;
442
+ url[part] = '';
443
+ } else if (value) {
444
+ url.host = url.hostname +':'+ value;
445
+ }
446
+
447
+ break;
448
+
449
+ case 'hostname':
450
+ url[part] = value;
451
+
452
+ if (url.port) value += ':'+ url.port;
453
+ url.host = value;
454
+ break;
455
+
456
+ case 'host':
457
+ url[part] = value;
458
+
459
+ if (port.test(value)) {
460
+ value = value.split(':');
461
+ url.port = value.pop();
462
+ url.hostname = value.join(':');
463
+ } else {
464
+ url.hostname = value;
465
+ url.port = '';
466
+ }
467
+
468
+ break;
469
+
470
+ case 'protocol':
471
+ url.protocol = value.toLowerCase();
472
+ url.slashes = !fn;
473
+ break;
474
+
475
+ case 'pathname':
476
+ case 'hash':
477
+ if (value) {
478
+ var char = part === 'pathname' ? '/' : '#';
479
+ url[part] = value.charAt(0) !== char ? char + value : value;
480
+ } else {
481
+ url[part] = value;
482
+ }
483
+ break;
484
+
485
+ case 'username':
486
+ case 'password':
487
+ url[part] = encodeURIComponent(value);
488
+ break;
489
+
490
+ case 'auth':
491
+ var index = value.indexOf(':');
492
+
493
+ if (~index) {
494
+ url.username = value.slice(0, index);
495
+ url.username = encodeURIComponent(decodeURIComponent(url.username));
496
+
497
+ url.password = value.slice(index + 1);
498
+ url.password = encodeURIComponent(decodeURIComponent(url.password));
499
+ } else {
500
+ url.username = encodeURIComponent(decodeURIComponent(value));
501
+ }
502
+ }
503
+
504
+ for (var i = 0; i < rules.length; i++) {
505
+ var ins = rules[i];
506
+
507
+ if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
508
+ }
509
+
510
+ url.auth = url.password ? url.username +':'+ url.password : url.username;
511
+
512
+ url.origin = url.protocol !== 'file:' && isSpecial(url.protocol) && url.host
513
+ ? url.protocol +'//'+ url.host
514
+ : 'null';
515
+
516
+ url.href = url.toString();
517
+
518
+ return url;
519
+ }
520
+
521
+ /**
522
+ * Transform the properties back in to a valid and full URL string.
523
+ *
524
+ * @param {Function} stringify Optional query stringify function.
525
+ * @returns {String} Compiled version of the URL.
526
+ * @public
527
+ */
528
+ function toString(stringify) {
529
+ if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;
530
+
531
+ var query
532
+ , url = this
533
+ , host = url.host
534
+ , protocol = url.protocol;
535
+
536
+ if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';
537
+
538
+ var result =
539
+ protocol +
540
+ ((url.protocol && url.slashes) || isSpecial(url.protocol) ? '//' : '');
541
+
542
+ if (url.username) {
543
+ result += url.username;
544
+ if (url.password) result += ':'+ url.password;
545
+ result += '@';
546
+ } else if (url.password) {
547
+ result += ':'+ url.password;
548
+ result += '@';
549
+ } else if (
550
+ url.protocol !== 'file:' &&
551
+ isSpecial(url.protocol) &&
552
+ !host &&
553
+ url.pathname !== '/'
554
+ ) {
555
+ //
556
+ // Add back the empty userinfo, otherwise the original invalid URL
557
+ // might be transformed into a valid one with `url.pathname` as host.
558
+ //
559
+ result += '@';
560
+ }
561
+
562
+ //
563
+ // Trailing colon is removed from `url.host` when it is parsed. If it still
564
+ // ends with a colon, then add back the trailing colon that was removed. This
565
+ // prevents an invalid URL from being transformed into a valid one.
566
+ //
567
+ if (host[host.length - 1] === ':' || (port.test(url.hostname) && !url.port)) {
568
+ host += ':';
569
+ }
570
+
571
+ result += host + url.pathname;
572
+
573
+ query = 'object' === typeof url.query ? stringify(url.query) : url.query;
574
+ if (query) result += '?' !== query.charAt(0) ? '?'+ query : query;
575
+
576
+ if (url.hash) result += url.hash;
577
+
578
+ return result;
579
+ }
580
+
581
+ Url.prototype = { set: set, toString: toString };
582
+
583
+ //
584
+ // Expose the URL parser and some additional properties that might be useful for
585
+ // others or testing.
586
+ //
587
+ Url.extractProtocol = extractProtocol;
588
+ Url.location = lolcation;
589
+ Url.trimLeft = trimLeft;
590
+ Url.qs = qs;
591
+
592
+ var urlParse = Url;
593
+
594
+ export { urlParse as default };
@@ -0,0 +1,71 @@
1
+ var fallback;
2
+ var hasRequiredFallback;
3
+
4
+ function requireFallback () {
5
+ if (hasRequiredFallback) return fallback;
6
+ hasRequiredFallback = 1;
7
+
8
+ /**
9
+ * Checks if a given buffer contains only correct UTF-8.
10
+ * Ported from https://www.cl.cam.ac.uk/%7Emgk25/ucs/utf8_check.c by
11
+ * Markus Kuhn.
12
+ *
13
+ * @param {Buffer} buf The buffer to check
14
+ * @return {Boolean} `true` if `buf` contains only correct UTF-8, else `false`
15
+ * @public
16
+ */
17
+ function isValidUTF8(buf) {
18
+ const len = buf.length;
19
+ let i = 0;
20
+
21
+ while (i < len) {
22
+ if ((buf[i] & 0x80) === 0x00) { // 0xxxxxxx
23
+ i++;
24
+ } else if ((buf[i] & 0xe0) === 0xc0) { // 110xxxxx 10xxxxxx
25
+ if (
26
+ i + 1 === len ||
27
+ (buf[i + 1] & 0xc0) !== 0x80 ||
28
+ (buf[i] & 0xfe) === 0xc0 // overlong
29
+ ) {
30
+ return false;
31
+ }
32
+
33
+ i += 2;
34
+ } else if ((buf[i] & 0xf0) === 0xe0) { // 1110xxxx 10xxxxxx 10xxxxxx
35
+ if (
36
+ i + 2 >= len ||
37
+ (buf[i + 1] & 0xc0) !== 0x80 ||
38
+ (buf[i + 2] & 0xc0) !== 0x80 ||
39
+ buf[i] === 0xe0 && (buf[i + 1] & 0xe0) === 0x80 || // overlong
40
+ buf[i] === 0xed && (buf[i + 1] & 0xe0) === 0xa0 // surrogate (U+D800 - U+DFFF)
41
+ ) {
42
+ return false;
43
+ }
44
+
45
+ i += 3;
46
+ } else if ((buf[i] & 0xf8) === 0xf0) { // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
47
+ if (
48
+ i + 3 >= len ||
49
+ (buf[i + 1] & 0xc0) !== 0x80 ||
50
+ (buf[i + 2] & 0xc0) !== 0x80 ||
51
+ (buf[i + 3] & 0xc0) !== 0x80 ||
52
+ buf[i] === 0xf0 && (buf[i + 1] & 0xf0) === 0x80 || // overlong
53
+ buf[i] === 0xf4 && buf[i + 1] > 0x8f || buf[i] > 0xf4 // > U+10FFFF
54
+ ) {
55
+ return false;
56
+ }
57
+
58
+ i += 4;
59
+ } else {
60
+ return false;
61
+ }
62
+ }
63
+
64
+ return true;
65
+ }
66
+
67
+ fallback = isValidUTF8;
68
+ return fallback;
69
+ }
70
+
71
+ export { requireFallback as __require };
@@ -0,0 +1,21 @@
1
+ import { exports as utf8ValidateExports, __module as utf8Validate } from '../../_virtual/index5.js';
2
+ import { __require as requireNodeGypBuild } from '../node-gyp-build/index.js';
3
+ import { __require as requireFallback } from './fallback.js';
4
+
5
+ var hasRequiredUtf8Validate;
6
+
7
+ function requireUtf8Validate () {
8
+ if (hasRequiredUtf8Validate) return utf8ValidateExports;
9
+ hasRequiredUtf8Validate = 1;
10
+ (function (module) {
11
+
12
+ try {
13
+ module.exports = requireNodeGypBuild()(__dirname);
14
+ } catch (e) {
15
+ module.exports = requireFallback();
16
+ }
17
+ } (utf8Validate));
18
+ return utf8ValidateExports;
19
+ }
20
+
21
+ export { requireUtf8Validate as __require };
@@ -0,0 +1,15 @@
1
+ import { exports as websocketExports, __module as websocket } from '../../_virtual/index2.js';
2
+ import { __require as requireWebsocket$1 } from './lib/websocket.js';
3
+
4
+ var hasRequiredWebsocket;
5
+
6
+ function requireWebsocket () {
7
+ if (hasRequiredWebsocket) return websocketExports;
8
+ hasRequiredWebsocket = 1;
9
+ (function (module) {
10
+ module.exports = requireWebsocket$1();
11
+ } (websocket));
12
+ return websocketExports;
13
+ }
14
+
15
+ export { requireWebsocket as __require };