Files
tools/core/fetch/src/index.ts
T
robonen a7e668ced8 feat(fetch): plugin system + eslint/tsconfig migration
- Add fetch plugin API (definePlugin, plugins) with type-level option flow.
- Migrate to eslint flat config and composite tsconfig.
2026-06-07 16:29:18 +07:00

55 lines
1.2 KiB
TypeScript

import { createFetch } from './fetch';
export { createFetch } from './fetch';
export { FetchError, createFetchError } from './error';
export { composePlugins, definePlugin, runHookPhase } from './plugin';
export type { ComposedPlugins } from './plugin';
export { retryPlugin, timeoutPlugin } from './plugins';
export {
isPayloadMethod,
isJSONSerializable,
detectResponseType,
buildURL,
joinURL,
callHooks,
resolveFetchOptions,
} from './utils';
export type {
$Fetch,
CreateFetchOptions,
Fetch,
FetchContext,
FetchErrorOptions,
FetchExecuteMiddleware,
FetchHook,
FetchHooks,
FetchOptions,
FetchPlugin,
FetchRequest,
FetchResponse,
IFetchError,
MappedResponseType,
MergePluginContext,
MergePluginOptions,
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();