axios-hooks
Advanced tools
Comparing version 3.1.5 to 4.0.0
@@ -71,2 +71,5 @@ "use strict"; | ||
function makeUseAxios(configureOptions) { | ||
/** | ||
* @type {import('lru-cache')} | ||
*/ | ||
var cache; | ||
@@ -78,3 +81,5 @@ var axiosInstance; | ||
function resetConfigure() { | ||
cache = new _lruCache["default"](); | ||
cache = new _lruCache["default"]({ | ||
max: 500 | ||
}); | ||
axiosInstance = _axios["default"]; | ||
@@ -139,3 +144,3 @@ defaultOptions = DEFAULT_OPTIONS; | ||
function clearCache() { | ||
cache.reset(); | ||
cache.clear(); | ||
} | ||
@@ -142,0 +147,0 @@ |
@@ -50,2 +50,5 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
export function makeUseAxios(configureOptions) { | ||
/** | ||
* @type {import('lru-cache')} | ||
*/ | ||
var cache; | ||
@@ -57,3 +60,5 @@ var axiosInstance; | ||
function resetConfigure() { | ||
cache = new LRU(); | ||
cache = new LRU({ | ||
max: 500 | ||
}); | ||
axiosInstance = StaticAxios; | ||
@@ -118,3 +123,3 @@ defaultOptions = DEFAULT_OPTIONS; | ||
function clearCache() { | ||
cache.reset(); | ||
cache.clear(); | ||
} | ||
@@ -121,0 +126,0 @@ |
{ | ||
"name": "axios-hooks", | ||
"version": "3.1.5", | ||
"version": "4.0.0", | ||
"description": "axios-hooks", | ||
@@ -33,8 +33,8 @@ "keywords": [ | ||
"pretest": "cp ./test/index.test.jsx ./test/index.test.tsx && cp ./test/index.test.ssr.jsx ./test/index.test.ssr.tsx", | ||
"test": "jest --no-cache" | ||
"test": "tsd && jest --no-cache" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "7.18.9", | ||
"@babel/runtime": "7.19.0", | ||
"dequal": "2.0.3", | ||
"lru-cache": "6.0.0" | ||
"lru-cache": "^7.14.0" | ||
}, | ||
@@ -46,6 +46,6 @@ "peerDependencies": { | ||
"devDependencies": { | ||
"@babel/cli": "7.18.10", | ||
"@babel/core": "7.18.13", | ||
"@babel/plugin-transform-runtime": "7.18.10", | ||
"@babel/preset-env": "7.18.10", | ||
"@babel/cli": "7.19.3", | ||
"@babel/core": "7.19.3", | ||
"@babel/plugin-transform-runtime": "7.19.1", | ||
"@babel/preset-env": "7.19.3", | ||
"@babel/preset-react": "7.18.6", | ||
@@ -56,14 +56,13 @@ "@commitlint/cli": "17.1.2", | ||
"@testing-library/react-hooks": "7.0.2", | ||
"@types/jest": "29.0.0", | ||
"@types/lru-cache": "7.10.10", | ||
"@types/node": "18.7.14", | ||
"@types/react": "18.0.17", | ||
"@types/jest": "29.0.3", | ||
"@types/node": "18.7.23", | ||
"@types/react": "18.0.21", | ||
"@types/react-dom": "18.0.6", | ||
"axios": "0.27.2", | ||
"cross-env": "7.0.3", | ||
"eslint": "8.23.0", | ||
"eslint": "8.24.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"eslint-plugin-react": "7.31.1", | ||
"eslint-plugin-react": "7.31.8", | ||
"eslint-plugin-react-hooks": "4.6.0", | ||
@@ -81,3 +80,4 @@ "husky": "^8.0.1", | ||
"ts-jest": "26.5.6", | ||
"typescript": "4.8.2" | ||
"tsd": "^0.24.1", | ||
"typescript": "4.8.4" | ||
}, | ||
@@ -88,3 +88,6 @@ "lint-staged": { | ||
] | ||
}, | ||
"tsd": { | ||
"directory": "test-d" | ||
} | ||
} |
@@ -35,8 +35,13 @@ import { | ||
export interface RefetchFunction<TBody, TResponse> { | ||
( | ||
config?: AxiosRequestConfig<TBody> | string, | ||
options?: RefetchOptions | ||
): AxiosPromise<TResponse> | ||
(e: Event): AxiosPromise<TResponse> | ||
} | ||
export type UseAxiosResult<TResponse = any, TBody = any, TError = any> = [ | ||
ResponseValues<TResponse, TBody, TError>, | ||
( | ||
config?: AxiosRequestConfig<TBody>, | ||
options?: RefetchOptions | ||
) => AxiosPromise<TResponse>, | ||
RefetchFunction<TBody, TResponse>, | ||
() => void | ||
@@ -43,0 +48,0 @@ ] |
@@ -62,2 +62,5 @@ import React from 'react' | ||
export function makeUseAxios(configureOptions) { | ||
/** | ||
* @type {import('lru-cache')} | ||
*/ | ||
let cache | ||
@@ -70,3 +73,3 @@ let axiosInstance | ||
function resetConfigure() { | ||
cache = new LRU() | ||
cache = new LRU({ max: 500 }) | ||
axiosInstance = StaticAxios | ||
@@ -108,3 +111,3 @@ defaultOptions = DEFAULT_OPTIONS | ||
function clearCache() { | ||
cache.reset() | ||
cache.clear() | ||
} | ||
@@ -111,0 +114,0 @@ |
46132
873
+ Added@babel/runtime@7.19.0(transitive)
+ Addedlru-cache@7.18.3(transitive)
- Removed@babel/runtime@7.18.9(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedyallist@4.0.0(transitive)
Updated@babel/runtime@7.19.0
Updatedlru-cache@^7.14.0