@puq/debug 0.0.1 → 0.0.2
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/README.md +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/debug.d.ts +5 -1
- package/dist/lib/debug.d.ts.map +1 -1
- package/dist/lib/debug.js +2 -3
- package/dist/lib/debug.js.map +1 -1
- package/dist/lib/end.d.ts +6 -0
- package/dist/lib/end.d.ts.map +1 -0
- package/dist/lib/end.js +12 -0
- package/dist/lib/end.js.map +1 -0
- package/dist/lib/is-debug-mode.d.ts +4 -0
- package/dist/lib/is-debug-mode.d.ts.map +1 -1
- package/dist/lib/is-debug-mode.js +7 -1
- package/dist/lib/is-debug-mode.js.map +1 -1
- package/dist/lib/start.d.ts +7 -0
- package/dist/lib/start.d.ts.map +1 -0
- package/dist/lib/start.js +11 -0
- package/dist/lib/start.js.map +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
@@ -6,7 +6,9 @@
|
|
6
6
|
|
7
7
|
## Summary
|
8
8
|
|
9
|
-
debug
|
9
|
+
The library privides 3 functions, `start`, `end`, and `debug`. These function only work when the `process.env.DEBUG_MODE` is `true`.
|
10
|
+
|
11
|
+
`start` function is for indicating context of the debug such as `operationName` and the `end` function is for indicating the closing of the context.
|
10
12
|
|
11
13
|
## Install
|
12
14
|
|
@@ -14,6 +16,8 @@ debug
|
|
14
16
|
pnpm add @puq/debug
|
15
17
|
```
|
16
18
|
|
19
|
+
### Useage
|
20
|
+
|
17
21
|
## Funding
|
18
22
|
|
19
23
|
Thank you for using `@puq/debug` It's an open-source project, and maintaining it takes time and effort. If you find this library useful, please consider supporting its ongoing development. Your contributions help ensure that the project stays up-to-date, secure, and well-maintained.
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)\nexport * from './lib/debug.js';\nexport * from './lib/is-debug-mode.js';\n"],"names":[],"rangeMappings":"
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./**/*.ts', '!./**/*.{spec,test}.ts'], f => `export * from '${f.path}.js'`)\nexport * from './lib/debug.js';\nexport * from './lib/end.js';\nexport * from './lib/is-debug-mode.js';\nexport * from './lib/start.js';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,uFAAuF;AACvF,cAAc,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB"}
|
package/dist/lib/debug.d.ts
CHANGED
package/dist/lib/debug.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/lib/debug.ts"],"names":[],"mappings":"AAEA,wBAAgB,KAAK,CAAC,
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/lib/debug.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,KAAK,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAW7C"}
|
package/dist/lib/debug.js
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
import { isDebugMode } from './is-debug-mode.js';
|
2
2
|
/**
|
3
|
-
*
|
3
|
+
* Print a debug message if DEBUG_MODE is active
|
4
4
|
* @returns
|
5
5
|
*/ export function debug(...message) {
|
6
6
|
if (!isDebugMode()) return;
|
7
7
|
if (message.every((e)=>{
|
8
8
|
return typeof e != 'object';
|
9
9
|
})) {
|
10
|
-
console.
|
10
|
+
console.log(...message);
|
11
11
|
} else {
|
12
|
-
console.debug('[ Debug ]');
|
13
12
|
console.table(message);
|
14
13
|
}
|
15
14
|
}
|
package/dist/lib/debug.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/lib/debug.ts"],"sourcesContent":["import { isDebugMode } from './is-debug-mode.js';\n\
|
1
|
+
{"version":3,"sources":["../../src/lib/debug.ts"],"sourcesContent":["import { isDebugMode } from './is-debug-mode.js';\n\n/**\n * Print a debug message if DEBUG_MODE is active\n * @returns\n */\nexport function debug(...message: any[]): void {\n if (!isDebugMode()) return;\n if (\n message.every((e) => {\n return typeof e != 'object';\n })\n ) {\n console.log(...message);\n } else {\n console.table(message);\n }\n}\n"],"names":["isDebugMode","debug","message","every","e","console","log","table"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,SAASA,WAAW,QAAQ,qBAAqB;AAEjD;;;CAGC,GACD,OAAO,SAASC,MAAM,GAAGC,OAAc;IACrC,IAAI,CAACF,eAAe;IACpB,IACEE,QAAQC,KAAK,CAAC,CAACC;QACb,OAAO,OAAOA,KAAK;IACrB,IACA;QACAC,QAAQC,GAAG,IAAIJ;IACjB,OAAO;QACLG,QAAQE,KAAK,CAACL;IAChB;AACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"end.d.ts","sourceRoot":"","sources":["../../src/lib/end.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,GAAG,SAKlB"}
|
package/dist/lib/end.js
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
import { isDebugMode } from './is-debug-mode.js';
|
2
|
+
/**
|
3
|
+
* Print a closing indicator for the debugger if DEBUG_MODE is active
|
4
|
+
* @returns
|
5
|
+
*/ export function end() {
|
6
|
+
if (!isDebugMode()) return;
|
7
|
+
console.log(`----------------------------End`);
|
8
|
+
console.log(' ');
|
9
|
+
console.log(' ');
|
10
|
+
}
|
11
|
+
|
12
|
+
//# sourceMappingURL=end.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/end.ts"],"sourcesContent":["import { isDebugMode } from './is-debug-mode.js';\r\n\r\n/**\r\n * Print a closing indicator for the debugger if DEBUG_MODE is active\r\n * @returns\r\n */\r\nexport function end() {\r\n if (!isDebugMode()) return;\r\n console.log(`----------------------------End`);\r\n console.log(' ');\r\n console.log(' ');\r\n}\r\n"],"names":["isDebugMode","end","console","log"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,SAASA,WAAW,QAAQ,qBAAqB;AAEjD;;;CAGC,GACD,OAAO,SAASC;IACd,IAAI,CAACD,eAAe;IACpBE,QAAQC,GAAG,CAAC,CAAC,+BAA+B,CAAC;IAC7CD,QAAQC,GAAG,CAAC;IACZD,QAAQC,GAAG,CAAC;AACd"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"is-debug-mode.d.ts","sourceRoot":"","sources":["../../src/lib/is-debug-mode.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,IAAI,OAAO,CAErC"}
|
1
|
+
{"version":3,"file":"is-debug-mode.d.ts","sourceRoot":"","sources":["../../src/lib/is-debug-mode.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,eAAe,CAAC;AAEvC,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,wBAAgB,SAAS;;EAIxB"}
|
@@ -1,9 +1,15 @@
|
|
1
|
+
export const DEBUG_MODE = 'DEBUG_MODE';
|
1
2
|
export function isDebugMode() {
|
2
3
|
return [
|
3
4
|
true,
|
4
5
|
'true',
|
5
6
|
1
|
6
|
-
].some((e)=>process.env
|
7
|
+
].some((e)=>process.env[DEBUG_MODE] === e);
|
8
|
+
}
|
9
|
+
export function debugMode() {
|
10
|
+
return {
|
11
|
+
[DEBUG_MODE]: true
|
12
|
+
};
|
7
13
|
}
|
8
14
|
|
9
15
|
//# sourceMappingURL=is-debug-mode.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/lib/is-debug-mode.ts"],"sourcesContent":["export function isDebugMode(): boolean {\r\n return [true, 'true', 1].some((e) => process.env
|
1
|
+
{"version":3,"sources":["../../src/lib/is-debug-mode.ts"],"sourcesContent":["export const DEBUG_MODE = 'DEBUG_MODE';\r\n\r\nexport function isDebugMode(): boolean {\r\n return [true, 'true', 1].some((e) => process.env[DEBUG_MODE] === e);\r\n}\r\n\r\nexport function debugMode() {\r\n return {\r\n [DEBUG_MODE]: true,\r\n };\r\n}\r\n"],"names":["DEBUG_MODE","isDebugMode","some","e","process","env","debugMode"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,OAAO,MAAMA,aAAa,aAAa;AAEvC,OAAO,SAASC;IACd,OAAO;QAAC;QAAM;QAAQ;KAAE,CAACC,IAAI,CAAC,CAACC,IAAMC,QAAQC,GAAG,CAACL,WAAW,KAAKG;AACnE;AAEA,OAAO,SAASG;IACd,OAAO;QACL,CAACN,WAAW,EAAE;IAChB;AACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/lib/start.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,SAAU,QAGtC"}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { isDebugMode } from './is-debug-mode.js';
|
2
|
+
/**
|
3
|
+
*
|
4
|
+
* Print a opening indicator for the debugger if DEBUG_MODE is active
|
5
|
+
* @param context Debug context
|
6
|
+
*/ export function start(context = 'Debug') {
|
7
|
+
if (!isDebugMode()) return;
|
8
|
+
console.log(`[ ${context} ] ----------------------------Start`);
|
9
|
+
}
|
10
|
+
|
11
|
+
//# sourceMappingURL=start.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/lib/start.ts"],"sourcesContent":["import { isDebugMode } from './is-debug-mode.js';\r\n\r\n/**\r\n *\r\n * Print a opening indicator for the debugger if DEBUG_MODE is active\r\n * @param context Debug context\r\n */\r\nexport function start(context = 'Debug') {\r\n if (!isDebugMode()) return;\r\n console.log(`[ ${context} ] ----------------------------Start`);\r\n}\r\n"],"names":["isDebugMode","start","context","console","log"],"rangeMappings":";;;;;;;;","mappings":"AAAA,SAASA,WAAW,QAAQ,qBAAqB;AAEjD;;;;CAIC,GACD,OAAO,SAASC,MAAMC,UAAU,OAAO;IACrC,IAAI,CAACF,eAAe;IACpBG,QAAQC,GAAG,CAAC,CAAC,EAAE,EAAEF,QAAQ,oCAAoC,CAAC;AAChE"}
|
package/package.json
CHANGED