chore: document build flags

This commit is contained in:
PalmDevs 2025-06-12 23:25:10 +07:00
parent e57fd88846
commit 6d51ab8209
No known key found for this signature in database
GPG key ID: 6FAE8F8677ACA8BA
2 changed files with 18 additions and 0 deletions

View file

@ -52,6 +52,8 @@ export default async function build(dev = false, log = true) {
(await $`git rev-parse --abbrev-ref HEAD`.text()).trim(),
),
__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_LOG_PROMISE_REJECTIONS__: String(dev),
@ -112,6 +114,7 @@ export default async function build(dev = false, log = true) {
await bundle.write({
minify: {
compress: false,
mangle: true,
},
file: 'dist/revenge.js',

15
types.d.ts vendored
View file

@ -6,8 +6,23 @@ declare global {
const __BUILD_BRANCH__: string
const __BUILD_VERSION__: string
/**
* Whether to log promise rejections to the console.
*/
const __BUILD_FLAG_LOG_PROMISE_REJECTIONS__: boolean
/**
* Whether to debug module lookups.
*
* - Logs failed lookups with stack traces.
* - Logs partial matches (matches exportless, but not with-exports).
*/
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
// CommonJS modules, we don't want to depend on @types/node