@vxrn/debug 1.1.326

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Nate Wienert
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,63 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf,
6
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: !0
11
+ });
12
+ },
13
+ __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
15
+ get: () => from[key],
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
+ value: mod,
27
+ enumerable: !0
28
+ }) : target, mod)),
29
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
+ value: !0
31
+ }), mod);
32
+ var src_exports = {};
33
+ __export(src_exports, {
34
+ createDebugger: () => createDebugger
35
+ });
36
+ module.exports = __toCommonJS(src_exports);
37
+ var import_debug = __toESM(require("debug"), 1);
38
+ const DEBUG = process.env.DEBUG;
39
+ function createDebugger(namespacePartial, options = {}) {
40
+ return {
41
+ debug: createSingleDebugger(namespacePartial, options),
42
+ debugDetails: createSingleDebugger(namespacePartial, options)
43
+ };
44
+ }
45
+ function createSingleDebugger(namespacePartial, options = {}) {
46
+ const namespace = `vxrn:${namespacePartial}`,
47
+ log = (0, import_debug.default)(namespace),
48
+ {
49
+ onlyWhenFocused
50
+ } = options;
51
+ let enabled = log.enabled;
52
+ if (enabled && onlyWhenFocused) {
53
+ const ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
54
+ enabled = !!DEBUG?.includes(ns);
55
+ }
56
+ const filter = void 0;
57
+ if (enabled) {
58
+ const fn = (...args) => {
59
+ (!filter || args.some(a => a?.includes?.(filter))) && log(...args);
60
+ };
61
+ return fn.namespace = namespace, fn;
62
+ }
63
+ }
@@ -0,0 +1,51 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var src_exports = {};
24
+ __export(src_exports, {
25
+ createDebugger: () => createDebugger
26
+ });
27
+ module.exports = __toCommonJS(src_exports);
28
+ var import_debug = __toESM(require("debug"), 1);
29
+ const DEBUG = process.env.DEBUG;
30
+ function createDebugger(namespacePartial, options = {}) {
31
+ return {
32
+ debug: createSingleDebugger(namespacePartial, options),
33
+ debugDetails: createSingleDebugger(namespacePartial, options)
34
+ };
35
+ }
36
+ function createSingleDebugger(namespacePartial, options = {}) {
37
+ const namespace = `vxrn:${namespacePartial}`, log = (0, import_debug.default)(namespace), { onlyWhenFocused } = options;
38
+ let enabled = log.enabled;
39
+ if (enabled && onlyWhenFocused) {
40
+ const ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
41
+ enabled = !!DEBUG?.includes(ns);
42
+ }
43
+ const filter = void 0;
44
+ if (enabled) {
45
+ const fn = (...args) => {
46
+ (!filter || args.some((a) => a?.includes?.(filter))) && log(...args);
47
+ };
48
+ return fn.namespace = namespace, fn;
49
+ }
50
+ }
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAQlB,MAAM,QAAQ,QAAQ,IAAI;AAMnB,SAAS,eACd,kBACA,UAA2B,CAAC,GACmB;AAC/C,SAAO;AAAA,IACL,OAAO,qBAAqB,kBAAkB,OAAO;AAAA,IACrD,cAAc,qBAAqB,kBAAkB,OAAO;AAAA,EAC9D;AACF;AAEA,SAAS,qBACP,kBACA,UAA2B,CAAC,GACN;AACtB,QAAM,YAAY,QAAQ,gBAAgB,IAEpC,UAAM,aAAAA,SAAM,SAAS,GACrB,EAAE,gBAAgB,IAAI;AAE5B,MAAI,UAAU,IAAI;AAClB,MAAI,WAAW,iBAAiB;AAC9B,UAAM,KAAK,OAAO,mBAAoB,WAAW,kBAAkB;AACnE,cAAU,CAAC,CAAC,OAAO,SAAS,EAAE;AAAA,EAChC;AAGA,QAAM,SAAS;AAEf,MAAI,SAAS;AACX,UAAM,KAAK,IAAI,SAA6B;AAC1C,OAAI,CAAC,UAAU,KAAK,KAAK,CAAC,MAAM,GAAG,WAAW,MAAM,CAAC,MACnD,IAAI,GAAG,IAAI;AAAA,IAEf;AAEA,cAAG,YAAY,WAER;AAAA,EACT;AACF;",
5
+ "names": ["debug"]
6
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: !0 });
10
+ }, __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from == "object" || typeof from == "function")
12
+ for (let key of __getOwnPropNames(from))
13
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
+ mod
23
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
24
+ var src_exports = {};
25
+ __export(src_exports, {
26
+ createDebugger: () => createDebugger
27
+ });
28
+ module.exports = __toCommonJS(src_exports);
29
+ var import_debug = __toESM(require("debug"), 1), DEBUG = process.env.DEBUG;
30
+ function createDebugger(namespacePartial) {
31
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
32
+ return {
33
+ debug: createSingleDebugger(namespacePartial, options),
34
+ debugDetails: createSingleDebugger(namespacePartial, options)
35
+ };
36
+ }
37
+ function createSingleDebugger(namespacePartial) {
38
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, namespace = `vxrn:${namespacePartial}`, log = (0, import_debug.default)(namespace), { onlyWhenFocused } = options, enabled = log.enabled;
39
+ if (enabled && onlyWhenFocused) {
40
+ var ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
41
+ enabled = !!(DEBUG != null && DEBUG.includes(ns));
42
+ }
43
+ var filter = void 0;
44
+ if (enabled) {
45
+ var fn = function() {
46
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
47
+ args[_key] = arguments[_key];
48
+ (!filter || args.some(function(a) {
49
+ var _a_includes;
50
+ return a == null || (_a_includes = a.includes) === null || _a_includes === void 0 ? void 0 : _a_includes.call(a, filter);
51
+ })) && log(...args);
52
+ };
53
+ return fn.namespace = namespace, fn;
54
+ }
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ createDebugger
59
+ });
60
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/debug/src/index.tsx"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;mBAAkB,8BAQZA,QAAQC,QAAQC,IAAIF;AAMnB,SAASG,eACdC,kBAAwB;MACxBC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAA2B,CAAC;AAE5B,SAAO;IACLC,OAAOC,qBAAqBH,kBAAkBC,OAAAA;IAC9CG,cAAcD,qBAAqBH,kBAAkBC,OAAAA;EACvD;AACF;AAEA,SAASE,qBACPH,kBAAwB;MACxBC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAA2B,CAAC,GAEtBI,YAAY,QAAQL,gBAAAA,IAEpBM,UAAMJ,aAAAA,SAAMG,SAAAA,GACZ,EAAEE,gBAAe,IAAKN,SAExBO,UAAUF,IAAIE;AAClB,MAAIA,WAAWD,iBAAiB;AAC9B,QAAME,KAAK,OAAOF,mBAAoB,WAAWA,kBAAkBF;AACnEG,cAAU,CAAC,EAACZ,SAAAA,QAAAA,MAAOc,SAASD,EAAAA;EAC9B;AAGA,MAAME,SAASC;AAEf,MAAIJ,SAAS;AACX,QAAMK,KAAK,WAAA;wCAAIC,OAAAA,IAAAA,MAAAA,IAAAA,GAAAA,OAAAA,GAAAA,OAAAA,MAAAA;AAAAA,aAAAA,IAAAA,IAAAA,UAAAA,IAAAA;AACb,OAAI,CAACH,UAAUG,KAAKC,KAAK,SAACC,GAAAA;YAAMA;eAAAA,KAAAA,SAAAA,cAAAA,EAAGN,cAAQ,QAAXM,gBAAAA,SAAAA,SAAAA,YAAAA,KAAAA,GAAcL,MAAAA;aAC5CL,IAAAA,GAAOQ,IAAAA;IAEX;AAEAD,cAAGR,YAAYA,WAERQ;EACT;AACF;",
5
+ "names": ["DEBUG", "process", "env", "createDebugger", "namespacePartial", "options", "debug", "createSingleDebugger", "debugDetails", "namespace", "log", "onlyWhenFocused", "enabled", "ns", "includes", "filter", "undefined", "fn", "args", "some", "a"]
6
+ }
@@ -0,0 +1,27 @@
1
+ import debug from "debug";
2
+ const DEBUG = process.env.DEBUG;
3
+ function createDebugger(namespacePartial, options = {}) {
4
+ return {
5
+ debug: createSingleDebugger(namespacePartial, options),
6
+ debugDetails: createSingleDebugger(namespacePartial, options)
7
+ };
8
+ }
9
+ function createSingleDebugger(namespacePartial, options = {}) {
10
+ const namespace = `vxrn:${namespacePartial}`, log = debug(namespace), { onlyWhenFocused } = options;
11
+ let enabled = log.enabled;
12
+ if (enabled && onlyWhenFocused) {
13
+ const ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
14
+ enabled = !!DEBUG?.includes(ns);
15
+ }
16
+ const filter = void 0;
17
+ if (enabled) {
18
+ const fn = (...args) => {
19
+ (!filter || args.some((a) => a?.includes?.(filter))) && log(...args);
20
+ };
21
+ return fn.namespace = namespace, fn;
22
+ }
23
+ }
24
+ export {
25
+ createDebugger
26
+ };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx"],
4
+ "mappings": "AAAA,OAAO,WAAW;AAQlB,MAAM,QAAQ,QAAQ,IAAI;AAMnB,SAAS,eACd,kBACA,UAA2B,CAAC,GACmB;AAC/C,SAAO;AAAA,IACL,OAAO,qBAAqB,kBAAkB,OAAO;AAAA,IACrD,cAAc,qBAAqB,kBAAkB,OAAO;AAAA,EAC9D;AACF;AAEA,SAAS,qBACP,kBACA,UAA2B,CAAC,GACN;AACtB,QAAM,YAAY,QAAQ,gBAAgB,IAEpC,MAAM,MAAM,SAAS,GACrB,EAAE,gBAAgB,IAAI;AAE5B,MAAI,UAAU,IAAI;AAClB,MAAI,WAAW,iBAAiB;AAC9B,UAAM,KAAK,OAAO,mBAAoB,WAAW,kBAAkB;AACnE,cAAU,CAAC,CAAC,OAAO,SAAS,EAAE;AAAA,EAChC;AAGA,QAAM,SAAS;AAEf,MAAI,SAAS;AACX,UAAM,KAAK,IAAI,SAA6B;AAC1C,OAAI,CAAC,UAAU,KAAK,KAAK,CAAC,MAAM,GAAG,WAAW,MAAM,CAAC,MACnD,IAAI,GAAG,IAAI;AAAA,IAEf;AAEA,cAAG,YAAY,WAER;AAAA,EACT;AACF;",
5
+ "names": []
6
+ }
@@ -0,0 +1,29 @@
1
+ import debug from "debug";
2
+ const DEBUG = process.env.DEBUG;
3
+ function createDebugger(namespacePartial, options = {}) {
4
+ return {
5
+ debug: createSingleDebugger(namespacePartial, options),
6
+ debugDetails: createSingleDebugger(namespacePartial, options)
7
+ };
8
+ }
9
+ function createSingleDebugger(namespacePartial, options = {}) {
10
+ const namespace = `vxrn:${namespacePartial}`,
11
+ log = debug(namespace),
12
+ {
13
+ onlyWhenFocused
14
+ } = options;
15
+ let enabled = log.enabled;
16
+ if (enabled && onlyWhenFocused) {
17
+ const ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
18
+ enabled = !!DEBUG?.includes(ns);
19
+ }
20
+ const filter = void 0;
21
+ if (enabled) {
22
+ const fn = (...args) => {
23
+ (!filter || args.some(a => a?.includes?.(filter))) && log(...args);
24
+ };
25
+ return fn.namespace = namespace, fn;
26
+ }
27
+ }
28
+ export { createDebugger };
29
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["debug","DEBUG","process","env","createDebugger","namespacePartial","options","createSingleDebugger","debugDetails","namespace","log","onlyWhenFocused","enabled","ns","includes","filter","fn","args","some","a"],"sources":["../../src/index.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAQlB,MAAMC,KAAA,GAAQC,OAAA,CAAQC,GAAA,CAAIF,KAAA;AAMnB,SAASG,eACdC,gBAAA,EACAC,OAAA,GAA2B,CAAC,GACmB;EAC/C,OAAO;IACLN,KAAA,EAAOO,oBAAA,CAAqBF,gBAAA,EAAkBC,OAAO;IACrDE,YAAA,EAAcD,oBAAA,CAAqBF,gBAAA,EAAkBC,OAAO;EAC9D;AACF;AAEA,SAASC,qBACPF,gBAAA,EACAC,OAAA,GAA2B,CAAC,GACN;EACtB,MAAMG,SAAA,GAAY,QAAQJ,gBAAgB;IAEpCK,GAAA,GAAMV,KAAA,CAAMS,SAAS;IACrB;MAAEE;IAAgB,IAAIL,OAAA;EAE5B,IAAIM,OAAA,GAAUF,GAAA,CAAIE,OAAA;EAClB,IAAIA,OAAA,IAAWD,eAAA,EAAiB;IAC9B,MAAME,EAAA,GAAK,OAAOF,eAAA,IAAoB,WAAWA,eAAA,GAAkBF,SAAA;IACnEG,OAAA,GAAU,CAAC,CAACX,KAAA,EAAOa,QAAA,CAASD,EAAE;EAChC;EAGA,MAAME,MAAA,GAAS;EAEf,IAAIH,OAAA,EAAS;IACX,MAAMI,EAAA,GAAKA,CAAA,GAAIC,IAAA,KAA6B;MAC1C,CAAI,CAACF,MAAA,IAAUE,IAAA,CAAKC,IAAA,CAAMC,CAAA,IAAMA,CAAA,EAAGL,QAAA,GAAWC,MAAM,CAAC,MACnDL,GAAA,CAAI,GAAGO,IAAI;IAEf;IAEA,OAAAD,EAAA,CAAGP,SAAA,GAAYA,SAAA,EAERO,EAAA;EACT;AACF","ignoreList":[]}
@@ -0,0 +1,32 @@
1
+ import debug from "debug";
2
+ var DEBUG = process.env.DEBUG;
3
+ function createDebugger(namespacePartial) {
4
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
5
+ return {
6
+ debug: createSingleDebugger(namespacePartial, options),
7
+ debugDetails: createSingleDebugger(namespacePartial, options)
8
+ };
9
+ }
10
+ function createSingleDebugger(namespacePartial) {
11
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, namespace = `vxrn:${namespacePartial}`, log = debug(namespace), { onlyWhenFocused } = options, enabled = log.enabled;
12
+ if (enabled && onlyWhenFocused) {
13
+ var ns = typeof onlyWhenFocused == "string" ? onlyWhenFocused : namespace;
14
+ enabled = !!DEBUG?.includes(ns);
15
+ }
16
+ var filter = void 0;
17
+ if (enabled) {
18
+ var fn = function() {
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)
20
+ args[_key] = arguments[_key];
21
+ (!filter || args.some(function(a) {
22
+ var _a_includes;
23
+ return a == null || (_a_includes = a.includes) === null || _a_includes === void 0 ? void 0 : _a_includes.call(a, filter);
24
+ })) && log(...args);
25
+ };
26
+ return fn.namespace = namespace, fn;
27
+ }
28
+ }
29
+ export {
30
+ createDebugger
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/Users/n8/one/packages/debug/src/index.tsx"],
4
+ "mappings": "AAAA,OAAOA,WAAW;AAQlB,IAAMC,QAAQC,QAAQC,IAAIF;AAMnB,SAASG,eACdC,kBAAwB;MACxBC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAA2B,CAAC;AAE5B,SAAO;IACLN,OAAOO,qBAAqBF,kBAAkBC,OAAAA;IAC9CE,cAAcD,qBAAqBF,kBAAkBC,OAAAA;EACvD;AACF;AAEA,SAASC,qBACPF,kBAAwB;MACxBC,UAAAA,UAAAA,SAAAA,KAAAA,UAAAA,CAAAA,MAAAA,SAAAA,UAAAA,CAAAA,IAA2B,CAAC,GAEtBG,YAAY,QAAQJ,gBAAAA,IAEpBK,MAAMV,MAAMS,SAAAA,GACZ,EAAEE,gBAAe,IAAKL,SAExBM,UAAUF,IAAIE;AAClB,MAAIA,WAAWD,iBAAiB;AAC9B,QAAME,KAAK,OAAOF,mBAAoB,WAAWA,kBAAkBF;AACnEG,cAAU,CAAC,CAACX,OAAOa,SAASD,EAAAA;EAC9B;AAGA,MAAME,SAASC;AAEf,MAAIJ,SAAS;AACX,QAAMK,KAAK,WAAA;wCAAIC,OAAAA,IAAAA,MAAAA,IAAAA,GAAAA,OAAAA,GAAAA,OAAAA,MAAAA;AAAAA,aAAAA,IAAAA,IAAAA,UAAAA,IAAAA;AACb,OAAI,CAACH,UAAUG,KAAKC,KAAK,SAACC,GAAAA;YAAMA;eAAAA,KAAAA,SAAAA,cAAAA,EAAGN,cAAQ,QAAXM,gBAAAA,SAAAA,SAAAA,YAAAA,KAAAA,GAAcL,MAAAA;aAC5CL,IAAAA,GAAOQ,IAAAA;IAEX;AAEAD,cAAGR,YAAYA,WAERQ;EACT;AACF;",
5
+ "names": ["debug", "DEBUG", "process", "env", "createDebugger", "namespacePartial", "options", "createSingleDebugger", "debugDetails", "namespace", "log", "onlyWhenFocused", "enabled", "ns", "includes", "filter", "undefined", "fn", "args", "some", "a"]
6
+ }
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@vxrn/debug",
3
+ "version": "1.1.326",
4
+ "sideEffects": false,
5
+ "source": "src/index.ts",
6
+ "type": "module",
7
+ "types": "./types/index.d.ts",
8
+ "main": "dist/cjs",
9
+ "module": "dist/esm",
10
+ "exports": {
11
+ "./package.json": "./package.json",
12
+ ".": {
13
+ "types": "./types/index.d.ts",
14
+ "import": "./dist/esm/index.mjs",
15
+ "require": "./dist/cjs/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "src",
20
+ "types",
21
+ "dist"
22
+ ],
23
+ "scripts": {
24
+ "build": "tamagui-build",
25
+ "watch": "tamagui-build --watch",
26
+ "lint": "npx biome check src",
27
+ "lint:fix": "npx biome check --apply-unsafe src",
28
+ "clean": "tamagui-build clean",
29
+ "clean:build": "tamagui-build clean:build"
30
+ },
31
+ "dependencies": {
32
+ "debug": "^4.3.7"
33
+ },
34
+ "devDependencies": {
35
+ "@tamagui/build": "^1.116.7",
36
+ "@types/debug": "^4"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ }
41
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,54 @@
1
+ import debug from 'debug'
2
+
3
+ type Debugger = debug.Debugger['log'] & { namespace: string }
4
+
5
+ interface DebuggerOptions {
6
+ onlyWhenFocused?: boolean | string
7
+ }
8
+
9
+ const DEBUG = process.env.DEBUG
10
+
11
+ /**
12
+ * This is like `createDebugger()` in the Vite source code ([see](https://github.com/vitejs/vite/blob/v6.0.0-beta.5/packages/vite/src/node/utils.ts#L163)),
13
+ * but some of its features are not supported yet to keeps things simple.
14
+ */
15
+ export function createDebugger(
16
+ namespacePartial: string,
17
+ options: DebuggerOptions = {}
18
+ ): { debug?: Debugger; debugDetails?: Debugger } {
19
+ return {
20
+ debug: createSingleDebugger(namespacePartial, options),
21
+ debugDetails: createSingleDebugger(namespacePartial, options),
22
+ }
23
+ }
24
+
25
+ function createSingleDebugger(
26
+ namespacePartial: string,
27
+ options: DebuggerOptions = {}
28
+ ): Debugger | undefined {
29
+ const namespace = `vxrn:${namespacePartial}`
30
+
31
+ const log = debug(namespace)
32
+ const { onlyWhenFocused } = options
33
+
34
+ let enabled = log.enabled
35
+ if (enabled && onlyWhenFocused) {
36
+ const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace
37
+ enabled = !!DEBUG?.includes(ns)
38
+ }
39
+
40
+ // Not supported for now
41
+ const filter = undefined
42
+
43
+ if (enabled) {
44
+ const fn = (...args: [string, ...any[]]) => {
45
+ if (!filter || args.some((a) => a?.includes?.(filter))) {
46
+ log(...args)
47
+ }
48
+ }
49
+
50
+ fn.namespace = namespace
51
+
52
+ return fn
53
+ }
54
+ }
@@ -0,0 +1,17 @@
1
+ import debug from 'debug';
2
+ type Debugger = debug.Debugger['log'] & {
3
+ namespace: string;
4
+ };
5
+ interface DebuggerOptions {
6
+ onlyWhenFocused?: boolean | string;
7
+ }
8
+ /**
9
+ * This is like `createDebugger()` in the Vite source code ([see](https://github.com/vitejs/vite/blob/v6.0.0-beta.5/packages/vite/src/node/utils.ts#L163)),
10
+ * but some of its features are not supported yet to keeps things simple.
11
+ */
12
+ export declare function createDebugger(namespacePartial: string, options?: DebuggerOptions): {
13
+ debug?: Debugger;
14
+ debugDetails?: Debugger;
15
+ };
16
+ export {};
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7D,UAAU,eAAe;IACvB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACnC;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,gBAAgB,EAAE,MAAM,EACxB,OAAO,GAAE,eAAoB,GAC5B;IAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;IAAC,YAAY,CAAC,EAAE,QAAQ,CAAA;CAAE,CAK/C"}