debug-fabulous 2.0.3 → 2.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/lib/.tmp/debugFabFactory.d.ts +0 -4
- package/lib/.tmp/extensions/lazyEval.d.ts +0 -3
- package/lib/.tmp/extensions/spawn.d.ts +0 -2
- package/lib/.tmp/index.d.ts +0 -4
- package/lib/.tmp/internals.d.ts +0 -17
- package/lib/index.js +0 -51
- package/umd/.tmp/debugFabFactory.d.ts +0 -4
- package/umd/.tmp/extensions/lazyEval.d.ts +0 -3
- package/umd/.tmp/extensions/spawn.d.ts +0 -2
- package/umd/.tmp/index.d.ts +0 -4
- package/umd/.tmp/internals.d.ts +0 -17
- package/umd/index.js +0 -55
package/package.json
CHANGED
package/lib/.tmp/index.d.ts
DELETED
package/lib/.tmp/internals.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Debug, Debugger } from 'debug';
|
|
2
|
-
export interface DebugLazy extends Debug {
|
|
3
|
-
(namespace: string): DebuggerExt;
|
|
4
|
-
}
|
|
5
|
-
export interface DebugFabulous extends DebugLazy {
|
|
6
|
-
(namespace: string): DebuggerExt;
|
|
7
|
-
spawnable: (_namespace: string, _debugFabFactory?: Debug) => DebuggerExtSpawn;
|
|
8
|
-
}
|
|
9
|
-
export type LazyDebugFunc = () => string | any[];
|
|
10
|
-
export interface DebuggerExt extends Debugger {
|
|
11
|
-
(lazyFunc: LazyDebugFunc): void;
|
|
12
|
-
(...args: any[]): void;
|
|
13
|
-
spawn: (ns: string) => DebuggerExt;
|
|
14
|
-
}
|
|
15
|
-
export interface DebuggerExtSpawn extends DebuggerExt {
|
|
16
|
-
spawn: (ns: string) => DebuggerExt;
|
|
17
|
-
}
|
package/lib/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var memoize = require('memoizee');
|
|
4
|
-
|
|
5
|
-
const extend = (_debugger) => {
|
|
6
|
-
const wrapped = (formatter, ...args) => {
|
|
7
|
-
if (typeof formatter === 'function') {
|
|
8
|
-
const ret = formatter();
|
|
9
|
-
const toApply = Array.isArray(ret) ? ret : [ret];
|
|
10
|
-
return _debugger(...toApply);
|
|
11
|
-
}
|
|
12
|
-
return _debugger(formatter, ...args);
|
|
13
|
-
};
|
|
14
|
-
return Object.assign(wrapped, _debugger);
|
|
15
|
-
};
|
|
16
|
-
const lazyEval = (debugInst) => {
|
|
17
|
-
function debug(namespace) {
|
|
18
|
-
function noop() { }
|
|
19
|
-
const instance = debugInst(namespace);
|
|
20
|
-
if (!instance.enabled) {
|
|
21
|
-
return Object.assign(noop, instance);
|
|
22
|
-
}
|
|
23
|
-
return extend(instance);
|
|
24
|
-
}
|
|
25
|
-
const debugMemoized = memoize(debug);
|
|
26
|
-
return Object.assign(debugMemoized, debugInst);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function debugFactory(debugApi = require('debug')) {
|
|
30
|
-
debugApi = lazyEval(debugApi);
|
|
31
|
-
return debugApi;
|
|
32
|
-
}
|
|
33
|
-
module.exports = debugFactory;
|
|
34
|
-
|
|
35
|
-
function spawnFactory(namespace = '', debugFabFactory = require('../debugFabFactory')()) {
|
|
36
|
-
function createDebugger(base = '', ns = '') {
|
|
37
|
-
const newNs = ns ? [base, ns].join(':') : base;
|
|
38
|
-
const debug = debugFabFactory(newNs);
|
|
39
|
-
debug.spawn = spawn;
|
|
40
|
-
return debug;
|
|
41
|
-
}
|
|
42
|
-
function spawn(ns) {
|
|
43
|
-
return createDebugger(this.namespace, ns);
|
|
44
|
-
}
|
|
45
|
-
return createDebugger(namespace);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const fabulous = Object.assign(debugFactory, { spawnable: spawnFactory });
|
|
49
|
-
module.exports = fabulous;
|
|
50
|
-
|
|
51
|
-
module.exports = fabulous;
|
package/umd/.tmp/index.d.ts
DELETED
package/umd/.tmp/internals.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Debug, Debugger } from 'debug';
|
|
2
|
-
export interface DebugLazy extends Debug {
|
|
3
|
-
(namespace: string): DebuggerExt;
|
|
4
|
-
}
|
|
5
|
-
export interface DebugFabulous extends DebugLazy {
|
|
6
|
-
(namespace: string): DebuggerExt;
|
|
7
|
-
spawnable: (_namespace: string, _debugFabFactory?: Debug) => DebuggerExtSpawn;
|
|
8
|
-
}
|
|
9
|
-
export type LazyDebugFunc = () => string | any[];
|
|
10
|
-
export interface DebuggerExt extends Debugger {
|
|
11
|
-
(lazyFunc: LazyDebugFunc): void;
|
|
12
|
-
(...args: any[]): void;
|
|
13
|
-
spawn: (ns: string) => DebuggerExt;
|
|
14
|
-
}
|
|
15
|
-
export interface DebuggerExtSpawn extends DebuggerExt {
|
|
16
|
-
spawn: (ns: string) => DebuggerExt;
|
|
17
|
-
}
|
package/umd/index.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('memoizee')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['memoizee'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.DebugFabulous = factory(global.memoizee));
|
|
5
|
-
})(this, (function (memoize) { 'use strict';
|
|
6
|
-
|
|
7
|
-
const extend = (_debugger) => {
|
|
8
|
-
const wrapped = (formatter, ...args) => {
|
|
9
|
-
if (typeof formatter === 'function') {
|
|
10
|
-
const ret = formatter();
|
|
11
|
-
const toApply = Array.isArray(ret) ? ret : [ret];
|
|
12
|
-
return _debugger(...toApply);
|
|
13
|
-
}
|
|
14
|
-
return _debugger(formatter, ...args);
|
|
15
|
-
};
|
|
16
|
-
return Object.assign(wrapped, _debugger);
|
|
17
|
-
};
|
|
18
|
-
const lazyEval = (debugInst) => {
|
|
19
|
-
function debug(namespace) {
|
|
20
|
-
function noop() { }
|
|
21
|
-
const instance = debugInst(namespace);
|
|
22
|
-
if (!instance.enabled) {
|
|
23
|
-
return Object.assign(noop, instance);
|
|
24
|
-
}
|
|
25
|
-
return extend(instance);
|
|
26
|
-
}
|
|
27
|
-
const debugMemoized = memoize(debug);
|
|
28
|
-
return Object.assign(debugMemoized, debugInst);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function debugFactory(debugApi = require('debug')) {
|
|
32
|
-
debugApi = lazyEval(debugApi);
|
|
33
|
-
return debugApi;
|
|
34
|
-
}
|
|
35
|
-
module.exports = debugFactory;
|
|
36
|
-
|
|
37
|
-
function spawnFactory(namespace = '', debugFabFactory = require('../debugFabFactory')()) {
|
|
38
|
-
function createDebugger(base = '', ns = '') {
|
|
39
|
-
const newNs = ns ? [base, ns].join(':') : base;
|
|
40
|
-
const debug = debugFabFactory(newNs);
|
|
41
|
-
debug.spawn = spawn;
|
|
42
|
-
return debug;
|
|
43
|
-
}
|
|
44
|
-
function spawn(ns) {
|
|
45
|
-
return createDebugger(this.namespace, ns);
|
|
46
|
-
}
|
|
47
|
-
return createDebugger(namespace);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const fabulous = Object.assign(debugFactory, { spawnable: spawnFactory });
|
|
51
|
-
module.exports = fabulous;
|
|
52
|
-
|
|
53
|
-
return fabulous;
|
|
54
|
-
|
|
55
|
-
}));
|