fix(scripts/build): turn on DEBUG_MODULE_LOOKUPS build flag if dev build

This commit is contained in:
PalmDevs 2025-06-15 17:57:33 +07:00
parent 42213c89c0
commit 8851f6867b
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
4 changed files with 10 additions and 10 deletions

View file

@ -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(

View file

@ -155,7 +155,7 @@ export function proxify<T>(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()
}

View file

@ -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: [

4
types.d.ts vendored
View file

@ -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: {