debug-fabulous 2.0.39 → 2.0.41
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.
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
3
|
+
const NOOP = (() => { });
|
|
7
4
|
const extend = (_debugger) => {
|
|
8
5
|
const wrapped = (formatter, ...args) => {
|
|
9
6
|
if (typeof formatter === 'function') {
|
|
@@ -16,15 +13,22 @@ const extend = (_debugger) => {
|
|
|
16
13
|
return Object.assign(wrapped, _debugger);
|
|
17
14
|
};
|
|
18
15
|
const lazyEval = (debugInst) => {
|
|
16
|
+
const cache = new Map();
|
|
19
17
|
function debug(namespace) {
|
|
20
|
-
|
|
18
|
+
let cached = cache.get(namespace);
|
|
19
|
+
if (cached !== undefined) {
|
|
20
|
+
return cached;
|
|
21
|
+
}
|
|
21
22
|
const instance = debugInst(namespace);
|
|
22
23
|
if (!instance.enabled) {
|
|
23
|
-
|
|
24
|
+
cached = Object.assign(NOOP, instance);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
cached = extend(instance);
|
|
24
28
|
}
|
|
25
|
-
|
|
29
|
+
cache.set(namespace, cached);
|
|
30
|
+
return cached;
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
return Object.assign(debugMemoized, debugInst);
|
|
32
|
+
return Object.assign(debug, debugInst);
|
|
29
33
|
};
|
|
30
34
|
exports.default = lazyEval;
|
package/lib/extensions/spawn.js
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.default = spawnFactory;
|
|
4
|
-
|
|
7
|
+
const debugFabFactory_1 = __importDefault(require("../debugFabFactory"));
|
|
8
|
+
let defaultFactory = null;
|
|
9
|
+
const getDefaultFactory = () => {
|
|
10
|
+
if (!defaultFactory) {
|
|
11
|
+
defaultFactory = (0, debugFabFactory_1.default)();
|
|
12
|
+
}
|
|
13
|
+
return defaultFactory;
|
|
14
|
+
};
|
|
15
|
+
function spawnFactory(namespace = '', debugFabFactory) {
|
|
16
|
+
const factory = debugFabFactory ?? getDefaultFactory();
|
|
5
17
|
function createDebugger(base = '', ns = '') {
|
|
6
18
|
const newNs = ns ? [base, ns].join(':') : base;
|
|
7
|
-
const debug =
|
|
19
|
+
const debug = factory(newNs);
|
|
8
20
|
debug.spawn = spawn;
|
|
9
21
|
return debug;
|
|
10
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debug-fabulous",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.41",
|
|
4
4
|
"description": "visionmedia debug extensions rolled into one",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"debug",
|
|
@@ -21,36 +21,35 @@
|
|
|
21
21
|
"lib"
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
|
+
"bench": "npm run build && vitest bench",
|
|
24
25
|
"build": "rm -rf lib && npx tsc",
|
|
25
26
|
"docs:api:markdown": "npx typedoc --theme markdown --exclude ./src/test --out ./docs/api ./src",
|
|
26
27
|
"docs:api:website": "npx typedoc --exclude ./src/test --out docs ./src",
|
|
27
|
-
"lint": "npm run build && eslint
|
|
28
|
+
"lint": "npm run build && eslint *.js src test --color",
|
|
28
29
|
"prepack": "npm run build",
|
|
29
30
|
"prepare": "npx sort-package-json",
|
|
30
|
-
"test": "npm run build &&
|
|
31
|
-
"test:ci": "npm run build &&
|
|
31
|
+
"test": "npm run build && vitest run",
|
|
32
|
+
"test:ci": "npm run build && vitest run --coverage",
|
|
32
33
|
"preversion": "npm run build"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"debug": "4.4.3"
|
|
36
|
-
"memoizee": "0.4"
|
|
36
|
+
"debug": "4.4.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@commitlint/cli": "^20",
|
|
40
40
|
"@commitlint/config-conventional": "^20",
|
|
41
41
|
"@types/debug": "^4",
|
|
42
|
-
"@types/jest": "^30.0.0",
|
|
43
42
|
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
43
|
+
"@vitest/eslint-plugin": "^1.6.6",
|
|
44
44
|
"commitlint": "20",
|
|
45
45
|
"config": "^4.0.0",
|
|
46
46
|
"eslint": "9",
|
|
47
|
-
"eslint-plugin-jest": "29.12.1",
|
|
48
47
|
"hook-std": "4.0",
|
|
49
|
-
"jest": ">=30.1.3",
|
|
50
48
|
"JSONStream": "1.X",
|
|
51
49
|
"prettier": "^3.6.2",
|
|
52
50
|
"sort-package-json": "^3.0.0",
|
|
53
|
-
"typescript": "^5.6.2"
|
|
51
|
+
"typescript": "^5.6.2",
|
|
52
|
+
"vitest": "^4.0.18"
|
|
54
53
|
},
|
|
55
54
|
"engines": {
|
|
56
55
|
"node": ">= 20"
|