xsfetch 0.1.3 → 0.2.0-beta.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 +1 @@
1
- https://xsai.js.org/docs/packages/top-level/xsfetch
1
+ https://xsai.js.org/docs/packages-top/xsfetch
package/dist/index.js CHANGED
@@ -1,15 +1,13 @@
1
- // ../utils-stream/src/_sleep.ts
2
- var sleep = async (delay) => delay === 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, delay));
1
+ const sleep = async (delay) => delay === 0 ? Promise.resolve() : new Promise((resolve) => setTimeout(resolve, delay));
3
2
 
4
- // src/index.ts
5
- var defaults = {
3
+ const defaults = {
6
4
  debug: false,
7
5
  retry: 3,
8
6
  retryDelay: 500,
9
7
  // https://github.com/unjs/ofetch#%EF%B8%8F-auto-retry
10
8
  retryStatusCodes: [408, 409, 425, 429, 500, 502, 503, 504]
11
9
  };
12
- var createFetch = (userOptions = {}) => {
10
+ const createFetch = (userOptions = {}) => {
13
11
  const options = Object.assign({}, defaults, userOptions);
14
12
  const xsfetch = async (retriesLeft, input, init) => {
15
13
  const res = await fetch(input, init);
@@ -26,6 +24,5 @@ var createFetch = (userOptions = {}) => {
26
24
  return res;
27
25
  };
28
26
  };
29
- export {
30
- createFetch
31
- };
27
+
28
+ export { createFetch };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xsfetch",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.2.0-beta.2",
5
5
  "description": "extra-small Fetch API with auto retry.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git+https://github.com/moeru-ai/xsai.git",
12
- "directory": "packages/xsfetch"
12
+ "directory": "packages-top/xsfetch"
13
13
  },
14
14
  "bugs": "https://github.com/moeru-ai/xsai/issues",
15
15
  "keywords": [
@@ -28,7 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "scripts": {
31
- "build": "tsup"
31
+ "build": "pkgroll"
32
32
  },
33
33
  "main": "./dist/index.js",
34
34
  "types": "./dist/index.d.ts"