debug-fabulous 2.0.3 → 2.0.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "debug-fabulous",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "visionmedia debug extensions rolled into one",
5
5
  "keywords": [
6
6
  "debug",
@@ -58,7 +58,7 @@
58
58
  "prettier": "^1.18.2",
59
59
  "rollup": "4.21.3",
60
60
  "sort-package-json": "^2.10.1",
61
- "typescript": "^4.2.4"
61
+ "typescript": "^5.6.2"
62
62
  },
63
63
  "engines": {
64
64
  "node": ">= 14"
@@ -1,4 +0,0 @@
1
- import { Debug } from 'debug';
2
- import { DebugLazy } from './internals';
3
- declare function debugFactory(debugApi?: Debug): DebugLazy;
4
- export default debugFactory;
@@ -1,3 +0,0 @@
1
- import { Debug } from 'debug';
2
- declare const lazyEval: (debugInst: Debug) => any;
3
- export default lazyEval;
@@ -1,2 +0,0 @@
1
- import { DebuggerExtSpawn, DebugFabulous } from '../internals';
2
- export default function spawnFactory(namespace?: string, debugFabFactory?: DebugFabulous): DebuggerExtSpawn;
@@ -1,4 +0,0 @@
1
- import { DebugFabulous } from './internals';
2
- export * from './internals';
3
- declare const fabulous: DebugFabulous;
4
- export default fabulous;
@@ -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;
@@ -1,4 +0,0 @@
1
- import { Debug } from 'debug';
2
- import { DebugLazy } from './internals';
3
- declare function debugFactory(debugApi?: Debug): DebugLazy;
4
- export default debugFactory;
@@ -1,3 +0,0 @@
1
- import { Debug } from 'debug';
2
- declare const lazyEval: (debugInst: Debug) => any;
3
- export default lazyEval;
@@ -1,2 +0,0 @@
1
- import { DebuggerExtSpawn, DebugFabulous } from '../internals';
2
- export default function spawnFactory(namespace?: string, debugFabFactory?: DebugFabulous): DebuggerExtSpawn;
@@ -1,4 +0,0 @@
1
- import { DebugFabulous } from './internals';
2
- export * from './internals';
3
- declare const fabulous: DebugFabulous;
4
- export default fabulous;
@@ -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
- }));