index.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838
  1. module.exports = (function() {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function(modId, func, req) { var m = { exports: {}, _tempexports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
  4. var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; };
  5. var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
  6. var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
  7. __DEFINE__(1682324647464, function(require, module, exports) {
  8. /**
  9. * Detect Electron renderer / nwjs process, which is node, but we should
  10. * treat as a browser.
  11. */
  12. if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
  13. module.exports = require('./browser.js');
  14. } else {
  15. module.exports = require('./node.js');
  16. }
  17. }, function(modId) {var map = {"./browser.js":1682324647465,"./node.js":1682324647467}; return __REQUIRE__(map[modId], modId); })
  18. __DEFINE__(1682324647465, function(require, module, exports) {
  19. /* eslint-env browser */
  20. /**
  21. * This is the web browser implementation of `debug()`.
  22. */
  23. exports.formatArgs = formatArgs;
  24. exports.save = save;
  25. exports.load = load;
  26. exports.useColors = useColors;
  27. exports.storage = localstorage();
  28. exports.destroy = (() => {
  29. let warned = false;
  30. return () => {
  31. if (!warned) {
  32. warned = true;
  33. console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
  34. }
  35. };
  36. })();
  37. /**
  38. * Colors.
  39. */
  40. exports.colors = [
  41. '#0000CC',
  42. '#0000FF',
  43. '#0033CC',
  44. '#0033FF',
  45. '#0066CC',
  46. '#0066FF',
  47. '#0099CC',
  48. '#0099FF',
  49. '#00CC00',
  50. '#00CC33',
  51. '#00CC66',
  52. '#00CC99',
  53. '#00CCCC',
  54. '#00CCFF',
  55. '#3300CC',
  56. '#3300FF',
  57. '#3333CC',
  58. '#3333FF',
  59. '#3366CC',
  60. '#3366FF',
  61. '#3399CC',
  62. '#3399FF',
  63. '#33CC00',
  64. '#33CC33',
  65. '#33CC66',
  66. '#33CC99',
  67. '#33CCCC',
  68. '#33CCFF',
  69. '#6600CC',
  70. '#6600FF',
  71. '#6633CC',
  72. '#6633FF',
  73. '#66CC00',
  74. '#66CC33',
  75. '#9900CC',
  76. '#9900FF',
  77. '#9933CC',
  78. '#9933FF',
  79. '#99CC00',
  80. '#99CC33',
  81. '#CC0000',
  82. '#CC0033',
  83. '#CC0066',
  84. '#CC0099',
  85. '#CC00CC',
  86. '#CC00FF',
  87. '#CC3300',
  88. '#CC3333',
  89. '#CC3366',
  90. '#CC3399',
  91. '#CC33CC',
  92. '#CC33FF',
  93. '#CC6600',
  94. '#CC6633',
  95. '#CC9900',
  96. '#CC9933',
  97. '#CCCC00',
  98. '#CCCC33',
  99. '#FF0000',
  100. '#FF0033',
  101. '#FF0066',
  102. '#FF0099',
  103. '#FF00CC',
  104. '#FF00FF',
  105. '#FF3300',
  106. '#FF3333',
  107. '#FF3366',
  108. '#FF3399',
  109. '#FF33CC',
  110. '#FF33FF',
  111. '#FF6600',
  112. '#FF6633',
  113. '#FF9900',
  114. '#FF9933',
  115. '#FFCC00',
  116. '#FFCC33'
  117. ];
  118. /**
  119. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  120. * and the Firebug extension (any Firefox version) are known
  121. * to support "%c" CSS customizations.
  122. *
  123. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  124. */
  125. // eslint-disable-next-line complexity
  126. function useColors() {
  127. // NB: In an Electron preload script, document will be defined but not fully
  128. // initialized. Since we know we're in Chrome, we'll just detect this case
  129. // explicitly
  130. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  131. return true;
  132. }
  133. // Internet Explorer and Edge do not support colors.
  134. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  135. return false;
  136. }
  137. // Is webkit? http://stackoverflow.com/a/16459606/376773
  138. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  139. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  140. // Is firebug? http://stackoverflow.com/a/398120/376773
  141. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  142. // Is firefox >= v31?
  143. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  144. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  145. // Double check webkit in userAgent just in case we are in a worker
  146. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  147. }
  148. /**
  149. * Colorize log arguments if enabled.
  150. *
  151. * @api public
  152. */
  153. function formatArgs(args) {
  154. args[0] = (this.useColors ? '%c' : '') +
  155. this.namespace +
  156. (this.useColors ? ' %c' : ' ') +
  157. args[0] +
  158. (this.useColors ? '%c ' : ' ') +
  159. '+' + module.exports.humanize(this.diff);
  160. if (!this.useColors) {
  161. return;
  162. }
  163. const c = 'color: ' + this.color;
  164. args.splice(1, 0, c, 'color: inherit');
  165. // The final "%c" is somewhat tricky, because there could be other
  166. // arguments passed either before or after the %c, so we need to
  167. // figure out the correct index to insert the CSS into
  168. let index = 0;
  169. let lastC = 0;
  170. args[0].replace(/%[a-zA-Z%]/g, match => {
  171. if (match === '%%') {
  172. return;
  173. }
  174. index++;
  175. if (match === '%c') {
  176. // We only are interested in the *last* %c
  177. // (the user may have provided their own)
  178. lastC = index;
  179. }
  180. });
  181. args.splice(lastC, 0, c);
  182. }
  183. /**
  184. * Invokes `console.debug()` when available.
  185. * No-op when `console.debug` is not a "function".
  186. * If `console.debug` is not available, falls back
  187. * to `console.log`.
  188. *
  189. * @api public
  190. */
  191. exports.log = console.debug || console.log || (() => {});
  192. /**
  193. * Save `namespaces`.
  194. *
  195. * @param {String} namespaces
  196. * @api private
  197. */
  198. function save(namespaces) {
  199. try {
  200. if (namespaces) {
  201. exports.storage.setItem('debug', namespaces);
  202. } else {
  203. exports.storage.removeItem('debug');
  204. }
  205. } catch (error) {
  206. // Swallow
  207. // XXX (@Qix-) should we be logging these?
  208. }
  209. }
  210. /**
  211. * Load `namespaces`.
  212. *
  213. * @return {String} returns the previously persisted debug modes
  214. * @api private
  215. */
  216. function load() {
  217. let r;
  218. try {
  219. r = exports.storage.getItem('debug');
  220. } catch (error) {
  221. // Swallow
  222. // XXX (@Qix-) should we be logging these?
  223. }
  224. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  225. if (!r && typeof process !== 'undefined' && 'env' in process) {
  226. r = process.env.DEBUG;
  227. }
  228. return r;
  229. }
  230. /**
  231. * Localstorage attempts to return the localstorage.
  232. *
  233. * This is necessary because safari throws
  234. * when a user disables cookies/localstorage
  235. * and you attempt to access it.
  236. *
  237. * @return {LocalStorage}
  238. * @api private
  239. */
  240. function localstorage() {
  241. try {
  242. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  243. // The Browser also has localStorage in the global context.
  244. return localStorage;
  245. } catch (error) {
  246. // Swallow
  247. // XXX (@Qix-) should we be logging these?
  248. }
  249. }
  250. module.exports = require('./common')(exports);
  251. const {formatters} = module.exports;
  252. /**
  253. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  254. */
  255. formatters.j = function (v) {
  256. try {
  257. return JSON.stringify(v);
  258. } catch (error) {
  259. return '[UnexpectedJSONParseError]: ' + error.message;
  260. }
  261. };
  262. }, function(modId) { var map = {"./common":1682324647466}; return __REQUIRE__(map[modId], modId); })
  263. __DEFINE__(1682324647466, function(require, module, exports) {
  264. /**
  265. * This is the common logic for both the Node.js and web browser
  266. * implementations of `debug()`.
  267. */
  268. function setup(env) {
  269. createDebug.debug = createDebug;
  270. createDebug.default = createDebug;
  271. createDebug.coerce = coerce;
  272. createDebug.disable = disable;
  273. createDebug.enable = enable;
  274. createDebug.enabled = enabled;
  275. createDebug.humanize = require('ms');
  276. createDebug.destroy = destroy;
  277. Object.keys(env).forEach(key => {
  278. createDebug[key] = env[key];
  279. });
  280. /**
  281. * The currently active debug mode names, and names to skip.
  282. */
  283. createDebug.names = [];
  284. createDebug.skips = [];
  285. /**
  286. * Map of special "%n" handling functions, for the debug "format" argument.
  287. *
  288. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  289. */
  290. createDebug.formatters = {};
  291. /**
  292. * Selects a color for a debug namespace
  293. * @param {String} namespace The namespace string for the debug instance to be colored
  294. * @return {Number|String} An ANSI color code for the given namespace
  295. * @api private
  296. */
  297. function selectColor(namespace) {
  298. let hash = 0;
  299. for (let i = 0; i < namespace.length; i++) {
  300. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  301. hash |= 0; // Convert to 32bit integer
  302. }
  303. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  304. }
  305. createDebug.selectColor = selectColor;
  306. /**
  307. * Create a debugger with the given `namespace`.
  308. *
  309. * @param {String} namespace
  310. * @return {Function}
  311. * @api public
  312. */
  313. function createDebug(namespace) {
  314. let prevTime;
  315. let enableOverride = null;
  316. let namespacesCache;
  317. let enabledCache;
  318. function debug(...args) {
  319. // Disabled?
  320. if (!debug.enabled) {
  321. return;
  322. }
  323. const self = debug;
  324. // Set `diff` timestamp
  325. const curr = Number(new Date());
  326. const ms = curr - (prevTime || curr);
  327. self.diff = ms;
  328. self.prev = prevTime;
  329. self.curr = curr;
  330. prevTime = curr;
  331. args[0] = createDebug.coerce(args[0]);
  332. if (typeof args[0] !== 'string') {
  333. // Anything else let's inspect with %O
  334. args.unshift('%O');
  335. }
  336. // Apply any `formatters` transformations
  337. let index = 0;
  338. args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
  339. // If we encounter an escaped % then don't increase the array index
  340. if (match === '%%') {
  341. return '%';
  342. }
  343. index++;
  344. const formatter = createDebug.formatters[format];
  345. if (typeof formatter === 'function') {
  346. const val = args[index];
  347. match = formatter.call(self, val);
  348. // Now we need to remove `args[index]` since it's inlined in the `format`
  349. args.splice(index, 1);
  350. index--;
  351. }
  352. return match;
  353. });
  354. // Apply env-specific formatting (colors, etc.)
  355. createDebug.formatArgs.call(self, args);
  356. const logFn = self.log || createDebug.log;
  357. logFn.apply(self, args);
  358. }
  359. debug.namespace = namespace;
  360. debug.useColors = createDebug.useColors();
  361. debug.color = createDebug.selectColor(namespace);
  362. debug.extend = extend;
  363. debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
  364. Object.defineProperty(debug, 'enabled', {
  365. enumerable: true,
  366. configurable: false,
  367. get: () => {
  368. if (enableOverride !== null) {
  369. return enableOverride;
  370. }
  371. if (namespacesCache !== createDebug.namespaces) {
  372. namespacesCache = createDebug.namespaces;
  373. enabledCache = createDebug.enabled(namespace);
  374. }
  375. return enabledCache;
  376. },
  377. set: v => {
  378. enableOverride = v;
  379. }
  380. });
  381. // Env-specific initialization logic for debug instances
  382. if (typeof createDebug.init === 'function') {
  383. createDebug.init(debug);
  384. }
  385. return debug;
  386. }
  387. function extend(namespace, delimiter) {
  388. const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  389. newDebug.log = this.log;
  390. return newDebug;
  391. }
  392. /**
  393. * Enables a debug mode by namespaces. This can include modes
  394. * separated by a colon and wildcards.
  395. *
  396. * @param {String} namespaces
  397. * @api public
  398. */
  399. function enable(namespaces) {
  400. createDebug.save(namespaces);
  401. createDebug.namespaces = namespaces;
  402. createDebug.names = [];
  403. createDebug.skips = [];
  404. let i;
  405. const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  406. const len = split.length;
  407. for (i = 0; i < len; i++) {
  408. if (!split[i]) {
  409. // ignore empty strings
  410. continue;
  411. }
  412. namespaces = split[i].replace(/\*/g, '.*?');
  413. if (namespaces[0] === '-') {
  414. createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$'));
  415. } else {
  416. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  417. }
  418. }
  419. }
  420. /**
  421. * Disable debug output.
  422. *
  423. * @return {String} namespaces
  424. * @api public
  425. */
  426. function disable() {
  427. const namespaces = [
  428. ...createDebug.names.map(toNamespace),
  429. ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
  430. ].join(',');
  431. createDebug.enable('');
  432. return namespaces;
  433. }
  434. /**
  435. * Returns true if the given mode name is enabled, false otherwise.
  436. *
  437. * @param {String} name
  438. * @return {Boolean}
  439. * @api public
  440. */
  441. function enabled(name) {
  442. if (name[name.length - 1] === '*') {
  443. return true;
  444. }
  445. let i;
  446. let len;
  447. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  448. if (createDebug.skips[i].test(name)) {
  449. return false;
  450. }
  451. }
  452. for (i = 0, len = createDebug.names.length; i < len; i++) {
  453. if (createDebug.names[i].test(name)) {
  454. return true;
  455. }
  456. }
  457. return false;
  458. }
  459. /**
  460. * Convert regexp to namespace
  461. *
  462. * @param {RegExp} regxep
  463. * @return {String} namespace
  464. * @api private
  465. */
  466. function toNamespace(regexp) {
  467. return regexp.toString()
  468. .substring(2, regexp.toString().length - 2)
  469. .replace(/\.\*\?$/, '*');
  470. }
  471. /**
  472. * Coerce `val`.
  473. *
  474. * @param {Mixed} val
  475. * @return {Mixed}
  476. * @api private
  477. */
  478. function coerce(val) {
  479. if (val instanceof Error) {
  480. return val.stack || val.message;
  481. }
  482. return val;
  483. }
  484. /**
  485. * XXX DO NOT USE. This is a temporary stub function.
  486. * XXX It WILL be removed in the next major release.
  487. */
  488. function destroy() {
  489. console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
  490. }
  491. createDebug.enable(createDebug.load());
  492. return createDebug;
  493. }
  494. module.exports = setup;
  495. }, function(modId) { var map = {}; return __REQUIRE__(map[modId], modId); })
  496. __DEFINE__(1682324647467, function(require, module, exports) {
  497. /**
  498. * Module dependencies.
  499. */
  500. const tty = require('tty');
  501. const util = require('util');
  502. /**
  503. * This is the Node.js implementation of `debug()`.
  504. */
  505. exports.init = init;
  506. exports.log = log;
  507. exports.formatArgs = formatArgs;
  508. exports.save = save;
  509. exports.load = load;
  510. exports.useColors = useColors;
  511. exports.destroy = util.deprecate(
  512. () => {},
  513. 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
  514. );
  515. /**
  516. * Colors.
  517. */
  518. exports.colors = [6, 2, 3, 4, 5, 1];
  519. try {
  520. // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
  521. // eslint-disable-next-line import/no-extraneous-dependencies
  522. const supportsColor = require('supports-color');
  523. if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
  524. exports.colors = [
  525. 20,
  526. 21,
  527. 26,
  528. 27,
  529. 32,
  530. 33,
  531. 38,
  532. 39,
  533. 40,
  534. 41,
  535. 42,
  536. 43,
  537. 44,
  538. 45,
  539. 56,
  540. 57,
  541. 62,
  542. 63,
  543. 68,
  544. 69,
  545. 74,
  546. 75,
  547. 76,
  548. 77,
  549. 78,
  550. 79,
  551. 80,
  552. 81,
  553. 92,
  554. 93,
  555. 98,
  556. 99,
  557. 112,
  558. 113,
  559. 128,
  560. 129,
  561. 134,
  562. 135,
  563. 148,
  564. 149,
  565. 160,
  566. 161,
  567. 162,
  568. 163,
  569. 164,
  570. 165,
  571. 166,
  572. 167,
  573. 168,
  574. 169,
  575. 170,
  576. 171,
  577. 172,
  578. 173,
  579. 178,
  580. 179,
  581. 184,
  582. 185,
  583. 196,
  584. 197,
  585. 198,
  586. 199,
  587. 200,
  588. 201,
  589. 202,
  590. 203,
  591. 204,
  592. 205,
  593. 206,
  594. 207,
  595. 208,
  596. 209,
  597. 214,
  598. 215,
  599. 220,
  600. 221
  601. ];
  602. }
  603. } catch (error) {
  604. // Swallow - we only care if `supports-color` is available; it doesn't have to be.
  605. }
  606. /**
  607. * Build up the default `inspectOpts` object from the environment variables.
  608. *
  609. * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
  610. */
  611. exports.inspectOpts = Object.keys(process.env).filter(key => {
  612. return /^debug_/i.test(key);
  613. }).reduce((obj, key) => {
  614. // Camel-case
  615. const prop = key
  616. .substring(6)
  617. .toLowerCase()
  618. .replace(/_([a-z])/g, (_, k) => {
  619. return k.toUpperCase();
  620. });
  621. // Coerce string value into JS value
  622. let val = process.env[key];
  623. if (/^(yes|on|true|enabled)$/i.test(val)) {
  624. val = true;
  625. } else if (/^(no|off|false|disabled)$/i.test(val)) {
  626. val = false;
  627. } else if (val === 'null') {
  628. val = null;
  629. } else {
  630. val = Number(val);
  631. }
  632. obj[prop] = val;
  633. return obj;
  634. }, {});
  635. /**
  636. * Is stdout a TTY? Colored output is enabled when `true`.
  637. */
  638. function useColors() {
  639. return 'colors' in exports.inspectOpts ?
  640. Boolean(exports.inspectOpts.colors) :
  641. tty.isatty(process.stderr.fd);
  642. }
  643. /**
  644. * Adds ANSI color escape codes if enabled.
  645. *
  646. * @api public
  647. */
  648. function formatArgs(args) {
  649. const {namespace: name, useColors} = this;
  650. if (useColors) {
  651. const c = this.color;
  652. const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
  653. const prefix = ` ${colorCode};1m${name} \u001B[0m`;
  654. args[0] = prefix + args[0].split('\n').join('\n' + prefix);
  655. args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
  656. } else {
  657. args[0] = getDate() + name + ' ' + args[0];
  658. }
  659. }
  660. function getDate() {
  661. if (exports.inspectOpts.hideDate) {
  662. return '';
  663. }
  664. return new Date().toISOString() + ' ';
  665. }
  666. /**
  667. * Invokes `util.format()` with the specified arguments and writes to stderr.
  668. */
  669. function log(...args) {
  670. return process.stderr.write(util.format(...args) + '\n');
  671. }
  672. /**
  673. * Save `namespaces`.
  674. *
  675. * @param {String} namespaces
  676. * @api private
  677. */
  678. function save(namespaces) {
  679. if (namespaces) {
  680. process.env.DEBUG = namespaces;
  681. } else {
  682. // If you set a process.env field to null or undefined, it gets cast to the
  683. // string 'null' or 'undefined'. Just delete instead.
  684. delete process.env.DEBUG;
  685. }
  686. }
  687. /**
  688. * Load `namespaces`.
  689. *
  690. * @return {String} returns the previously persisted debug modes
  691. * @api private
  692. */
  693. function load() {
  694. return process.env.DEBUG;
  695. }
  696. /**
  697. * Init logic for `debug` instances.
  698. *
  699. * Create a new `inspectOpts` object in case `useColors` is set
  700. * differently for a particular `debug` instance.
  701. */
  702. function init(debug) {
  703. debug.inspectOpts = {};
  704. const keys = Object.keys(exports.inspectOpts);
  705. for (let i = 0; i < keys.length; i++) {
  706. debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
  707. }
  708. }
  709. module.exports = require('./common')(exports);
  710. const {formatters} = module.exports;
  711. /**
  712. * Map %o to `util.inspect()`, all on a single line.
  713. */
  714. formatters.o = function (v) {
  715. this.inspectOpts.colors = this.useColors;
  716. return util.inspect(v, this.inspectOpts)
  717. .split('\n')
  718. .map(str => str.trim())
  719. .join(' ');
  720. };
  721. /**
  722. * Map %O to `util.inspect()`, allowing multiple lines if needed.
  723. */
  724. formatters.O = function (v) {
  725. this.inspectOpts.colors = this.useColors;
  726. return util.inspect(v, this.inspectOpts);
  727. };
  728. }, function(modId) { var map = {"./common":1682324647466}; return __REQUIRE__(map[modId], modId); })
  729. return __REQUIRE__(1682324647464);
  730. })()
  731. //miniprogram-npm-outsideDeps=["ms","tty","util","supports-color"]
  732. //# sourceMappingURL=index.js.map