From 6d51ab8209905f35f073a1ed5daeda3ff7062581 Mon Sep 17 00:00:00 2001 From: PalmDevs Date: Thu, 12 Jun 2025 23:25:10 +0700 Subject: [PATCH] chore: document build flags --- scripts/build.ts | 3 +++ types.d.ts | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/scripts/build.ts b/scripts/build.ts index eaf45c7..b4bc6f3 100644 --- a/scripts/build.ts +++ b/scripts/build.ts @@ -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', diff --git a/types.d.ts b/types.d.ts index de77f7c..b5efa46 100644 --- a/types.d.ts +++ b/types.d.ts @@ -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