@blocksuite/global
Advanced tools
Comparing version 0.4.0-20230201063624-4e0463b to 0.4.0-20230201220903-262005c
@@ -6,6 +6,6 @@ export declare const removeStackHeader: (stack: unknown) => string; | ||
}) => void; | ||
export declare const debug: (tag?: string) => (target: object, name: string, descriptor: TypedPropertyDescriptor<AnyFunction>) => TypedPropertyDescriptor<AnyFunction>; | ||
export declare const debug: (tag: string) => (target: object, name: string, descriptor: TypedPropertyDescriptor<AnyFunction>) => TypedPropertyDescriptor<AnyFunction>; | ||
export declare function configDebugLog(verbose: boolean): void; | ||
export declare function enableDebugLog(tags: string | string[]): void; | ||
export declare function enableDebugLog(tags?: string | string[]): void; | ||
export declare function disableDebuglog(tag?: string): void; | ||
//# sourceMappingURL=debug.d.ts.map |
@@ -24,3 +24,5 @@ import color from 'ansi-colors'; | ||
const whitelist = new Set(); | ||
const all = new Set(); | ||
export const debug = (tag) => { | ||
all.add(tag); | ||
return (target, name, descriptor) => { | ||
@@ -51,5 +53,8 @@ const original = descriptor.value; | ||
} | ||
else { | ||
else if (tags) { | ||
whitelist.add(tags); | ||
} | ||
else { | ||
[...all.values()].forEach(tag => whitelist.add(tag)); | ||
} | ||
} | ||
@@ -56,0 +61,0 @@ export function disableDebuglog(tag) { |
@@ -72,2 +72,5 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
enable_slash_menu: boolean; | ||
/** | ||
* @deprecated Will be removed after slash menu is stable | ||
*/ | ||
enable_append_flavor_slash: boolean; | ||
@@ -74,0 +77,0 @@ readonly: Record<string, boolean>; |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.4.0-20230201063624-4e0463b", | ||
"version": "0.4.0-20230201220903-262005c", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -40,4 +40,6 @@ import color from 'ansi-colors'; | ||
const whitelist = new Set<string>(); | ||
const all = new Set<string>(); | ||
export const debug = (tag?: string) => { | ||
export const debug = (tag: string) => { | ||
all.add(tag); | ||
return ( | ||
@@ -71,3 +73,3 @@ target: object, | ||
export function enableDebugLog(tags: string | string[]) { | ||
export function enableDebugLog(tags?: string | string[]) { | ||
color.enabled = true; | ||
@@ -77,4 +79,6 @@ enabled = true; | ||
tags.forEach(tag => whitelist.add(tag)); | ||
} else if (tags) { | ||
whitelist.add(tags); | ||
} else { | ||
whitelist.add(tags); | ||
[...all.values()].forEach(tag => whitelist.add(tag)); | ||
} | ||
@@ -81,0 +85,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
241878
2939