@hyper-fetch/axios 8.1.1 โ†’ 8.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # ๐Ÿ›๏ธ Hyper Fetch Axios
2
2
 
3
- <p>
3
+ <p align="center">
4
+ <b>Use Axios as the HTTP engine for HyperFetch. Drop-in replacement with interceptors and all Axios features.</b>
5
+ </p>
6
+
7
+ <p align="center">
4
8
  <a href="https://bettertyped.com/">
5
9
  <img src="https://custom-icon-badges.demolab.com/static/v1?label=&message=BetterTyped&color=333&logo=BT" />
6
10
  </a>
@@ -13,57 +17,87 @@
13
17
  <a href="https://www.npmjs.com/package/@hyper-fetch/axios">
14
18
  <img src="https://custom-icon-badges.demolab.com/npm/v/@hyper-fetch/axios.svg?logo=npm&color=e76f51" />
15
19
  </a>
16
- <a href="https://github.com/BetterTyped/hyper-fetch">
17
- <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
20
+ <a href="https://www.npmjs.com/package/@hyper-fetch/axios">
21
+ <img src="https://custom-icon-badges.demolab.com/npm/dm/@hyper-fetch/axios?logoColor=fff&logo=trending-up" />
18
22
  </a>
19
23
  <a href="https://github.com/BetterTyped/hyper-fetch">
20
- <img src="https://custom-icon-badges.demolab.com/badge/-Axios-E10098?logo=axios&logoColor=white" />
24
+ <img src="https://custom-icon-badges.demolab.com/badge/typescript-%23007ACC.svg?logo=typescript&logoColor=white" />
21
25
  </a>
22
- <a href="https://www.npmjs.com/package/@hyper-fetch/axios">
26
+ <a href="https://bundlephobia.com/package/@hyper-fetch/axios">
23
27
  <img src="https://custom-icon-badges.demolab.com/bundlephobia/minzip/@hyper-fetch/axios?color=64BC4B&logo=package" />
24
28
  </a>
25
29
  </p>
26
30
 
27
- ## About
31
+ ## ๐Ÿ“– About
32
+
33
+ This adapter replaces HyperFetch's built-in HTTP engine with Axios. You get all of Axios's features โ€” interceptors,
34
+ automatic JSON transforms, request/response transforms โ€” while keeping HyperFetch's typed request system, caching,
35
+ queuing, and React hooks.
36
+
37
+ ## ๐ŸŽฏ Key Capabilities
38
+
39
+ - ๐Ÿ”Œ **One line to switch** โ€” Replace the default HTTP engine with Axios without touching your requests
40
+ - ๐ŸŽฏ **Keep your interceptors** โ€” Use existing Axios request/response interceptors and error transforms
41
+ - โœจ **All HyperFetch features stay** โ€” Caching, queuing, types, offline support, React hooks โ€” nothing lost
42
+ - ๐Ÿ”ง **Bring your own instance** โ€” Pass a pre-configured Axios instance with custom defaults and auth headers
28
43
 
29
- **`Hyper Fetch Axios`** is adapter for Hyper Fetch. It enables seamless communication with Axios, simplifying the
30
- retrieval and manipulation of data. Benefit from the convenience and efficiency of Hyper Fetch.
44
+ ## ๐Ÿš€ Quick Start
31
45
 
32
- ## Features
46
+ ```bash
47
+ npm install @hyper-fetch/core @hyper-fetch/axios axios
48
+ ```
33
49
 
34
- ๐Ÿ”ฎ **Simple setup** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/basic/setup)
50
+ ```ts
51
+ import { createClient } from "@hyper-fetch/core";
52
+ import { AxiosAdapter } from "@hyper-fetch/axios";
35
53
 
36
- ๐ŸŽฏ **Request cancellation** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/advanced/cancellation)
54
+ const client = createClient({ url: "https://api.example.com" }).setAdapter(AxiosAdapter());
55
+ ```
37
56
 
38
- โœจ **Window Focus/Blur Events** -
39
- [Read more](https://hyperfetch.bettertyped.com/docs/guides/react/core/window-focus-blur)
57
+ ## ๐Ÿ“š Documentation
40
58
 
41
- ๐Ÿš€ **Queueing** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/advanced/queueing)
59
+ - [Axios Adapter Docs](https://hyperfetch.bettertyped.com/docs/integrations/adapter-axios)
60
+ - [Getting Started](https://hyperfetch.bettertyped.com/docs/getting-started/quick-start)
61
+ - [API Reference](https://hyperfetch.bettertyped.com/api/)
42
62
 
43
- ๐Ÿ’Ž **Automatic caching** - [Read more](https://hyperfetch.bettertyped.com/docs/core/cache)
63
+ ## ๐Ÿ’ก Examples
44
64
 
45
- ๐Ÿช„ **Persistence** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/advanced/persistence)
65
+ ### Use with Axios interceptors
46
66
 
47
- ๐ŸŽŠ **SSR Support** - [Read more](https://hyperfetch.bettertyped.com/docs/getting-started/environment)
67
+ ```ts
68
+ import axios from "axios";
69
+ import { createClient } from "@hyper-fetch/core";
70
+ import { AxiosAdapter } from "@hyper-fetch/axios";
48
71
 
49
- ๐Ÿ”‹ **Offline First** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/advanced/offline)
72
+ const axiosInstance = axios.create({ baseURL: "https://api.example.com" });
50
73
 
51
- ๐Ÿ“ก **Built-in adapter** - [Read more](https://hyperfetch.bettertyped.com/docs/core/adapter)
74
+ axiosInstance.interceptors.request.use((config) => {
75
+ config.headers.Authorization = `Bearer ${getToken()}`;
76
+ return config;
77
+ });
52
78
 
53
- ๐Ÿงช **Easy to test** - [Read more](https://hyperfetch.bettertyped.com/docs/getting-started/testing)
79
+ axiosInstance.interceptors.response.use(
80
+ (response) => response,
81
+ (error) => {
82
+ if (error.response?.status === 401) refreshToken();
83
+ return Promise.reject(error);
84
+ },
85
+ );
54
86
 
55
- ๐ŸŽŸ **Authentication** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/basic/authentication)
87
+ const client = createClient({ url: "https://api.example.com" }).setAdapter(AxiosAdapter({ instance: axiosInstance }));
88
+ ```
56
89
 
57
- ๐Ÿ’ก **Prefetching** - [Read more](https://hyperfetch.bettertyped.com/docs/guides/advanced/prefetching)
90
+ ### Create typed requests (same as core)
58
91
 
59
- ## Help us keep working on this project โค๏ธ
92
+ ```ts
93
+ const getUsers = client.createRequest<{ response: User[] }>()({
94
+ endpoint: "/users",
95
+ method: "GET",
96
+ });
60
97
 
61
- - [Become a Sponsor on GitHub](https://github.com/sponsors/prc5)
98
+ const { data, error } = await getUsers.send();
99
+ ```
62
100
 
63
- ## Sources
101
+ ## License
64
102
 
65
- - #### [Installation](https://hyperfetch.bettertyped.com/docs/getting-started/installation)
66
- - #### [Docs](https://hyperfetch.bettertyped.com/)
67
- - #### [API](https://hyperfetch.bettertyped.com/api/)
68
- - #### [NPM](https://www.npmjs.com/package/@hyper-fetch/axios)
69
- - #### [Guides](https://hyperfetch.bettertyped.com/guides/Basic/Setup)
103
+ [MIT](https://github.com/BetterTyped/hyper-fetch/blob/main/License.md)
@@ -1,21 +1,11 @@
1
1
  {
2
+ "extends": "../tsconfig.json",
2
3
  "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "moduleResolution": "bundler",
6
- "lib": ["dom", "dom.iterable", "ESNext"],
7
- "strict": true,
8
4
  "noEmit": true,
9
- "skipLibCheck": true,
10
- "esModuleInterop": true,
11
- "allowSyntheticDefaultImports": true,
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
5
  "noUnusedLocals": false,
15
6
  "noUnusedParameters": false,
16
- "types": ["vitest/globals", "@types/node"],
17
- "baseUrl": "../src",
18
- "paths": {}
7
+ "types": ["vitest/globals", "@types/node"]
19
8
  },
20
- "include": ["**/*.ts", "**/*.tsx", "../../../global.d.ts", "../../../vitest.d.ts"]
9
+ "include": ["**/*.ts", "**/*.tsx", "../../../global.d.ts", "../../../vitest.d.ts"],
10
+ "exclude": ["node_modules"]
21
11
  }
@@ -2,5 +2,6 @@ import { Adapter } from '@hyper-fetch/core';
2
2
  import { Method as AxiosMethods, AxiosRequestConfig } from 'axios';
3
3
  import { AxiosExtra } from './adapter.types';
4
4
  export type AxiosAdapterType = typeof AxiosAdapter;
5
+ /** Pre-configured adapter that uses Axios as the underlying HTTP transport. Supports upload/download progress and abort. */
5
6
  export declare const AxiosAdapter: Adapter<Omit<AxiosRequestConfig<any>, "url" | "baseURL" | "method" | "onUploadProgress" | "onDownloadProgress" | "data">, AxiosMethods, number, AxiosExtra, string | import('@hyper-fetch/core').QueryParamsType | import('@hyper-fetch/core').EmptyTypes, undefined, string, import('@hyper-fetch/core').DefaultMapperType, (queryParams: import('@hyper-fetch/core').QueryParamsType | string | import('@hyper-fetch/core').EmptyTypes, options?: import('@hyper-fetch/core').QueryStringifyOptionsType) => string, import('@hyper-fetch/core').DefaultMapperType, import('@hyper-fetch/core').DefaultMapperType>;
6
7
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAEnD,eAAO,MAAM,YAAY,qlBAgFtB,CAAC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAwB,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,iBAAiB,CAAC;AAEnE,MAAM,MAAM,gBAAgB,GAAG,OAAO,YAAY,CAAC;AAEnD,4HAA4H;AAC5H,eAAO,MAAM,YAAY,qlBAgFtB,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { Adapter, stringifyQueryParams } from "@hyper-fetch/core";
2
2
  import axios, { AxiosHeaders } from "axios";
3
3
  //#region src/adapter/adapter.ts
4
+ /** Pre-configured adapter that uses Axios as the underlying HTTP transport. Supports upload/download progress and abort. */
4
5
  var AxiosAdapter = new Adapter({
5
6
  name: "axios-adapter",
6
7
  defaultMethod: "GET",
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/adapter/adapter.ts"],"sourcesContent":["import { Adapter, stringifyQueryParams } from \"@hyper-fetch/core\";\nimport type { Method as AxiosMethods, AxiosRequestConfig } from \"axios\";\nimport axios, { AxiosHeaders } from \"axios\";\n\nimport type { AxiosExtra, RawAxiosHeaders } from \"./adapter.types\";\n\nexport type AxiosAdapterType = typeof AxiosAdapter;\n\nexport const AxiosAdapter = new Adapter<\n Omit<AxiosRequestConfig, \"url\" | \"baseURL\" | \"method\" | \"onUploadProgress\" | \"onDownloadProgress\" | \"data\">,\n AxiosMethods,\n number,\n AxiosExtra\n>({\n name: \"axios-adapter\",\n defaultMethod: \"GET\",\n defaultExtra: { headers: {} },\n systemErrorStatus: 0,\n systemErrorExtra: { headers: {} },\n})\n .setQueryParamsMapper(stringifyQueryParams)\n .setFetcher(\n async ({\n url,\n endpoint,\n queryParams,\n request,\n headers,\n payload,\n adapter,\n adapterOptions,\n onError,\n onResponseEnd,\n onRequestEnd,\n createAbortListener,\n onResponseProgress,\n onRequestProgress,\n onResponseStart,\n onBeforeRequest,\n onRequestStart,\n onSuccess,\n getAbortController,\n }) => {\n const { method } = request;\n\n const fullUrl = `${url}${endpoint}${queryParams}`;\n\n onBeforeRequest();\n\n const controller = getAbortController();\n const unmountListener = () =>\n createAbortListener({\n status: 0,\n extra: { headers: {} },\n });\n\n onRequestStart();\n axios({\n ...adapterOptions,\n data: payload,\n method,\n url: fullUrl,\n signal: controller?.signal,\n headers: new AxiosHeaders(headers as RawAxiosHeaders),\n onUploadProgress: (progressEvent) => {\n onRequestProgress(progressEvent);\n },\n onDownloadProgress: (progressEvent) => {\n onRequestEnd();\n onResponseStart();\n onResponseProgress(progressEvent);\n },\n })\n .then((response) => {\n onSuccess({ data: response.data, status: response.status, extra: { headers: response.headers } });\n onResponseEnd();\n })\n .catch((error) => {\n onError({\n error,\n status: error.response?.status || adapter.systemErrorStatus,\n extra: { headers: error.response?.headers },\n });\n })\n .finally(() => {\n unmountListener();\n });\n },\n );\n"],"mappings":";;;AAQA,IAAa,eAAe,IAAI,QAK9B;CACA,MAAM;CACN,eAAe;CACf,cAAc,EAAE,SAAS,EAAE,EAAE;CAC7B,mBAAmB;CACnB,kBAAkB,EAAE,SAAS,EAAE,EAAE;CAClC,CAAC,CACC,qBAAqB,qBAAqB,CAC1C,WACC,OAAO,EACL,KACA,UACA,aACA,SACA,SACA,SACA,SACA,gBACA,SACA,eACA,cACA,qBACA,oBACA,mBACA,iBACA,iBACA,gBACA,WACA,yBACI;CACJ,MAAM,EAAE,WAAW;CAEnB,MAAM,UAAU,GAAG,MAAM,WAAW;AAEpC,kBAAiB;CAEjB,MAAM,aAAa,oBAAoB;CACvC,MAAM,wBACJ,oBAAoB;EAClB,QAAQ;EACR,OAAO,EAAE,SAAS,EAAE,EAAE;EACvB,CAAC;AAEJ,iBAAgB;AAChB,OAAM;EACJ,GAAG;EACH,MAAM;EACN;EACA,KAAK;EACL,QAAQ,YAAY;EACpB,SAAS,IAAI,aAAa,QAA2B;EACrD,mBAAmB,kBAAkB;AACnC,qBAAkB,cAAc;;EAElC,qBAAqB,kBAAkB;AACrC,iBAAc;AACd,oBAAiB;AACjB,sBAAmB,cAAc;;EAEpC,CAAC,CACC,MAAM,aAAa;AAClB,YAAU;GAAE,MAAM,SAAS;GAAM,QAAQ,SAAS;GAAQ,OAAO,EAAE,SAAS,SAAS,SAAS;GAAE,CAAC;AACjG,iBAAe;GACf,CACD,OAAO,UAAU;AAChB,UAAQ;GACN;GACA,QAAQ,MAAM,UAAU,UAAU,QAAQ;GAC1C,OAAO,EAAE,SAAS,MAAM,UAAU,SAAS;GAC5C,CAAC;GACF,CACD,cAAc;AACb,mBAAiB;GACjB;EAEP"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/adapter/adapter.ts"],"sourcesContent":["import { Adapter, stringifyQueryParams } from \"@hyper-fetch/core\";\nimport type { Method as AxiosMethods, AxiosRequestConfig } from \"axios\";\nimport axios, { AxiosHeaders } from \"axios\";\n\nimport type { AxiosExtra, RawAxiosHeaders } from \"./adapter.types\";\n\nexport type AxiosAdapterType = typeof AxiosAdapter;\n\n/** Pre-configured adapter that uses Axios as the underlying HTTP transport. Supports upload/download progress and abort. */\nexport const AxiosAdapter = new Adapter<\n Omit<AxiosRequestConfig, \"url\" | \"baseURL\" | \"method\" | \"onUploadProgress\" | \"onDownloadProgress\" | \"data\">,\n AxiosMethods,\n number,\n AxiosExtra\n>({\n name: \"axios-adapter\",\n defaultMethod: \"GET\",\n defaultExtra: { headers: {} },\n systemErrorStatus: 0,\n systemErrorExtra: { headers: {} },\n})\n .setQueryParamsMapper(stringifyQueryParams)\n .setFetcher(\n async ({\n url,\n endpoint,\n queryParams,\n request,\n headers,\n payload,\n adapter,\n adapterOptions,\n onError,\n onResponseEnd,\n onRequestEnd,\n createAbortListener,\n onResponseProgress,\n onRequestProgress,\n onResponseStart,\n onBeforeRequest,\n onRequestStart,\n onSuccess,\n getAbortController,\n }) => {\n const { method } = request;\n\n const fullUrl = `${url}${endpoint}${queryParams}`;\n\n onBeforeRequest();\n\n const controller = getAbortController();\n const unmountListener = () =>\n createAbortListener({\n status: 0,\n extra: { headers: {} },\n });\n\n onRequestStart();\n axios({\n ...adapterOptions,\n data: payload,\n method,\n url: fullUrl,\n signal: controller?.signal,\n headers: new AxiosHeaders(headers as RawAxiosHeaders),\n onUploadProgress: (progressEvent) => {\n onRequestProgress(progressEvent);\n },\n onDownloadProgress: (progressEvent) => {\n onRequestEnd();\n onResponseStart();\n onResponseProgress(progressEvent);\n },\n })\n .then((response) => {\n onSuccess({ data: response.data, status: response.status, extra: { headers: response.headers } });\n onResponseEnd();\n })\n .catch((error) => {\n onError({\n error,\n status: error.response?.status || adapter.systemErrorStatus,\n extra: { headers: error.response?.headers },\n });\n })\n .finally(() => {\n unmountListener();\n });\n },\n );\n"],"mappings":";;;;AASA,IAAa,eAAe,IAAI,QAK9B;CACA,MAAM;CACN,eAAe;CACf,cAAc,EAAE,SAAS,EAAE,EAAE;CAC7B,mBAAmB;CACnB,kBAAkB,EAAE,SAAS,EAAE,EAAE;CAClC,CAAC,CACC,qBAAqB,qBAAqB,CAC1C,WACC,OAAO,EACL,KACA,UACA,aACA,SACA,SACA,SACA,SACA,gBACA,SACA,eACA,cACA,qBACA,oBACA,mBACA,iBACA,iBACA,gBACA,WACA,yBACI;CACJ,MAAM,EAAE,WAAW;CAEnB,MAAM,UAAU,GAAG,MAAM,WAAW;AAEpC,kBAAiB;CAEjB,MAAM,aAAa,oBAAoB;CACvC,MAAM,wBACJ,oBAAoB;EAClB,QAAQ;EACR,OAAO,EAAE,SAAS,EAAE,EAAE;EACvB,CAAC;AAEJ,iBAAgB;AAChB,OAAM;EACJ,GAAG;EACH,MAAM;EACN;EACA,KAAK;EACL,QAAQ,YAAY;EACpB,SAAS,IAAI,aAAa,QAA2B;EACrD,mBAAmB,kBAAkB;AACnC,qBAAkB,cAAc;;EAElC,qBAAqB,kBAAkB;AACrC,iBAAc;AACd,oBAAiB;AACjB,sBAAmB,cAAc;;EAEpC,CAAC,CACC,MAAM,aAAa;AAClB,YAAU;GAAE,MAAM,SAAS;GAAM,QAAQ,SAAS;GAAQ,OAAO,EAAE,SAAS,SAAS,SAAS;GAAE,CAAC;AACjG,iBAAe;GACf,CACD,OAAO,UAAU;AAChB,UAAQ;GACN;GACA,QAAQ,MAAM,UAAU,UAAU,QAAQ;GAC1C,OAAO,EAAE,SAAS,MAAM,UAAU,SAAS;GAC5C,CAAC;GACF,CACD,cAAc;AACb,mBAAiB;GACjB;EAEP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyper-fetch/axios",
3
- "version": "8.1.1",
3
+ "version": "8.2.2",
4
4
  "description": "Simple axios adapter for Hyper Fetch",
5
5
  "author": "Maciej Pyrc <maciekpyrc@gmail.com>, Kacper Skawina <kacper.skawina@gmail.com>",
6
6
  "homepage": "https://hyperfetch.bettertyped.com/",
@@ -11,17 +11,17 @@
11
11
  "source": "src/index.ts",
12
12
  "scripts": {
13
13
  "test": "vitest run",
14
- "start": "yarn build && npx run-when-changed --watch 'src/**/*.ts' --exec 'yarn build'",
14
+ "start": "pnpm build && npx run-when-changed --watch 'src/**/*.ts' --exec 'pnpm build'",
15
15
  "build": "vite build",
16
- "lint": "eslint . --ext .js,.jsx,.tsx,.ts --fix",
17
- "format": "prettier --write .",
18
- "typecheck": "tsc --noEmit --emitDeclarationOnly false && tsc --noEmit -p __tests__/tsconfig.json",
19
- "tests": "yarn lint-staged",
20
- "release": "yarn semantic-release --extends ../../release.config.js -t 'hyper-fetch-axios-v${version}'"
16
+ "lint": "oxlint .",
17
+ "format": "oxfmt --write .",
18
+ "typecheck": "tsgo --noEmit --emitDeclarationOnly false && tsgo --noEmit -p __tests__/tsconfig.json",
19
+ "tests": "pnpm lint-staged",
20
+ "release": "pnpm semantic-release --extends ../../release.config.js -t 'hyper-fetch-axios-v${version}'"
21
21
  },
22
22
  "publishConfig": {
23
23
  "access": "public",
24
- "registry": "https://registry.npmjs.com/"
24
+ "registry": "https://registry.npmjs.org/"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",
@@ -6,6 +6,7 @@ import type { AxiosExtra, RawAxiosHeaders } from "./adapter.types";
6
6
 
7
7
  export type AxiosAdapterType = typeof AxiosAdapter;
8
8
 
9
+ /** Pre-configured adapter that uses Axios as the underlying HTTP transport. Supports upload/download progress and abort. */
9
10
  export const AxiosAdapter = new Adapter<
10
11
  Omit<AxiosRequestConfig, "url" | "baseURL" | "method" | "onUploadProgress" | "onDownloadProgress" | "data">,
11
12
  AxiosMethods,
package/tsconfig.json CHANGED
@@ -2,10 +2,9 @@
2
2
  "extends": "../../tsconfig.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": ".",
5
- "baseUrl": "./src",
6
5
  "paths": {
7
- "@browser-adapter": ["./adapter/adapter.browser.ts"],
8
- "@server-adapter": ["./adapter/adapter.server.ts"]
6
+ "@browser-adapter": ["./src/adapter/adapter.browser.ts"],
7
+ "@server-adapter": ["./src/adapter/adapter.server.ts"]
9
8
  }
10
9
  },
11
10
  "exclude": ["node_modules", "dist", "vite.config.ts", "__tests__"]
package/vite.config.ts CHANGED
@@ -1,45 +1,39 @@
1
1
  /// <reference types="vitest/config" />
2
+ import path from "path";
2
3
  import { defineConfig } from "vite";
3
4
  import dts from "vite-plugin-dts";
4
5
  import tsconfigPaths from "vite-tsconfig-paths";
5
- import path from "path";
6
- import { getDtsCompilerOptionsForPackage } from "../../scripts/vite-dts-internal-paths";
6
+
7
7
  import { getRollupExternalsFromPackageJson } from "../../scripts/vite-lib-externals-from-package";
8
8
 
9
9
  export default defineConfig({
10
10
  build: {
11
11
  lib: {
12
12
  entry: "src/index.ts",
13
- formats: ["es"],
14
13
  fileName: "index",
14
+ formats: ["es"],
15
15
  },
16
- sourcemap: true,
17
16
  minify: false,
18
17
  rollupOptions: {
19
18
  external: getRollupExternalsFromPackageJson(__dirname),
20
19
  },
20
+ sourcemap: true,
21
21
  },
22
- plugins: [
23
- dts({
24
- entryRoot: "src",
25
- compilerOptions: getDtsCompilerOptionsForPackage(__dirname),
26
- }),
27
- tsconfigPaths(),
28
- ],
22
+ plugins: [tsconfigPaths(), dts({ entryRoot: "src" })],
29
23
  test: {
30
- globals: true,
31
- environment: "node",
32
- setupFiles: ["./__tests__/vitest.setup.ts"],
33
- include: ["__tests__/**/*.spec.{ts,tsx}", "src/**/*.spec.{ts,tsx}"],
34
- coverage: {
35
- provider: "v8",
36
- include: ["src/**/*.{ts,tsx}"],
37
- exclude: ["**/*.spec.*", "**/types.*", "**/constants.*", "**/index.ts"],
38
- },
39
24
  alias: {
40
25
  "@hyper-fetch/core": path.resolve(__dirname, "../core/src/index.ts"),
41
26
  "@hyper-fetch/sockets": path.resolve(__dirname, "../sockets/src/index.ts"),
42
27
  "@hyper-fetch/testing": path.resolve(__dirname, "../testing/src/index.ts"),
43
28
  },
29
+ coverage: {
30
+ exclude: ["**/*.spec.*", "**/types.*", "**/constants.*", "**/index.ts"],
31
+ include: ["src/**/*.{ts,tsx}"],
32
+ provider: "v8",
33
+ },
34
+ environment: "node",
35
+ globals: true,
36
+ include: ["__tests__/**/*.spec.{ts,tsx}", "src/**/*.spec.{ts,tsx}"],
37
+ setupFiles: ["./__tests__/vitest.setup.ts"],
44
38
  },
45
39
  });
package/.eslintrc.cjs DELETED
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- extends: ["plugin:@nx/react", "../../.eslintrc.js"],
3
- parserOptions: {
4
- tsconfigRootDir: __dirname,
5
- project: ["./tsconfig.json", "./__tests__/tsconfig.json"],
6
- },
7
- rules: {
8
- "react/jsx-props-no-spreading": 0,
9
- "react/require-default-props": 0,
10
- },
11
- ignorePatterns: ["dist/", "coverage/", "vite.config.ts", "/*.js"],
12
- };