@infly/libs 2.0.43 → 2.0.45

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 (67) hide show
  1. package/README.md +104 -67
  2. package/{module → adapters/vue2/module}/Permission.js +2 -2
  3. package/{module → adapters/vue2/module}/REST.js +32 -20
  4. package/{module → adapters/vue2/module}/TokenService.js +10 -1
  5. package/adapters/vue2/module/file-export.js +18 -0
  6. package/adapters/vue2/postinstall.js +46 -0
  7. package/adapters/vue2/project-preview.js +152 -0
  8. package/adapters/vue2/script-config.js +26 -0
  9. package/adapters/vue2/store/index.js +1 -0
  10. package/{store → adapters/vue2/store}/modules/user.js +1 -1
  11. package/adapters/vue2/vite/index.js +95 -0
  12. package/adapters/vue2/vite/jest.config.js +11 -0
  13. package/{build → adapters/vue2}/webpack5/webpack.base.js +26 -79
  14. package/bin/cli.js +71 -71
  15. package/build/build-dist/index.js +863 -863
  16. package/build/build-dist/script-management.js +5 -5
  17. package/{script/build → build/build-utils}/command.js +13 -4
  18. package/{script/build → build/build-utils}/deps.js +1 -1
  19. package/{script/build → build/build-utils}/git.js +6 -4
  20. package/{script/build → build/build-utils}/preview.js +4 -1
  21. package/{script/webhook/webhook.js → build/build-utils/webhook-single.js} +7 -2
  22. package/{script/build → build/build-utils}/webhook.js +3 -2
  23. package/build/docker/compose-command.js +74 -74
  24. package/build/docker/compose-release.js +91 -91
  25. package/compat/init.js +9 -0
  26. package/index.js +8 -20
  27. package/module/Uts.js +77 -7265
  28. package/module/cjs/{request-url-rules.cjs → request-url-rules.js} +6 -0
  29. package/module/cjs/rest-error-rules.js +33 -0
  30. package/package.json +124 -92
  31. package/script/git-automation/git-clone.js +3 -4
  32. package/script/git-automation/git-configure.js +29 -0
  33. package/script/git-automation/index.js +0 -14
  34. package/script/git-automation/submodule-status.js +113 -0
  35. package/script/git-automation/submodule-utils.js +18 -0
  36. package/script/index.js +1 -26
  37. package/tools/auto-export.js +1 -2
  38. package/tools/concurrency.js +30 -0
  39. package/tools/progress.js +63 -0
  40. package/tools/project-command.js +198 -194
  41. package/tools/project-preview.js +1 -148
  42. package/tools/select-option.js +60 -60
  43. package/tools/workspace-config.js +145 -0
  44. package/.prettierrc +0 -5
  45. package/build/build-dist/script-management.test.js +0 -16
  46. package/build/docker/compose-command.test.js +0 -148
  47. package/build/docker/compose-release.test.js +0 -101
  48. package/build/docker/docker-build-push.test.js +0 -124
  49. package/build/webpack5/remove-legacy-assets-plugin.js +0 -84
  50. package/build/webpack5/webpack.base.test.js +0 -59
  51. package/lib/index.js +0 -6
  52. package/lib/server/connect.js +0 -3011
  53. package/lib/server/serve-static.js +0 -4848
  54. package/module/cjs/deep-merge.cjs +0 -38
  55. package/script/pts/cloud-scenes.mjs +0 -65
  56. package/script/pts/cloud.js +0 -151
  57. package/script/pts/generate-cloud-params.mjs +0 -210
  58. package/script/pts/generate-cloud-params.test.mjs +0 -67
  59. package/store/index.js +0 -0
  60. package/tools/file-export.js +0 -165
  61. package/tools/project-command.test.js +0 -267
  62. package/tools/select-option.test.js +0 -52
  63. package/webpack.config.js +0 -38
  64. /package/{module → adapters/vue2/module}/Router.js +0 -0
  65. /package/{build → adapters/vue2}/webpack5/inline-runtime-plugin.js +0 -0
  66. /package/{script/build → build/build-utils}/env.js +0 -0
  67. /package/module/cjs/{page-config.cjs → page-config.js} +0 -0
@@ -1,3011 +0,0 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ var __webpack_modules__ = ({
3
-
4
- /***/ 16:
5
- /***/ ((module) => {
6
-
7
- "use strict";
8
- module.exports = require("url");
9
-
10
- /***/ }),
11
-
12
- /***/ 18:
13
- /***/ ((module, exports, __webpack_require__) => {
14
-
15
- /**
16
- * Module dependencies.
17
- */
18
-
19
- var tty = __webpack_require__(637);
20
- var util = __webpack_require__(23);
21
-
22
- /**
23
- * This is the Node.js implementation of `debug()`.
24
- *
25
- * Expose `debug()` as the module.
26
- */
27
-
28
- exports = module.exports = __webpack_require__(123);
29
- exports.init = init;
30
- exports.log = log;
31
- exports.formatArgs = formatArgs;
32
- exports.save = save;
33
- exports.load = load;
34
- exports.useColors = useColors;
35
-
36
- /**
37
- * Colors.
38
- */
39
-
40
- exports.colors = [6, 2, 3, 4, 5, 1];
41
-
42
- /**
43
- * Build up the default `inspectOpts` object from the environment variables.
44
- *
45
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
46
- */
47
-
48
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
49
- return /^debug_/i.test(key);
50
- }).reduce(function (obj, key) {
51
- // camel-case
52
- var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
53
- return k.toUpperCase();
54
- });
55
-
56
- // coerce string value into JS value
57
- var val = process.env[key];
58
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;else if (/^(no|off|false|disabled)$/i.test(val)) val = false;else if (val === 'null') val = null;else val = Number(val);
59
- obj[prop] = val;
60
- return obj;
61
- }, {});
62
-
63
- /**
64
- * The file descriptor to write the `debug()` calls to.
65
- * Set the `DEBUG_FD` env variable to override with another value. i.e.:
66
- *
67
- * $ DEBUG_FD=3 node script.js 3>debug.log
68
- */
69
-
70
- var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
71
- if (1 !== fd && 2 !== fd) {
72
- 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)')();
73
- }
74
- var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd);
75
-
76
- /**
77
- * Is stdout a TTY? Colored output is enabled when `true`.
78
- */
79
-
80
- function useColors() {
81
- return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(fd);
82
- }
83
-
84
- /**
85
- * Map %o to `util.inspect()`, all on a single line.
86
- */
87
-
88
- exports.formatters.o = function (v) {
89
- this.inspectOpts.colors = this.useColors;
90
- return util.inspect(v, this.inspectOpts).split('\n').map(function (str) {
91
- return str.trim();
92
- }).join(' ');
93
- };
94
-
95
- /**
96
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
97
- */
98
-
99
- exports.formatters.O = function (v) {
100
- this.inspectOpts.colors = this.useColors;
101
- return util.inspect(v, this.inspectOpts);
102
- };
103
-
104
- /**
105
- * Adds ANSI color escape codes if enabled.
106
- *
107
- * @api public
108
- */
109
-
110
- function formatArgs(args) {
111
- var name = this.namespace;
112
- var useColors = this.useColors;
113
- if (useColors) {
114
- var c = this.color;
115
- var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
116
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
117
- args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
118
- } else {
119
- args[0] = new Date().toUTCString() + ' ' + name + ' ' + args[0];
120
- }
121
- }
122
-
123
- /**
124
- * Invokes `util.format()` with the specified arguments and writes to `stream`.
125
- */
126
-
127
- function log() {
128
- return stream.write(util.format.apply(util, arguments) + '\n');
129
- }
130
-
131
- /**
132
- * Save `namespaces`.
133
- *
134
- * @param {String} namespaces
135
- * @api private
136
- */
137
-
138
- function save(namespaces) {
139
- if (null == namespaces) {
140
- // If you set a process.env field to null or undefined, it gets cast to the
141
- // string 'null' or 'undefined'. Just delete instead.
142
- delete process.env.DEBUG;
143
- } else {
144
- process.env.DEBUG = namespaces;
145
- }
146
- }
147
-
148
- /**
149
- * Load `namespaces`.
150
- *
151
- * @return {String} returns the previously persisted debug modes
152
- * @api private
153
- */
154
-
155
- function load() {
156
- return process.env.DEBUG;
157
- }
158
-
159
- /**
160
- * Copied from `node/src/node.js`.
161
- *
162
- * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
163
- * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
164
- */
165
-
166
- function createWritableStdioStream(fd) {
167
- var stream;
168
- var tty_wrap = process.binding('tty_wrap');
169
-
170
- // Note stream._type is used for test-module-load-list.js
171
-
172
- switch (tty_wrap.guessHandleType(fd)) {
173
- case 'TTY':
174
- stream = new tty.WriteStream(fd);
175
- stream._type = 'tty';
176
-
177
- // Hack to have stream not keep the event loop alive.
178
- // See https://github.com/joyent/node/issues/1726
179
- if (stream._handle && stream._handle.unref) {
180
- stream._handle.unref();
181
- }
182
- break;
183
- case 'FILE':
184
- var fs = __webpack_require__(896);
185
- stream = new fs.SyncWriteStream(fd, {
186
- autoClose: false
187
- });
188
- stream._type = 'fs';
189
- break;
190
- case 'PIPE':
191
- case 'TCP':
192
- var net = __webpack_require__(278);
193
- stream = new net.Socket({
194
- fd: fd,
195
- readable: false,
196
- writable: true
197
- });
198
-
199
- // FIXME Should probably have an option in net.Socket to create a
200
- // stream from an existing fd which is writable only. But for now
201
- // we'll just add this hack and set the `readable` member to false.
202
- // Test: ./node test/fixtures/echo.js < /etc/passwd
203
- stream.readable = false;
204
- stream.read = null;
205
- stream._type = 'pipe';
206
-
207
- // FIXME Hack to have stream not keep the event loop alive.
208
- // See https://github.com/joyent/node/issues/1726
209
- if (stream._handle && stream._handle.unref) {
210
- stream._handle.unref();
211
- }
212
- break;
213
- default:
214
- // Probably an error on in uv_guess_handle()
215
- throw new Error('Implement me. Unknown stream file type!');
216
- }
217
-
218
- // For supporting legacy API we put the FD here.
219
- stream.fd = fd;
220
- stream._isStdio = true;
221
- return stream;
222
- }
223
-
224
- /**
225
- * Init logic for `debug` instances.
226
- *
227
- * Create a new `inspectOpts` object in case `useColors` is set
228
- * differently for a particular `debug` instance.
229
- */
230
-
231
- function init(debug) {
232
- debug.inspectOpts = {};
233
- var keys = Object.keys(exports.inspectOpts);
234
- for (var i = 0; i < keys.length; i++) {
235
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
236
- }
237
- }
238
-
239
- /**
240
- * Enable namespaces listed in `process.env.DEBUG` initially.
241
- */
242
-
243
- exports.enable(load());
244
-
245
- /***/ }),
246
-
247
- /***/ 23:
248
- /***/ ((module) => {
249
-
250
- "use strict";
251
- module.exports = require("util");
252
-
253
- /***/ }),
254
-
255
- /***/ 46:
256
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
257
-
258
- /**
259
- * Detect Electron renderer process, which is node, but we should
260
- * treat as a browser.
261
- */
262
-
263
- if (typeof process !== 'undefined' && process.type === 'renderer') {
264
- module.exports = __webpack_require__(110);
265
- } else {
266
- module.exports = __webpack_require__(700);
267
- }
268
-
269
- /***/ }),
270
-
271
- /***/ 110:
272
- /***/ ((module, exports, __webpack_require__) => {
273
-
274
- /**
275
- * This is the web browser implementation of `debug()`.
276
- *
277
- * Expose `debug()` as the module.
278
- */
279
-
280
- exports = module.exports = __webpack_require__(577);
281
- exports.log = log;
282
- exports.formatArgs = formatArgs;
283
- exports.save = save;
284
- exports.load = load;
285
- exports.useColors = useColors;
286
- exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
287
-
288
- /**
289
- * Colors.
290
- */
291
-
292
- exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
293
-
294
- /**
295
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
296
- * and the Firebug extension (any Firefox version) are known
297
- * to support "%c" CSS customizations.
298
- *
299
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
300
- */
301
-
302
- function useColors() {
303
- // NB: In an Electron preload script, document will be defined but not fully
304
- // initialized. Since we know we're in Chrome, we'll just detect this case
305
- // explicitly
306
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
307
- return true;
308
- }
309
-
310
- // is webkit? http://stackoverflow.com/a/16459606/376773
311
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
312
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
313
- // is firebug? http://stackoverflow.com/a/398120/376773
314
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
315
- // is firefox >= v31?
316
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
317
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
318
- // double check webkit in userAgent just in case we are in a worker
319
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
320
- }
321
-
322
- /**
323
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
324
- */
325
-
326
- exports.formatters.j = function (v) {
327
- try {
328
- return JSON.stringify(v);
329
- } catch (err) {
330
- return '[UnexpectedJSONParseError]: ' + err.message;
331
- }
332
- };
333
-
334
- /**
335
- * Colorize log arguments if enabled.
336
- *
337
- * @api public
338
- */
339
-
340
- function formatArgs(args) {
341
- var useColors = this.useColors;
342
- args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
343
- if (!useColors) return;
344
- var c = 'color: ' + this.color;
345
- args.splice(1, 0, c, 'color: inherit');
346
-
347
- // the final "%c" is somewhat tricky, because there could be other
348
- // arguments passed either before or after the %c, so we need to
349
- // figure out the correct index to insert the CSS into
350
- var index = 0;
351
- var lastC = 0;
352
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
353
- if ('%%' === match) return;
354
- index++;
355
- if ('%c' === match) {
356
- // we only are interested in the *last* %c
357
- // (the user may have provided their own)
358
- lastC = index;
359
- }
360
- });
361
- args.splice(lastC, 0, c);
362
- }
363
-
364
- /**
365
- * Invokes `console.log()` when available.
366
- * No-op when `console.log` is not a "function".
367
- *
368
- * @api public
369
- */
370
-
371
- function log() {
372
- // this hackery is required for IE8/9, where
373
- // the `console.log` function doesn't have 'apply'
374
- return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments);
375
- }
376
-
377
- /**
378
- * Save `namespaces`.
379
- *
380
- * @param {String} namespaces
381
- * @api private
382
- */
383
-
384
- function save(namespaces) {
385
- try {
386
- if (null == namespaces) {
387
- exports.storage.removeItem('debug');
388
- } else {
389
- exports.storage.debug = namespaces;
390
- }
391
- } catch (e) {}
392
- }
393
-
394
- /**
395
- * Load `namespaces`.
396
- *
397
- * @return {String} returns the previously persisted debug modes
398
- * @api private
399
- */
400
-
401
- function load() {
402
- var r;
403
- try {
404
- r = exports.storage.debug;
405
- } catch (e) {}
406
-
407
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
408
- if (!r && typeof process !== 'undefined' && 'env' in process) {
409
- r = process.env.DEBUG;
410
- }
411
- return r;
412
- }
413
-
414
- /**
415
- * Enable namespaces listed in `localStorage.debug` initially.
416
- */
417
-
418
- exports.enable(load());
419
-
420
- /**
421
- * Localstorage attempts to return the localstorage.
422
- *
423
- * This is necessary because safari throws
424
- * when a user disables cookies/localstorage
425
- * and you attempt to access it.
426
- *
427
- * @return {LocalStorage}
428
- * @api private
429
- */
430
-
431
- function localstorage() {
432
- try {
433
- return window.localStorage;
434
- } catch (e) {}
435
- }
436
-
437
- /***/ }),
438
-
439
- /***/ 123:
440
- /***/ ((module, exports, __webpack_require__) => {
441
-
442
- /**
443
- * This is the common logic for both the Node.js and web browser
444
- * implementations of `debug()`.
445
- *
446
- * Expose `debug()` as the module.
447
- */
448
-
449
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
450
- exports.coerce = coerce;
451
- exports.disable = disable;
452
- exports.enable = enable;
453
- exports.enabled = enabled;
454
- exports.humanize = __webpack_require__(694);
455
-
456
- /**
457
- * The currently active debug mode names, and names to skip.
458
- */
459
-
460
- exports.names = [];
461
- exports.skips = [];
462
-
463
- /**
464
- * Map of special "%n" handling functions, for the debug "format" argument.
465
- *
466
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
467
- */
468
-
469
- exports.formatters = {};
470
-
471
- /**
472
- * Previous log timestamp.
473
- */
474
-
475
- var prevTime;
476
-
477
- /**
478
- * Select a color.
479
- * @param {String} namespace
480
- * @return {Number}
481
- * @api private
482
- */
483
-
484
- function selectColor(namespace) {
485
- var hash = 0,
486
- i;
487
- for (i in namespace) {
488
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
489
- hash |= 0; // Convert to 32bit integer
490
- }
491
- return exports.colors[Math.abs(hash) % exports.colors.length];
492
- }
493
-
494
- /**
495
- * Create a debugger with the given `namespace`.
496
- *
497
- * @param {String} namespace
498
- * @return {Function}
499
- * @api public
500
- */
501
-
502
- function createDebug(namespace) {
503
- function debug() {
504
- // disabled?
505
- if (!debug.enabled) return;
506
- var self = debug;
507
-
508
- // set `diff` timestamp
509
- var curr = +new Date();
510
- var ms = curr - (prevTime || curr);
511
- self.diff = ms;
512
- self.prev = prevTime;
513
- self.curr = curr;
514
- prevTime = curr;
515
-
516
- // turn the `arguments` into a proper Array
517
- var args = new Array(arguments.length);
518
- for (var i = 0; i < args.length; i++) {
519
- args[i] = arguments[i];
520
- }
521
- args[0] = exports.coerce(args[0]);
522
- if ('string' !== typeof args[0]) {
523
- // anything else let's inspect with %O
524
- args.unshift('%O');
525
- }
526
-
527
- // apply any `formatters` transformations
528
- var index = 0;
529
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
530
- // if we encounter an escaped % then don't increase the array index
531
- if (match === '%%') return match;
532
- index++;
533
- var formatter = exports.formatters[format];
534
- if ('function' === typeof formatter) {
535
- var val = args[index];
536
- match = formatter.call(self, val);
537
-
538
- // now we need to remove `args[index]` since it's inlined in the `format`
539
- args.splice(index, 1);
540
- index--;
541
- }
542
- return match;
543
- });
544
-
545
- // apply env-specific formatting (colors, etc.)
546
- exports.formatArgs.call(self, args);
547
- var logFn = debug.log || exports.log || console.log.bind(console);
548
- logFn.apply(self, args);
549
- }
550
- debug.namespace = namespace;
551
- debug.enabled = exports.enabled(namespace);
552
- debug.useColors = exports.useColors();
553
- debug.color = selectColor(namespace);
554
-
555
- // env-specific initialization logic for debug instances
556
- if ('function' === typeof exports.init) {
557
- exports.init(debug);
558
- }
559
- return debug;
560
- }
561
-
562
- /**
563
- * Enables a debug mode by namespaces. This can include modes
564
- * separated by a colon and wildcards.
565
- *
566
- * @param {String} namespaces
567
- * @api public
568
- */
569
-
570
- function enable(namespaces) {
571
- exports.save(namespaces);
572
- exports.names = [];
573
- exports.skips = [];
574
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
575
- var len = split.length;
576
- for (var i = 0; i < len; i++) {
577
- if (!split[i]) continue; // ignore empty strings
578
- namespaces = split[i].replace(/\*/g, '.*?');
579
- if (namespaces[0] === '-') {
580
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
581
- } else {
582
- exports.names.push(new RegExp('^' + namespaces + '$'));
583
- }
584
- }
585
- }
586
-
587
- /**
588
- * Disable debug output.
589
- *
590
- * @api public
591
- */
592
-
593
- function disable() {
594
- exports.enable('');
595
- }
596
-
597
- /**
598
- * Returns true if the given mode name is enabled, false otherwise.
599
- *
600
- * @param {String} name
601
- * @return {Boolean}
602
- * @api public
603
- */
604
-
605
- function enabled(name) {
606
- var i, len;
607
- for (i = 0, len = exports.skips.length; i < len; i++) {
608
- if (exports.skips[i].test(name)) {
609
- return false;
610
- }
611
- }
612
- for (i = 0, len = exports.names.length; i < len; i++) {
613
- if (exports.names[i].test(name)) {
614
- return true;
615
- }
616
- }
617
- return false;
618
- }
619
-
620
- /**
621
- * Coerce `val`.
622
- *
623
- * @param {Mixed} val
624
- * @return {Mixed}
625
- * @api private
626
- */
627
-
628
- function coerce(val) {
629
- if (val instanceof Error) return val.stack || val.message;
630
- return val;
631
- }
632
-
633
- /***/ }),
634
-
635
- /***/ 128:
636
- /***/ ((module, exports, __webpack_require__) => {
637
-
638
- /**
639
- * This is the web browser implementation of `debug()`.
640
- *
641
- * Expose `debug()` as the module.
642
- */
643
-
644
- exports = module.exports = __webpack_require__(123);
645
- exports.log = log;
646
- exports.formatArgs = formatArgs;
647
- exports.save = save;
648
- exports.load = load;
649
- exports.useColors = useColors;
650
- exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
651
-
652
- /**
653
- * Colors.
654
- */
655
-
656
- exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
657
-
658
- /**
659
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
660
- * and the Firebug extension (any Firefox version) are known
661
- * to support "%c" CSS customizations.
662
- *
663
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
664
- */
665
-
666
- function useColors() {
667
- // NB: In an Electron preload script, document will be defined but not fully
668
- // initialized. Since we know we're in Chrome, we'll just detect this case
669
- // explicitly
670
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
671
- return true;
672
- }
673
-
674
- // is webkit? http://stackoverflow.com/a/16459606/376773
675
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
676
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
677
- // is firebug? http://stackoverflow.com/a/398120/376773
678
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
679
- // is firefox >= v31?
680
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
681
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 ||
682
- // double check webkit in userAgent just in case we are in a worker
683
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
684
- }
685
-
686
- /**
687
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
688
- */
689
-
690
- exports.formatters.j = function (v) {
691
- try {
692
- return JSON.stringify(v);
693
- } catch (err) {
694
- return '[UnexpectedJSONParseError]: ' + err.message;
695
- }
696
- };
697
-
698
- /**
699
- * Colorize log arguments if enabled.
700
- *
701
- * @api public
702
- */
703
-
704
- function formatArgs(args) {
705
- var useColors = this.useColors;
706
- args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
707
- if (!useColors) return;
708
- var c = 'color: ' + this.color;
709
- args.splice(1, 0, c, 'color: inherit');
710
-
711
- // the final "%c" is somewhat tricky, because there could be other
712
- // arguments passed either before or after the %c, so we need to
713
- // figure out the correct index to insert the CSS into
714
- var index = 0;
715
- var lastC = 0;
716
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
717
- if ('%%' === match) return;
718
- index++;
719
- if ('%c' === match) {
720
- // we only are interested in the *last* %c
721
- // (the user may have provided their own)
722
- lastC = index;
723
- }
724
- });
725
- args.splice(lastC, 0, c);
726
- }
727
-
728
- /**
729
- * Invokes `console.log()` when available.
730
- * No-op when `console.log` is not a "function".
731
- *
732
- * @api public
733
- */
734
-
735
- function log() {
736
- // this hackery is required for IE8/9, where
737
- // the `console.log` function doesn't have 'apply'
738
- return 'object' === typeof console && console.log && Function.prototype.apply.call(console.log, console, arguments);
739
- }
740
-
741
- /**
742
- * Save `namespaces`.
743
- *
744
- * @param {String} namespaces
745
- * @api private
746
- */
747
-
748
- function save(namespaces) {
749
- try {
750
- if (null == namespaces) {
751
- exports.storage.removeItem('debug');
752
- } else {
753
- exports.storage.debug = namespaces;
754
- }
755
- } catch (e) {}
756
- }
757
-
758
- /**
759
- * Load `namespaces`.
760
- *
761
- * @return {String} returns the previously persisted debug modes
762
- * @api private
763
- */
764
-
765
- function load() {
766
- var r;
767
- try {
768
- r = exports.storage.debug;
769
- } catch (e) {}
770
-
771
- // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
772
- if (!r && typeof process !== 'undefined' && 'env' in process) {
773
- r = process.env.DEBUG;
774
- }
775
- return r;
776
- }
777
-
778
- /**
779
- * Enable namespaces listed in `localStorage.debug` initially.
780
- */
781
-
782
- exports.enable(load());
783
-
784
- /**
785
- * Localstorage attempts to return the localstorage.
786
- *
787
- * This is necessary because safari throws
788
- * when a user disables cookies/localstorage
789
- * and you attempt to access it.
790
- *
791
- * @return {LocalStorage}
792
- * @api private
793
- */
794
-
795
- function localstorage() {
796
- try {
797
- return window.localStorage;
798
- } catch (e) {}
799
- }
800
-
801
- /***/ }),
802
-
803
- /***/ 200:
804
- /***/ ((module, exports) => {
805
-
806
- /**
807
- * Merge object b with object a.
808
- *
809
- * var a = { foo: 'bar' }
810
- * , b = { bar: 'baz' };
811
- *
812
- * merge(a, b);
813
- * // => { foo: 'bar', bar: 'baz' }
814
- *
815
- * @param {Object} a
816
- * @param {Object} b
817
- * @return {Object}
818
- * @api public
819
- */
820
-
821
- exports = module.exports = function (a, b) {
822
- if (a && b) {
823
- for (var key in b) {
824
- a[key] = b[key];
825
- }
826
- }
827
- return a;
828
- };
829
-
830
- /***/ }),
831
-
832
- /***/ 216:
833
- /***/ ((module) => {
834
-
835
- /**
836
- * Helpers.
837
- */
838
-
839
- var s = 1000;
840
- var m = s * 60;
841
- var h = m * 60;
842
- var d = h * 24;
843
- var y = d * 365.25;
844
-
845
- /**
846
- * Parse or format the given `val`.
847
- *
848
- * Options:
849
- *
850
- * - `long` verbose formatting [false]
851
- *
852
- * @param {String|Number} val
853
- * @param {Object} [options]
854
- * @throws {Error} throw an error if val is not a non-empty string or a number
855
- * @return {String|Number}
856
- * @api public
857
- */
858
-
859
- module.exports = function (val, options) {
860
- options = options || {};
861
- var type = typeof val;
862
- if (type === 'string' && val.length > 0) {
863
- return parse(val);
864
- } else if (type === 'number' && isNaN(val) === false) {
865
- return options.long ? fmtLong(val) : fmtShort(val);
866
- }
867
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
868
- };
869
-
870
- /**
871
- * Parse the given `str` and return milliseconds.
872
- *
873
- * @param {String} str
874
- * @return {Number}
875
- * @api private
876
- */
877
-
878
- function parse(str) {
879
- str = String(str);
880
- if (str.length > 100) {
881
- return;
882
- }
883
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
884
- if (!match) {
885
- return;
886
- }
887
- var n = parseFloat(match[1]);
888
- var type = (match[2] || 'ms').toLowerCase();
889
- switch (type) {
890
- case 'years':
891
- case 'year':
892
- case 'yrs':
893
- case 'yr':
894
- case 'y':
895
- return n * y;
896
- case 'days':
897
- case 'day':
898
- case 'd':
899
- return n * d;
900
- case 'hours':
901
- case 'hour':
902
- case 'hrs':
903
- case 'hr':
904
- case 'h':
905
- return n * h;
906
- case 'minutes':
907
- case 'minute':
908
- case 'mins':
909
- case 'min':
910
- case 'm':
911
- return n * m;
912
- case 'seconds':
913
- case 'second':
914
- case 'secs':
915
- case 'sec':
916
- case 's':
917
- return n * s;
918
- case 'milliseconds':
919
- case 'millisecond':
920
- case 'msecs':
921
- case 'msec':
922
- case 'ms':
923
- return n;
924
- default:
925
- return undefined;
926
- }
927
- }
928
-
929
- /**
930
- * Short format for `ms`.
931
- *
932
- * @param {Number} ms
933
- * @return {String}
934
- * @api private
935
- */
936
-
937
- function fmtShort(ms) {
938
- if (ms >= d) {
939
- return Math.round(ms / d) + 'd';
940
- }
941
- if (ms >= h) {
942
- return Math.round(ms / h) + 'h';
943
- }
944
- if (ms >= m) {
945
- return Math.round(ms / m) + 'm';
946
- }
947
- if (ms >= s) {
948
- return Math.round(ms / s) + 's';
949
- }
950
- return ms + 'ms';
951
- }
952
-
953
- /**
954
- * Long format for `ms`.
955
- *
956
- * @param {Number} ms
957
- * @return {String}
958
- * @api private
959
- */
960
-
961
- function fmtLong(ms) {
962
- return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
963
- }
964
-
965
- /**
966
- * Pluralization helper.
967
- */
968
-
969
- function plural(ms, n, name) {
970
- if (ms < n) {
971
- return;
972
- }
973
- if (ms < n * 1.5) {
974
- return Math.floor(ms / n) + ' ' + name;
975
- }
976
- return Math.ceil(ms / n) + ' ' + name + 's';
977
- }
978
-
979
- /***/ }),
980
-
981
- /***/ 252:
982
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
983
-
984
- "use strict";
985
- /*!
986
- * parseurl
987
- * Copyright(c) 2014 Jonathan Ong
988
- * Copyright(c) 2014-2017 Douglas Christopher Wilson
989
- * MIT Licensed
990
- */
991
-
992
-
993
-
994
- /**
995
- * Module dependencies.
996
- * @private
997
- */
998
- var url = __webpack_require__(16);
999
- var parse = url.parse;
1000
- var Url = url.Url;
1001
-
1002
- /**
1003
- * Module exports.
1004
- * @public
1005
- */
1006
-
1007
- module.exports = parseurl;
1008
- module.exports.original = originalurl;
1009
-
1010
- /**
1011
- * Parse the `req` url with memoization.
1012
- *
1013
- * @param {ServerRequest} req
1014
- * @return {Object}
1015
- * @public
1016
- */
1017
-
1018
- function parseurl(req) {
1019
- var url = req.url;
1020
- if (url === undefined) {
1021
- // URL is undefined
1022
- return undefined;
1023
- }
1024
- var parsed = req._parsedUrl;
1025
- if (fresh(url, parsed)) {
1026
- // Return cached URL parse
1027
- return parsed;
1028
- }
1029
-
1030
- // Parse the URL
1031
- parsed = fastparse(url);
1032
- parsed._raw = url;
1033
- return req._parsedUrl = parsed;
1034
- }
1035
- ;
1036
-
1037
- /**
1038
- * Parse the `req` original url with fallback and memoization.
1039
- *
1040
- * @param {ServerRequest} req
1041
- * @return {Object}
1042
- * @public
1043
- */
1044
-
1045
- function originalurl(req) {
1046
- var url = req.originalUrl;
1047
- if (typeof url !== 'string') {
1048
- // Fallback
1049
- return parseurl(req);
1050
- }
1051
- var parsed = req._parsedOriginalUrl;
1052
- if (fresh(url, parsed)) {
1053
- // Return cached URL parse
1054
- return parsed;
1055
- }
1056
-
1057
- // Parse the URL
1058
- parsed = fastparse(url);
1059
- parsed._raw = url;
1060
- return req._parsedOriginalUrl = parsed;
1061
- }
1062
- ;
1063
-
1064
- /**
1065
- * Parse the `str` url with fast-path short-cut.
1066
- *
1067
- * @param {string} str
1068
- * @return {Object}
1069
- * @private
1070
- */
1071
-
1072
- function fastparse(str) {
1073
- if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
1074
- return parse(str);
1075
- }
1076
- var pathname = str;
1077
- var query = null;
1078
- var search = null;
1079
-
1080
- // This takes the regexp from https://github.com/joyent/node/pull/7878
1081
- // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/
1082
- // And unrolls it into a for loop
1083
- for (var i = 1; i < str.length; i++) {
1084
- switch (str.charCodeAt(i)) {
1085
- case 0x3f:
1086
- /* ? */
1087
- if (search === null) {
1088
- pathname = str.substring(0, i);
1089
- query = str.substring(i + 1);
1090
- search = str.substring(i);
1091
- }
1092
- break;
1093
- case 0x09: /* \t */
1094
- case 0x0a: /* \n */
1095
- case 0x0c: /* \f */
1096
- case 0x0d: /* \r */
1097
- case 0x20: /* */
1098
- case 0x23: /* # */
1099
- case 0xa0:
1100
- case 0xfeff:
1101
- return parse(str);
1102
- }
1103
- }
1104
- var url = Url !== undefined ? new Url() : {};
1105
- url.path = str;
1106
- url.href = str;
1107
- url.pathname = pathname;
1108
- if (search !== null) {
1109
- url.query = query;
1110
- url.search = search;
1111
- }
1112
- return url;
1113
- }
1114
-
1115
- /**
1116
- * Determine if parsed is still fresh for url.
1117
- *
1118
- * @param {string} url
1119
- * @param {object} parsedUrl
1120
- * @return {boolean}
1121
- * @private
1122
- */
1123
-
1124
- function fresh(url, parsedUrl) {
1125
- return typeof parsedUrl === 'object' && parsedUrl !== null && (Url === undefined || parsedUrl instanceof Url) && parsedUrl._raw === url;
1126
- }
1127
-
1128
- /***/ }),
1129
-
1130
- /***/ 268:
1131
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1132
-
1133
- // 集中导出常用方法
1134
- module.exports = {
1135
- connect: __webpack_require__(958)
1136
- // serveStatic: require('serve-static')
1137
- };
1138
-
1139
- /***/ }),
1140
-
1141
- /***/ 278:
1142
- /***/ ((module) => {
1143
-
1144
- "use strict";
1145
- module.exports = require("net");
1146
-
1147
- /***/ }),
1148
-
1149
- /***/ 289:
1150
- /***/ ((module) => {
1151
-
1152
- "use strict";
1153
- /*!
1154
- * ee-first
1155
- * Copyright(c) 2014 Jonathan Ong
1156
- * MIT Licensed
1157
- */
1158
-
1159
-
1160
-
1161
- /**
1162
- * Module exports.
1163
- * @public
1164
- */
1165
- module.exports = first;
1166
-
1167
- /**
1168
- * Get the first event in a set of event emitters and event pairs.
1169
- *
1170
- * @param {array} stuff
1171
- * @param {function} done
1172
- * @public
1173
- */
1174
-
1175
- function first(stuff, done) {
1176
- if (!Array.isArray(stuff)) throw new TypeError('arg must be an array of [ee, events...] arrays');
1177
- var cleanups = [];
1178
- for (var i = 0; i < stuff.length; i++) {
1179
- var arr = stuff[i];
1180
- if (!Array.isArray(arr) || arr.length < 2) throw new TypeError('each array member must be [ee, events...]');
1181
- var ee = arr[0];
1182
- for (var j = 1; j < arr.length; j++) {
1183
- var event = arr[j];
1184
- var fn = listener(event, callback);
1185
-
1186
- // listen to the event
1187
- ee.on(event, fn);
1188
- // push this listener to the list of cleanups
1189
- cleanups.push({
1190
- ee: ee,
1191
- event: event,
1192
- fn: fn
1193
- });
1194
- }
1195
- }
1196
- function callback() {
1197
- cleanup();
1198
- done.apply(null, arguments);
1199
- }
1200
- function cleanup() {
1201
- var x;
1202
- for (var i = 0; i < cleanups.length; i++) {
1203
- x = cleanups[i];
1204
- x.ee.removeListener(x.event, x.fn);
1205
- }
1206
- }
1207
- function thunk(fn) {
1208
- done = fn;
1209
- }
1210
- thunk.cancel = cleanup;
1211
- return thunk;
1212
- }
1213
-
1214
- /**
1215
- * Create the event listener.
1216
- * @private
1217
- */
1218
-
1219
- function listener(event, done) {
1220
- return function onevent(arg1) {
1221
- var args = new Array(arguments.length);
1222
- var ee = this;
1223
- var err = event === 'error' ? arg1 : null;
1224
-
1225
- // copy args to prevent arguments escaping scope
1226
- for (var i = 0; i < args.length; i++) {
1227
- args[i] = arguments[i];
1228
- }
1229
- done(err, ee, event, args);
1230
- };
1231
- }
1232
-
1233
- /***/ }),
1234
-
1235
- /***/ 415:
1236
- /***/ ((module) => {
1237
-
1238
- "use strict";
1239
- /*!
1240
- * escape-html
1241
- * Copyright(c) 2012-2013 TJ Holowaychuk
1242
- * Copyright(c) 2015 Andreas Lubbe
1243
- * Copyright(c) 2015 Tiancheng "Timothy" Gu
1244
- * MIT Licensed
1245
- */
1246
-
1247
-
1248
-
1249
- /**
1250
- * Module variables.
1251
- * @private
1252
- */
1253
- var matchHtmlRegExp = /["'&<>]/;
1254
-
1255
- /**
1256
- * Module exports.
1257
- * @public
1258
- */
1259
-
1260
- module.exports = escapeHtml;
1261
-
1262
- /**
1263
- * Escape special characters in the given string of html.
1264
- *
1265
- * @param {string} string The string to escape for inserting into HTML
1266
- * @return {string}
1267
- * @public
1268
- */
1269
-
1270
- function escapeHtml(string) {
1271
- var str = '' + string;
1272
- var match = matchHtmlRegExp.exec(str);
1273
- if (!match) {
1274
- return str;
1275
- }
1276
- var escape;
1277
- var html = '';
1278
- var index = 0;
1279
- var lastIndex = 0;
1280
- for (index = match.index; index < str.length; index++) {
1281
- switch (str.charCodeAt(index)) {
1282
- case 34:
1283
- // "
1284
- escape = '&quot;';
1285
- break;
1286
- case 38:
1287
- // &
1288
- escape = '&amp;';
1289
- break;
1290
- case 39:
1291
- // '
1292
- escape = '&#39;';
1293
- break;
1294
- case 60:
1295
- // <
1296
- escape = '&lt;';
1297
- break;
1298
- case 62:
1299
- // >
1300
- escape = '&gt;';
1301
- break;
1302
- default:
1303
- continue;
1304
- }
1305
- if (lastIndex !== index) {
1306
- html += str.substring(lastIndex, index);
1307
- }
1308
- lastIndex = index + 1;
1309
- html += escape;
1310
- }
1311
- return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
1312
- }
1313
-
1314
- /***/ }),
1315
-
1316
- /***/ 434:
1317
- /***/ ((module) => {
1318
-
1319
- "use strict";
1320
- module.exports = require("events");
1321
-
1322
- /***/ }),
1323
-
1324
- /***/ 471:
1325
- /***/ ((module) => {
1326
-
1327
- "use strict";
1328
- /*!
1329
- * unpipe
1330
- * Copyright(c) 2015 Douglas Christopher Wilson
1331
- * MIT Licensed
1332
- */
1333
-
1334
-
1335
-
1336
- /**
1337
- * Module exports.
1338
- * @public
1339
- */
1340
- module.exports = unpipe;
1341
-
1342
- /**
1343
- * Determine if there are Node.js pipe-like data listeners.
1344
- * @private
1345
- */
1346
-
1347
- function hasPipeDataListeners(stream) {
1348
- var listeners = stream.listeners('data');
1349
- for (var i = 0; i < listeners.length; i++) {
1350
- if (listeners[i].name === 'ondata') {
1351
- return true;
1352
- }
1353
- }
1354
- return false;
1355
- }
1356
-
1357
- /**
1358
- * Unpipe a stream from all destinations.
1359
- *
1360
- * @param {object} stream
1361
- * @public
1362
- */
1363
-
1364
- function unpipe(stream) {
1365
- if (!stream) {
1366
- throw new TypeError('argument stream is required');
1367
- }
1368
- if (typeof stream.unpipe === 'function') {
1369
- // new-style
1370
- stream.unpipe();
1371
- return;
1372
- }
1373
-
1374
- // Node.js 0.8 hack
1375
- if (!hasPipeDataListeners(stream)) {
1376
- return;
1377
- }
1378
- var listener;
1379
- var listeners = stream.listeners('close');
1380
- for (var i = 0; i < listeners.length; i++) {
1381
- listener = listeners[i];
1382
- if (listener.name !== 'cleanup' && listener.name !== 'onclose') {
1383
- continue;
1384
- }
1385
-
1386
- // invoke the listener
1387
- listener.call(stream);
1388
- }
1389
- }
1390
-
1391
- /***/ }),
1392
-
1393
- /***/ 577:
1394
- /***/ ((module, exports, __webpack_require__) => {
1395
-
1396
- /**
1397
- * This is the common logic for both the Node.js and web browser
1398
- * implementations of `debug()`.
1399
- *
1400
- * Expose `debug()` as the module.
1401
- */
1402
-
1403
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
1404
- exports.coerce = coerce;
1405
- exports.disable = disable;
1406
- exports.enable = enable;
1407
- exports.enabled = enabled;
1408
- exports.humanize = __webpack_require__(216);
1409
-
1410
- /**
1411
- * The currently active debug mode names, and names to skip.
1412
- */
1413
-
1414
- exports.names = [];
1415
- exports.skips = [];
1416
-
1417
- /**
1418
- * Map of special "%n" handling functions, for the debug "format" argument.
1419
- *
1420
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
1421
- */
1422
-
1423
- exports.formatters = {};
1424
-
1425
- /**
1426
- * Previous log timestamp.
1427
- */
1428
-
1429
- var prevTime;
1430
-
1431
- /**
1432
- * Select a color.
1433
- * @param {String} namespace
1434
- * @return {Number}
1435
- * @api private
1436
- */
1437
-
1438
- function selectColor(namespace) {
1439
- var hash = 0,
1440
- i;
1441
- for (i in namespace) {
1442
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
1443
- hash |= 0; // Convert to 32bit integer
1444
- }
1445
- return exports.colors[Math.abs(hash) % exports.colors.length];
1446
- }
1447
-
1448
- /**
1449
- * Create a debugger with the given `namespace`.
1450
- *
1451
- * @param {String} namespace
1452
- * @return {Function}
1453
- * @api public
1454
- */
1455
-
1456
- function createDebug(namespace) {
1457
- function debug() {
1458
- // disabled?
1459
- if (!debug.enabled) return;
1460
- var self = debug;
1461
-
1462
- // set `diff` timestamp
1463
- var curr = +new Date();
1464
- var ms = curr - (prevTime || curr);
1465
- self.diff = ms;
1466
- self.prev = prevTime;
1467
- self.curr = curr;
1468
- prevTime = curr;
1469
-
1470
- // turn the `arguments` into a proper Array
1471
- var args = new Array(arguments.length);
1472
- for (var i = 0; i < args.length; i++) {
1473
- args[i] = arguments[i];
1474
- }
1475
- args[0] = exports.coerce(args[0]);
1476
- if ('string' !== typeof args[0]) {
1477
- // anything else let's inspect with %O
1478
- args.unshift('%O');
1479
- }
1480
-
1481
- // apply any `formatters` transformations
1482
- var index = 0;
1483
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
1484
- // if we encounter an escaped % then don't increase the array index
1485
- if (match === '%%') return match;
1486
- index++;
1487
- var formatter = exports.formatters[format];
1488
- if ('function' === typeof formatter) {
1489
- var val = args[index];
1490
- match = formatter.call(self, val);
1491
-
1492
- // now we need to remove `args[index]` since it's inlined in the `format`
1493
- args.splice(index, 1);
1494
- index--;
1495
- }
1496
- return match;
1497
- });
1498
-
1499
- // apply env-specific formatting (colors, etc.)
1500
- exports.formatArgs.call(self, args);
1501
- var logFn = debug.log || exports.log || console.log.bind(console);
1502
- logFn.apply(self, args);
1503
- }
1504
- debug.namespace = namespace;
1505
- debug.enabled = exports.enabled(namespace);
1506
- debug.useColors = exports.useColors();
1507
- debug.color = selectColor(namespace);
1508
-
1509
- // env-specific initialization logic for debug instances
1510
- if ('function' === typeof exports.init) {
1511
- exports.init(debug);
1512
- }
1513
- return debug;
1514
- }
1515
-
1516
- /**
1517
- * Enables a debug mode by namespaces. This can include modes
1518
- * separated by a colon and wildcards.
1519
- *
1520
- * @param {String} namespaces
1521
- * @api public
1522
- */
1523
-
1524
- function enable(namespaces) {
1525
- exports.save(namespaces);
1526
- exports.names = [];
1527
- exports.skips = [];
1528
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
1529
- var len = split.length;
1530
- for (var i = 0; i < len; i++) {
1531
- if (!split[i]) continue; // ignore empty strings
1532
- namespaces = split[i].replace(/\*/g, '.*?');
1533
- if (namespaces[0] === '-') {
1534
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
1535
- } else {
1536
- exports.names.push(new RegExp('^' + namespaces + '$'));
1537
- }
1538
- }
1539
- }
1540
-
1541
- /**
1542
- * Disable debug output.
1543
- *
1544
- * @api public
1545
- */
1546
-
1547
- function disable() {
1548
- exports.enable('');
1549
- }
1550
-
1551
- /**
1552
- * Returns true if the given mode name is enabled, false otherwise.
1553
- *
1554
- * @param {String} name
1555
- * @return {Boolean}
1556
- * @api public
1557
- */
1558
-
1559
- function enabled(name) {
1560
- var i, len;
1561
- for (i = 0, len = exports.skips.length; i < len; i++) {
1562
- if (exports.skips[i].test(name)) {
1563
- return false;
1564
- }
1565
- }
1566
- for (i = 0, len = exports.names.length; i < len; i++) {
1567
- if (exports.names[i].test(name)) {
1568
- return true;
1569
- }
1570
- }
1571
- return false;
1572
- }
1573
-
1574
- /**
1575
- * Coerce `val`.
1576
- *
1577
- * @param {Mixed} val
1578
- * @return {Mixed}
1579
- * @api private
1580
- */
1581
-
1582
- function coerce(val) {
1583
- if (val instanceof Error) return val.stack || val.message;
1584
- return val;
1585
- }
1586
-
1587
- /***/ }),
1588
-
1589
- /***/ 578:
1590
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1591
-
1592
- "use strict";
1593
- /*!
1594
- * on-finished
1595
- * Copyright(c) 2013 Jonathan Ong
1596
- * Copyright(c) 2014 Douglas Christopher Wilson
1597
- * MIT Licensed
1598
- */
1599
-
1600
-
1601
-
1602
- /**
1603
- * Module exports.
1604
- * @public
1605
- */
1606
- module.exports = onFinished;
1607
- module.exports.isFinished = isFinished;
1608
-
1609
- /**
1610
- * Module dependencies.
1611
- * @private
1612
- */
1613
-
1614
- var first = __webpack_require__(289);
1615
-
1616
- /**
1617
- * Variables.
1618
- * @private
1619
- */
1620
-
1621
- /* istanbul ignore next */
1622
- var defer = typeof setImmediate === 'function' ? setImmediate : function (fn) {
1623
- process.nextTick(fn.bind.apply(fn, arguments));
1624
- };
1625
-
1626
- /**
1627
- * Invoke callback when the response has finished, useful for
1628
- * cleaning up resources afterwards.
1629
- *
1630
- * @param {object} msg
1631
- * @param {function} listener
1632
- * @return {object}
1633
- * @public
1634
- */
1635
-
1636
- function onFinished(msg, listener) {
1637
- if (isFinished(msg) !== false) {
1638
- defer(listener, null, msg);
1639
- return msg;
1640
- }
1641
-
1642
- // attach the listener to the message
1643
- attachListener(msg, listener);
1644
- return msg;
1645
- }
1646
-
1647
- /**
1648
- * Determine if message is already finished.
1649
- *
1650
- * @param {object} msg
1651
- * @return {boolean}
1652
- * @public
1653
- */
1654
-
1655
- function isFinished(msg) {
1656
- var socket = msg.socket;
1657
- if (typeof msg.finished === 'boolean') {
1658
- // OutgoingMessage
1659
- return Boolean(msg.finished || socket && !socket.writable);
1660
- }
1661
- if (typeof msg.complete === 'boolean') {
1662
- // IncomingMessage
1663
- return Boolean(msg.upgrade || !socket || !socket.readable || msg.complete && !msg.readable);
1664
- }
1665
-
1666
- // don't know
1667
- return undefined;
1668
- }
1669
-
1670
- /**
1671
- * Attach a finished listener to the message.
1672
- *
1673
- * @param {object} msg
1674
- * @param {function} callback
1675
- * @private
1676
- */
1677
-
1678
- function attachFinishedListener(msg, callback) {
1679
- var eeMsg;
1680
- var eeSocket;
1681
- var finished = false;
1682
- function onFinish(error) {
1683
- eeMsg.cancel();
1684
- eeSocket.cancel();
1685
- finished = true;
1686
- callback(error);
1687
- }
1688
-
1689
- // finished on first message event
1690
- eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish);
1691
- function onSocket(socket) {
1692
- // remove listener
1693
- msg.removeListener('socket', onSocket);
1694
- if (finished) return;
1695
- if (eeMsg !== eeSocket) return;
1696
-
1697
- // finished on first socket event
1698
- eeSocket = first([[socket, 'error', 'close']], onFinish);
1699
- }
1700
- if (msg.socket) {
1701
- // socket already assigned
1702
- onSocket(msg.socket);
1703
- return;
1704
- }
1705
-
1706
- // wait for socket to be assigned
1707
- msg.on('socket', onSocket);
1708
- if (msg.socket === undefined) {
1709
- // node.js 0.8 patch
1710
- patchAssignSocket(msg, onSocket);
1711
- }
1712
- }
1713
-
1714
- /**
1715
- * Attach the listener to the message.
1716
- *
1717
- * @param {object} msg
1718
- * @return {function}
1719
- * @private
1720
- */
1721
-
1722
- function attachListener(msg, listener) {
1723
- var attached = msg.__onFinished;
1724
-
1725
- // create a private single listener with queue
1726
- if (!attached || !attached.queue) {
1727
- attached = msg.__onFinished = createListener(msg);
1728
- attachFinishedListener(msg, attached);
1729
- }
1730
- attached.queue.push(listener);
1731
- }
1732
-
1733
- /**
1734
- * Create listener on message.
1735
- *
1736
- * @param {object} msg
1737
- * @return {function}
1738
- * @private
1739
- */
1740
-
1741
- function createListener(msg) {
1742
- function listener(err) {
1743
- if (msg.__onFinished === listener) msg.__onFinished = null;
1744
- if (!listener.queue) return;
1745
- var queue = listener.queue;
1746
- listener.queue = null;
1747
- for (var i = 0; i < queue.length; i++) {
1748
- queue[i](err, msg);
1749
- }
1750
- }
1751
- listener.queue = [];
1752
- return listener;
1753
- }
1754
-
1755
- /**
1756
- * Patch ServerResponse.prototype.assignSocket for node.js 0.8.
1757
- *
1758
- * @param {ServerResponse} res
1759
- * @param {function} callback
1760
- * @private
1761
- */
1762
-
1763
- function patchAssignSocket(res, callback) {
1764
- var assignSocket = res.assignSocket;
1765
- if (typeof assignSocket !== 'function') return;
1766
-
1767
- // res.on('socket', callback) is broken in 0.8
1768
- res.assignSocket = function _assignSocket(socket) {
1769
- assignSocket.call(this, socket);
1770
- callback(socket);
1771
- };
1772
- }
1773
-
1774
- /***/ }),
1775
-
1776
- /***/ 611:
1777
- /***/ ((module) => {
1778
-
1779
- "use strict";
1780
- module.exports = require("http");
1781
-
1782
- /***/ }),
1783
-
1784
- /***/ 637:
1785
- /***/ ((module) => {
1786
-
1787
- "use strict";
1788
- module.exports = require("tty");
1789
-
1790
- /***/ }),
1791
-
1792
- /***/ 662:
1793
- /***/ ((module) => {
1794
-
1795
- "use strict";
1796
- module.exports = /*#__PURE__*/JSON.parse('{"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","306":"(Unused)","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I\'m a teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Unordered Collection","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}');
1797
-
1798
- /***/ }),
1799
-
1800
- /***/ 664:
1801
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1802
-
1803
- "use strict";
1804
- /*!
1805
- * finalhandler
1806
- * Copyright(c) 2014-2017 Douglas Christopher Wilson
1807
- * MIT Licensed
1808
- */
1809
-
1810
-
1811
-
1812
- /**
1813
- * Module dependencies.
1814
- * @private
1815
- */
1816
- var debug = __webpack_require__(46)('finalhandler');
1817
- var encodeUrl = __webpack_require__(987);
1818
- var escapeHtml = __webpack_require__(415);
1819
- var onFinished = __webpack_require__(578);
1820
- var parseUrl = __webpack_require__(252);
1821
- var statuses = __webpack_require__(778);
1822
- var unpipe = __webpack_require__(471);
1823
-
1824
- /**
1825
- * Module variables.
1826
- * @private
1827
- */
1828
-
1829
- var DOUBLE_SPACE_REGEXP = /\x20{2}/g;
1830
- var NEWLINE_REGEXP = /\n/g;
1831
-
1832
- /* istanbul ignore next */
1833
- var defer = typeof setImmediate === 'function' ? setImmediate : function (fn) {
1834
- process.nextTick(fn.bind.apply(fn, arguments));
1835
- };
1836
- var isFinished = onFinished.isFinished;
1837
-
1838
- /**
1839
- * Create a minimal HTML document.
1840
- *
1841
- * @param {string} message
1842
- * @private
1843
- */
1844
-
1845
- function createHtmlDocument(message) {
1846
- var body = escapeHtml(message).replace(NEWLINE_REGEXP, '<br>').replace(DOUBLE_SPACE_REGEXP, ' &nbsp;');
1847
- return '<!DOCTYPE html>\n' + '<html lang="en">\n' + '<head>\n' + '<meta charset="utf-8">\n' + '<title>Error</title>\n' + '</head>\n' + '<body>\n' + '<pre>' + body + '</pre>\n' + '</body>\n' + '</html>\n';
1848
- }
1849
-
1850
- /**
1851
- * Module exports.
1852
- * @public
1853
- */
1854
-
1855
- module.exports = finalhandler;
1856
-
1857
- /**
1858
- * Create a function to handle the final response.
1859
- *
1860
- * @param {Request} req
1861
- * @param {Response} res
1862
- * @param {Object} [options]
1863
- * @return {Function}
1864
- * @public
1865
- */
1866
-
1867
- function finalhandler(req, res, options) {
1868
- var opts = options || {};
1869
-
1870
- // get environment
1871
- var env = opts.env || "production" || 0;
1872
-
1873
- // get error callback
1874
- var onerror = opts.onerror;
1875
- return function (err) {
1876
- var headers;
1877
- var msg;
1878
- var status;
1879
-
1880
- // ignore 404 on in-flight response
1881
- if (!err && headersSent(res)) {
1882
- debug('cannot 404 after headers sent');
1883
- return;
1884
- }
1885
-
1886
- // unhandled error
1887
- if (err) {
1888
- // respect status code from error
1889
- status = getErrorStatusCode(err);
1890
- if (status === undefined) {
1891
- // fallback to status code on response
1892
- status = getResponseStatusCode(res);
1893
- } else {
1894
- // respect headers from error
1895
- headers = getErrorHeaders(err);
1896
- }
1897
-
1898
- // get error message
1899
- msg = getErrorMessage(err, status, env);
1900
- } else {
1901
- // not found
1902
- status = 404;
1903
- msg = 'Cannot ' + req.method + ' ' + encodeUrl(getResourceName(req));
1904
- }
1905
- debug('default %s', status);
1906
-
1907
- // schedule onerror callback
1908
- if (err && onerror) {
1909
- defer(onerror, err, req, res);
1910
- }
1911
-
1912
- // cannot actually respond
1913
- if (headersSent(res)) {
1914
- debug('cannot %d after headers sent', status);
1915
- req.socket.destroy();
1916
- return;
1917
- }
1918
-
1919
- // send response
1920
- send(req, res, status, headers, msg);
1921
- };
1922
- }
1923
-
1924
- /**
1925
- * Get headers from Error object.
1926
- *
1927
- * @param {Error} err
1928
- * @return {object}
1929
- * @private
1930
- */
1931
-
1932
- function getErrorHeaders(err) {
1933
- if (!err.headers || typeof err.headers !== 'object') {
1934
- return undefined;
1935
- }
1936
- var headers = Object.create(null);
1937
- var keys = Object.keys(err.headers);
1938
- for (var i = 0; i < keys.length; i++) {
1939
- var key = keys[i];
1940
- headers[key] = err.headers[key];
1941
- }
1942
- return headers;
1943
- }
1944
-
1945
- /**
1946
- * Get message from Error object, fallback to status message.
1947
- *
1948
- * @param {Error} err
1949
- * @param {number} status
1950
- * @param {string} env
1951
- * @return {string}
1952
- * @private
1953
- */
1954
-
1955
- function getErrorMessage(err, status, env) {
1956
- var msg;
1957
- if (env !== 'production') {
1958
- // use err.stack, which typically includes err.message
1959
- msg = err.stack;
1960
-
1961
- // fallback to err.toString() when possible
1962
- if (!msg && typeof err.toString === 'function') {
1963
- msg = err.toString();
1964
- }
1965
- }
1966
- return msg || statuses[status];
1967
- }
1968
-
1969
- /**
1970
- * Get status code from Error object.
1971
- *
1972
- * @param {Error} err
1973
- * @return {number}
1974
- * @private
1975
- */
1976
-
1977
- function getErrorStatusCode(err) {
1978
- // check err.status
1979
- if (typeof err.status === 'number' && err.status >= 400 && err.status < 600) {
1980
- return err.status;
1981
- }
1982
-
1983
- // check err.statusCode
1984
- if (typeof err.statusCode === 'number' && err.statusCode >= 400 && err.statusCode < 600) {
1985
- return err.statusCode;
1986
- }
1987
- return undefined;
1988
- }
1989
-
1990
- /**
1991
- * Get resource name for the request.
1992
- *
1993
- * This is typically just the original pathname of the request
1994
- * but will fallback to "resource" is that cannot be determined.
1995
- *
1996
- * @param {IncomingMessage} req
1997
- * @return {string}
1998
- * @private
1999
- */
2000
-
2001
- function getResourceName(req) {
2002
- try {
2003
- return parseUrl.original(req).pathname;
2004
- } catch (e) {
2005
- return 'resource';
2006
- }
2007
- }
2008
-
2009
- /**
2010
- * Get status code from response.
2011
- *
2012
- * @param {OutgoingMessage} res
2013
- * @return {number}
2014
- * @private
2015
- */
2016
-
2017
- function getResponseStatusCode(res) {
2018
- var status = res.statusCode;
2019
-
2020
- // default status code to 500 if outside valid range
2021
- if (typeof status !== 'number' || status < 400 || status > 599) {
2022
- status = 500;
2023
- }
2024
- return status;
2025
- }
2026
-
2027
- /**
2028
- * Determine if the response headers have been sent.
2029
- *
2030
- * @param {object} res
2031
- * @returns {boolean}
2032
- * @private
2033
- */
2034
-
2035
- function headersSent(res) {
2036
- return typeof res.headersSent !== 'boolean' ? Boolean(res._header) : res.headersSent;
2037
- }
2038
-
2039
- /**
2040
- * Send response.
2041
- *
2042
- * @param {IncomingMessage} req
2043
- * @param {OutgoingMessage} res
2044
- * @param {number} status
2045
- * @param {object} headers
2046
- * @param {string} message
2047
- * @private
2048
- */
2049
-
2050
- function send(req, res, status, headers, message) {
2051
- function write() {
2052
- // response body
2053
- var body = createHtmlDocument(message);
2054
-
2055
- // response status
2056
- res.statusCode = status;
2057
- res.statusMessage = statuses[status];
2058
-
2059
- // response headers
2060
- setHeaders(res, headers);
2061
-
2062
- // security headers
2063
- res.setHeader('Content-Security-Policy', "default-src 'none'");
2064
- res.setHeader('X-Content-Type-Options', 'nosniff');
2065
-
2066
- // standard headers
2067
- res.setHeader('Content-Type', 'text/html; charset=utf-8');
2068
- res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'));
2069
- if (req.method === 'HEAD') {
2070
- res.end();
2071
- return;
2072
- }
2073
- res.end(body, 'utf8');
2074
- }
2075
- if (isFinished(req)) {
2076
- write();
2077
- return;
2078
- }
2079
-
2080
- // unpipe everything from the request
2081
- unpipe(req);
2082
-
2083
- // flush the request
2084
- onFinished(req, write);
2085
- req.resume();
2086
- }
2087
-
2088
- /**
2089
- * Set response headers from an object.
2090
- *
2091
- * @param {OutgoingMessage} res
2092
- * @param {object} headers
2093
- * @private
2094
- */
2095
-
2096
- function setHeaders(res, headers) {
2097
- if (!headers) {
2098
- return;
2099
- }
2100
- var keys = Object.keys(headers);
2101
- for (var i = 0; i < keys.length; i++) {
2102
- var key = keys[i];
2103
- res.setHeader(key, headers[key]);
2104
- }
2105
- }
2106
-
2107
- /***/ }),
2108
-
2109
- /***/ 694:
2110
- /***/ ((module) => {
2111
-
2112
- /**
2113
- * Helpers.
2114
- */
2115
-
2116
- var s = 1000;
2117
- var m = s * 60;
2118
- var h = m * 60;
2119
- var d = h * 24;
2120
- var y = d * 365.25;
2121
-
2122
- /**
2123
- * Parse or format the given `val`.
2124
- *
2125
- * Options:
2126
- *
2127
- * - `long` verbose formatting [false]
2128
- *
2129
- * @param {String|Number} val
2130
- * @param {Object} [options]
2131
- * @throws {Error} throw an error if val is not a non-empty string or a number
2132
- * @return {String|Number}
2133
- * @api public
2134
- */
2135
-
2136
- module.exports = function (val, options) {
2137
- options = options || {};
2138
- var type = typeof val;
2139
- if (type === 'string' && val.length > 0) {
2140
- return parse(val);
2141
- } else if (type === 'number' && isNaN(val) === false) {
2142
- return options.long ? fmtLong(val) : fmtShort(val);
2143
- }
2144
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
2145
- };
2146
-
2147
- /**
2148
- * Parse the given `str` and return milliseconds.
2149
- *
2150
- * @param {String} str
2151
- * @return {Number}
2152
- * @api private
2153
- */
2154
-
2155
- function parse(str) {
2156
- str = String(str);
2157
- if (str.length > 100) {
2158
- return;
2159
- }
2160
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
2161
- if (!match) {
2162
- return;
2163
- }
2164
- var n = parseFloat(match[1]);
2165
- var type = (match[2] || 'ms').toLowerCase();
2166
- switch (type) {
2167
- case 'years':
2168
- case 'year':
2169
- case 'yrs':
2170
- case 'yr':
2171
- case 'y':
2172
- return n * y;
2173
- case 'days':
2174
- case 'day':
2175
- case 'd':
2176
- return n * d;
2177
- case 'hours':
2178
- case 'hour':
2179
- case 'hrs':
2180
- case 'hr':
2181
- case 'h':
2182
- return n * h;
2183
- case 'minutes':
2184
- case 'minute':
2185
- case 'mins':
2186
- case 'min':
2187
- case 'm':
2188
- return n * m;
2189
- case 'seconds':
2190
- case 'second':
2191
- case 'secs':
2192
- case 'sec':
2193
- case 's':
2194
- return n * s;
2195
- case 'milliseconds':
2196
- case 'millisecond':
2197
- case 'msecs':
2198
- case 'msec':
2199
- case 'ms':
2200
- return n;
2201
- default:
2202
- return undefined;
2203
- }
2204
- }
2205
-
2206
- /**
2207
- * Short format for `ms`.
2208
- *
2209
- * @param {Number} ms
2210
- * @return {String}
2211
- * @api private
2212
- */
2213
-
2214
- function fmtShort(ms) {
2215
- if (ms >= d) {
2216
- return Math.round(ms / d) + 'd';
2217
- }
2218
- if (ms >= h) {
2219
- return Math.round(ms / h) + 'h';
2220
- }
2221
- if (ms >= m) {
2222
- return Math.round(ms / m) + 'm';
2223
- }
2224
- if (ms >= s) {
2225
- return Math.round(ms / s) + 's';
2226
- }
2227
- return ms + 'ms';
2228
- }
2229
-
2230
- /**
2231
- * Long format for `ms`.
2232
- *
2233
- * @param {Number} ms
2234
- * @return {String}
2235
- * @api private
2236
- */
2237
-
2238
- function fmtLong(ms) {
2239
- return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
2240
- }
2241
-
2242
- /**
2243
- * Pluralization helper.
2244
- */
2245
-
2246
- function plural(ms, n, name) {
2247
- if (ms < n) {
2248
- return;
2249
- }
2250
- if (ms < n * 1.5) {
2251
- return Math.floor(ms / n) + ' ' + name;
2252
- }
2253
- return Math.ceil(ms / n) + ' ' + name + 's';
2254
- }
2255
-
2256
- /***/ }),
2257
-
2258
- /***/ 700:
2259
- /***/ ((module, exports, __webpack_require__) => {
2260
-
2261
- /**
2262
- * Module dependencies.
2263
- */
2264
-
2265
- var tty = __webpack_require__(637);
2266
- var util = __webpack_require__(23);
2267
-
2268
- /**
2269
- * This is the Node.js implementation of `debug()`.
2270
- *
2271
- * Expose `debug()` as the module.
2272
- */
2273
-
2274
- exports = module.exports = __webpack_require__(577);
2275
- exports.init = init;
2276
- exports.log = log;
2277
- exports.formatArgs = formatArgs;
2278
- exports.save = save;
2279
- exports.load = load;
2280
- exports.useColors = useColors;
2281
-
2282
- /**
2283
- * Colors.
2284
- */
2285
-
2286
- exports.colors = [6, 2, 3, 4, 5, 1];
2287
-
2288
- /**
2289
- * Build up the default `inspectOpts` object from the environment variables.
2290
- *
2291
- * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
2292
- */
2293
-
2294
- exports.inspectOpts = Object.keys(process.env).filter(function (key) {
2295
- return /^debug_/i.test(key);
2296
- }).reduce(function (obj, key) {
2297
- // camel-case
2298
- var prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, function (_, k) {
2299
- return k.toUpperCase();
2300
- });
2301
-
2302
- // coerce string value into JS value
2303
- var val = process.env[key];
2304
- if (/^(yes|on|true|enabled)$/i.test(val)) val = true;else if (/^(no|off|false|disabled)$/i.test(val)) val = false;else if (val === 'null') val = null;else val = Number(val);
2305
- obj[prop] = val;
2306
- return obj;
2307
- }, {});
2308
-
2309
- /**
2310
- * The file descriptor to write the `debug()` calls to.
2311
- * Set the `DEBUG_FD` env variable to override with another value. i.e.:
2312
- *
2313
- * $ DEBUG_FD=3 node script.js 3>debug.log
2314
- */
2315
-
2316
- var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
2317
- if (1 !== fd && 2 !== fd) {
2318
- 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)')();
2319
- }
2320
- var stream = 1 === fd ? process.stdout : 2 === fd ? process.stderr : createWritableStdioStream(fd);
2321
-
2322
- /**
2323
- * Is stdout a TTY? Colored output is enabled when `true`.
2324
- */
2325
-
2326
- function useColors() {
2327
- return 'colors' in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(fd);
2328
- }
2329
-
2330
- /**
2331
- * Map %o to `util.inspect()`, all on a single line.
2332
- */
2333
-
2334
- exports.formatters.o = function (v) {
2335
- this.inspectOpts.colors = this.useColors;
2336
- return util.inspect(v, this.inspectOpts).split('\n').map(function (str) {
2337
- return str.trim();
2338
- }).join(' ');
2339
- };
2340
-
2341
- /**
2342
- * Map %o to `util.inspect()`, allowing multiple lines if needed.
2343
- */
2344
-
2345
- exports.formatters.O = function (v) {
2346
- this.inspectOpts.colors = this.useColors;
2347
- return util.inspect(v, this.inspectOpts);
2348
- };
2349
-
2350
- /**
2351
- * Adds ANSI color escape codes if enabled.
2352
- *
2353
- * @api public
2354
- */
2355
-
2356
- function formatArgs(args) {
2357
- var name = this.namespace;
2358
- var useColors = this.useColors;
2359
- if (useColors) {
2360
- var c = this.color;
2361
- var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
2362
- args[0] = prefix + args[0].split('\n').join('\n' + prefix);
2363
- args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
2364
- } else {
2365
- args[0] = new Date().toUTCString() + ' ' + name + ' ' + args[0];
2366
- }
2367
- }
2368
-
2369
- /**
2370
- * Invokes `util.format()` with the specified arguments and writes to `stream`.
2371
- */
2372
-
2373
- function log() {
2374
- return stream.write(util.format.apply(util, arguments) + '\n');
2375
- }
2376
-
2377
- /**
2378
- * Save `namespaces`.
2379
- *
2380
- * @param {String} namespaces
2381
- * @api private
2382
- */
2383
-
2384
- function save(namespaces) {
2385
- if (null == namespaces) {
2386
- // If you set a process.env field to null or undefined, it gets cast to the
2387
- // string 'null' or 'undefined'. Just delete instead.
2388
- delete process.env.DEBUG;
2389
- } else {
2390
- process.env.DEBUG = namespaces;
2391
- }
2392
- }
2393
-
2394
- /**
2395
- * Load `namespaces`.
2396
- *
2397
- * @return {String} returns the previously persisted debug modes
2398
- * @api private
2399
- */
2400
-
2401
- function load() {
2402
- return process.env.DEBUG;
2403
- }
2404
-
2405
- /**
2406
- * Copied from `node/src/node.js`.
2407
- *
2408
- * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
2409
- * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
2410
- */
2411
-
2412
- function createWritableStdioStream(fd) {
2413
- var stream;
2414
- var tty_wrap = process.binding('tty_wrap');
2415
-
2416
- // Note stream._type is used for test-module-load-list.js
2417
-
2418
- switch (tty_wrap.guessHandleType(fd)) {
2419
- case 'TTY':
2420
- stream = new tty.WriteStream(fd);
2421
- stream._type = 'tty';
2422
-
2423
- // Hack to have stream not keep the event loop alive.
2424
- // See https://github.com/joyent/node/issues/1726
2425
- if (stream._handle && stream._handle.unref) {
2426
- stream._handle.unref();
2427
- }
2428
- break;
2429
- case 'FILE':
2430
- var fs = __webpack_require__(896);
2431
- stream = new fs.SyncWriteStream(fd, {
2432
- autoClose: false
2433
- });
2434
- stream._type = 'fs';
2435
- break;
2436
- case 'PIPE':
2437
- case 'TCP':
2438
- var net = __webpack_require__(278);
2439
- stream = new net.Socket({
2440
- fd: fd,
2441
- readable: false,
2442
- writable: true
2443
- });
2444
-
2445
- // FIXME Should probably have an option in net.Socket to create a
2446
- // stream from an existing fd which is writable only. But for now
2447
- // we'll just add this hack and set the `readable` member to false.
2448
- // Test: ./node test/fixtures/echo.js < /etc/passwd
2449
- stream.readable = false;
2450
- stream.read = null;
2451
- stream._type = 'pipe';
2452
-
2453
- // FIXME Hack to have stream not keep the event loop alive.
2454
- // See https://github.com/joyent/node/issues/1726
2455
- if (stream._handle && stream._handle.unref) {
2456
- stream._handle.unref();
2457
- }
2458
- break;
2459
- default:
2460
- // Probably an error on in uv_guess_handle()
2461
- throw new Error('Implement me. Unknown stream file type!');
2462
- }
2463
-
2464
- // For supporting legacy API we put the FD here.
2465
- stream.fd = fd;
2466
- stream._isStdio = true;
2467
- return stream;
2468
- }
2469
-
2470
- /**
2471
- * Init logic for `debug` instances.
2472
- *
2473
- * Create a new `inspectOpts` object in case `useColors` is set
2474
- * differently for a particular `debug` instance.
2475
- */
2476
-
2477
- function init(debug) {
2478
- debug.inspectOpts = {};
2479
- var keys = Object.keys(exports.inspectOpts);
2480
- for (var i = 0; i < keys.length; i++) {
2481
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
2482
- }
2483
- }
2484
-
2485
- /**
2486
- * Enable namespaces listed in `process.env.DEBUG` initially.
2487
- */
2488
-
2489
- exports.enable(load());
2490
-
2491
- /***/ }),
2492
-
2493
- /***/ 778:
2494
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2495
-
2496
- "use strict";
2497
- /*!
2498
- * statuses
2499
- * Copyright(c) 2014 Jonathan Ong
2500
- * Copyright(c) 2016 Douglas Christopher Wilson
2501
- * MIT Licensed
2502
- */
2503
-
2504
-
2505
-
2506
- /**
2507
- * Module dependencies.
2508
- * @private
2509
- */
2510
- var codes = __webpack_require__(662);
2511
-
2512
- /**
2513
- * Module exports.
2514
- * @public
2515
- */
2516
-
2517
- module.exports = status;
2518
-
2519
- // status code to message map
2520
- status.STATUS_CODES = codes;
2521
-
2522
- // array of status codes
2523
- status.codes = populateStatusesMap(status, codes);
2524
-
2525
- // status codes for redirects
2526
- status.redirect = {
2527
- 300: true,
2528
- 301: true,
2529
- 302: true,
2530
- 303: true,
2531
- 305: true,
2532
- 307: true,
2533
- 308: true
2534
- };
2535
-
2536
- // status codes for empty bodies
2537
- status.empty = {
2538
- 204: true,
2539
- 205: true,
2540
- 304: true
2541
- };
2542
-
2543
- // status codes for when you should retry the request
2544
- status.retry = {
2545
- 502: true,
2546
- 503: true,
2547
- 504: true
2548
- };
2549
-
2550
- /**
2551
- * Populate the statuses map for given codes.
2552
- * @private
2553
- */
2554
-
2555
- function populateStatusesMap(statuses, codes) {
2556
- var arr = [];
2557
- Object.keys(codes).forEach(function forEachCode(code) {
2558
- var message = codes[code];
2559
- var status = Number(code);
2560
-
2561
- // Populate properties
2562
- statuses[status] = message;
2563
- statuses[message] = status;
2564
- statuses[message.toLowerCase()] = status;
2565
-
2566
- // Add to array
2567
- arr.push(status);
2568
- });
2569
- return arr;
2570
- }
2571
-
2572
- /**
2573
- * Get the status code.
2574
- *
2575
- * Given a number, this will throw if it is not a known status
2576
- * code, otherwise the code will be returned. Given a string,
2577
- * the string will be parsed for a number and return the code
2578
- * if valid, otherwise will lookup the code assuming this is
2579
- * the status message.
2580
- *
2581
- * @param {string|number} code
2582
- * @returns {number}
2583
- * @public
2584
- */
2585
-
2586
- function status(code) {
2587
- if (typeof code === 'number') {
2588
- if (!status[code]) throw new Error('invalid status code: ' + code);
2589
- return code;
2590
- }
2591
- if (typeof code !== 'string') {
2592
- throw new TypeError('code must be a number or string');
2593
- }
2594
-
2595
- // '403'
2596
- var n = parseInt(code, 10);
2597
- if (!isNaN(n)) {
2598
- if (!status[n]) throw new Error('invalid status code: ' + n);
2599
- return n;
2600
- }
2601
- n = status[code.toLowerCase()];
2602
- if (!n) throw new Error('invalid status message: "' + code + '"');
2603
- return n;
2604
- }
2605
-
2606
- /***/ }),
2607
-
2608
- /***/ 820:
2609
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2610
-
2611
- /**
2612
- * Detect Electron renderer process, which is node, but we should
2613
- * treat as a browser.
2614
- */
2615
-
2616
- if (typeof process !== 'undefined' && process.type === 'renderer') {
2617
- module.exports = __webpack_require__(128);
2618
- } else {
2619
- module.exports = __webpack_require__(18);
2620
- }
2621
-
2622
- /***/ }),
2623
-
2624
- /***/ 896:
2625
- /***/ ((module) => {
2626
-
2627
- "use strict";
2628
- module.exports = require("fs");
2629
-
2630
- /***/ }),
2631
-
2632
- /***/ 958:
2633
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2634
-
2635
- "use strict";
2636
- /*!
2637
- * connect
2638
- * Copyright(c) 2010 Sencha Inc.
2639
- * Copyright(c) 2011 TJ Holowaychuk
2640
- * Copyright(c) 2015 Douglas Christopher Wilson
2641
- * MIT Licensed
2642
- */
2643
-
2644
-
2645
-
2646
- /**
2647
- * Module dependencies.
2648
- * @private
2649
- */
2650
- var debug = __webpack_require__(820)('connect:dispatcher');
2651
- var EventEmitter = (__webpack_require__(434).EventEmitter);
2652
- var finalhandler = __webpack_require__(664);
2653
- var http = __webpack_require__(611);
2654
- var merge = __webpack_require__(200);
2655
- var parseUrl = __webpack_require__(252);
2656
-
2657
- /**
2658
- * Module exports.
2659
- * @public
2660
- */
2661
-
2662
- module.exports = createServer;
2663
-
2664
- /**
2665
- * Module variables.
2666
- * @private
2667
- */
2668
-
2669
- var env = "production" || 0;
2670
- var proto = {};
2671
-
2672
- /* istanbul ignore next */
2673
- var defer = typeof setImmediate === 'function' ? setImmediate : function (fn) {
2674
- process.nextTick(fn.bind.apply(fn, arguments));
2675
- };
2676
-
2677
- /**
2678
- * Create a new connect server.
2679
- *
2680
- * @return {function}
2681
- * @public
2682
- */
2683
-
2684
- function createServer() {
2685
- function app(req, res, next) {
2686
- app.handle(req, res, next);
2687
- }
2688
- merge(app, proto);
2689
- merge(app, EventEmitter.prototype);
2690
- app.route = '/';
2691
- app.stack = [];
2692
- return app;
2693
- }
2694
-
2695
- /**
2696
- * Utilize the given middleware `handle` to the given `route`,
2697
- * defaulting to _/_. This "route" is the mount-point for the
2698
- * middleware, when given a value other than _/_ the middleware
2699
- * is only effective when that segment is present in the request's
2700
- * pathname.
2701
- *
2702
- * For example if we were to mount a function at _/admin_, it would
2703
- * be invoked on _/admin_, and _/admin/settings_, however it would
2704
- * not be invoked for _/_, or _/posts_.
2705
- *
2706
- * @param {String|Function|Server} route, callback or server
2707
- * @param {Function|Server} callback or server
2708
- * @return {Server} for chaining
2709
- * @public
2710
- */
2711
-
2712
- proto.use = function use(route, fn) {
2713
- var handle = fn;
2714
- var path = route;
2715
-
2716
- // default route to '/'
2717
- if (typeof route !== 'string') {
2718
- handle = route;
2719
- path = '/';
2720
- }
2721
-
2722
- // wrap sub-apps
2723
- if (typeof handle.handle === 'function') {
2724
- var server = handle;
2725
- server.route = path;
2726
- handle = function (req, res, next) {
2727
- server.handle(req, res, next);
2728
- };
2729
- }
2730
-
2731
- // wrap vanilla http.Servers
2732
- if (handle instanceof http.Server) {
2733
- handle = handle.listeners('request')[0];
2734
- }
2735
-
2736
- // strip trailing slash
2737
- if (path[path.length - 1] === '/') {
2738
- path = path.slice(0, -1);
2739
- }
2740
-
2741
- // add the middleware
2742
- debug('use %s %s', path || '/', handle.name || 'anonymous');
2743
- this.stack.push({
2744
- route: path,
2745
- handle: handle
2746
- });
2747
- return this;
2748
- };
2749
-
2750
- /**
2751
- * Handle server requests, punting them down
2752
- * the middleware stack.
2753
- *
2754
- * @private
2755
- */
2756
-
2757
- proto.handle = function handle(req, res, out) {
2758
- var index = 0;
2759
- var protohost = getProtohost(req.url) || '';
2760
- var removed = '';
2761
- var slashAdded = false;
2762
- var stack = this.stack;
2763
-
2764
- // final function handler
2765
- var done = out || finalhandler(req, res, {
2766
- env: env,
2767
- onerror: logerror
2768
- });
2769
-
2770
- // store the original URL
2771
- req.originalUrl = req.originalUrl || req.url;
2772
- function next(err) {
2773
- if (slashAdded) {
2774
- req.url = req.url.substr(1);
2775
- slashAdded = false;
2776
- }
2777
- if (removed.length !== 0) {
2778
- req.url = protohost + removed + req.url.substr(protohost.length);
2779
- removed = '';
2780
- }
2781
-
2782
- // next callback
2783
- var layer = stack[index++];
2784
-
2785
- // all done
2786
- if (!layer) {
2787
- defer(done, err);
2788
- return;
2789
- }
2790
-
2791
- // route data
2792
- var path = parseUrl(req).pathname || '/';
2793
- var route = layer.route;
2794
-
2795
- // skip this layer if the route doesn't match
2796
- if (path.toLowerCase().substr(0, route.length) !== route.toLowerCase()) {
2797
- return next(err);
2798
- }
2799
-
2800
- // skip if route match does not border "/", ".", or end
2801
- var c = path.length > route.length && path[route.length];
2802
- if (c && c !== '/' && c !== '.') {
2803
- return next(err);
2804
- }
2805
-
2806
- // trim off the part of the url that matches the route
2807
- if (route.length !== 0 && route !== '/') {
2808
- removed = route;
2809
- req.url = protohost + req.url.substr(protohost.length + removed.length);
2810
-
2811
- // ensure leading slash
2812
- if (!protohost && req.url[0] !== '/') {
2813
- req.url = '/' + req.url;
2814
- slashAdded = true;
2815
- }
2816
- }
2817
-
2818
- // call the layer handle
2819
- call(layer.handle, route, err, req, res, next);
2820
- }
2821
- next();
2822
- };
2823
-
2824
- /**
2825
- * Listen for connections.
2826
- *
2827
- * This method takes the same arguments
2828
- * as node's `http.Server#listen()`.
2829
- *
2830
- * HTTP and HTTPS:
2831
- *
2832
- * If you run your application both as HTTP
2833
- * and HTTPS you may wrap them individually,
2834
- * since your Connect "server" is really just
2835
- * a JavaScript `Function`.
2836
- *
2837
- * var connect = require('connect')
2838
- * , http = require('http')
2839
- * , https = require('https');
2840
- *
2841
- * var app = connect();
2842
- *
2843
- * http.createServer(app).listen(80);
2844
- * https.createServer(options, app).listen(443);
2845
- *
2846
- * @return {http.Server}
2847
- * @api public
2848
- */
2849
-
2850
- proto.listen = function listen() {
2851
- var server = http.createServer(this);
2852
- return server.listen.apply(server, arguments);
2853
- };
2854
-
2855
- /**
2856
- * Invoke a route handle.
2857
- * @private
2858
- */
2859
-
2860
- function call(handle, route, err, req, res, next) {
2861
- var arity = handle.length;
2862
- var error = err;
2863
- var hasError = Boolean(err);
2864
- debug('%s %s : %s', handle.name || '<anonymous>', route, req.originalUrl);
2865
- try {
2866
- if (hasError && arity === 4) {
2867
- // error-handling middleware
2868
- handle(err, req, res, next);
2869
- return;
2870
- } else if (!hasError && arity < 4) {
2871
- // request-handling middleware
2872
- handle(req, res, next);
2873
- return;
2874
- }
2875
- } catch (e) {
2876
- // replace the error
2877
- error = e;
2878
- }
2879
-
2880
- // continue
2881
- next(error);
2882
- }
2883
-
2884
- /**
2885
- * Log error using console.error.
2886
- *
2887
- * @param {Error} err
2888
- * @private
2889
- */
2890
-
2891
- function logerror(err) {
2892
- if (env !== 'test') console.error(err.stack || err.toString());
2893
- }
2894
-
2895
- /**
2896
- * Get get protocol + host for a URL.
2897
- *
2898
- * @param {string} url
2899
- * @private
2900
- */
2901
-
2902
- function getProtohost(url) {
2903
- if (url.length === 0 || url[0] === '/') {
2904
- return undefined;
2905
- }
2906
- var fqdnIndex = url.indexOf('://');
2907
- return fqdnIndex !== -1 && url.lastIndexOf('?', fqdnIndex) === -1 ? url.substr(0, url.indexOf('/', 3 + fqdnIndex)) : undefined;
2908
- }
2909
-
2910
- /***/ }),
2911
-
2912
- /***/ 987:
2913
- /***/ ((module) => {
2914
-
2915
- "use strict";
2916
- /*!
2917
- * encodeurl
2918
- * Copyright(c) 2016 Douglas Christopher Wilson
2919
- * MIT Licensed
2920
- */
2921
-
2922
-
2923
-
2924
- /**
2925
- * Module exports.
2926
- * @public
2927
- */
2928
- module.exports = encodeUrl;
2929
-
2930
- /**
2931
- * RegExp to match non-URL code points, *after* encoding (i.e. not including "%")
2932
- * and including invalid escape sequences.
2933
- * @private
2934
- */
2935
-
2936
- var ENCODE_CHARS_REGEXP = /(?:[^\x21\x25\x26-\x3B\x3D\x3F-\x5B\x5D\x5F\x61-\x7A\x7E]|%(?:[^0-9A-Fa-f]|[0-9A-Fa-f][^0-9A-Fa-f]|$))+/g;
2937
-
2938
- /**
2939
- * RegExp to match unmatched surrogate pair.
2940
- * @private
2941
- */
2942
-
2943
- var UNMATCHED_SURROGATE_PAIR_REGEXP = /(^|[^\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF]([^\uDC00-\uDFFF]|$)/g;
2944
-
2945
- /**
2946
- * String to replace unmatched surrogate pair with.
2947
- * @private
2948
- */
2949
-
2950
- var UNMATCHED_SURROGATE_PAIR_REPLACE = '$1\uFFFD$2';
2951
-
2952
- /**
2953
- * Encode a URL to a percent-encoded form, excluding already-encoded sequences.
2954
- *
2955
- * This function will take an already-encoded URL and encode all the non-URL
2956
- * code points. This function will not encode the "%" character unless it is
2957
- * not part of a valid sequence (`%20` will be left as-is, but `%foo` will
2958
- * be encoded as `%25foo`).
2959
- *
2960
- * This encode is meant to be "safe" and does not throw errors. It will try as
2961
- * hard as it can to properly encode the given URL, including replacing any raw,
2962
- * unpaired surrogate pairs with the Unicode replacement character prior to
2963
- * encoding.
2964
- *
2965
- * @param {string} url
2966
- * @return {string}
2967
- * @public
2968
- */
2969
-
2970
- function encodeUrl(url) {
2971
- return String(url).replace(UNMATCHED_SURROGATE_PAIR_REGEXP, UNMATCHED_SURROGATE_PAIR_REPLACE).replace(ENCODE_CHARS_REGEXP, encodeURI);
2972
- }
2973
-
2974
- /***/ })
2975
-
2976
- /******/ });
2977
- /************************************************************************/
2978
- /******/ // The module cache
2979
- /******/ var __webpack_module_cache__ = {};
2980
- /******/
2981
- /******/ // The require function
2982
- /******/ function __webpack_require__(moduleId) {
2983
- /******/ // Check if module is in cache
2984
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
2985
- /******/ if (cachedModule !== undefined) {
2986
- /******/ return cachedModule.exports;
2987
- /******/ }
2988
- /******/ // Create a new module (and put it into the cache)
2989
- /******/ var module = __webpack_module_cache__[moduleId] = {
2990
- /******/ // no module.id needed
2991
- /******/ // no module.loaded needed
2992
- /******/ exports: {}
2993
- /******/ };
2994
- /******/
2995
- /******/ // Execute the module function
2996
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
2997
- /******/
2998
- /******/ // Return the exports of the module
2999
- /******/ return module.exports;
3000
- /******/ }
3001
- /******/
3002
- /************************************************************************/
3003
- /******/
3004
- /******/ // startup
3005
- /******/ // Load entry module and return exports
3006
- /******/ // This entry module is referenced by other modules so it can't be inlined
3007
- /******/ var __webpack_exports__ = __webpack_require__(268);
3008
- /******/ module.exports = __webpack_exports__;
3009
- /******/
3010
- /******/ })()
3011
- ;