-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
3,444 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[{*.json,*.md,.*rc,*.yml,*.txt}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
|
||
- name: pnpm install, build, and test | ||
run: | | ||
pnpm install | ||
pnpm test | ||
pnpm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
package-lock.json | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# feaxios | ||
|
||
`feaxios` is a lightweight alternative to [Axios], providing the same familiar API with a significantly reduced footprint of **800 bytes**. It leverages the native `fetch()` API supported in all modern browsers, delivering a performant and minimalistic solution. This makes it an ideal choice for projects where minimizing bundle size is a priority. | ||
|
||
### Key Features | ||
|
||
- **Lightweight:** With a size of less than 1/5th of Axios, `feaxios` is an efficient choice for projects with strict size constraints. | ||
|
||
- **Native Fetch API:** Utilizes the browser's native [Fetch API][fetch], ensuring broad compatibility and seamless integration with modern web development tools. | ||
|
||
- **Interceptor Support:** `feaxios` supports interceptors, allowing you to customize and augment the request and response handling process. | ||
|
||
- **Timeouts:** Easily configure timeouts for requests, ensuring your application remains responsive and resilient. | ||
|
||
### When to Use feaxios | ||
|
||
While [Axios] remains an excellent module, `feaxios` provides a compelling option in scenarios where minimizing dependencies is crucial. By offering a similar API to Axios, `feaxios` bridges the gap between Axios and the native `fetch()` API. | ||
|
||
### Usage | ||
|
||
```js | ||
import axios from 'feaxios'; | ||
|
||
// Use 'feaxios' just like you would with Axios | ||
axios.get('https://api.example.com/data') | ||
.then(response => { | ||
// Handle the response | ||
console.log(response.data); | ||
}) | ||
.catch(error => { | ||
// Handle errors | ||
console.error(error); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{ | ||
"name": "feaxios", | ||
"version": "0.0.1", | ||
"description": "Tiny Fetch wrapper that provides a similar API to Axios", | ||
"main": "dist/index.js", | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.mts", | ||
"default": "./dist/index.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"build": "tsup", | ||
"typecheck": "tsc --noEmit", | ||
"test": "vitest", | ||
"test-ui": "vitest --ui", | ||
"format": "prettier --write './**/*.{ts,md}'", | ||
"format:check": "prettier --check './**/*.{ts,md}'" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"tsup": { | ||
"entry": [ | ||
"src/index.ts" | ||
], | ||
"clean": true, | ||
"treeshake": true, | ||
"minify": true, | ||
"splitting": false, | ||
"format": [ | ||
"cjs", | ||
"esm" | ||
], | ||
"dts": true | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"prettier" | ||
] | ||
}, | ||
"repository": "divyam234/feaxios", | ||
"keywords": [ | ||
"axios", | ||
"fetch" | ||
], | ||
"license": "MIT", | ||
"homepage": "https://github.com/divyam234/feaxios", | ||
"devDependencies": { | ||
"@vitest/ui": "^1.2.2", | ||
"eslint": "^8.56.0", | ||
"eslint-config-prettier": "^9.1.0 ", | ||
"msw": "^2.2.0", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.2.2" | ||
}, | ||
"dependencies": { | ||
"@types/node": "^20.11.17", | ||
"tsup": "^8.0.2" | ||
} | ||
} |
Oops, something went wrong.