@graphql-tools/utils 10.0.10 → 10.0.11

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.
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debugTimerEnd = exports.debugTimerStart = void 0;
4
+ const debugNamesOngoing = new Set();
5
+ function debugTimerStart(name) {
6
+ const debugEnvVar = globalThis?.process.env['DEBUG'] || globalThis.DEBUG;
7
+ if (debugEnvVar === '1' || debugEnvVar?.includes(name)) {
8
+ debugNamesOngoing.add(name);
9
+ console.time(name);
10
+ }
11
+ }
12
+ exports.debugTimerStart = debugTimerStart;
13
+ function debugTimerEnd(name) {
14
+ if (debugNamesOngoing.has(name)) {
15
+ console.timeEnd(name);
16
+ }
17
+ }
18
+ exports.debugTimerEnd = debugTimerEnd;
package/cjs/index.js CHANGED
@@ -58,3 +58,4 @@ tslib_1.__exportStar(require("./Path.js"), exports);
58
58
  tslib_1.__exportStar(require("./jsutils.js"), exports);
59
59
  tslib_1.__exportStar(require("./directives.js"), exports);
60
60
  tslib_1.__exportStar(require("./mergeIncrementalResult.js"), exports);
61
+ tslib_1.__exportStar(require("./debugTimer.js"), exports);
@@ -0,0 +1,13 @@
1
+ const debugNamesOngoing = new Set();
2
+ export function debugTimerStart(name) {
3
+ const debugEnvVar = globalThis?.process.env['DEBUG'] || globalThis.DEBUG;
4
+ if (debugEnvVar === '1' || debugEnvVar?.includes(name)) {
5
+ debugNamesOngoing.add(name);
6
+ console.time(name);
7
+ }
8
+ }
9
+ export function debugTimerEnd(name) {
10
+ if (debugNamesOngoing.has(name)) {
11
+ console.timeEnd(name);
12
+ }
13
+ }
package/esm/index.js CHANGED
@@ -53,3 +53,4 @@ export * from './Path.js';
53
53
  export * from './jsutils.js';
54
54
  export * from './directives.js';
55
55
  export * from './mergeIncrementalResult.js';
56
+ export * from './debugTimer.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-tools/utils",
3
- "version": "10.0.10",
3
+ "version": "10.0.11",
4
4
  "description": "Common package containing utils and types for GraphQL tools",
5
5
  "sideEffects": false,
6
6
  "peerDependencies": {
@@ -0,0 +1,2 @@
1
+ export declare function debugTimerStart(name: string): void;
2
+ export declare function debugTimerEnd(name: string): void;
@@ -0,0 +1,2 @@
1
+ export declare function debugTimerStart(name: string): void;
2
+ export declare function debugTimerEnd(name: string): void;
@@ -53,3 +53,4 @@ export * from './Path.cjs';
53
53
  export * from './jsutils.cjs';
54
54
  export * from './directives.cjs';
55
55
  export * from './mergeIncrementalResult.cjs';
56
+ export * from './debugTimer.cjs';
@@ -53,3 +53,4 @@ export * from './Path.js';
53
53
  export * from './jsutils.js';
54
54
  export * from './directives.js';
55
55
  export * from './mergeIncrementalResult.js';
56
+ export * from './debugTimer.js';