@iconoma/cli 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -91
- package/bin/run.js +0 -0
- package/dist/commands/studio.d.ts.map +1 -1
- package/dist/commands/studio.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +26 -13
- package/dist/get-studio.d.ts +0 -9
- package/dist/get-studio.d.ts.map +0 -1
- package/dist/get-studio.js +0 -4
- package/dist/studio/128.index.js +0 -55
- package/dist/studio/143.index.js +0 -2457
- package/dist/studio/148.index.js +0 -744
- package/dist/studio/211.index.js +0 -47186
- package/dist/studio/22.index.js +0 -5942
- package/dist/studio/259.index.js +0 -7397
- package/dist/studio/437.index.js +0 -20
- package/dist/studio/454.index.js +0 -295
- package/dist/studio/47.index.js +0 -1431
- package/dist/studio/509.index.js +0 -2240
- package/dist/studio/533.index.js +0 -883
- package/dist/studio/537.index.js +0 -62
- package/dist/studio/542.index.js +0 -22
- package/dist/studio/543.index.js +0 -6603
- package/dist/studio/777.index.js +0 -24
- package/dist/studio/786.index.js +0 -1065
- package/dist/studio/860.index.js +0 -13
- package/dist/studio/876.index.js +0 -38613
- package/dist/studio/922.index.js +0 -78317
- package/dist/studio/940.index.js +0 -6772
- package/dist/studio/942.index.js +0 -8218
- package/dist/studio/951.index.js +0 -98
- package/dist/studio/c4c9b2153fb0d143f75f.js +0 -1
- package/dist/studio/client/assets/base-80a1f760-DUOHyEl5.js +0 -1
- package/dist/studio/client/assets/consoleHook-59e792cb-jD7_jZ5v.js +0 -2
- package/dist/studio/client/assets/index-599aeaf7-B2yLv6MY.js +0 -16
- package/dist/studio/client/assets/index-RLDlFy_p.js +0 -810
- package/dist/studio/client/assets/index-iqn0_0ft.css +0 -1
- package/dist/studio/client/assets/node-BLCLUDWv.js +0 -4
- package/dist/studio/client/assets/runtime-BUwhFSj5.js +0 -1
- package/dist/studio/client/favicon.ico +0 -0
- package/dist/studio/client/icon.png +0 -0
- package/dist/studio/client/index.html +0 -21
- package/dist/studio/index.js +0 -277752
- package/dist/studio/package.json +0 -3
- package/oclif.manifest.json +0 -37
package/dist/studio/143.index.js
DELETED
|
@@ -1,2457 +0,0 @@
|
|
|
1
|
-
export const id = 143;
|
|
2
|
-
export const ids = [143];
|
|
3
|
-
export const modules = {
|
|
4
|
-
|
|
5
|
-
/***/ 5750:
|
|
6
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
7
|
-
|
|
8
|
-
/*!
|
|
9
|
-
* compressible
|
|
10
|
-
* Copyright(c) 2013 Jonathan Ong
|
|
11
|
-
* Copyright(c) 2014 Jeremiah Senkpiel
|
|
12
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
13
|
-
* MIT Licensed
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Module dependencies.
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
var db = __webpack_require__(9585)
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Module variables.
|
|
27
|
-
* @private
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
var COMPRESSIBLE_TYPE_REGEXP = /^text\/|\+(?:json|text|xml)$/i
|
|
31
|
-
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Module exports.
|
|
35
|
-
* @public
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
module.exports = compressible
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Checks if a type is compressible.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} type
|
|
44
|
-
* @return {Boolean} compressible
|
|
45
|
-
* @public
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
function compressible (type) {
|
|
49
|
-
if (!type || typeof type !== 'string') {
|
|
50
|
-
return false
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// strip parameters
|
|
54
|
-
var match = EXTRACT_TYPE_REGEXP.exec(type)
|
|
55
|
-
var mime = match && match[1].toLowerCase()
|
|
56
|
-
var data = db[mime]
|
|
57
|
-
|
|
58
|
-
// return database information
|
|
59
|
-
if (data && data.compressible !== undefined) {
|
|
60
|
-
return data.compressible
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// fallback to regexp or unknown
|
|
64
|
-
return COMPRESSIBLE_TYPE_REGEXP.test(mime) || undefined
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/***/ }),
|
|
69
|
-
|
|
70
|
-
/***/ 3143:
|
|
71
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
72
|
-
|
|
73
|
-
/*!
|
|
74
|
-
* compression
|
|
75
|
-
* Copyright(c) 2010 Sencha Inc.
|
|
76
|
-
* Copyright(c) 2011 TJ Holowaychuk
|
|
77
|
-
* Copyright(c) 2014 Jonathan Ong
|
|
78
|
-
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
79
|
-
* MIT Licensed
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Module dependencies.
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
|
|
89
|
-
var Negotiator = __webpack_require__(721)
|
|
90
|
-
var Buffer = (__webpack_require__(5725).Buffer)
|
|
91
|
-
var bytes = __webpack_require__(5365)
|
|
92
|
-
var compressible = __webpack_require__(5750)
|
|
93
|
-
var debug = __webpack_require__(2825)('compression')
|
|
94
|
-
var onHeaders = __webpack_require__(1563)
|
|
95
|
-
var vary = __webpack_require__(2321)
|
|
96
|
-
var zlib = __webpack_require__(3106)
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Module exports.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
module.exports = compression
|
|
103
|
-
module.exports.filter = shouldCompress
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @const
|
|
107
|
-
* whether current node version has brotli support
|
|
108
|
-
*/
|
|
109
|
-
var hasBrotliSupport = 'createBrotliCompress' in zlib
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Module variables.
|
|
113
|
-
* @private
|
|
114
|
-
*/
|
|
115
|
-
var cacheControlNoTransformRegExp = /(?:^|,)\s*?no-transform\s*?(?:,|$)/
|
|
116
|
-
var SUPPORTED_ENCODING = hasBrotliSupport ? ['br', 'gzip', 'deflate', 'identity'] : ['gzip', 'deflate', 'identity']
|
|
117
|
-
var PREFERRED_ENCODING = hasBrotliSupport ? ['br', 'gzip'] : ['gzip']
|
|
118
|
-
|
|
119
|
-
var encodingSupported = ['gzip', 'deflate', 'identity', 'br']
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Compress response data with gzip / deflate.
|
|
123
|
-
*
|
|
124
|
-
* @param {Object} [options]
|
|
125
|
-
* @return {Function} middleware
|
|
126
|
-
* @public
|
|
127
|
-
*/
|
|
128
|
-
|
|
129
|
-
function compression (options) {
|
|
130
|
-
var opts = options || {}
|
|
131
|
-
var optsBrotli = {}
|
|
132
|
-
|
|
133
|
-
if (hasBrotliSupport) {
|
|
134
|
-
Object.assign(optsBrotli, opts.brotli)
|
|
135
|
-
|
|
136
|
-
var brotliParams = {}
|
|
137
|
-
brotliParams[zlib.constants.BROTLI_PARAM_QUALITY] = 4
|
|
138
|
-
|
|
139
|
-
// set the default level to a reasonable value with balanced speed/ratio
|
|
140
|
-
optsBrotli.params = Object.assign(brotliParams, optsBrotli.params)
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// options
|
|
144
|
-
var filter = opts.filter || shouldCompress
|
|
145
|
-
var threshold = bytes.parse(opts.threshold)
|
|
146
|
-
var enforceEncoding = opts.enforceEncoding || 'identity'
|
|
147
|
-
|
|
148
|
-
if (threshold == null) {
|
|
149
|
-
threshold = 1024
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return function compression (req, res, next) {
|
|
153
|
-
var ended = false
|
|
154
|
-
var length
|
|
155
|
-
var listeners = []
|
|
156
|
-
var stream
|
|
157
|
-
|
|
158
|
-
var _end = res.end
|
|
159
|
-
var _on = res.on
|
|
160
|
-
var _write = res.write
|
|
161
|
-
|
|
162
|
-
// flush
|
|
163
|
-
res.flush = function flush () {
|
|
164
|
-
if (stream) {
|
|
165
|
-
stream.flush()
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// proxy
|
|
170
|
-
|
|
171
|
-
res.write = function write (chunk, encoding) {
|
|
172
|
-
if (ended) {
|
|
173
|
-
return false
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (!headersSent(res)) {
|
|
177
|
-
this.writeHead(this.statusCode)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return stream
|
|
181
|
-
? stream.write(toBuffer(chunk, encoding))
|
|
182
|
-
: _write.call(this, chunk, encoding)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
res.end = function end (chunk, encoding) {
|
|
186
|
-
if (ended) {
|
|
187
|
-
return false
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (!headersSent(res)) {
|
|
191
|
-
// estimate the length
|
|
192
|
-
if (!this.getHeader('Content-Length')) {
|
|
193
|
-
length = chunkLength(chunk, encoding)
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
this.writeHead(this.statusCode)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (!stream) {
|
|
200
|
-
return _end.call(this, chunk, encoding)
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
// mark ended
|
|
204
|
-
ended = true
|
|
205
|
-
|
|
206
|
-
// write Buffer for Node.js 0.8
|
|
207
|
-
return chunk
|
|
208
|
-
? stream.end(toBuffer(chunk, encoding))
|
|
209
|
-
: stream.end()
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
res.on = function on (type, listener) {
|
|
213
|
-
if (!listeners || type !== 'drain') {
|
|
214
|
-
return _on.call(this, type, listener)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (stream) {
|
|
218
|
-
return stream.on(type, listener)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// buffer listeners for future stream
|
|
222
|
-
listeners.push([type, listener])
|
|
223
|
-
|
|
224
|
-
return this
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function nocompress (msg) {
|
|
228
|
-
debug('no compression: %s', msg)
|
|
229
|
-
addListeners(res, _on, listeners)
|
|
230
|
-
listeners = null
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
onHeaders(res, function onResponseHeaders () {
|
|
234
|
-
// determine if request is filtered
|
|
235
|
-
if (!filter(req, res)) {
|
|
236
|
-
nocompress('filtered')
|
|
237
|
-
return
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
// determine if the entity should be transformed
|
|
241
|
-
if (!shouldTransform(req, res)) {
|
|
242
|
-
nocompress('no transform')
|
|
243
|
-
return
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// vary
|
|
247
|
-
vary(res, 'Accept-Encoding')
|
|
248
|
-
|
|
249
|
-
// content-length below threshold
|
|
250
|
-
if (Number(res.getHeader('Content-Length')) < threshold || length < threshold) {
|
|
251
|
-
nocompress('size below threshold')
|
|
252
|
-
return
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
var encoding = res.getHeader('Content-Encoding') || 'identity'
|
|
256
|
-
|
|
257
|
-
// already encoded
|
|
258
|
-
if (encoding !== 'identity') {
|
|
259
|
-
nocompress('already encoded')
|
|
260
|
-
return
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// head
|
|
264
|
-
if (req.method === 'HEAD') {
|
|
265
|
-
nocompress('HEAD request')
|
|
266
|
-
return
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// compression method
|
|
270
|
-
var negotiator = new Negotiator(req)
|
|
271
|
-
var method = negotiator.encoding(SUPPORTED_ENCODING, PREFERRED_ENCODING)
|
|
272
|
-
|
|
273
|
-
// if no method is found, use the default encoding
|
|
274
|
-
if (!req.headers['accept-encoding'] && encodingSupported.indexOf(enforceEncoding) !== -1) {
|
|
275
|
-
method = enforceEncoding
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// negotiation failed
|
|
279
|
-
if (!method || method === 'identity') {
|
|
280
|
-
nocompress('not acceptable')
|
|
281
|
-
return
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// compression stream
|
|
285
|
-
debug('%s compression', method)
|
|
286
|
-
stream = method === 'gzip'
|
|
287
|
-
? zlib.createGzip(opts)
|
|
288
|
-
: method === 'br'
|
|
289
|
-
? zlib.createBrotliCompress(optsBrotli)
|
|
290
|
-
: zlib.createDeflate(opts)
|
|
291
|
-
|
|
292
|
-
// add buffered listeners to stream
|
|
293
|
-
addListeners(stream, stream.on, listeners)
|
|
294
|
-
|
|
295
|
-
// header fields
|
|
296
|
-
res.setHeader('Content-Encoding', method)
|
|
297
|
-
res.removeHeader('Content-Length')
|
|
298
|
-
|
|
299
|
-
// compression
|
|
300
|
-
stream.on('data', function onStreamData (chunk) {
|
|
301
|
-
if (_write.call(res, chunk) === false) {
|
|
302
|
-
stream.pause()
|
|
303
|
-
}
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
stream.on('end', function onStreamEnd () {
|
|
307
|
-
_end.call(res)
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
_on.call(res, 'drain', function onResponseDrain () {
|
|
311
|
-
stream.resume()
|
|
312
|
-
})
|
|
313
|
-
})
|
|
314
|
-
|
|
315
|
-
next()
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/**
|
|
320
|
-
* Add bufferred listeners to stream
|
|
321
|
-
* @private
|
|
322
|
-
*/
|
|
323
|
-
|
|
324
|
-
function addListeners (stream, on, listeners) {
|
|
325
|
-
for (var i = 0; i < listeners.length; i++) {
|
|
326
|
-
on.apply(stream, listeners[i])
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Get the length of a given chunk
|
|
332
|
-
*/
|
|
333
|
-
|
|
334
|
-
function chunkLength (chunk, encoding) {
|
|
335
|
-
if (!chunk) {
|
|
336
|
-
return 0
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
return Buffer.isBuffer(chunk)
|
|
340
|
-
? chunk.length
|
|
341
|
-
: Buffer.byteLength(chunk, encoding)
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Default filter function.
|
|
346
|
-
* @private
|
|
347
|
-
*/
|
|
348
|
-
|
|
349
|
-
function shouldCompress (req, res) {
|
|
350
|
-
var type = res.getHeader('Content-Type')
|
|
351
|
-
|
|
352
|
-
if (type === undefined || !compressible(type)) {
|
|
353
|
-
debug('%s not compressible', type)
|
|
354
|
-
return false
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
return true
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* Determine if the entity should be transformed.
|
|
362
|
-
* @private
|
|
363
|
-
*/
|
|
364
|
-
|
|
365
|
-
function shouldTransform (req, res) {
|
|
366
|
-
var cacheControl = res.getHeader('Cache-Control')
|
|
367
|
-
|
|
368
|
-
// Don't compress for Cache-Control: no-transform
|
|
369
|
-
// https://tools.ietf.org/html/rfc7234#section-5.2.2.4
|
|
370
|
-
return !cacheControl ||
|
|
371
|
-
!cacheControlNoTransformRegExp.test(cacheControl)
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Coerce arguments to Buffer
|
|
376
|
-
* @private
|
|
377
|
-
*/
|
|
378
|
-
|
|
379
|
-
function toBuffer (chunk, encoding) {
|
|
380
|
-
return Buffer.isBuffer(chunk)
|
|
381
|
-
? chunk
|
|
382
|
-
: Buffer.from(chunk, encoding)
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Determine if the response headers have been sent.
|
|
387
|
-
*
|
|
388
|
-
* @param {object} res
|
|
389
|
-
* @returns {boolean}
|
|
390
|
-
* @private
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
function headersSent (res) {
|
|
394
|
-
return typeof res.headersSent !== 'boolean'
|
|
395
|
-
? Boolean(res._header)
|
|
396
|
-
: res.headersSent
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
/***/ }),
|
|
401
|
-
|
|
402
|
-
/***/ 5881:
|
|
403
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
404
|
-
|
|
405
|
-
/**
|
|
406
|
-
* This is the web browser implementation of `debug()`.
|
|
407
|
-
*
|
|
408
|
-
* Expose `debug()` as the module.
|
|
409
|
-
*/
|
|
410
|
-
|
|
411
|
-
exports = module.exports = __webpack_require__(86);
|
|
412
|
-
exports.log = log;
|
|
413
|
-
exports.formatArgs = formatArgs;
|
|
414
|
-
exports.save = save;
|
|
415
|
-
exports.load = load;
|
|
416
|
-
exports.useColors = useColors;
|
|
417
|
-
exports.storage = 'undefined' != typeof chrome
|
|
418
|
-
&& 'undefined' != typeof chrome.storage
|
|
419
|
-
? chrome.storage.local
|
|
420
|
-
: localstorage();
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Colors.
|
|
424
|
-
*/
|
|
425
|
-
|
|
426
|
-
exports.colors = [
|
|
427
|
-
'lightseagreen',
|
|
428
|
-
'forestgreen',
|
|
429
|
-
'goldenrod',
|
|
430
|
-
'dodgerblue',
|
|
431
|
-
'darkorchid',
|
|
432
|
-
'crimson'
|
|
433
|
-
];
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
437
|
-
* and the Firebug extension (any Firefox version) are known
|
|
438
|
-
* to support "%c" CSS customizations.
|
|
439
|
-
*
|
|
440
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
441
|
-
*/
|
|
442
|
-
|
|
443
|
-
function useColors() {
|
|
444
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
445
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
446
|
-
// explicitly
|
|
447
|
-
if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
|
|
448
|
-
return true;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// is webkit? http://stackoverflow.com/a/16459606/376773
|
|
452
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
453
|
-
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
|
454
|
-
// is firebug? http://stackoverflow.com/a/398120/376773
|
|
455
|
-
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
|
456
|
-
// is firefox >= v31?
|
|
457
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
458
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
|
|
459
|
-
// double check webkit in userAgent just in case we are in a worker
|
|
460
|
-
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
/**
|
|
464
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
465
|
-
*/
|
|
466
|
-
|
|
467
|
-
exports.formatters.j = function(v) {
|
|
468
|
-
try {
|
|
469
|
-
return JSON.stringify(v);
|
|
470
|
-
} catch (err) {
|
|
471
|
-
return '[UnexpectedJSONParseError]: ' + err.message;
|
|
472
|
-
}
|
|
473
|
-
};
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Colorize log arguments if enabled.
|
|
478
|
-
*
|
|
479
|
-
* @api public
|
|
480
|
-
*/
|
|
481
|
-
|
|
482
|
-
function formatArgs(args) {
|
|
483
|
-
var useColors = this.useColors;
|
|
484
|
-
|
|
485
|
-
args[0] = (useColors ? '%c' : '')
|
|
486
|
-
+ this.namespace
|
|
487
|
-
+ (useColors ? ' %c' : ' ')
|
|
488
|
-
+ args[0]
|
|
489
|
-
+ (useColors ? '%c ' : ' ')
|
|
490
|
-
+ '+' + exports.humanize(this.diff);
|
|
491
|
-
|
|
492
|
-
if (!useColors) return;
|
|
493
|
-
|
|
494
|
-
var c = 'color: ' + this.color;
|
|
495
|
-
args.splice(1, 0, c, 'color: inherit')
|
|
496
|
-
|
|
497
|
-
// the final "%c" is somewhat tricky, because there could be other
|
|
498
|
-
// arguments passed either before or after the %c, so we need to
|
|
499
|
-
// figure out the correct index to insert the CSS into
|
|
500
|
-
var index = 0;
|
|
501
|
-
var lastC = 0;
|
|
502
|
-
args[0].replace(/%[a-zA-Z%]/g, function(match) {
|
|
503
|
-
if ('%%' === match) return;
|
|
504
|
-
index++;
|
|
505
|
-
if ('%c' === match) {
|
|
506
|
-
// we only are interested in the *last* %c
|
|
507
|
-
// (the user may have provided their own)
|
|
508
|
-
lastC = index;
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
|
|
512
|
-
args.splice(lastC, 0, c);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Invokes `console.log()` when available.
|
|
517
|
-
* No-op when `console.log` is not a "function".
|
|
518
|
-
*
|
|
519
|
-
* @api public
|
|
520
|
-
*/
|
|
521
|
-
|
|
522
|
-
function log() {
|
|
523
|
-
// this hackery is required for IE8/9, where
|
|
524
|
-
// the `console.log` function doesn't have 'apply'
|
|
525
|
-
return 'object' === typeof console
|
|
526
|
-
&& console.log
|
|
527
|
-
&& Function.prototype.apply.call(console.log, console, arguments);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* Save `namespaces`.
|
|
532
|
-
*
|
|
533
|
-
* @param {String} namespaces
|
|
534
|
-
* @api private
|
|
535
|
-
*/
|
|
536
|
-
|
|
537
|
-
function save(namespaces) {
|
|
538
|
-
try {
|
|
539
|
-
if (null == namespaces) {
|
|
540
|
-
exports.storage.removeItem('debug');
|
|
541
|
-
} else {
|
|
542
|
-
exports.storage.debug = namespaces;
|
|
543
|
-
}
|
|
544
|
-
} catch(e) {}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
/**
|
|
548
|
-
* Load `namespaces`.
|
|
549
|
-
*
|
|
550
|
-
* @return {String} returns the previously persisted debug modes
|
|
551
|
-
* @api private
|
|
552
|
-
*/
|
|
553
|
-
|
|
554
|
-
function load() {
|
|
555
|
-
var r;
|
|
556
|
-
try {
|
|
557
|
-
r = exports.storage.debug;
|
|
558
|
-
} catch(e) {}
|
|
559
|
-
|
|
560
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
561
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
562
|
-
r = process.env.DEBUG;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
return r;
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* Enable namespaces listed in `localStorage.debug` initially.
|
|
570
|
-
*/
|
|
571
|
-
|
|
572
|
-
exports.enable(load());
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Localstorage attempts to return the localstorage.
|
|
576
|
-
*
|
|
577
|
-
* This is necessary because safari throws
|
|
578
|
-
* when a user disables cookies/localstorage
|
|
579
|
-
* and you attempt to access it.
|
|
580
|
-
*
|
|
581
|
-
* @return {LocalStorage}
|
|
582
|
-
* @api private
|
|
583
|
-
*/
|
|
584
|
-
|
|
585
|
-
function localstorage() {
|
|
586
|
-
try {
|
|
587
|
-
return window.localStorage;
|
|
588
|
-
} catch (e) {}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
/***/ }),
|
|
593
|
-
|
|
594
|
-
/***/ 86:
|
|
595
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* This is the common logic for both the Node.js and web browser
|
|
600
|
-
* implementations of `debug()`.
|
|
601
|
-
*
|
|
602
|
-
* Expose `debug()` as the module.
|
|
603
|
-
*/
|
|
604
|
-
|
|
605
|
-
exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
|
|
606
|
-
exports.coerce = coerce;
|
|
607
|
-
exports.disable = disable;
|
|
608
|
-
exports.enable = enable;
|
|
609
|
-
exports.enabled = enabled;
|
|
610
|
-
exports.humanize = __webpack_require__(753);
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* The currently active debug mode names, and names to skip.
|
|
614
|
-
*/
|
|
615
|
-
|
|
616
|
-
exports.names = [];
|
|
617
|
-
exports.skips = [];
|
|
618
|
-
|
|
619
|
-
/**
|
|
620
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
621
|
-
*
|
|
622
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
623
|
-
*/
|
|
624
|
-
|
|
625
|
-
exports.formatters = {};
|
|
626
|
-
|
|
627
|
-
/**
|
|
628
|
-
* Previous log timestamp.
|
|
629
|
-
*/
|
|
630
|
-
|
|
631
|
-
var prevTime;
|
|
632
|
-
|
|
633
|
-
/**
|
|
634
|
-
* Select a color.
|
|
635
|
-
* @param {String} namespace
|
|
636
|
-
* @return {Number}
|
|
637
|
-
* @api private
|
|
638
|
-
*/
|
|
639
|
-
|
|
640
|
-
function selectColor(namespace) {
|
|
641
|
-
var hash = 0, i;
|
|
642
|
-
|
|
643
|
-
for (i in namespace) {
|
|
644
|
-
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
|
645
|
-
hash |= 0; // Convert to 32bit integer
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
return exports.colors[Math.abs(hash) % exports.colors.length];
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
/**
|
|
652
|
-
* Create a debugger with the given `namespace`.
|
|
653
|
-
*
|
|
654
|
-
* @param {String} namespace
|
|
655
|
-
* @return {Function}
|
|
656
|
-
* @api public
|
|
657
|
-
*/
|
|
658
|
-
|
|
659
|
-
function createDebug(namespace) {
|
|
660
|
-
|
|
661
|
-
function debug() {
|
|
662
|
-
// disabled?
|
|
663
|
-
if (!debug.enabled) return;
|
|
664
|
-
|
|
665
|
-
var self = debug;
|
|
666
|
-
|
|
667
|
-
// set `diff` timestamp
|
|
668
|
-
var curr = +new Date();
|
|
669
|
-
var ms = curr - (prevTime || curr);
|
|
670
|
-
self.diff = ms;
|
|
671
|
-
self.prev = prevTime;
|
|
672
|
-
self.curr = curr;
|
|
673
|
-
prevTime = curr;
|
|
674
|
-
|
|
675
|
-
// turn the `arguments` into a proper Array
|
|
676
|
-
var args = new Array(arguments.length);
|
|
677
|
-
for (var i = 0; i < args.length; i++) {
|
|
678
|
-
args[i] = arguments[i];
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
args[0] = exports.coerce(args[0]);
|
|
682
|
-
|
|
683
|
-
if ('string' !== typeof args[0]) {
|
|
684
|
-
// anything else let's inspect with %O
|
|
685
|
-
args.unshift('%O');
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
// apply any `formatters` transformations
|
|
689
|
-
var index = 0;
|
|
690
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
|
|
691
|
-
// if we encounter an escaped % then don't increase the array index
|
|
692
|
-
if (match === '%%') return match;
|
|
693
|
-
index++;
|
|
694
|
-
var formatter = exports.formatters[format];
|
|
695
|
-
if ('function' === typeof formatter) {
|
|
696
|
-
var val = args[index];
|
|
697
|
-
match = formatter.call(self, val);
|
|
698
|
-
|
|
699
|
-
// now we need to remove `args[index]` since it's inlined in the `format`
|
|
700
|
-
args.splice(index, 1);
|
|
701
|
-
index--;
|
|
702
|
-
}
|
|
703
|
-
return match;
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
// apply env-specific formatting (colors, etc.)
|
|
707
|
-
exports.formatArgs.call(self, args);
|
|
708
|
-
|
|
709
|
-
var logFn = debug.log || exports.log || console.log.bind(console);
|
|
710
|
-
logFn.apply(self, args);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
debug.namespace = namespace;
|
|
714
|
-
debug.enabled = exports.enabled(namespace);
|
|
715
|
-
debug.useColors = exports.useColors();
|
|
716
|
-
debug.color = selectColor(namespace);
|
|
717
|
-
|
|
718
|
-
// env-specific initialization logic for debug instances
|
|
719
|
-
if ('function' === typeof exports.init) {
|
|
720
|
-
exports.init(debug);
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
return debug;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
/**
|
|
727
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
728
|
-
* separated by a colon and wildcards.
|
|
729
|
-
*
|
|
730
|
-
* @param {String} namespaces
|
|
731
|
-
* @api public
|
|
732
|
-
*/
|
|
733
|
-
|
|
734
|
-
function enable(namespaces) {
|
|
735
|
-
exports.save(namespaces);
|
|
736
|
-
|
|
737
|
-
exports.names = [];
|
|
738
|
-
exports.skips = [];
|
|
739
|
-
|
|
740
|
-
var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
|
|
741
|
-
var len = split.length;
|
|
742
|
-
|
|
743
|
-
for (var i = 0; i < len; i++) {
|
|
744
|
-
if (!split[i]) continue; // ignore empty strings
|
|
745
|
-
namespaces = split[i].replace(/\*/g, '.*?');
|
|
746
|
-
if (namespaces[0] === '-') {
|
|
747
|
-
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
|
|
748
|
-
} else {
|
|
749
|
-
exports.names.push(new RegExp('^' + namespaces + '$'));
|
|
750
|
-
}
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
754
|
-
/**
|
|
755
|
-
* Disable debug output.
|
|
756
|
-
*
|
|
757
|
-
* @api public
|
|
758
|
-
*/
|
|
759
|
-
|
|
760
|
-
function disable() {
|
|
761
|
-
exports.enable('');
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
766
|
-
*
|
|
767
|
-
* @param {String} name
|
|
768
|
-
* @return {Boolean}
|
|
769
|
-
* @api public
|
|
770
|
-
*/
|
|
771
|
-
|
|
772
|
-
function enabled(name) {
|
|
773
|
-
var i, len;
|
|
774
|
-
for (i = 0, len = exports.skips.length; i < len; i++) {
|
|
775
|
-
if (exports.skips[i].test(name)) {
|
|
776
|
-
return false;
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
for (i = 0, len = exports.names.length; i < len; i++) {
|
|
780
|
-
if (exports.names[i].test(name)) {
|
|
781
|
-
return true;
|
|
782
|
-
}
|
|
783
|
-
}
|
|
784
|
-
return false;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
/**
|
|
788
|
-
* Coerce `val`.
|
|
789
|
-
*
|
|
790
|
-
* @param {Mixed} val
|
|
791
|
-
* @return {Mixed}
|
|
792
|
-
* @api private
|
|
793
|
-
*/
|
|
794
|
-
|
|
795
|
-
function coerce(val) {
|
|
796
|
-
if (val instanceof Error) return val.stack || val.message;
|
|
797
|
-
return val;
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
/***/ }),
|
|
802
|
-
|
|
803
|
-
/***/ 2825:
|
|
804
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
805
|
-
|
|
806
|
-
/**
|
|
807
|
-
* Detect Electron renderer process, which is node, but we should
|
|
808
|
-
* treat as a browser.
|
|
809
|
-
*/
|
|
810
|
-
|
|
811
|
-
if (typeof process !== 'undefined' && process.type === 'renderer') {
|
|
812
|
-
module.exports = __webpack_require__(5881);
|
|
813
|
-
} else {
|
|
814
|
-
module.exports = __webpack_require__(1281);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
/***/ }),
|
|
819
|
-
|
|
820
|
-
/***/ 1281:
|
|
821
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
822
|
-
|
|
823
|
-
/**
|
|
824
|
-
* Module dependencies.
|
|
825
|
-
*/
|
|
826
|
-
|
|
827
|
-
var tty = __webpack_require__(2018);
|
|
828
|
-
var util = __webpack_require__(9023);
|
|
829
|
-
|
|
830
|
-
/**
|
|
831
|
-
* This is the Node.js implementation of `debug()`.
|
|
832
|
-
*
|
|
833
|
-
* Expose `debug()` as the module.
|
|
834
|
-
*/
|
|
835
|
-
|
|
836
|
-
exports = module.exports = __webpack_require__(86);
|
|
837
|
-
exports.init = init;
|
|
838
|
-
exports.log = log;
|
|
839
|
-
exports.formatArgs = formatArgs;
|
|
840
|
-
exports.save = save;
|
|
841
|
-
exports.load = load;
|
|
842
|
-
exports.useColors = useColors;
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Colors.
|
|
846
|
-
*/
|
|
847
|
-
|
|
848
|
-
exports.colors = [6, 2, 3, 4, 5, 1];
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
852
|
-
*
|
|
853
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
854
|
-
*/
|
|
855
|
-
|
|
856
|
-
exports.inspectOpts = Object.keys(process.env).filter(function (key) {
|
|
857
|
-
return /^debug_/i.test(key);
|
|
858
|
-
}).reduce(function (obj, key) {
|
|
859
|
-
// camel-case
|
|
860
|
-
var prop = key
|
|
861
|
-
.substring(6)
|
|
862
|
-
.toLowerCase()
|
|
863
|
-
.replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
|
|
864
|
-
|
|
865
|
-
// coerce string value into JS value
|
|
866
|
-
var val = process.env[key];
|
|
867
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
|
|
868
|
-
else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
|
|
869
|
-
else if (val === 'null') val = null;
|
|
870
|
-
else val = Number(val);
|
|
871
|
-
|
|
872
|
-
obj[prop] = val;
|
|
873
|
-
return obj;
|
|
874
|
-
}, {});
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* The file descriptor to write the `debug()` calls to.
|
|
878
|
-
* Set the `DEBUG_FD` env variable to override with another value. i.e.:
|
|
879
|
-
*
|
|
880
|
-
* $ DEBUG_FD=3 node script.js 3>debug.log
|
|
881
|
-
*/
|
|
882
|
-
|
|
883
|
-
var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
|
|
884
|
-
|
|
885
|
-
if (1 !== fd && 2 !== fd) {
|
|
886
|
-
util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
var stream = 1 === fd ? process.stdout :
|
|
890
|
-
2 === fd ? process.stderr :
|
|
891
|
-
createWritableStdioStream(fd);
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
895
|
-
*/
|
|
896
|
-
|
|
897
|
-
function useColors() {
|
|
898
|
-
return 'colors' in exports.inspectOpts
|
|
899
|
-
? Boolean(exports.inspectOpts.colors)
|
|
900
|
-
: tty.isatty(fd);
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
905
|
-
*/
|
|
906
|
-
|
|
907
|
-
exports.formatters.o = function(v) {
|
|
908
|
-
this.inspectOpts.colors = this.useColors;
|
|
909
|
-
return util.inspect(v, this.inspectOpts)
|
|
910
|
-
.split('\n').map(function(str) {
|
|
911
|
-
return str.trim()
|
|
912
|
-
}).join(' ');
|
|
913
|
-
};
|
|
914
|
-
|
|
915
|
-
/**
|
|
916
|
-
* Map %o to `util.inspect()`, allowing multiple lines if needed.
|
|
917
|
-
*/
|
|
918
|
-
|
|
919
|
-
exports.formatters.O = function(v) {
|
|
920
|
-
this.inspectOpts.colors = this.useColors;
|
|
921
|
-
return util.inspect(v, this.inspectOpts);
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
/**
|
|
925
|
-
* Adds ANSI color escape codes if enabled.
|
|
926
|
-
*
|
|
927
|
-
* @api public
|
|
928
|
-
*/
|
|
929
|
-
|
|
930
|
-
function formatArgs(args) {
|
|
931
|
-
var name = this.namespace;
|
|
932
|
-
var useColors = this.useColors;
|
|
933
|
-
|
|
934
|
-
if (useColors) {
|
|
935
|
-
var c = this.color;
|
|
936
|
-
var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
|
|
937
|
-
|
|
938
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
939
|
-
args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
|
|
940
|
-
} else {
|
|
941
|
-
args[0] = new Date().toUTCString()
|
|
942
|
-
+ ' ' + name + ' ' + args[0];
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Invokes `util.format()` with the specified arguments and writes to `stream`.
|
|
948
|
-
*/
|
|
949
|
-
|
|
950
|
-
function log() {
|
|
951
|
-
return stream.write(util.format.apply(util, arguments) + '\n');
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Save `namespaces`.
|
|
956
|
-
*
|
|
957
|
-
* @param {String} namespaces
|
|
958
|
-
* @api private
|
|
959
|
-
*/
|
|
960
|
-
|
|
961
|
-
function save(namespaces) {
|
|
962
|
-
if (null == namespaces) {
|
|
963
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
964
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
965
|
-
delete process.env.DEBUG;
|
|
966
|
-
} else {
|
|
967
|
-
process.env.DEBUG = namespaces;
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
|
|
971
|
-
/**
|
|
972
|
-
* Load `namespaces`.
|
|
973
|
-
*
|
|
974
|
-
* @return {String} returns the previously persisted debug modes
|
|
975
|
-
* @api private
|
|
976
|
-
*/
|
|
977
|
-
|
|
978
|
-
function load() {
|
|
979
|
-
return process.env.DEBUG;
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Copied from `node/src/node.js`.
|
|
984
|
-
*
|
|
985
|
-
* XXX: It's lame that node doesn't expose this API out-of-the-box. It also
|
|
986
|
-
* relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
|
|
987
|
-
*/
|
|
988
|
-
|
|
989
|
-
function createWritableStdioStream (fd) {
|
|
990
|
-
var stream;
|
|
991
|
-
var tty_wrap = process.binding('tty_wrap');
|
|
992
|
-
|
|
993
|
-
// Note stream._type is used for test-module-load-list.js
|
|
994
|
-
|
|
995
|
-
switch (tty_wrap.guessHandleType(fd)) {
|
|
996
|
-
case 'TTY':
|
|
997
|
-
stream = new tty.WriteStream(fd);
|
|
998
|
-
stream._type = 'tty';
|
|
999
|
-
|
|
1000
|
-
// Hack to have stream not keep the event loop alive.
|
|
1001
|
-
// See https://github.com/joyent/node/issues/1726
|
|
1002
|
-
if (stream._handle && stream._handle.unref) {
|
|
1003
|
-
stream._handle.unref();
|
|
1004
|
-
}
|
|
1005
|
-
break;
|
|
1006
|
-
|
|
1007
|
-
case 'FILE':
|
|
1008
|
-
var fs = __webpack_require__(9896);
|
|
1009
|
-
stream = new fs.SyncWriteStream(fd, { autoClose: false });
|
|
1010
|
-
stream._type = 'fs';
|
|
1011
|
-
break;
|
|
1012
|
-
|
|
1013
|
-
case 'PIPE':
|
|
1014
|
-
case 'TCP':
|
|
1015
|
-
var net = __webpack_require__(9278);
|
|
1016
|
-
stream = new net.Socket({
|
|
1017
|
-
fd: fd,
|
|
1018
|
-
readable: false,
|
|
1019
|
-
writable: true
|
|
1020
|
-
});
|
|
1021
|
-
|
|
1022
|
-
// FIXME Should probably have an option in net.Socket to create a
|
|
1023
|
-
// stream from an existing fd which is writable only. But for now
|
|
1024
|
-
// we'll just add this hack and set the `readable` member to false.
|
|
1025
|
-
// Test: ./node test/fixtures/echo.js < /etc/passwd
|
|
1026
|
-
stream.readable = false;
|
|
1027
|
-
stream.read = null;
|
|
1028
|
-
stream._type = 'pipe';
|
|
1029
|
-
|
|
1030
|
-
// FIXME Hack to have stream not keep the event loop alive.
|
|
1031
|
-
// See https://github.com/joyent/node/issues/1726
|
|
1032
|
-
if (stream._handle && stream._handle.unref) {
|
|
1033
|
-
stream._handle.unref();
|
|
1034
|
-
}
|
|
1035
|
-
break;
|
|
1036
|
-
|
|
1037
|
-
default:
|
|
1038
|
-
// Probably an error on in uv_guess_handle()
|
|
1039
|
-
throw new Error('Implement me. Unknown stream file type!');
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
// For supporting legacy API we put the FD here.
|
|
1043
|
-
stream.fd = fd;
|
|
1044
|
-
|
|
1045
|
-
stream._isStdio = true;
|
|
1046
|
-
|
|
1047
|
-
return stream;
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* Init logic for `debug` instances.
|
|
1052
|
-
*
|
|
1053
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
1054
|
-
* differently for a particular `debug` instance.
|
|
1055
|
-
*/
|
|
1056
|
-
|
|
1057
|
-
function init (debug) {
|
|
1058
|
-
debug.inspectOpts = {};
|
|
1059
|
-
|
|
1060
|
-
var keys = Object.keys(exports.inspectOpts);
|
|
1061
|
-
for (var i = 0; i < keys.length; i++) {
|
|
1062
|
-
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
/**
|
|
1067
|
-
* Enable namespaces listed in `process.env.DEBUG` initially.
|
|
1068
|
-
*/
|
|
1069
|
-
|
|
1070
|
-
exports.enable(load());
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
/***/ }),
|
|
1074
|
-
|
|
1075
|
-
/***/ 753:
|
|
1076
|
-
/***/ ((module) => {
|
|
1077
|
-
|
|
1078
|
-
/**
|
|
1079
|
-
* Helpers.
|
|
1080
|
-
*/
|
|
1081
|
-
|
|
1082
|
-
var s = 1000;
|
|
1083
|
-
var m = s * 60;
|
|
1084
|
-
var h = m * 60;
|
|
1085
|
-
var d = h * 24;
|
|
1086
|
-
var y = d * 365.25;
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Parse or format the given `val`.
|
|
1090
|
-
*
|
|
1091
|
-
* Options:
|
|
1092
|
-
*
|
|
1093
|
-
* - `long` verbose formatting [false]
|
|
1094
|
-
*
|
|
1095
|
-
* @param {String|Number} val
|
|
1096
|
-
* @param {Object} [options]
|
|
1097
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
1098
|
-
* @return {String|Number}
|
|
1099
|
-
* @api public
|
|
1100
|
-
*/
|
|
1101
|
-
|
|
1102
|
-
module.exports = function(val, options) {
|
|
1103
|
-
options = options || {};
|
|
1104
|
-
var type = typeof val;
|
|
1105
|
-
if (type === 'string' && val.length > 0) {
|
|
1106
|
-
return parse(val);
|
|
1107
|
-
} else if (type === 'number' && isNaN(val) === false) {
|
|
1108
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
1109
|
-
}
|
|
1110
|
-
throw new Error(
|
|
1111
|
-
'val is not a non-empty string or a valid number. val=' +
|
|
1112
|
-
JSON.stringify(val)
|
|
1113
|
-
);
|
|
1114
|
-
};
|
|
1115
|
-
|
|
1116
|
-
/**
|
|
1117
|
-
* Parse the given `str` and return milliseconds.
|
|
1118
|
-
*
|
|
1119
|
-
* @param {String} str
|
|
1120
|
-
* @return {Number}
|
|
1121
|
-
* @api private
|
|
1122
|
-
*/
|
|
1123
|
-
|
|
1124
|
-
function parse(str) {
|
|
1125
|
-
str = String(str);
|
|
1126
|
-
if (str.length > 100) {
|
|
1127
|
-
return;
|
|
1128
|
-
}
|
|
1129
|
-
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
|
|
1130
|
-
str
|
|
1131
|
-
);
|
|
1132
|
-
if (!match) {
|
|
1133
|
-
return;
|
|
1134
|
-
}
|
|
1135
|
-
var n = parseFloat(match[1]);
|
|
1136
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
1137
|
-
switch (type) {
|
|
1138
|
-
case 'years':
|
|
1139
|
-
case 'year':
|
|
1140
|
-
case 'yrs':
|
|
1141
|
-
case 'yr':
|
|
1142
|
-
case 'y':
|
|
1143
|
-
return n * y;
|
|
1144
|
-
case 'days':
|
|
1145
|
-
case 'day':
|
|
1146
|
-
case 'd':
|
|
1147
|
-
return n * d;
|
|
1148
|
-
case 'hours':
|
|
1149
|
-
case 'hour':
|
|
1150
|
-
case 'hrs':
|
|
1151
|
-
case 'hr':
|
|
1152
|
-
case 'h':
|
|
1153
|
-
return n * h;
|
|
1154
|
-
case 'minutes':
|
|
1155
|
-
case 'minute':
|
|
1156
|
-
case 'mins':
|
|
1157
|
-
case 'min':
|
|
1158
|
-
case 'm':
|
|
1159
|
-
return n * m;
|
|
1160
|
-
case 'seconds':
|
|
1161
|
-
case 'second':
|
|
1162
|
-
case 'secs':
|
|
1163
|
-
case 'sec':
|
|
1164
|
-
case 's':
|
|
1165
|
-
return n * s;
|
|
1166
|
-
case 'milliseconds':
|
|
1167
|
-
case 'millisecond':
|
|
1168
|
-
case 'msecs':
|
|
1169
|
-
case 'msec':
|
|
1170
|
-
case 'ms':
|
|
1171
|
-
return n;
|
|
1172
|
-
default:
|
|
1173
|
-
return undefined;
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
/**
|
|
1178
|
-
* Short format for `ms`.
|
|
1179
|
-
*
|
|
1180
|
-
* @param {Number} ms
|
|
1181
|
-
* @return {String}
|
|
1182
|
-
* @api private
|
|
1183
|
-
*/
|
|
1184
|
-
|
|
1185
|
-
function fmtShort(ms) {
|
|
1186
|
-
if (ms >= d) {
|
|
1187
|
-
return Math.round(ms / d) + 'd';
|
|
1188
|
-
}
|
|
1189
|
-
if (ms >= h) {
|
|
1190
|
-
return Math.round(ms / h) + 'h';
|
|
1191
|
-
}
|
|
1192
|
-
if (ms >= m) {
|
|
1193
|
-
return Math.round(ms / m) + 'm';
|
|
1194
|
-
}
|
|
1195
|
-
if (ms >= s) {
|
|
1196
|
-
return Math.round(ms / s) + 's';
|
|
1197
|
-
}
|
|
1198
|
-
return ms + 'ms';
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
/**
|
|
1202
|
-
* Long format for `ms`.
|
|
1203
|
-
*
|
|
1204
|
-
* @param {Number} ms
|
|
1205
|
-
* @return {String}
|
|
1206
|
-
* @api private
|
|
1207
|
-
*/
|
|
1208
|
-
|
|
1209
|
-
function fmtLong(ms) {
|
|
1210
|
-
return plural(ms, d, 'day') ||
|
|
1211
|
-
plural(ms, h, 'hour') ||
|
|
1212
|
-
plural(ms, m, 'minute') ||
|
|
1213
|
-
plural(ms, s, 'second') ||
|
|
1214
|
-
ms + ' ms';
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
/**
|
|
1218
|
-
* Pluralization helper.
|
|
1219
|
-
*/
|
|
1220
|
-
|
|
1221
|
-
function plural(ms, n, name) {
|
|
1222
|
-
if (ms < n) {
|
|
1223
|
-
return;
|
|
1224
|
-
}
|
|
1225
|
-
if (ms < n * 1.5) {
|
|
1226
|
-
return Math.floor(ms / n) + ' ' + name;
|
|
1227
|
-
}
|
|
1228
|
-
return Math.ceil(ms / n) + ' ' + name + 's';
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
/***/ }),
|
|
1233
|
-
|
|
1234
|
-
/***/ 721:
|
|
1235
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1236
|
-
|
|
1237
|
-
/*!
|
|
1238
|
-
* negotiator
|
|
1239
|
-
* Copyright(c) 2012 Federico Romero
|
|
1240
|
-
* Copyright(c) 2012-2014 Isaac Z. Schlueter
|
|
1241
|
-
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
1242
|
-
* MIT Licensed
|
|
1243
|
-
*/
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
var preferredCharsets = __webpack_require__(313)
|
|
1248
|
-
var preferredEncodings = __webpack_require__(9792)
|
|
1249
|
-
var preferredLanguages = __webpack_require__(2711)
|
|
1250
|
-
var preferredMediaTypes = __webpack_require__(5581)
|
|
1251
|
-
|
|
1252
|
-
/**
|
|
1253
|
-
* Module exports.
|
|
1254
|
-
* @public
|
|
1255
|
-
*/
|
|
1256
|
-
|
|
1257
|
-
module.exports = Negotiator;
|
|
1258
|
-
module.exports.Negotiator = Negotiator;
|
|
1259
|
-
|
|
1260
|
-
/**
|
|
1261
|
-
* Create a Negotiator instance from a request.
|
|
1262
|
-
* @param {object} request
|
|
1263
|
-
* @public
|
|
1264
|
-
*/
|
|
1265
|
-
|
|
1266
|
-
function Negotiator(request) {
|
|
1267
|
-
if (!(this instanceof Negotiator)) {
|
|
1268
|
-
return new Negotiator(request);
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
this.request = request;
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
Negotiator.prototype.charset = function charset(available) {
|
|
1275
|
-
var set = this.charsets(available);
|
|
1276
|
-
return set && set[0];
|
|
1277
|
-
};
|
|
1278
|
-
|
|
1279
|
-
Negotiator.prototype.charsets = function charsets(available) {
|
|
1280
|
-
return preferredCharsets(this.request.headers['accept-charset'], available);
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
|
-
Negotiator.prototype.encoding = function encoding(available, preferred) {
|
|
1284
|
-
var set = this.encodings(available, preferred);
|
|
1285
|
-
return set && set[0];
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
Negotiator.prototype.encodings = function encodings(available, preferred) {
|
|
1289
|
-
return preferredEncodings(this.request.headers['accept-encoding'], available, preferred);
|
|
1290
|
-
};
|
|
1291
|
-
|
|
1292
|
-
Negotiator.prototype.language = function language(available) {
|
|
1293
|
-
var set = this.languages(available);
|
|
1294
|
-
return set && set[0];
|
|
1295
|
-
};
|
|
1296
|
-
|
|
1297
|
-
Negotiator.prototype.languages = function languages(available) {
|
|
1298
|
-
return preferredLanguages(this.request.headers['accept-language'], available);
|
|
1299
|
-
};
|
|
1300
|
-
|
|
1301
|
-
Negotiator.prototype.mediaType = function mediaType(available) {
|
|
1302
|
-
var set = this.mediaTypes(available);
|
|
1303
|
-
return set && set[0];
|
|
1304
|
-
};
|
|
1305
|
-
|
|
1306
|
-
Negotiator.prototype.mediaTypes = function mediaTypes(available) {
|
|
1307
|
-
return preferredMediaTypes(this.request.headers.accept, available);
|
|
1308
|
-
};
|
|
1309
|
-
|
|
1310
|
-
// Backwards compatibility
|
|
1311
|
-
Negotiator.prototype.preferredCharset = Negotiator.prototype.charset;
|
|
1312
|
-
Negotiator.prototype.preferredCharsets = Negotiator.prototype.charsets;
|
|
1313
|
-
Negotiator.prototype.preferredEncoding = Negotiator.prototype.encoding;
|
|
1314
|
-
Negotiator.prototype.preferredEncodings = Negotiator.prototype.encodings;
|
|
1315
|
-
Negotiator.prototype.preferredLanguage = Negotiator.prototype.language;
|
|
1316
|
-
Negotiator.prototype.preferredLanguages = Negotiator.prototype.languages;
|
|
1317
|
-
Negotiator.prototype.preferredMediaType = Negotiator.prototype.mediaType;
|
|
1318
|
-
Negotiator.prototype.preferredMediaTypes = Negotiator.prototype.mediaTypes;
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
/***/ }),
|
|
1322
|
-
|
|
1323
|
-
/***/ 313:
|
|
1324
|
-
/***/ ((module) => {
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* negotiator
|
|
1328
|
-
* Copyright(c) 2012 Isaac Z. Schlueter
|
|
1329
|
-
* Copyright(c) 2014 Federico Romero
|
|
1330
|
-
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
1331
|
-
* MIT Licensed
|
|
1332
|
-
*/
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Module exports.
|
|
1338
|
-
* @public
|
|
1339
|
-
*/
|
|
1340
|
-
|
|
1341
|
-
module.exports = preferredCharsets;
|
|
1342
|
-
module.exports.preferredCharsets = preferredCharsets;
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* Module variables.
|
|
1346
|
-
* @private
|
|
1347
|
-
*/
|
|
1348
|
-
|
|
1349
|
-
var simpleCharsetRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
|
|
1350
|
-
|
|
1351
|
-
/**
|
|
1352
|
-
* Parse the Accept-Charset header.
|
|
1353
|
-
* @private
|
|
1354
|
-
*/
|
|
1355
|
-
|
|
1356
|
-
function parseAcceptCharset(accept) {
|
|
1357
|
-
var accepts = accept.split(',');
|
|
1358
|
-
|
|
1359
|
-
for (var i = 0, j = 0; i < accepts.length; i++) {
|
|
1360
|
-
var charset = parseCharset(accepts[i].trim(), i);
|
|
1361
|
-
|
|
1362
|
-
if (charset) {
|
|
1363
|
-
accepts[j++] = charset;
|
|
1364
|
-
}
|
|
1365
|
-
}
|
|
1366
|
-
|
|
1367
|
-
// trim accepts
|
|
1368
|
-
accepts.length = j;
|
|
1369
|
-
|
|
1370
|
-
return accepts;
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
/**
|
|
1374
|
-
* Parse a charset from the Accept-Charset header.
|
|
1375
|
-
* @private
|
|
1376
|
-
*/
|
|
1377
|
-
|
|
1378
|
-
function parseCharset(str, i) {
|
|
1379
|
-
var match = simpleCharsetRegExp.exec(str);
|
|
1380
|
-
if (!match) return null;
|
|
1381
|
-
|
|
1382
|
-
var charset = match[1];
|
|
1383
|
-
var q = 1;
|
|
1384
|
-
if (match[2]) {
|
|
1385
|
-
var params = match[2].split(';')
|
|
1386
|
-
for (var j = 0; j < params.length; j++) {
|
|
1387
|
-
var p = params[j].trim().split('=');
|
|
1388
|
-
if (p[0] === 'q') {
|
|
1389
|
-
q = parseFloat(p[1]);
|
|
1390
|
-
break;
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
|
|
1395
|
-
return {
|
|
1396
|
-
charset: charset,
|
|
1397
|
-
q: q,
|
|
1398
|
-
i: i
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
/**
|
|
1403
|
-
* Get the priority of a charset.
|
|
1404
|
-
* @private
|
|
1405
|
-
*/
|
|
1406
|
-
|
|
1407
|
-
function getCharsetPriority(charset, accepted, index) {
|
|
1408
|
-
var priority = {o: -1, q: 0, s: 0};
|
|
1409
|
-
|
|
1410
|
-
for (var i = 0; i < accepted.length; i++) {
|
|
1411
|
-
var spec = specify(charset, accepted[i], index);
|
|
1412
|
-
|
|
1413
|
-
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
|
1414
|
-
priority = spec;
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
return priority;
|
|
1419
|
-
}
|
|
1420
|
-
|
|
1421
|
-
/**
|
|
1422
|
-
* Get the specificity of the charset.
|
|
1423
|
-
* @private
|
|
1424
|
-
*/
|
|
1425
|
-
|
|
1426
|
-
function specify(charset, spec, index) {
|
|
1427
|
-
var s = 0;
|
|
1428
|
-
if(spec.charset.toLowerCase() === charset.toLowerCase()){
|
|
1429
|
-
s |= 1;
|
|
1430
|
-
} else if (spec.charset !== '*' ) {
|
|
1431
|
-
return null
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
return {
|
|
1435
|
-
i: index,
|
|
1436
|
-
o: spec.i,
|
|
1437
|
-
q: spec.q,
|
|
1438
|
-
s: s
|
|
1439
|
-
}
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* Get the preferred charsets from an Accept-Charset header.
|
|
1444
|
-
* @public
|
|
1445
|
-
*/
|
|
1446
|
-
|
|
1447
|
-
function preferredCharsets(accept, provided) {
|
|
1448
|
-
// RFC 2616 sec 14.2: no header = *
|
|
1449
|
-
var accepts = parseAcceptCharset(accept === undefined ? '*' : accept || '');
|
|
1450
|
-
|
|
1451
|
-
if (!provided) {
|
|
1452
|
-
// sorted list of all charsets
|
|
1453
|
-
return accepts
|
|
1454
|
-
.filter(isQuality)
|
|
1455
|
-
.sort(compareSpecs)
|
|
1456
|
-
.map(getFullCharset);
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
var priorities = provided.map(function getPriority(type, index) {
|
|
1460
|
-
return getCharsetPriority(type, accepts, index);
|
|
1461
|
-
});
|
|
1462
|
-
|
|
1463
|
-
// sorted list of accepted charsets
|
|
1464
|
-
return priorities.filter(isQuality).sort(compareSpecs).map(function getCharset(priority) {
|
|
1465
|
-
return provided[priorities.indexOf(priority)];
|
|
1466
|
-
});
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
/**
|
|
1470
|
-
* Compare two specs.
|
|
1471
|
-
* @private
|
|
1472
|
-
*/
|
|
1473
|
-
|
|
1474
|
-
function compareSpecs(a, b) {
|
|
1475
|
-
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
|
1476
|
-
}
|
|
1477
|
-
|
|
1478
|
-
/**
|
|
1479
|
-
* Get full charset string.
|
|
1480
|
-
* @private
|
|
1481
|
-
*/
|
|
1482
|
-
|
|
1483
|
-
function getFullCharset(spec) {
|
|
1484
|
-
return spec.charset;
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
/**
|
|
1488
|
-
* Check if a spec has any quality.
|
|
1489
|
-
* @private
|
|
1490
|
-
*/
|
|
1491
|
-
|
|
1492
|
-
function isQuality(spec) {
|
|
1493
|
-
return spec.q > 0;
|
|
1494
|
-
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
/***/ }),
|
|
1498
|
-
|
|
1499
|
-
/***/ 9792:
|
|
1500
|
-
/***/ ((module) => {
|
|
1501
|
-
|
|
1502
|
-
/**
|
|
1503
|
-
* negotiator
|
|
1504
|
-
* Copyright(c) 2012 Isaac Z. Schlueter
|
|
1505
|
-
* Copyright(c) 2014 Federico Romero
|
|
1506
|
-
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
1507
|
-
* MIT Licensed
|
|
1508
|
-
*/
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
/**
|
|
1513
|
-
* Module exports.
|
|
1514
|
-
* @public
|
|
1515
|
-
*/
|
|
1516
|
-
|
|
1517
|
-
module.exports = preferredEncodings;
|
|
1518
|
-
module.exports.preferredEncodings = preferredEncodings;
|
|
1519
|
-
|
|
1520
|
-
/**
|
|
1521
|
-
* Module variables.
|
|
1522
|
-
* @private
|
|
1523
|
-
*/
|
|
1524
|
-
|
|
1525
|
-
var simpleEncodingRegExp = /^\s*([^\s;]+)\s*(?:;(.*))?$/;
|
|
1526
|
-
|
|
1527
|
-
/**
|
|
1528
|
-
* Parse the Accept-Encoding header.
|
|
1529
|
-
* @private
|
|
1530
|
-
*/
|
|
1531
|
-
|
|
1532
|
-
function parseAcceptEncoding(accept) {
|
|
1533
|
-
var accepts = accept.split(',');
|
|
1534
|
-
var hasIdentity = false;
|
|
1535
|
-
var minQuality = 1;
|
|
1536
|
-
|
|
1537
|
-
for (var i = 0, j = 0; i < accepts.length; i++) {
|
|
1538
|
-
var encoding = parseEncoding(accepts[i].trim(), i);
|
|
1539
|
-
|
|
1540
|
-
if (encoding) {
|
|
1541
|
-
accepts[j++] = encoding;
|
|
1542
|
-
hasIdentity = hasIdentity || specify('identity', encoding);
|
|
1543
|
-
minQuality = Math.min(minQuality, encoding.q || 1);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
|
|
1547
|
-
if (!hasIdentity) {
|
|
1548
|
-
/*
|
|
1549
|
-
* If identity doesn't explicitly appear in the accept-encoding header,
|
|
1550
|
-
* it's added to the list of acceptable encoding with the lowest q
|
|
1551
|
-
*/
|
|
1552
|
-
accepts[j++] = {
|
|
1553
|
-
encoding: 'identity',
|
|
1554
|
-
q: minQuality,
|
|
1555
|
-
i: i
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
// trim accepts
|
|
1560
|
-
accepts.length = j;
|
|
1561
|
-
|
|
1562
|
-
return accepts;
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1565
|
-
/**
|
|
1566
|
-
* Parse an encoding from the Accept-Encoding header.
|
|
1567
|
-
* @private
|
|
1568
|
-
*/
|
|
1569
|
-
|
|
1570
|
-
function parseEncoding(str, i) {
|
|
1571
|
-
var match = simpleEncodingRegExp.exec(str);
|
|
1572
|
-
if (!match) return null;
|
|
1573
|
-
|
|
1574
|
-
var encoding = match[1];
|
|
1575
|
-
var q = 1;
|
|
1576
|
-
if (match[2]) {
|
|
1577
|
-
var params = match[2].split(';');
|
|
1578
|
-
for (var j = 0; j < params.length; j++) {
|
|
1579
|
-
var p = params[j].trim().split('=');
|
|
1580
|
-
if (p[0] === 'q') {
|
|
1581
|
-
q = parseFloat(p[1]);
|
|
1582
|
-
break;
|
|
1583
|
-
}
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
|
|
1587
|
-
return {
|
|
1588
|
-
encoding: encoding,
|
|
1589
|
-
q: q,
|
|
1590
|
-
i: i
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
|
|
1594
|
-
/**
|
|
1595
|
-
* Get the priority of an encoding.
|
|
1596
|
-
* @private
|
|
1597
|
-
*/
|
|
1598
|
-
|
|
1599
|
-
function getEncodingPriority(encoding, accepted, index) {
|
|
1600
|
-
var priority = {encoding: encoding, o: -1, q: 0, s: 0};
|
|
1601
|
-
|
|
1602
|
-
for (var i = 0; i < accepted.length; i++) {
|
|
1603
|
-
var spec = specify(encoding, accepted[i], index);
|
|
1604
|
-
|
|
1605
|
-
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
|
1606
|
-
priority = spec;
|
|
1607
|
-
}
|
|
1608
|
-
}
|
|
1609
|
-
|
|
1610
|
-
return priority;
|
|
1611
|
-
}
|
|
1612
|
-
|
|
1613
|
-
/**
|
|
1614
|
-
* Get the specificity of the encoding.
|
|
1615
|
-
* @private
|
|
1616
|
-
*/
|
|
1617
|
-
|
|
1618
|
-
function specify(encoding, spec, index) {
|
|
1619
|
-
var s = 0;
|
|
1620
|
-
if(spec.encoding.toLowerCase() === encoding.toLowerCase()){
|
|
1621
|
-
s |= 1;
|
|
1622
|
-
} else if (spec.encoding !== '*' ) {
|
|
1623
|
-
return null
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
return {
|
|
1627
|
-
encoding: encoding,
|
|
1628
|
-
i: index,
|
|
1629
|
-
o: spec.i,
|
|
1630
|
-
q: spec.q,
|
|
1631
|
-
s: s
|
|
1632
|
-
}
|
|
1633
|
-
};
|
|
1634
|
-
|
|
1635
|
-
/**
|
|
1636
|
-
* Get the preferred encodings from an Accept-Encoding header.
|
|
1637
|
-
* @public
|
|
1638
|
-
*/
|
|
1639
|
-
|
|
1640
|
-
function preferredEncodings(accept, provided, preferred) {
|
|
1641
|
-
var accepts = parseAcceptEncoding(accept || '');
|
|
1642
|
-
|
|
1643
|
-
var comparator = preferred ? function comparator (a, b) {
|
|
1644
|
-
if (a.q !== b.q) {
|
|
1645
|
-
return b.q - a.q // higher quality first
|
|
1646
|
-
}
|
|
1647
|
-
|
|
1648
|
-
var aPreferred = preferred.indexOf(a.encoding)
|
|
1649
|
-
var bPreferred = preferred.indexOf(b.encoding)
|
|
1650
|
-
|
|
1651
|
-
if (aPreferred === -1 && bPreferred === -1) {
|
|
1652
|
-
// consider the original specifity/order
|
|
1653
|
-
return (b.s - a.s) || (a.o - b.o) || (a.i - b.i)
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
|
-
if (aPreferred !== -1 && bPreferred !== -1) {
|
|
1657
|
-
return aPreferred - bPreferred // consider the preferred order
|
|
1658
|
-
}
|
|
1659
|
-
|
|
1660
|
-
return aPreferred === -1 ? 1 : -1 // preferred first
|
|
1661
|
-
} : compareSpecs;
|
|
1662
|
-
|
|
1663
|
-
if (!provided) {
|
|
1664
|
-
// sorted list of all encodings
|
|
1665
|
-
return accepts
|
|
1666
|
-
.filter(isQuality)
|
|
1667
|
-
.sort(comparator)
|
|
1668
|
-
.map(getFullEncoding);
|
|
1669
|
-
}
|
|
1670
|
-
|
|
1671
|
-
var priorities = provided.map(function getPriority(type, index) {
|
|
1672
|
-
return getEncodingPriority(type, accepts, index);
|
|
1673
|
-
});
|
|
1674
|
-
|
|
1675
|
-
// sorted list of accepted encodings
|
|
1676
|
-
return priorities.filter(isQuality).sort(comparator).map(function getEncoding(priority) {
|
|
1677
|
-
return provided[priorities.indexOf(priority)];
|
|
1678
|
-
});
|
|
1679
|
-
}
|
|
1680
|
-
|
|
1681
|
-
/**
|
|
1682
|
-
* Compare two specs.
|
|
1683
|
-
* @private
|
|
1684
|
-
*/
|
|
1685
|
-
|
|
1686
|
-
function compareSpecs(a, b) {
|
|
1687
|
-
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i);
|
|
1688
|
-
}
|
|
1689
|
-
|
|
1690
|
-
/**
|
|
1691
|
-
* Get full encoding string.
|
|
1692
|
-
* @private
|
|
1693
|
-
*/
|
|
1694
|
-
|
|
1695
|
-
function getFullEncoding(spec) {
|
|
1696
|
-
return spec.encoding;
|
|
1697
|
-
}
|
|
1698
|
-
|
|
1699
|
-
/**
|
|
1700
|
-
* Check if a spec has any quality.
|
|
1701
|
-
* @private
|
|
1702
|
-
*/
|
|
1703
|
-
|
|
1704
|
-
function isQuality(spec) {
|
|
1705
|
-
return spec.q > 0;
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
/***/ }),
|
|
1710
|
-
|
|
1711
|
-
/***/ 2711:
|
|
1712
|
-
/***/ ((module) => {
|
|
1713
|
-
|
|
1714
|
-
/**
|
|
1715
|
-
* negotiator
|
|
1716
|
-
* Copyright(c) 2012 Isaac Z. Schlueter
|
|
1717
|
-
* Copyright(c) 2014 Federico Romero
|
|
1718
|
-
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
1719
|
-
* MIT Licensed
|
|
1720
|
-
*/
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
/**
|
|
1725
|
-
* Module exports.
|
|
1726
|
-
* @public
|
|
1727
|
-
*/
|
|
1728
|
-
|
|
1729
|
-
module.exports = preferredLanguages;
|
|
1730
|
-
module.exports.preferredLanguages = preferredLanguages;
|
|
1731
|
-
|
|
1732
|
-
/**
|
|
1733
|
-
* Module variables.
|
|
1734
|
-
* @private
|
|
1735
|
-
*/
|
|
1736
|
-
|
|
1737
|
-
var simpleLanguageRegExp = /^\s*([^\s\-;]+)(?:-([^\s;]+))?\s*(?:;(.*))?$/;
|
|
1738
|
-
|
|
1739
|
-
/**
|
|
1740
|
-
* Parse the Accept-Language header.
|
|
1741
|
-
* @private
|
|
1742
|
-
*/
|
|
1743
|
-
|
|
1744
|
-
function parseAcceptLanguage(accept) {
|
|
1745
|
-
var accepts = accept.split(',');
|
|
1746
|
-
|
|
1747
|
-
for (var i = 0, j = 0; i < accepts.length; i++) {
|
|
1748
|
-
var language = parseLanguage(accepts[i].trim(), i);
|
|
1749
|
-
|
|
1750
|
-
if (language) {
|
|
1751
|
-
accepts[j++] = language;
|
|
1752
|
-
}
|
|
1753
|
-
}
|
|
1754
|
-
|
|
1755
|
-
// trim accepts
|
|
1756
|
-
accepts.length = j;
|
|
1757
|
-
|
|
1758
|
-
return accepts;
|
|
1759
|
-
}
|
|
1760
|
-
|
|
1761
|
-
/**
|
|
1762
|
-
* Parse a language from the Accept-Language header.
|
|
1763
|
-
* @private
|
|
1764
|
-
*/
|
|
1765
|
-
|
|
1766
|
-
function parseLanguage(str, i) {
|
|
1767
|
-
var match = simpleLanguageRegExp.exec(str);
|
|
1768
|
-
if (!match) return null;
|
|
1769
|
-
|
|
1770
|
-
var prefix = match[1]
|
|
1771
|
-
var suffix = match[2]
|
|
1772
|
-
var full = prefix
|
|
1773
|
-
|
|
1774
|
-
if (suffix) full += "-" + suffix;
|
|
1775
|
-
|
|
1776
|
-
var q = 1;
|
|
1777
|
-
if (match[3]) {
|
|
1778
|
-
var params = match[3].split(';')
|
|
1779
|
-
for (var j = 0; j < params.length; j++) {
|
|
1780
|
-
var p = params[j].split('=');
|
|
1781
|
-
if (p[0] === 'q') q = parseFloat(p[1]);
|
|
1782
|
-
}
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
return {
|
|
1786
|
-
prefix: prefix,
|
|
1787
|
-
suffix: suffix,
|
|
1788
|
-
q: q,
|
|
1789
|
-
i: i,
|
|
1790
|
-
full: full
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
|
-
/**
|
|
1795
|
-
* Get the priority of a language.
|
|
1796
|
-
* @private
|
|
1797
|
-
*/
|
|
1798
|
-
|
|
1799
|
-
function getLanguagePriority(language, accepted, index) {
|
|
1800
|
-
var priority = {o: -1, q: 0, s: 0};
|
|
1801
|
-
|
|
1802
|
-
for (var i = 0; i < accepted.length; i++) {
|
|
1803
|
-
var spec = specify(language, accepted[i], index);
|
|
1804
|
-
|
|
1805
|
-
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
|
1806
|
-
priority = spec;
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
|
|
1810
|
-
return priority;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
/**
|
|
1814
|
-
* Get the specificity of the language.
|
|
1815
|
-
* @private
|
|
1816
|
-
*/
|
|
1817
|
-
|
|
1818
|
-
function specify(language, spec, index) {
|
|
1819
|
-
var p = parseLanguage(language)
|
|
1820
|
-
if (!p) return null;
|
|
1821
|
-
var s = 0;
|
|
1822
|
-
if(spec.full.toLowerCase() === p.full.toLowerCase()){
|
|
1823
|
-
s |= 4;
|
|
1824
|
-
} else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) {
|
|
1825
|
-
s |= 2;
|
|
1826
|
-
} else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) {
|
|
1827
|
-
s |= 1;
|
|
1828
|
-
} else if (spec.full !== '*' ) {
|
|
1829
|
-
return null
|
|
1830
|
-
}
|
|
1831
|
-
|
|
1832
|
-
return {
|
|
1833
|
-
i: index,
|
|
1834
|
-
o: spec.i,
|
|
1835
|
-
q: spec.q,
|
|
1836
|
-
s: s
|
|
1837
|
-
}
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
|
-
/**
|
|
1841
|
-
* Get the preferred languages from an Accept-Language header.
|
|
1842
|
-
* @public
|
|
1843
|
-
*/
|
|
1844
|
-
|
|
1845
|
-
function preferredLanguages(accept, provided) {
|
|
1846
|
-
// RFC 2616 sec 14.4: no header = *
|
|
1847
|
-
var accepts = parseAcceptLanguage(accept === undefined ? '*' : accept || '');
|
|
1848
|
-
|
|
1849
|
-
if (!provided) {
|
|
1850
|
-
// sorted list of all languages
|
|
1851
|
-
return accepts
|
|
1852
|
-
.filter(isQuality)
|
|
1853
|
-
.sort(compareSpecs)
|
|
1854
|
-
.map(getFullLanguage);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
var priorities = provided.map(function getPriority(type, index) {
|
|
1858
|
-
return getLanguagePriority(type, accepts, index);
|
|
1859
|
-
});
|
|
1860
|
-
|
|
1861
|
-
// sorted list of accepted languages
|
|
1862
|
-
return priorities.filter(isQuality).sort(compareSpecs).map(function getLanguage(priority) {
|
|
1863
|
-
return provided[priorities.indexOf(priority)];
|
|
1864
|
-
});
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
/**
|
|
1868
|
-
* Compare two specs.
|
|
1869
|
-
* @private
|
|
1870
|
-
*/
|
|
1871
|
-
|
|
1872
|
-
function compareSpecs(a, b) {
|
|
1873
|
-
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
/**
|
|
1877
|
-
* Get full language string.
|
|
1878
|
-
* @private
|
|
1879
|
-
*/
|
|
1880
|
-
|
|
1881
|
-
function getFullLanguage(spec) {
|
|
1882
|
-
return spec.full;
|
|
1883
|
-
}
|
|
1884
|
-
|
|
1885
|
-
/**
|
|
1886
|
-
* Check if a spec has any quality.
|
|
1887
|
-
* @private
|
|
1888
|
-
*/
|
|
1889
|
-
|
|
1890
|
-
function isQuality(spec) {
|
|
1891
|
-
return spec.q > 0;
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
/***/ }),
|
|
1896
|
-
|
|
1897
|
-
/***/ 5581:
|
|
1898
|
-
/***/ ((module) => {
|
|
1899
|
-
|
|
1900
|
-
/**
|
|
1901
|
-
* negotiator
|
|
1902
|
-
* Copyright(c) 2012 Isaac Z. Schlueter
|
|
1903
|
-
* Copyright(c) 2014 Federico Romero
|
|
1904
|
-
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
|
1905
|
-
* MIT Licensed
|
|
1906
|
-
*/
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
/**
|
|
1911
|
-
* Module exports.
|
|
1912
|
-
* @public
|
|
1913
|
-
*/
|
|
1914
|
-
|
|
1915
|
-
module.exports = preferredMediaTypes;
|
|
1916
|
-
module.exports.preferredMediaTypes = preferredMediaTypes;
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* Module variables.
|
|
1920
|
-
* @private
|
|
1921
|
-
*/
|
|
1922
|
-
|
|
1923
|
-
var simpleMediaTypeRegExp = /^\s*([^\s\/;]+)\/([^;\s]+)\s*(?:;(.*))?$/;
|
|
1924
|
-
|
|
1925
|
-
/**
|
|
1926
|
-
* Parse the Accept header.
|
|
1927
|
-
* @private
|
|
1928
|
-
*/
|
|
1929
|
-
|
|
1930
|
-
function parseAccept(accept) {
|
|
1931
|
-
var accepts = splitMediaTypes(accept);
|
|
1932
|
-
|
|
1933
|
-
for (var i = 0, j = 0; i < accepts.length; i++) {
|
|
1934
|
-
var mediaType = parseMediaType(accepts[i].trim(), i);
|
|
1935
|
-
|
|
1936
|
-
if (mediaType) {
|
|
1937
|
-
accepts[j++] = mediaType;
|
|
1938
|
-
}
|
|
1939
|
-
}
|
|
1940
|
-
|
|
1941
|
-
// trim accepts
|
|
1942
|
-
accepts.length = j;
|
|
1943
|
-
|
|
1944
|
-
return accepts;
|
|
1945
|
-
}
|
|
1946
|
-
|
|
1947
|
-
/**
|
|
1948
|
-
* Parse a media type from the Accept header.
|
|
1949
|
-
* @private
|
|
1950
|
-
*/
|
|
1951
|
-
|
|
1952
|
-
function parseMediaType(str, i) {
|
|
1953
|
-
var match = simpleMediaTypeRegExp.exec(str);
|
|
1954
|
-
if (!match) return null;
|
|
1955
|
-
|
|
1956
|
-
var params = Object.create(null);
|
|
1957
|
-
var q = 1;
|
|
1958
|
-
var subtype = match[2];
|
|
1959
|
-
var type = match[1];
|
|
1960
|
-
|
|
1961
|
-
if (match[3]) {
|
|
1962
|
-
var kvps = splitParameters(match[3]).map(splitKeyValuePair);
|
|
1963
|
-
|
|
1964
|
-
for (var j = 0; j < kvps.length; j++) {
|
|
1965
|
-
var pair = kvps[j];
|
|
1966
|
-
var key = pair[0].toLowerCase();
|
|
1967
|
-
var val = pair[1];
|
|
1968
|
-
|
|
1969
|
-
// get the value, unwrapping quotes
|
|
1970
|
-
var value = val && val[0] === '"' && val[val.length - 1] === '"'
|
|
1971
|
-
? val.slice(1, -1)
|
|
1972
|
-
: val;
|
|
1973
|
-
|
|
1974
|
-
if (key === 'q') {
|
|
1975
|
-
q = parseFloat(value);
|
|
1976
|
-
break;
|
|
1977
|
-
}
|
|
1978
|
-
|
|
1979
|
-
// store parameter
|
|
1980
|
-
params[key] = value;
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
|
|
1984
|
-
return {
|
|
1985
|
-
type: type,
|
|
1986
|
-
subtype: subtype,
|
|
1987
|
-
params: params,
|
|
1988
|
-
q: q,
|
|
1989
|
-
i: i
|
|
1990
|
-
};
|
|
1991
|
-
}
|
|
1992
|
-
|
|
1993
|
-
/**
|
|
1994
|
-
* Get the priority of a media type.
|
|
1995
|
-
* @private
|
|
1996
|
-
*/
|
|
1997
|
-
|
|
1998
|
-
function getMediaTypePriority(type, accepted, index) {
|
|
1999
|
-
var priority = {o: -1, q: 0, s: 0};
|
|
2000
|
-
|
|
2001
|
-
for (var i = 0; i < accepted.length; i++) {
|
|
2002
|
-
var spec = specify(type, accepted[i], index);
|
|
2003
|
-
|
|
2004
|
-
if (spec && (priority.s - spec.s || priority.q - spec.q || priority.o - spec.o) < 0) {
|
|
2005
|
-
priority = spec;
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
|
|
2009
|
-
return priority;
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
/**
|
|
2013
|
-
* Get the specificity of the media type.
|
|
2014
|
-
* @private
|
|
2015
|
-
*/
|
|
2016
|
-
|
|
2017
|
-
function specify(type, spec, index) {
|
|
2018
|
-
var p = parseMediaType(type);
|
|
2019
|
-
var s = 0;
|
|
2020
|
-
|
|
2021
|
-
if (!p) {
|
|
2022
|
-
return null;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
if(spec.type.toLowerCase() == p.type.toLowerCase()) {
|
|
2026
|
-
s |= 4
|
|
2027
|
-
} else if(spec.type != '*') {
|
|
2028
|
-
return null;
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
if(spec.subtype.toLowerCase() == p.subtype.toLowerCase()) {
|
|
2032
|
-
s |= 2
|
|
2033
|
-
} else if(spec.subtype != '*') {
|
|
2034
|
-
return null;
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
var keys = Object.keys(spec.params);
|
|
2038
|
-
if (keys.length > 0) {
|
|
2039
|
-
if (keys.every(function (k) {
|
|
2040
|
-
return spec.params[k] == '*' || (spec.params[k] || '').toLowerCase() == (p.params[k] || '').toLowerCase();
|
|
2041
|
-
})) {
|
|
2042
|
-
s |= 1
|
|
2043
|
-
} else {
|
|
2044
|
-
return null
|
|
2045
|
-
}
|
|
2046
|
-
}
|
|
2047
|
-
|
|
2048
|
-
return {
|
|
2049
|
-
i: index,
|
|
2050
|
-
o: spec.i,
|
|
2051
|
-
q: spec.q,
|
|
2052
|
-
s: s,
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* Get the preferred media types from an Accept header.
|
|
2058
|
-
* @public
|
|
2059
|
-
*/
|
|
2060
|
-
|
|
2061
|
-
function preferredMediaTypes(accept, provided) {
|
|
2062
|
-
// RFC 2616 sec 14.2: no header = */*
|
|
2063
|
-
var accepts = parseAccept(accept === undefined ? '*/*' : accept || '');
|
|
2064
|
-
|
|
2065
|
-
if (!provided) {
|
|
2066
|
-
// sorted list of all types
|
|
2067
|
-
return accepts
|
|
2068
|
-
.filter(isQuality)
|
|
2069
|
-
.sort(compareSpecs)
|
|
2070
|
-
.map(getFullType);
|
|
2071
|
-
}
|
|
2072
|
-
|
|
2073
|
-
var priorities = provided.map(function getPriority(type, index) {
|
|
2074
|
-
return getMediaTypePriority(type, accepts, index);
|
|
2075
|
-
});
|
|
2076
|
-
|
|
2077
|
-
// sorted list of accepted types
|
|
2078
|
-
return priorities.filter(isQuality).sort(compareSpecs).map(function getType(priority) {
|
|
2079
|
-
return provided[priorities.indexOf(priority)];
|
|
2080
|
-
});
|
|
2081
|
-
}
|
|
2082
|
-
|
|
2083
|
-
/**
|
|
2084
|
-
* Compare two specs.
|
|
2085
|
-
* @private
|
|
2086
|
-
*/
|
|
2087
|
-
|
|
2088
|
-
function compareSpecs(a, b) {
|
|
2089
|
-
return (b.q - a.q) || (b.s - a.s) || (a.o - b.o) || (a.i - b.i) || 0;
|
|
2090
|
-
}
|
|
2091
|
-
|
|
2092
|
-
/**
|
|
2093
|
-
* Get full type string.
|
|
2094
|
-
* @private
|
|
2095
|
-
*/
|
|
2096
|
-
|
|
2097
|
-
function getFullType(spec) {
|
|
2098
|
-
return spec.type + '/' + spec.subtype;
|
|
2099
|
-
}
|
|
2100
|
-
|
|
2101
|
-
/**
|
|
2102
|
-
* Check if a spec has any quality.
|
|
2103
|
-
* @private
|
|
2104
|
-
*/
|
|
2105
|
-
|
|
2106
|
-
function isQuality(spec) {
|
|
2107
|
-
return spec.q > 0;
|
|
2108
|
-
}
|
|
2109
|
-
|
|
2110
|
-
/**
|
|
2111
|
-
* Count the number of quotes in a string.
|
|
2112
|
-
* @private
|
|
2113
|
-
*/
|
|
2114
|
-
|
|
2115
|
-
function quoteCount(string) {
|
|
2116
|
-
var count = 0;
|
|
2117
|
-
var index = 0;
|
|
2118
|
-
|
|
2119
|
-
while ((index = string.indexOf('"', index)) !== -1) {
|
|
2120
|
-
count++;
|
|
2121
|
-
index++;
|
|
2122
|
-
}
|
|
2123
|
-
|
|
2124
|
-
return count;
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
/**
|
|
2128
|
-
* Split a key value pair.
|
|
2129
|
-
* @private
|
|
2130
|
-
*/
|
|
2131
|
-
|
|
2132
|
-
function splitKeyValuePair(str) {
|
|
2133
|
-
var index = str.indexOf('=');
|
|
2134
|
-
var key;
|
|
2135
|
-
var val;
|
|
2136
|
-
|
|
2137
|
-
if (index === -1) {
|
|
2138
|
-
key = str;
|
|
2139
|
-
} else {
|
|
2140
|
-
key = str.slice(0, index);
|
|
2141
|
-
val = str.slice(index + 1);
|
|
2142
|
-
}
|
|
2143
|
-
|
|
2144
|
-
return [key, val];
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
/**
|
|
2148
|
-
* Split an Accept header into media types.
|
|
2149
|
-
* @private
|
|
2150
|
-
*/
|
|
2151
|
-
|
|
2152
|
-
function splitMediaTypes(accept) {
|
|
2153
|
-
var accepts = accept.split(',');
|
|
2154
|
-
|
|
2155
|
-
for (var i = 1, j = 0; i < accepts.length; i++) {
|
|
2156
|
-
if (quoteCount(accepts[j]) % 2 == 0) {
|
|
2157
|
-
accepts[++j] = accepts[i];
|
|
2158
|
-
} else {
|
|
2159
|
-
accepts[j] += ',' + accepts[i];
|
|
2160
|
-
}
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
// trim accepts
|
|
2164
|
-
accepts.length = j + 1;
|
|
2165
|
-
|
|
2166
|
-
return accepts;
|
|
2167
|
-
}
|
|
2168
|
-
|
|
2169
|
-
/**
|
|
2170
|
-
* Split a string of parameters.
|
|
2171
|
-
* @private
|
|
2172
|
-
*/
|
|
2173
|
-
|
|
2174
|
-
function splitParameters(str) {
|
|
2175
|
-
var parameters = str.split(';');
|
|
2176
|
-
|
|
2177
|
-
for (var i = 1, j = 0; i < parameters.length; i++) {
|
|
2178
|
-
if (quoteCount(parameters[j]) % 2 == 0) {
|
|
2179
|
-
parameters[++j] = parameters[i];
|
|
2180
|
-
} else {
|
|
2181
|
-
parameters[j] += ';' + parameters[i];
|
|
2182
|
-
}
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
// trim parameters
|
|
2186
|
-
parameters.length = j + 1;
|
|
2187
|
-
|
|
2188
|
-
for (var i = 0; i < parameters.length; i++) {
|
|
2189
|
-
parameters[i] = parameters[i].trim();
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
return parameters;
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
/***/ }),
|
|
2197
|
-
|
|
2198
|
-
/***/ 1563:
|
|
2199
|
-
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
2200
|
-
|
|
2201
|
-
/*!
|
|
2202
|
-
* on-headers
|
|
2203
|
-
* Copyright(c) 2014 Douglas Christopher Wilson
|
|
2204
|
-
* MIT Licensed
|
|
2205
|
-
*/
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
/**
|
|
2210
|
-
* Module exports.
|
|
2211
|
-
* @public
|
|
2212
|
-
*/
|
|
2213
|
-
|
|
2214
|
-
module.exports = onHeaders
|
|
2215
|
-
|
|
2216
|
-
var http = __webpack_require__(8611)
|
|
2217
|
-
|
|
2218
|
-
// older node versions don't have appendHeader
|
|
2219
|
-
var isAppendHeaderSupported = typeof http.ServerResponse.prototype.appendHeader === 'function'
|
|
2220
|
-
var set1dArray = isAppendHeaderSupported ? set1dArrayWithAppend : set1dArrayWithSet
|
|
2221
|
-
|
|
2222
|
-
/**
|
|
2223
|
-
* Create a replacement writeHead method.
|
|
2224
|
-
*
|
|
2225
|
-
* @param {function} prevWriteHead
|
|
2226
|
-
* @param {function} listener
|
|
2227
|
-
* @private
|
|
2228
|
-
*/
|
|
2229
|
-
|
|
2230
|
-
function createWriteHead (prevWriteHead, listener) {
|
|
2231
|
-
var fired = false
|
|
2232
|
-
|
|
2233
|
-
// return function with core name and argument list
|
|
2234
|
-
return function writeHead (statusCode) {
|
|
2235
|
-
// set headers from arguments
|
|
2236
|
-
var args = setWriteHeadHeaders.apply(this, arguments)
|
|
2237
|
-
|
|
2238
|
-
// fire listener
|
|
2239
|
-
if (!fired) {
|
|
2240
|
-
fired = true
|
|
2241
|
-
listener.call(this)
|
|
2242
|
-
|
|
2243
|
-
// pass-along an updated status code
|
|
2244
|
-
if (typeof args[0] === 'number' && this.statusCode !== args[0]) {
|
|
2245
|
-
args[0] = this.statusCode
|
|
2246
|
-
args.length = 1
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
return prevWriteHead.apply(this, args)
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
|
|
2254
|
-
/**
|
|
2255
|
-
* Execute a listener when a response is about to write headers.
|
|
2256
|
-
*
|
|
2257
|
-
* @param {object} res
|
|
2258
|
-
* @return {function} listener
|
|
2259
|
-
* @public
|
|
2260
|
-
*/
|
|
2261
|
-
|
|
2262
|
-
function onHeaders (res, listener) {
|
|
2263
|
-
if (!res) {
|
|
2264
|
-
throw new TypeError('argument res is required')
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
if (typeof listener !== 'function') {
|
|
2268
|
-
throw new TypeError('argument listener must be a function')
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
res.writeHead = createWriteHead(res.writeHead, listener)
|
|
2272
|
-
}
|
|
2273
|
-
|
|
2274
|
-
/**
|
|
2275
|
-
* Set headers contained in array on the response object.
|
|
2276
|
-
*
|
|
2277
|
-
* @param {object} res
|
|
2278
|
-
* @param {array} headers
|
|
2279
|
-
* @private
|
|
2280
|
-
*/
|
|
2281
|
-
|
|
2282
|
-
function setHeadersFromArray (res, headers) {
|
|
2283
|
-
if (headers.length && Array.isArray(headers[0])) {
|
|
2284
|
-
// 2D
|
|
2285
|
-
set2dArray(res, headers)
|
|
2286
|
-
} else {
|
|
2287
|
-
// 1D
|
|
2288
|
-
if (headers.length % 2 !== 0) {
|
|
2289
|
-
throw new TypeError('headers array is malformed')
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
set1dArray(res, headers)
|
|
2293
|
-
}
|
|
2294
|
-
}
|
|
2295
|
-
|
|
2296
|
-
/**
|
|
2297
|
-
* Set headers contained in object on the response object.
|
|
2298
|
-
*
|
|
2299
|
-
* @param {object} res
|
|
2300
|
-
* @param {object} headers
|
|
2301
|
-
* @private
|
|
2302
|
-
*/
|
|
2303
|
-
|
|
2304
|
-
function setHeadersFromObject (res, headers) {
|
|
2305
|
-
var keys = Object.keys(headers)
|
|
2306
|
-
for (var i = 0; i < keys.length; i++) {
|
|
2307
|
-
var k = keys[i]
|
|
2308
|
-
if (k) res.setHeader(k, headers[k])
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
/**
|
|
2313
|
-
* Set headers and other properties on the response object.
|
|
2314
|
-
*
|
|
2315
|
-
* @param {number} statusCode
|
|
2316
|
-
* @private
|
|
2317
|
-
*/
|
|
2318
|
-
|
|
2319
|
-
function setWriteHeadHeaders (statusCode) {
|
|
2320
|
-
var length = arguments.length
|
|
2321
|
-
var headerIndex = length > 1 && typeof arguments[1] === 'string'
|
|
2322
|
-
? 2
|
|
2323
|
-
: 1
|
|
2324
|
-
|
|
2325
|
-
var headers = length >= headerIndex + 1
|
|
2326
|
-
? arguments[headerIndex]
|
|
2327
|
-
: undefined
|
|
2328
|
-
|
|
2329
|
-
this.statusCode = statusCode
|
|
2330
|
-
|
|
2331
|
-
if (Array.isArray(headers)) {
|
|
2332
|
-
// handle array case
|
|
2333
|
-
setHeadersFromArray(this, headers)
|
|
2334
|
-
} else if (headers) {
|
|
2335
|
-
// handle object case
|
|
2336
|
-
setHeadersFromObject(this, headers)
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
|
-
// copy leading arguments
|
|
2340
|
-
var args = new Array(Math.min(length, headerIndex))
|
|
2341
|
-
for (var i = 0; i < args.length; i++) {
|
|
2342
|
-
args[i] = arguments[i]
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
return args
|
|
2346
|
-
}
|
|
2347
|
-
|
|
2348
|
-
function set2dArray (res, headers) {
|
|
2349
|
-
var key
|
|
2350
|
-
for (var i = 0; i < headers.length; i++) {
|
|
2351
|
-
key = headers[i][0]
|
|
2352
|
-
if (key) {
|
|
2353
|
-
res.setHeader(key, headers[i][1])
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
}
|
|
2357
|
-
|
|
2358
|
-
function set1dArrayWithAppend (res, headers) {
|
|
2359
|
-
for (var i = 0; i < headers.length; i += 2) {
|
|
2360
|
-
res.removeHeader(headers[i])
|
|
2361
|
-
}
|
|
2362
|
-
|
|
2363
|
-
var key
|
|
2364
|
-
for (var j = 0; j < headers.length; j += 2) {
|
|
2365
|
-
key = headers[j]
|
|
2366
|
-
if (key) {
|
|
2367
|
-
res.appendHeader(key, headers[j + 1])
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
}
|
|
2371
|
-
|
|
2372
|
-
function set1dArrayWithSet (res, headers) {
|
|
2373
|
-
var key
|
|
2374
|
-
for (var i = 0; i < headers.length; i += 2) {
|
|
2375
|
-
key = headers[i]
|
|
2376
|
-
if (key) {
|
|
2377
|
-
res.setHeader(key, headers[i + 1])
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
}
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
/***/ }),
|
|
2384
|
-
|
|
2385
|
-
/***/ 5725:
|
|
2386
|
-
/***/ ((module, exports, __webpack_require__) => {
|
|
2387
|
-
|
|
2388
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
2389
|
-
/* eslint-disable node/no-deprecated-api */
|
|
2390
|
-
var buffer = __webpack_require__(181)
|
|
2391
|
-
var Buffer = buffer.Buffer
|
|
2392
|
-
|
|
2393
|
-
// alternative to using Object.keys for old browsers
|
|
2394
|
-
function copyProps (src, dst) {
|
|
2395
|
-
for (var key in src) {
|
|
2396
|
-
dst[key] = src[key]
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
2400
|
-
module.exports = buffer
|
|
2401
|
-
} else {
|
|
2402
|
-
// Copy properties from require('buffer')
|
|
2403
|
-
copyProps(buffer, exports)
|
|
2404
|
-
exports.Buffer = SafeBuffer
|
|
2405
|
-
}
|
|
2406
|
-
|
|
2407
|
-
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
2408
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
2409
|
-
}
|
|
2410
|
-
|
|
2411
|
-
SafeBuffer.prototype = Object.create(Buffer.prototype)
|
|
2412
|
-
|
|
2413
|
-
// Copy static methods from Buffer
|
|
2414
|
-
copyProps(Buffer, SafeBuffer)
|
|
2415
|
-
|
|
2416
|
-
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
2417
|
-
if (typeof arg === 'number') {
|
|
2418
|
-
throw new TypeError('Argument must not be a number')
|
|
2419
|
-
}
|
|
2420
|
-
return Buffer(arg, encodingOrOffset, length)
|
|
2421
|
-
}
|
|
2422
|
-
|
|
2423
|
-
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
2424
|
-
if (typeof size !== 'number') {
|
|
2425
|
-
throw new TypeError('Argument must be a number')
|
|
2426
|
-
}
|
|
2427
|
-
var buf = Buffer(size)
|
|
2428
|
-
if (fill !== undefined) {
|
|
2429
|
-
if (typeof encoding === 'string') {
|
|
2430
|
-
buf.fill(fill, encoding)
|
|
2431
|
-
} else {
|
|
2432
|
-
buf.fill(fill)
|
|
2433
|
-
}
|
|
2434
|
-
} else {
|
|
2435
|
-
buf.fill(0)
|
|
2436
|
-
}
|
|
2437
|
-
return buf
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
SafeBuffer.allocUnsafe = function (size) {
|
|
2441
|
-
if (typeof size !== 'number') {
|
|
2442
|
-
throw new TypeError('Argument must be a number')
|
|
2443
|
-
}
|
|
2444
|
-
return Buffer(size)
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
2448
|
-
if (typeof size !== 'number') {
|
|
2449
|
-
throw new TypeError('Argument must be a number')
|
|
2450
|
-
}
|
|
2451
|
-
return buffer.SlowBuffer(size)
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
/***/ })
|
|
2456
|
-
|
|
2457
|
-
};
|