Skip to content

Commit 6a8a488

Browse files
tinchox5claude
andcommitted
perf(preCache): use fused collectFontUsage (one walk instead of two)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent bc0f854 commit 6a8a488

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/api/preCache.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// src/api/preCache.js
22
import { getStyle, inlineSingleBackgroundEntry, precacheCommonTags, isSafari } from '../utils'
3-
import { embedCustomFonts, collectUsedFontVariants, collectUsedCodepoints, ensureFontsReady } from '../modules/fonts.js'
3+
import { embedCustomFonts, collectFontUsage, ensureFontsReady } from '../modules/fonts.js'
44
import { snapFetch } from '../modules/snapFetch.js'
55
import { cache, applyCachePolicy, EvictingMap } from '../core/cache.js'
66
import { inlineBackgroundImages } from '../modules/background.js'
@@ -119,8 +119,7 @@ export async function preCache(root = document, options = {}) {
119119
// Optional: preload/embed fonts
120120
if (embedFonts) {
121121
try {
122-
const required = collectUsedFontVariants(root)
123-
const usedCodepoints = collectUsedCodepoints(root)
122+
const { required, usedCodepoints } = collectFontUsage(root)
124123

125124
// Safari warmup: ensure families are ready before embedding
126125
const safari = (typeof isSafari === 'function') ? isSafari() : !!isSafari

0 commit comments

Comments
 (0)