From ef2670254382ee7f0e0fb4fecaf5d2f638d0ca05 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 9 Feb 2023 08:54:14 -0800 Subject: [PATCH] fix: @W-12489598 detect minification from function name and not comment removal (#419) --- packages/near-membrane-base/src/membrane.ts | 6 +++++- packages/near-membrane-shared/src/constants.ts | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/near-membrane-base/src/membrane.ts b/packages/near-membrane-base/src/membrane.ts index c76033f0..b0951131 100644 --- a/packages/near-membrane-base/src/membrane.ts +++ b/packages/near-membrane-base/src/membrane.ts @@ -189,7 +189,11 @@ export function createMembraneMarshall( // phase two, the user opted-in to custom devtools formatters. Phase one // is used for light weight initialization time debug while phase two is // reserved for post initialization runtime. - const LOCKER_UNMINIFIED_FLAG = `${() => /* $LWS */ 1}`.includes('*'); + + // eslint-disable-next-line @typescript-eslint/naming-convention + const LOCKER_UNMINIFIED_FLAG = `${(function LOCKER_UNMINIFIED_FLAG() { + return LOCKER_UNMINIFIED_FLAG.name; + })()}`.includes('LOCKER_UNMINIFIED_FLAG'); // Indicate whether debug support is available. const LOCKER_DEBUGGABLE_FLAG = LOCKER_UNMINIFIED_FLAG && !IS_IN_SHADOW_REALM; // BigInt is not supported in Safari 13.1. diff --git a/packages/near-membrane-shared/src/constants.ts b/packages/near-membrane-shared/src/constants.ts index 86f05621..23edede8 100644 --- a/packages/near-membrane-shared/src/constants.ts +++ b/packages/near-membrane-shared/src/constants.ts @@ -6,9 +6,11 @@ export const LOCKER_IDENTIFIER_MARKER = '$LWS'; // phase two, the user opted-in to custom devtools formatters. Phase one // is used for light weight initialization time debug while phase two is // reserved for post initialization runtime. - -// istanbul ignore next -export const LOCKER_UNMINIFIED_FLAG = `${() => /* $LWS */ 1}`.includes(LOCKER_IDENTIFIER_MARKER); +export const LOCKER_UNMINIFIED_FLAG = + // eslint-disable-next-line @typescript-eslint/naming-convention + /* istanbul ignore next */ `${(function LOCKER_UNMINIFIED_FLAG() { + return LOCKER_UNMINIFIED_FLAG.name; + })()}`.includes('LOCKER_UNMINIFIED_FLAG'); export const CHAR_ELLIPSIS = '\u2026'; export const TO_STRING_BRAND_ARRAY = '[object Array]'; export const TO_STRING_BRAND_ARRAY_BUFFER = '[object ArrayBuffer]';