debug-fabulous 2.0.6 → 2.0.8
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/lib/debugFabFactory.d.ts +4 -0
- package/lib/debugFabFactory.js +12 -0
- package/lib/extensions/lazyEval.d.ts +3 -0
- package/lib/extensions/lazyEval.js +30 -0
- package/lib/extensions/spawn.d.ts +2 -0
- package/lib/extensions/spawn.js +15 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +25 -0
- package/lib/internals.d.ts +17 -0
- package/lib/internals.js +2 -0
- package/package.json +6 -12
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const lazyEval_1 = __importDefault(require("./extensions/lazyEval"));
|
|
7
|
+
function debugFactory(debugApi = require('debug')) {
|
|
8
|
+
debugApi = (0, lazyEval_1.default)(debugApi);
|
|
9
|
+
return debugApi;
|
|
10
|
+
}
|
|
11
|
+
module.exports = debugFactory;
|
|
12
|
+
exports.default = debugFactory;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const memoizee_1 = __importDefault(require("memoizee"));
|
|
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 = (0, memoizee_1.default)(debug);
|
|
28
|
+
return Object.assign(debugMemoized, debugInst);
|
|
29
|
+
};
|
|
30
|
+
exports.default = lazyEval;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = spawnFactory;
|
|
4
|
+
function spawnFactory(namespace = '', debugFabFactory = require('../debugFabFactory')()) {
|
|
5
|
+
function createDebugger(base = '', ns = '') {
|
|
6
|
+
const newNs = ns ? [base, ns].join(':') : base;
|
|
7
|
+
const debug = debugFabFactory(newNs);
|
|
8
|
+
debug.spawn = spawn;
|
|
9
|
+
return debug;
|
|
10
|
+
}
|
|
11
|
+
function spawn(ns) {
|
|
12
|
+
return createDebugger(this.namespace, ns);
|
|
13
|
+
}
|
|
14
|
+
return createDebugger(namespace);
|
|
15
|
+
}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const debugFabFactory_1 = __importDefault(require("./debugFabFactory"));
|
|
21
|
+
const spawn_1 = __importDefault(require("./extensions/spawn"));
|
|
22
|
+
__exportStar(require("./internals"), exports);
|
|
23
|
+
const fabulous = Object.assign(debugFabFactory_1.default, { spawnable: spawn_1.default });
|
|
24
|
+
module.exports = fabulous;
|
|
25
|
+
exports.default = fabulous;
|
|
@@ -0,0 +1,17 @@
|
|
|
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/internals.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debug-fabulous",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.8",
|
|
4
4
|
"description": "visionmedia debug extensions rolled into one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"debug",
|
|
@@ -18,19 +18,18 @@
|
|
|
18
18
|
],
|
|
19
19
|
"main": "lib/index.js",
|
|
20
20
|
"files": [
|
|
21
|
-
"lib"
|
|
22
|
-
"umd"
|
|
21
|
+
"lib"
|
|
23
22
|
],
|
|
24
23
|
"scripts": {
|
|
25
|
-
"build": "
|
|
24
|
+
"build": "rm -rf lib && npx tsc",
|
|
26
25
|
"coveralls": "cat ./coverage/lcov.info | coveralls",
|
|
27
26
|
"docs:api:markdown": "npx typedoc --theme markdown --exclude ./src/test --out ./docs/api ./src",
|
|
28
27
|
"docs:api:website": "npx typedoc --exclude ./src/test --out docs ./src",
|
|
29
|
-
"jest": "npx jest",
|
|
30
28
|
"lint": "npm run build && eslint --ext .js,.ts,.tsx *.js src test --color",
|
|
31
29
|
"mocha": "mocha",
|
|
30
|
+
"prepack": "npm run build",
|
|
32
31
|
"prepare": "npx sort-package-json",
|
|
33
|
-
"test": "npm run build &&
|
|
32
|
+
"test": "npm run build && npx jest",
|
|
34
33
|
"test:ci": "npm run build && npm run test --coverage && npm run coveralls",
|
|
35
34
|
"preversion": "npm run build"
|
|
36
35
|
},
|
|
@@ -42,8 +41,6 @@
|
|
|
42
41
|
"@biiaidt/node-memwatch": "2.0.1",
|
|
43
42
|
"@commitlint/cli": "^19",
|
|
44
43
|
"@commitlint/config-conventional": "^19",
|
|
45
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
46
|
-
"@rollup/plugin-typescript": "^11.1.6",
|
|
47
44
|
"@types/debug": "^4",
|
|
48
45
|
"@types/jest": "^29.5.13",
|
|
49
46
|
"@znemz/js-common-eslint-config": "^0.2.2",
|
|
@@ -52,16 +49,13 @@
|
|
|
52
49
|
"commitlint": "19",
|
|
53
50
|
"config": "^3.2.2",
|
|
54
51
|
"coveralls": "^3.0.4",
|
|
55
|
-
"del": "^7.1.0",
|
|
56
52
|
"hook-std": "0.X",
|
|
57
53
|
"jest": "^29.7.0",
|
|
58
54
|
"prettier": "^1.18.2",
|
|
59
|
-
"rollup": "4.21.3",
|
|
60
55
|
"sort-package-json": "^2.10.1",
|
|
61
56
|
"typescript": "^5.6.2"
|
|
62
57
|
},
|
|
63
58
|
"engines": {
|
|
64
59
|
"node": ">= 14"
|
|
65
|
-
}
|
|
66
|
-
"umd": "umd/index.js"
|
|
60
|
+
}
|
|
67
61
|
}
|