diff --git a/lib/modules/src/finders/lookup.ts b/lib/modules/src/finders/lookup.ts index 62cc235..54e34ec 100644 --- a/lib/modules/src/finders/lookup.ts +++ b/lib/modules/src/finders/lookup.ts @@ -125,11 +125,11 @@ export function* lookupModules(filter: Filter, options?: LookupModulesOptions) { exportsFromFilterResultFlag(flag, exports, options), id, ] - } else if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS) + } else if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS__) warnDeveloperAboutPartialFilterMatch(id, filter.key) } - if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS) + if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS__) if (warn) warnDeveloperAboutNoFilterMatch(filter) } @@ -176,11 +176,11 @@ export function lookupModule(filter: Filter, options?: LookupModulesOptions) { exportsFromFilterResultFlag(flag, exports, options), id, ] - else if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS) + else if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS__) warnDeveloperAboutPartialFilterMatch(id, filter.key) } - if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS) + if (__BUILD_FLAG_DEBUG_MODULE_LOOKUPS__) warnDeveloperAboutNoFilterMatch(filter) return [] @@ -221,7 +221,7 @@ function warnDeveloperAboutPartialFilterMatch(id: Metro.ModuleID, key: string) { ) } -const __blacklistedFunctions = __BUILD_FLAG_DEBUG_MODULE_LOOKUPS +const __blacklistedFunctions = __BUILD_FLAG_DEBUG_MODULE_LOOKUPS__ ? [ import('./get').then(m => m.getModule), import('@revenge-mod/utils/discord').then( diff --git a/lib/utils/src/proxy.ts b/lib/utils/src/proxy.ts index 270e647..13d83d5 100644 --- a/lib/utils/src/proxy.ts +++ b/lib/utils/src/proxy.ts @@ -155,7 +155,7 @@ export function proxify(signal: () => T, options?: ProxifyOptions): T { options?.cache ?? false, ]) - if (__BUILD_FLAG_DEBUG_PROXIFIED_VALUES) { + if (__BUILD_FLAG_DEBUG_PROXIFIED_VALUES__) { const v = unproxifyFromHint(hint) if (v == null) warnDeveloperAboutNullishProxifiedValue() } diff --git a/scripts/build.ts b/scripts/build.ts index b7359ff..07a234a 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -57,8 +57,8 @@ export default async function build(dev = Dev, log = true) { __BUILD_ENV__: JSON.stringify(dev ? 'development' : 'production'), // See types.d.ts for what these flags do - __BUILD_FLAG_DEBUG_MODULE_LOOKUPS: 'false', - __BUILD_FLAG_DEBUG_PROXIFIED_VALUES: 'false', + __BUILD_FLAG_DEBUG_MODULE_LOOKUPS__: String(dev), + __BUILD_FLAG_DEBUG_PROXIFIED_VALUES__: 'false', __BUILD_FLAG_LOG_PROMISE_REJECTIONS__: String(dev), }, plugins: [ diff --git a/types.d.ts b/types.d.ts index b5efa46..4d021ba 100644 --- a/types.d.ts +++ b/types.d.ts @@ -16,14 +16,14 @@ declare global { * - Logs failed lookups with stack traces. * - Logs partial matches (matches exportless, but not with-exports). */ - const __BUILD_FLAG_DEBUG_MODULE_LOOKUPS: boolean + const __BUILD_FLAG_DEBUG_MODULE_LOOKUPS__: boolean /** * Whether to debug proxified values. * * - Immediately calls the signal to initialize the proxified value. * - Warns if the proxified value is nullish. */ - const __BUILD_FLAG_DEBUG_PROXIFIED_VALUES: boolean + const __BUILD_FLAG_DEBUG_PROXIFIED_VALUES__: boolean // CommonJS modules, we don't want to depend on @types/node const module: {