diff --git a/dist/main.js b/dist/main.js index 689b7a7..b64a10d 100644 --- a/dist/main.js +++ b/dist/main.js @@ -23586,7 +23586,7 @@ var require_fast_content_type_parse = __commonJS({ }); // npm/node_modules/json-with-bigint/json-with-bigint.js -var intRegex, noiseValue, originalStringify, originalParse, customFormat, bigIntsStringify, noiseStringify, JSONStringify, isContextSourceSupported, convertMarkedBigIntsReviver, JSONParseV2, MAX_INT, MAX_DIGITS, stringsOrLargeNumbers, noiseValueWithQuotes, JSONParse; +var intRegex, noiseValue, originalStringify, originalParse, customFormat, bigIntsStringify, noiseStringify, JSONStringify, featureCache, isContextSourceSupported, convertMarkedBigIntsReviver, JSONParseV2, MAX_INT, MAX_DIGITS, stringsOrLargeNumbers, noiseValueWithQuotes, JSONParse; var init_json_with_bigint = __esm({ "npm/node_modules/json-with-bigint/json-with-bigint.js"() { intRegex = /^-?\d+$/; @@ -23613,7 +23613,7 @@ var init_json_with_bigint = __esm({ const convertedToCustomJSON = originalStringify( value, (key, value2) => { - const isNoise = typeof value2 === "string" && Boolean(value2.match(noiseValue)); + const isNoise = typeof value2 === "string" && noiseValue.test(value2); if (isNoise) return value2.toString() + "n"; if (typeof value2 === "bigint") return value2.toString() + "n"; if (typeof replacer === "function") return replacer(key, value2); @@ -23629,11 +23629,28 @@ var init_json_with_bigint = __esm({ const denoisedJSON = processedJSON.replace(noiseStringify, "$1$2$3"); return denoisedJSON; }; - isContextSourceSupported = () => JSON.parse("1", (_, __, context) => !!context && context.source === "1"); + featureCache = /* @__PURE__ */ new Map(); + isContextSourceSupported = () => { + const parseFingerprint = JSON.parse.toString(); + if (featureCache.has(parseFingerprint)) { + return featureCache.get(parseFingerprint); + } + try { + const result = JSON.parse( + "1", + (_, __, context) => !!context?.source && context.source === "1" + ); + featureCache.set(parseFingerprint, result); + return result; + } catch { + featureCache.set(parseFingerprint, false); + return false; + } + }; convertMarkedBigIntsReviver = (key, value, context, userReviver) => { - const isCustomFormatBigInt = typeof value === "string" && value.match(customFormat); + const isCustomFormatBigInt = typeof value === "string" && customFormat.test(value); if (isCustomFormatBigInt) return BigInt(value.slice(0, -1)); - const isNoiseValue = typeof value === "string" && value.match(noiseValue); + const isNoiseValue = typeof value === "string" && noiseValue.test(value); if (isNoiseValue) return value.slice(0, -1); if (typeof userReviver !== "function") return value; return userReviver(key, value, context); @@ -23659,7 +23676,7 @@ var init_json_with_bigint = __esm({ stringsOrLargeNumbers, (text2, digits, fractional, exponential) => { const isString = text2[0] === '"'; - const isNoise = isString && Boolean(text2.match(noiseValueWithQuotes)); + const isNoise = isString && noiseValueWithQuotes.test(text2); if (isNoise) return text2.substring(0, text2.length - 1) + 'n"'; const isFractionalOrExponential = fractional || exponential; const isLessThanMaxSafeInt = digits && (digits.length < MAX_DIGITS || digits.length === MAX_DIGITS && digits <= MAX_INT);