UNPKG

646 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3// tslint:disable no-console
4let debug;
5try {
6 debug = require('debug');
7}
8catch (_a) { }
9function displayWarnings() {
10 if (process.listenerCount('warning') > 1)
11 return;
12 process.on('warning', (warning) => {
13 console.error(warning.stack);
14 if (warning.detail)
15 console.error(warning.detail);
16 });
17}
18exports.default = (...scope) => {
19 if (!debug)
20 return (..._) => { };
21 const d = debug(['@oclif/config', ...scope].join(':'));
22 if (d.enabled)
23 displayWarnings();
24 return (...args) => d(...args);
25};