$ account unjs
This monorepo provides two packages for font optimization in web applications. `fontaine` is a library that automatically generates metric-adjusted CSS `@font-face` fallback rules to reduce Cumulative Layout Shift (CLS). It parses CSS, reads font metrics from files or URLs, and injects override rules with proper `size-adjust`, `ascent-override`, etc. `fontless` is a Vite plugin that builds on top of fontaine and integrates with multiple font providers (Google Fonts, Bunny, FontSource, npm, etc.) to automatically download, subset, and serve optimized fonts with zero runtime JavaScript. It scans CSS for `font-family` declarations, resolves fonts through a provider chain, downloads the actual font files, emits them as build assets, and injects both the primary `@font-face` rules and metric-override fallback families. The codebase is well-structured, has comprehensive test coverage, and follows modern JavaScript/TypeScript practices. It is a hybrid of a library (fontaine) and an application plugin (fontless) but primarily serves as a developer tool for building optimized web fonts.
pkg-types is a small, ESM-only TypeScript library that provides utilities and type definitions for Node.js configuration files. In production it is consumed as a dependency rather than run as a service: callers use functions such as readPackageJSON, readTSConfig, findWorkspaceDir, resolveLockfile, parseGitConfig, and sortPackage to locate, parse, serialize, and manipulate package.json, tsconfig.json, and .git/config files. It supports package.json, package.json5, package.yaml, JSONC, JSON5, YAML, and git INI formats, with lazy parser loading for JSON5/YAML to keep cold-start cost low. The code is organized into four small vertical slices — resolve, packagejson, tsconfig, and gitconfig — all re-exported from src/index.ts. Path resolution uses exsolve for module-style imports and pathe for cross-platform paths; parsing is delegated to confbox. The primary data flow is simple: an input path is resolved to the nearest or farthest matching file, the file is read and parsed into a typed object, and optionally written back after mutation. There are no API endpoints, data stores, or background processes. Notable implementations include a boundary-aware nearest/farthest file finder that stops at node_modules, workspace directory detection from pnpm/lerna/turbo/rush/deno markers or git config/lockfiles, a Proxy-based updatePackage that auto-creates common package.json map fields during mutation, deterministic package.json sorting/normalizing, and conversion of git's subsection INI format ([remote "origin"]) into generic dotted INI keys for parsing and back on stringify. The project has solid Vitest coverage, type-level tests, and modern CI using oxlint, oxfmt, and obuild. One minor limitation is that git config subsection round-tripping is regex-based and not fully robust for unusual subsection names containing slashes or other non-word characters.