{"_id":"@arsole6766/link","name":"@arsole6766/link","dist-tags":{"latest":"0.5.0"},"versions":{"0.5.0":{"name":"@arsole6766/link","version":"0.5.0","description":"Sub-1KB fetch() wrapper with Express-style middleware pipeline","type":"module","main":"./dist/link.cjs.js","module":"./dist/link.esm.js","exports":{".":{"import":"./dist/link.esm.js","require":"./dist/link.cjs.js"}},"scripts":{"build":"rollup -c","build:vite":"vite build","test":"node --test test/*.test.js","lint":"eslint src/","lint:fix":"eslint src/ --fix","bench":"node bench/vs-axios.bench.js","size":"size-limit","prepublishOnly":"npm run lint && npm run build && npm test"},"size-limit":[{"path":"dist/link.esm.js","limit":"100 KB"}],"devDependencies":{"@eslint/js":"^9.0.0","@rollup/plugin-node-resolve":"^15.0.0","@rollup/plugin-terser":"^0.4.0","@size-limit/file":"^11.0.0","axios":"^1.0.0","eslint":"^9.0.0","globals":"^15.0.0","mitata":"^0.1.0","rollup":"^4.0.0","size-limit":"^11.0.0","undici":"^6.0.0","vite":"^5.0.0"},"keywords":["fetch","http","middleware","axios-alternative","promise"],"license":"MIT","_id":"@arsole6766/link@0.5.0","gitHead":"992ea9457b14e6e92f66e4c595e1085ead99160b","_nodeVersion":"22.22.2","_npmVersion":"10.9.7","dist":{"integrity":"sha512-7w/Oh5mk5y0R3YR97ZcdqOjS75AGXi7mj6bDLe/oZdpsy6i/zxMenFTjlEry0DNNzJthJe7L19wdcopiNrhH2g==","shasum":"b3620bf6c29281f34b1bf33bb5b0f6932ee0099b","tarball":"https://registry.npmjs.org/@arsole6766/link/-/link-0.5.0.tgz","fileCount":6,"unpackedSize":23804,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDIsX+NZHwFD8jPpcS0U7gVhYpKKBVGcXt3wH5ahmS1VQIgcde8vg2o7Aah6MzwVB2laQ3ELzY3e3F8eihlu99ovUM="}]},"_npmUser":{"name":"arsole6766","email":"arsole676@gmail.com"},"directories":{},"maintainers":[{"name":"arsole6766","email":"arsole676@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/link_0.5.0_1785713502673_0.8064499537660639"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-02T23:31:42.494Z","0.5.0":"2026-08-02T23:31:42.823Z","modified":"2026-08-02T23:31:43.064Z"},"maintainers":[{"name":"arsole6766","email":"arsole676@gmail.com"}],"description":"Sub-1KB fetch() wrapper with Express-style middleware pipeline","keywords":["fetch","http","middleware","axios-alternative","promise"],"license":"MIT","readme":"<p align=\"center\">\n  <img src=\"public/LINKLOGO.png\" alt=\"Link\" width=\"320\" />\n</p>\n\n<p align=\"center\">\n  <strong>A JavaScript Library made with the Fetch() API</strong><br/>\n  <em>Our mission is to revolutionize your HTTP requests by crafting a powerhouse wrapper over the Fetch API.</em>\n</p>\n\n<p align=\"center\">\n  <img src=\"https://img.shields.io/badge/size-%3C1KB-blueviolet?style=flat-square\" alt=\"< 1KB\" />\n  <img src=\"https://img.shields.io/badge/dependencies-zero-blueviolet?style=flat-square\" alt=\"zero deps\" />\n  <img src=\"https://img.shields.io/badge/license-MIT-blueviolet?style=flat-square\" alt=\"MIT\" />\n  <img src=\"https://img.shields.io/badge/node-%3E%3D18-blueviolet?style=flat-square\" alt=\"Node 18+\" />\n  <img src=\"https://img.shields.io/github/actions/workflow/status/Agrazel1459/Link/ci.yml?style=flat-square&color=blueviolet\" alt=\"CI\" />\n</p>\n\n---\n\n> **Link** is not another Axios clone. It is the library Axios would be if it were written today — native `fetch()` at its core, an Express-style middleware pipeline that intercepts both request and response in a single function, built-in timeout and retry, a CRUD resource factory, a client-side SPA router, and a gzipped footprint smaller than a tweet. Zero dependencies. Works everywhere `fetch()` does.\n\n---\n\n## Browser Support\n\n| Browser | Support |\n|---|---|\n| Chrome 42+ | ✓ Native |\n| Firefox 39+ | ✓ Native |\n| Safari 10.1+ | ✓ Native |\n| Edge 14+ | ✓ Native |\n| Brave (all) | ✓ Native |\n| IE 11 | ✓ With polyfills |\n| Node 18+ | ✓ Native |\n| Deno / Bun / CF Workers | ✓ Native |\n\nSee [Browser Support Guide](docs/browser-support.md) for IE11 polyfill setup.\n\n---\n\n\n---\n\n## Table of Contents\n\n### API Reference\n\n| Method | Description |\n|---|---|\n| [`create(config)`](docs/create.md) | Create a Link instance with shared defaults |\n| [`get(url, options?)`](docs/get.md) | Send a GET request |\n| [`post(url, body?, options?)`](docs/post.md) | Send a POST request |\n| [`put(url, body?, options?)`](docs/put.md) | Send a PUT request |\n| [`patch(url, body?, options?)`](docs/patch.md) | Send a PATCH request |\n| [`delete(url, options?)`](docs/delete.md) | Send a DELETE request |\n| [`head(url, options?)`](docs/head.md) | Send a HEAD request |\n| [`options(url, options?)`](docs/options.md) | Send an OPTIONS request |\n| [`use(fn)`](docs/use.md) | Register middleware on an instance |\n| [`resource(instance, path)`](docs/resource.md) | CRUD factory: list, get, create, update, patch, remove |\n| [`createRouter(options?)`](docs/router.md) | Lightweight SPA client-side router |\n\n### Guides\n\n| Guide | Description |\n|---|---|\n| [Timeout](docs/timeout.md) | Built-in AbortController timeout |\n| [Retry](docs/retry.md) | Automatic retry with delay and status filtering |\n| [Errors](docs/errors.md) | `LinkError` and `TimeoutError` — typed error handling |\n| [Browser Support](docs/browser-support.md) | Compatibility matrix and polyfill guide |\n\n### Project\n\n| | |\n|---|---|\n| [Changelog](CHANGELOG.md) | Full version history |\n| [Documentation Site](client/) | Local docs site (Vite) |\n\n---\n\n## Installation\n\n```bash\nnpm install link-fetch\n```\n\n---\n\n## Usage\n\n### Create an instance\n\n```js\nimport { create } from 'link-fetch'\n\nconst api = create({\n  baseURL: 'https://api.example.com',\n  timeout: 5000,\n  headers: { Authorization: 'Bearer your-token' },\n})\n```\n\n### HTTP requests\n\n```js\nconst res = await api.get('/users/1')      // res.data = auto-parsed JSON\nawait api.post('/users', { name: 'Bob' })  // body auto JSON-serialized\nawait api.patch('/users/1', { name: 'Bob Updated' })\nawait api.delete('/users/1')\n```\n\n### CRUD resource API\n\n```js\nimport { create, resource } from 'link-fetch'\n\nconst api = create({ baseURL: 'https://api.example.com' })\nconst users = resource(api, '/users')\n\nawait users.list()           // GET  /users\nawait users.get(1)           // GET  /users/1\nawait users.create({ ... })  // POST /users\nawait users.update(1, {...}) // PUT  /users/1\nawait users.patch(1, {...})  // PATCH /users/1\nawait users.remove(1)        // DELETE /users/1\n```\n\n### SPA Router\n\n```js\nimport { createRouter } from 'link-fetch'\n\nconst router = createRouter()\n\nrouter\n  .on('/', () => renderHome())\n  .on('/users/:id', ({ id }) => renderUser(id))\n  .on('*', () => render404())\n  .start()\n\nrouter.push('/users/42')\n```\n\n### Middleware\n\n```js\napi.use(async (req, next) => {\n  req.headers.set('X-Request-ID', crypto.randomUUID())\n  const res = await next(req)\n  console.log(`${req.method} ${req.url} → ${res.status}`)\n  return res\n})\n```\n\n### Error handling\n\n```js\nimport { LinkError, TimeoutError } from 'link-fetch'\n\ntry {\n  const res = await api.get('/data')\n} catch (err) {\n  if (err instanceof TimeoutError) console.error(`Timed out after ${err.ms}ms`)\n  else if (err instanceof LinkError) console.error(`HTTP ${err.status}`)\n}\n```\n\n---\n\n## Running the documentation site\n\n```bash\ncd client\nnpm install\nnpm run dev\n```\n\nOpens at `http://localhost:3000`.\n\n---\n\n<p align=\"center\">\n  Made with ☕ by <a href=\"https://github.com/Agrazel1459\">Adward Celestine</a> · MIT License\n</p>\n","readmeFilename":"README.md","_rev":"1-184e86a1155c5ee762f4a97ed5dea90f"}