1- const { Buffer, TextEncoder , TextDecoder } = globalThis
1+ const { Buffer } = globalThis
22const haveNativeBuffer = Buffer && ! Buffer . TYPED_ARRAY_SUPPORT
33export const nativeBuffer = haveNativeBuffer ? Buffer : null
44export const isHermes = /* @__PURE__ */ ( ( ) => ! ! globalThis . HermesInternal ) ( )
@@ -11,14 +11,14 @@ let isNative = (x) => x && (haveNativeBuffer || `${x}`.includes('[native code]')
1111if ( ! haveNativeBuffer && isNative ( ( ) => { } ) ) isNative = ( ) => false // e.g. XS, we don't want false positives
1212
1313export const nativeEncoder = /* @__PURE__ */ ( ( ) =>
14- isNative ( TextEncoder ) ? new TextEncoder ( ) : null ) ( )
14+ isNative ( globalThis . TextEncoder ) ? new TextEncoder ( ) : null ) ( )
1515export const nativeDecoder = /* @__PURE__ */ ( ( ) =>
16- isNative ( TextDecoder ) ? new TextDecoder ( 'utf-8' , { ignoreBOM : true } ) : null ) ( )
16+ isNative ( globalThis . TextDecoder ) ? new TextDecoder ( 'utf-8' , { ignoreBOM : true } ) : null ) ( )
1717
1818// Actually windows-1252, compatible with ascii and latin1 decoding
1919// Beware that on non-latin1, i.e. on windows-1252, this is broken in ~all Node.js versions released
2020// in 2025 due to a regression, so we call it Latin1 as it's usable only for that
21- const getNativeLatin1 = ( ) => {
21+ export const nativeDecoderLatin1 = /* @__PURE__ */ ( ( ) => {
2222 // Not all barebone engines with TextDecoder support something except utf-8, detect
2323 if ( nativeDecoder ) {
2424 try {
@@ -27,9 +27,7 @@ const getNativeLatin1 = () => {
2727 }
2828
2929 return null
30- }
31-
32- export const nativeDecoderLatin1 = /* @__PURE__ */ getNativeLatin1 ( )
30+ } ) ( )
3331
3432// Block Firefox < 146 specifically from using native hex/base64, as it's very slow there
3533// Refs: https://bugzilla.mozilla.org/show_bug.cgi?id=1994067 (and linked issues), fixed in 146
0 commit comments