CodeVetter · Repo Unpack · System map
unjs/ofetch
The system is a library consumed through an ESM package entrypoint. Seven source modules divide client creation, request execution, helpers, errors, and public types. State lives in factory closures and per-request contexts, while network behavior belongs to native or injected fetch. Build and CI configuration describe npm distribution and Node validation.
- The package identifies version 2.0.0-alpha.3, exports dist/index.mjs with dist/index.d.mts types, publishes only dist, and declares sideEffects false.
- src/index.ts re-exports runtime APIs through base.ts and public types, creates ofetch with its fetch wrapper, and exports $fetch as the same client.
- The entrypoint wrapper allows later global fetch patching when fetch existed at import time; otherwise it installs a rejecting fallback.
- createFetch captures the transport, owns nested error/raw functions, and attaches raw, native, and create methods to the callable client.
- fetch.ts orchestrates transport, utils.ts handles option resolution and hooks, utils.url.ts handles string URLs, and error.ts constructs contextual failures.
- The inspected request pipeline stores transient state in FetchContext and response._data; transport is the external output boundary rather than a repository persistence layer.
- pnpm 10.20.0 drives obuild, Vitest, ESLint, and Prettier scripts; release additionally invokes changelogen with alpha publishing and push flags.
- CI declares Ubuntu jobs across Node 20, 22, and 24; autofix separately runs lint:fix with read-only contents permission and a pinned autofix action.