1
0
mirror of https://github.com/robonen/tools.git synced 2026-03-20 10:54:44 +00:00

feat: add @robonen/fetch package - lightweight fetch wrapper with V8 optimizations

Co-authored-by: robonen <26167508+robonen@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-13 17:09:49 +00:00
parent 11f823afb4
commit 170093a039
16 changed files with 1919 additions and 0 deletions

46
core/fetch/src/index.ts Normal file
View File

@@ -0,0 +1,46 @@
export { createFetch } from './fetch';
export { FetchError, createFetchError } from './error';
export {
isPayloadMethod,
isJSONSerializable,
detectResponseType,
buildURL,
joinURL,
callHooks,
resolveFetchOptions,
} from './utils';
export type {
$Fetch,
CreateFetchOptions,
Fetch,
FetchContext,
FetchHook,
FetchHooks,
FetchOptions,
FetchRequest,
FetchResponse,
IFetchError,
MappedResponseType,
MaybeArray,
MaybePromise,
ResponseMap,
ResponseType,
ResolvedFetchOptions,
} from './types';
/**
* @name $fetch
* @category Fetch
* @description Default $fetch instance backed by globalThis.fetch
*
* @example
* const data = await $fetch<User>('https://api.example.com/users/1');
*
* @example
* const user = await $fetch.post<User>('https://api.example.com/users', {
* body: { name: 'Alice' },
* });
*
* @since 0.0.1
*/
export const $fetch = createFetch();