Skip to content

Commit 170c628

Browse files
committed
size: label more exports as __PURE__ for further bundle size reduction
1 parent 7aa5adc commit 170c628

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

base58check.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import { makeBase58check } from './fallback/base58check.js'
88

99
const hash256sync = (x) => sha256(sha256(x))
1010
const hash256 = hash256sync // See note at the top
11-
const {
12-
encode: toBase58check,
13-
decode: fromBase58check,
14-
encodeSync: toBase58checkSync,
15-
decodeSync: fromBase58checkSync,
16-
} = makeBase58check(hash256, hash256sync)
11+
12+
const b58c = /* @__PURE__ */ makeBase58check(hash256, hash256sync)
13+
export const toBase58check = /* @__PURE__ */ (() => b58c.encode)()
14+
export const fromBase58check = /* @__PURE__ */ (() => b58c.decode)()
15+
export const toBase58checkSync = /* @__PURE__ */ (() => b58c.encodeSync)()
16+
export const fromBase58checkSync = /* @__PURE__ */ (() => b58c.decodeSync)()
1717

1818
export { makeBase58check } from './fallback/base58check.js'
19-
export { toBase58check, fromBase58check, toBase58checkSync, fromBase58checkSync }

fallback/utf16.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { assertU8, E_STRING, E_STRICT_UNICODE } from './_utils.js'
33
import { nativeDecoder, isLE, encodeCharcodes } from './platform.js'
44

55
export const E_STRICT = 'Input is not well-formed utf16'
6-
const isWellFormedStr = String.prototype.isWellFormed
6+
const isWellFormedStr = /* @__PURE__ */ (() => String.prototype.isWellFormed)()
77
const toWellFormedStr = /* @__PURE__ */ (() => String.prototype.toWellFormed)()
88

99
const replacementCodepoint = 0xff_fd

single-byte.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function createSinglebyteEncoder(encoding, { mode = 'fatal' } = {}) {
129129
}
130130
}
131131

132-
export const latin1toString = createSinglebyteDecoder('iso-8859-1')
133-
export const latin1fromString = createSinglebyteEncoder('iso-8859-1')
134-
export const windows1252toString = createSinglebyteDecoder('windows-1252')
135-
export const windows1252fromString = createSinglebyteEncoder('windows-1252')
132+
export const latin1toString = /* @__PURE__ */ createSinglebyteDecoder('iso-8859-1')
133+
export const latin1fromString = /* @__PURE__ */ createSinglebyteEncoder('iso-8859-1')
134+
export const windows1252toString = /* @__PURE__ */ createSinglebyteDecoder('windows-1252')
135+
export const windows1252fromString = /* @__PURE__ */ createSinglebyteEncoder('windows-1252')

single-byte.node.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export function createSinglebyteEncoder(encoding, { mode = 'fatal' } = {}) {
114114
}
115115
}
116116

117-
export const latin1toString = createSinglebyteDecoder('iso-8859-1')
118-
export const latin1fromString = createSinglebyteEncoder('iso-8859-1')
119-
export const windows1252toString = createSinglebyteDecoder('windows-1252')
120-
export const windows1252fromString = createSinglebyteEncoder('windows-1252')
117+
export const latin1toString = /* @__PURE__ */ createSinglebyteDecoder('iso-8859-1')
118+
export const latin1fromString = /* @__PURE__ */ createSinglebyteEncoder('iso-8859-1')
119+
export const windows1252toString = /* @__PURE__ */ createSinglebyteDecoder('windows-1252')
120+
export const windows1252fromString = /* @__PURE__ */ createSinglebyteEncoder('windows-1252')

0 commit comments

Comments
 (0)