From 0f83ab0f874fa6ed7d8a3d121493aa058beb8a90 Mon Sep 17 00:00:00 2001 From: Shrutesh Pachineela Date: Tue, 21 Nov 2023 22:59:36 +0530 Subject: [PATCH] Add Abortable (#3) * basic attempt * fix all types * split files * convert states to statuses * integrate linter * lint fixes * extract types * add test, coverage * lint fixes * lint fixes * change coverage in CI * add build * update example * add esbuild and minification * add documentation --- .eslintrc.js | 42 ++ .github/workflows/main.yml | 2 +- .prettierignore | 2 + README.md | 188 +++++-- dist/abortable.d.ts | 5 + dist/abortable.js | 89 +++ dist/abortable.js.map | 1 + dist/async.d.ts | 3 + dist/async.js | 83 +++ dist/async.js.map | 1 + dist/index.d.ts | 27 +- dist/index.js | 91 +--- dist/index.js.map | 2 +- dist/index.min.js | 15 + dist/index.min.js.map | 7 + dist/state.d.ts | 6 + dist/state.js | 8 + dist/state.js.map | 1 + dist/types.d.ts | 41 ++ dist/types.js | 6 + dist/types.js.map | 1 + example/.eslintrc.cjs | 18 +- example/README.md | 8 +- example/src/App.tsx | 68 ++- example/src/main.tsx | 10 +- example/vite.config.ts | 6 +- jest.config.js | 6 +- package.json | 17 +- src/abortable.ts | 59 ++ src/async.ts | 53 ++ src/index.ts | 62 +-- src/state.ts | 6 + src/types.ts | 70 +++ test/abortable.test.ts | 152 ++++++ test/{index.test.ts => async.test.ts} | 53 +- tsconfig.json | 32 +- yarn.lock | 748 +++++++++++++++++++++++++- 37 files changed, 1695 insertions(+), 294 deletions(-) create mode 100644 .eslintrc.js create mode 100644 .prettierignore create mode 100644 dist/abortable.d.ts create mode 100644 dist/abortable.js create mode 100644 dist/abortable.js.map create mode 100644 dist/async.d.ts create mode 100644 dist/async.js create mode 100644 dist/async.js.map create mode 100644 dist/index.min.js create mode 100644 dist/index.min.js.map create mode 100644 dist/state.d.ts create mode 100644 dist/state.js create mode 100644 dist/state.js.map create mode 100644 dist/types.d.ts create mode 100644 dist/types.js create mode 100644 dist/types.js.map create mode 100644 src/abortable.ts create mode 100644 src/async.ts create mode 100644 src/state.ts create mode 100644 src/types.ts create mode 100644 test/abortable.test.ts rename test/{index.test.ts => async.test.ts} (88%) diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..e600d82 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,42 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: [ + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react-hooks/recommended", + "prettier", + ], + overrides: [ + { + env: { + node: true, + }, + files: [".eslintrc.{js,cjs}"], + parserOptions: { + sourceType: "script", + }, + }, + ], + parser: "@typescript-eslint/parser", + parserOptions: { + ecmaVersion: "latest", + sourceType: "module", + }, + plugins: ["@typescript-eslint"], + rules: { + // Disable base config that may casuse erros + "no-unused-vars": "off", + "@typescript-eslint/no-unused-vars": [ + "error", // or "error" + { + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], + }, + ignorePatterns: ["dist/**/*.*", "jest.config.js"], +}; diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3731139..0ee4a9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: run: yarn install --frozen-lockfile - name: Test - run: yarn test --ci --coverage + run: yarn coverage --ci - name: Coveralls uses: coverallsapp/github-action@master diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..672620e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +dist +.github diff --git a/README.md b/README.md index 7a90375..3775090 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,12 @@ ## React Use Async Fn -React hook for managing the state of an async function +React hook for managing the state of async function and abortable async functions + +### Features +- Execute and track not only API requests but any async functions. +- Abort async functions. Can be used to abort fetch API calls. +- Simple API to `await` async function to get its result while the hook manages the state. +- Callbacks for notifying success and error ### Installing @@ -17,22 +23,110 @@ yarn add react-use-async-fn ``` ### Importing + ```js -const { useAsync, STATES } = require('react-use-async-fn'); +const { useAsync, STATES } = require("react-use-async-fn"); ``` + or in ES6 + ```js -import { useAsync, STATES } from 'react-use-async-fn'; +import { useAsync, STATES } from "react-use-async-fn"; ``` - ### Usage: #### Basic example: +```js + const [{ data, error, status}, trigger] = useAsync({ + fn: getData, + }); +``` + +You can provide your async function through the `fn` prop. +The hook returns the state of the async function and a `trigger`. +You can run you async function by calling the `trigger`. +Any arguments provided to the trigger will be provided to your function. + +If needed you can even `await` your function by using `await` on trigger. + +```js +const onClick = async () => { + const result = await trigger(2); + console.log({ result }); +}; +``` + +### API + +#### useAsync + +This hook manages the state of execution of an async function + +**props:** +`fn`: Async function to track and execute. +`onDone`: (Optional) Callback function called when the `fn` is ran successfully. It will be called with the result and the args provided to the `fn`. +`onError`: (Optional) Callback function called when the `fn`failed with an error. It will be called with the error and the args provided to the `fn`. + +**returns:** +Array of state, trigger. +`[state, trigger]` + +`state.data`: The return value of the `fn`. Initially `null`. +`state.status`: [Status](#STATUSES) of the function. One of [`INITIAL`, `WORKING`, `DONE`, `FAILED`] +`state.error`: The error thrown by the `fn`. Initially `null`. +`state.isLoading`: boolean. `true` if `state.status` is `STATUS.WORKING`. +`trigger`: Function to call the provided `fn`. All arguments are forwarded to the `fn`. You can `await` the trigger to get the output of `fn`. + + +#### useAbortableAsync(props) + +This function manages the state of an async function which can be aborted. + +The `fn` prop requires the last argument to be of `AbortableLifecycle` to use this hook. + +**props** + +`fn`: `(...any[], { abortSignal: AbortSignal }) => Promise` Async function to track and execute. + +Other props are same as [useAsync](#useAsync). + + +**returns** + +Array of state, actions +`[state, { trigger, abort }]` + +`state`: same as `[useAsync](#useAsync)`. +`trigger`: function which takes all arguments for `fn`, execpt the last argument [AbortableLifecycle](#AbortableLifecycle). The `AbortableLifecycle` argument is automatically injected by the hook. +`abort`: function to abort the request. + + +#### STATUSES + +Enum of statuses + +`INITIAL`: The status before triggering +`WORKING`: The status after triggering but before completion +`DONE`: The status when completed successfully +`FAILED`: The status when failed + +#### AbortableLifecycle +The last argument of an `AbortableAsyncFn`. It has the shape of +``` + { + abortSignal: AbortSignal, + } +``` + +### Examples: + +#### useAsync: + ```js import { useCallback } from 'react' -import { useAsync, STATES } from 'react-use-async-fn'; +import { useAsync, STATUSES } from 'react-use-async-fn'; const sleep = () => new Promise(r => setTimeout(r, 5000)) @@ -59,50 +153,56 @@ function App() { ) } -export default App - ``` -You can provide your async function through the `fn` prop. -The hook returns the state of the async function and a `trigger`. -You can run you async function by calling the `trigger`. -Any arguments provided to the trigger will be provided to your function. - -If needed you can even `await` your function by using `await` on trigger. +#### useAbortableAsync ```js -const onClick = async () => { - const result = await trigger(2); - console.log({ result }) +import { useCallback } from 'react' +import { AbortableLifecycle, STATUSES, useAbortableAsync } from 'react-use-async-fn'; + +function abortbleSleep(ms=5000, {abortSignal}: AbortableLifecycle): Promise{ + return new Promise((resolve, reject) => { + console.log("Promise Started"); + + let timeout: ReturnType; + + const abortHandler = () => { + clearTimeout(timeout); + reject(new Error("Aborted")); + } + + // start async operation + timeout = setTimeout(() => { + resolve("Promise Resolved"); + abortSignal?.removeEventListener("abort", abortHandler); + }, ms); + + abortSignal?.addEventListener("abort", abortHandler); + }); } -``` - -### API -useAsync(props) - -**props:** -`fn`: Async function to track and execute. -`onDone`: (Optional) Callback function called when the `fn` is ran successfully. It will be called with the result and the args provided to the `fn`. -`onError`: (Optional) Callback function called when the `fn`failed with an error. It will be called with the error and the args provided to the `fn`. - - -**returns:** -Array of state, trigger. -`[state, trigger]` - -`state.data`: The return value of the `fn`. Initially `null`. -`state.status`: `STATUS` of the function. One of [`INITIAL`, `WORKING`, `DONE`, `FAILED`] -`state.error`: The error thrown by the `fn`. Initially `null`. -`state.isLoading`: boolean. `true` if `state.status` is `STATUS.WORKING`. -`trigger`: Function to call the provided `fn`. All arguments are forwarded to the `fn`. +function App() { + const [{ data, error, status }, {trigger, abort}] = useAbortableAsync({ + fn: abortbleSleep, + }); -**STATUS:** -```js -STATES = { - INITIAL: "INITIAL", - WORKING: "WORKING", - DONE: "DONE", - FAILED: "FAILED", -}; + return ( +
+

Abortable

+

data

+

{data}

+

status

+

{status}

+

error

+

{(error as Error)?.message}

+

+ +

+

+ +

+
+ ) +} ``` \ No newline at end of file diff --git a/dist/abortable.d.ts b/dist/abortable.d.ts new file mode 100644 index 0000000..7a2c23d --- /dev/null +++ b/dist/abortable.d.ts @@ -0,0 +1,5 @@ +import { AbortableAsyncAbort, AbortableAsyncTrigger, AsyncState, BasicAsyncFn, useAsyncArgs } from "./types"; +export declare const useAbortableAsync: ({ fn, onDone, onError, }: useAsyncArgs) => [AsyncState, { + trigger: AbortableAsyncTrigger; + abort: AbortableAsyncAbort; +}]; diff --git a/dist/abortable.js b/dist/abortable.js new file mode 100644 index 0000000..f0d49c8 --- /dev/null +++ b/dist/abortable.js @@ -0,0 +1,89 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +}; +import { useCallback, useEffect, useRef } from "react"; +import { noOp, useAsync } from "./async"; +export var useAbortableAsync = function (_a) { + var fn = _a.fn, _b = _a.onDone, onDone = _b === void 0 ? noOp : _b, _c = _a.onError, onError = _c === void 0 ? noOp : _c; + var abortControllerRef = useRef(null); + var _d = useAsync({ + fn: fn, + onDone: onDone, + onError: onError, + }), data = _d[0], asyncTrigger = _d[1]; + var trigger = useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(void 0, void 0, void 0, function () { + var result; + var _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + abortControllerRef.current = new AbortController(); + return [4 /*yield*/, asyncTrigger.apply(void 0, __spreadArray(__spreadArray([], args, true), [ + { + abortSignal: (_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.signal, + }, + ], false))]; + case 1: + result = _b.sent(); + return [2 /*return*/, result]; + } + }); + }); + }, [asyncTrigger]); + var abort = useCallback(function () { + var _a; + (_a = abortControllerRef.current) === null || _a === void 0 ? void 0 : _a.abort(); + }, []); + useEffect(function () { + return abort; + }, [abort]); + return [data, { trigger: trigger, abort: abort }]; +}; +//# sourceMappingURL=abortable.js.map \ No newline at end of file diff --git a/dist/abortable.js.map b/dist/abortable.js.map new file mode 100644 index 0000000..b9d038b --- /dev/null +++ b/dist/abortable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abortable.js","sourceRoot":"","sources":["../src/abortable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAUvD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAAyB,EAIxC;QAHhB,EAAE,QAAA,EACF,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EACb,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA;IAQd,IAAM,kBAAkB,GAAG,MAAM,CAAyB,IAAI,CAAC,CAAC;IAE1D,IAAA,KAAuB,QAAQ,CAAI;QACvC,EAAE,IAAA;QACF,MAAM,QAAA;QACN,OAAO,SAAA;KACR,CAAC,EAJK,IAAI,QAAA,EAAE,YAAY,QAIvB,CAAC;IAEH,IAAM,OAAO,GAAG,WAAW,CACzB;QAAO,cAAuC;aAAvC,UAAuC,EAAvC,qBAAuC,EAAvC,IAAuC;YAAvC,yBAAuC;;;;;;;;wBAC5C,kBAAkB,CAAC,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;wBAEpC,qBAAM,YAAY,eAC3B,gCACC,IAAI;gCACP;oCACE,WAAW,EAAE,MAAA,kBAAkB,CAAC,OAAO,0CAAE,MAAM;iCAC1B;qCACK,GAC/B;;wBAPK,MAAM,GAAG,SAOd;wBAED,sBAAO,MAAM,EAAC;;;;KACf,EACD,CAAC,YAAY,CAAC,CACf,CAAC;IAEF,IAAM,KAAK,GAAG,WAAW,CAAC;;QACxB,MAAA,kBAAkB,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC;QACR,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,CAAC,IAAI,EAAE,EAAE,OAAO,SAAA,EAAE,KAAK,OAAA,EAAE,CAAC,CAAC;AACpC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/async.d.ts b/dist/async.d.ts new file mode 100644 index 0000000..8434b62 --- /dev/null +++ b/dist/async.d.ts @@ -0,0 +1,3 @@ +import { AsyncState, AsyncTrigger, BasicAsyncFn, useAsyncArgs } from "./types"; +export declare const noOp: () => undefined; +export declare const useAsync: ({ fn, onDone, onError, }: useAsyncArgs) => [AsyncState, AsyncTrigger]; diff --git a/dist/async.js b/dist/async.js new file mode 100644 index 0000000..3e029c9 --- /dev/null +++ b/dist/async.js @@ -0,0 +1,83 @@ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +import { useCallback, useMemo, useState } from "react"; +import { STATUSES } from "./state"; +export var noOp = function () { return undefined; }; +export var useAsync = function (_a) { + var fn = _a.fn, _b = _a.onDone, onDone = _b === void 0 ? noOp : _b, _c = _a.onError, onError = _c === void 0 ? noOp : _c; + var _d = useState(null), data = _d[0], setData = _d[1]; + var _e = useState(null), error = _e[0], setError = _e[1]; + var _f = useState(STATUSES.INITIAL), status = _f[0], setStatus = _f[1]; + var isLoading = useMemo(function () { return status === STATUSES.WORKING; }, [status]); + var trigger = useCallback(function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + return __awaiter(void 0, void 0, void 0, function () { + var result, error_1; + return __generator(this, function (_a) { + switch (_a.label) { + case 0: + _a.trys.push([0, 2, , 3]); + setStatus(STATUSES.WORKING); + return [4 /*yield*/, fn.apply(void 0, args)]; + case 1: + result = _a.sent(); + setData(result); + setStatus(STATUSES.DONE); + onDone(result, { + args: args, + }); + return [2 /*return*/, result]; + case 2: + error_1 = _a.sent(); + setData(null); + setError(error_1); + setStatus(STATUSES.FAILED); + onError(error_1, { + args: args, + }); + return [2 /*return*/]; + case 3: return [2 /*return*/]; + } + }); + }); + }, [fn, onDone, onError]); + return [{ status: status, data: data, error: error, isLoading: isLoading }, trigger]; +}; +//# sourceMappingURL=async.js.map \ No newline at end of file diff --git a/dist/async.js.map b/dist/async.js.map new file mode 100644 index 0000000..febd26a --- /dev/null +++ b/dist/async.js.map @@ -0,0 +1 @@ +{"version":3,"file":"async.js","sourceRoot":"","sources":["../src/async.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AASnC,MAAM,CAAC,IAAM,IAAI,GAAG,cAAM,OAAA,SAAS,EAAT,CAAS,CAAC;AAEpC,MAAM,CAAC,IAAM,QAAQ,GAAG,UAAyB,EAI/B;QAHhB,EAAE,QAAA,EACF,cAAa,EAAb,MAAM,mBAAG,IAAI,KAAA,EACb,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA;IAER,IAAA,KAAkB,QAAQ,CAAgC,IAAI,CAAC,EAA9D,IAAI,QAAA,EAAE,OAAO,QAAiD,CAAC;IAChE,IAAA,KAAoB,QAAQ,CAAiB,IAAI,CAAC,EAAjD,KAAK,QAAA,EAAE,QAAQ,QAAkC,CAAC;IACnD,IAAA,KAAsB,QAAQ,CAClC,QAAQ,CAAC,OAAO,CACjB,EAFM,MAAM,QAAA,EAAE,SAAS,QAEvB,CAAC;IAEF,IAAM,SAAS,GAAG,OAAO,CAAC,cAAM,OAAA,MAAM,KAAK,QAAQ,CAAC,OAAO,EAA3B,CAA2B,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvE,IAAM,OAAO,GAAG,WAAW,CACzB;QAAO,cAAsB;aAAtB,UAAsB,EAAtB,qBAAsB,EAAtB,IAAsB;YAAtB,yBAAsB;;;;;;;;wBAEzB,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;wBAEb,qBAAM,EAAE,eAAI,IAAI,GAAC;;wBAA1B,MAAM,GAAG,SAAiB;wBAEhC,OAAO,CAAC,MAAM,CAAC,CAAC;wBAChB,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;wBACzB,MAAM,CAAC,MAAM,EAAE;4BACb,IAAI,MAAA;yBACL,CAAC,CAAC;wBACH,sBAAO,MAAM,EAAC;;;wBAEd,OAAO,CAAC,IAAI,CAAC,CAAC;wBACd,QAAQ,CAAC,OAAK,CAAC,CAAC;wBAChB,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;wBAC3B,OAAO,CAAC,OAAK,EAAE;4BACb,IAAI,MAAA;yBACL,CAAC,CAAC;wBACH,sBAAO;;;;;KAEV,EACD,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CACtB,CAAC;IAEF,OAAO,CAAC,EAAE,MAAM,QAAA,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts index a80b057..9e2086c 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,23 +1,4 @@ -export declare const STATES: { - INITIAL: string; - WORKING: string; - DONE: string; - FAILED: string; -}; -export interface useAsyncArgs { - fn: (...args: A) => Promise; - onDone?: (result?: R, ctx?: { - args: A; - }) => void; - onError?: (error?: unknown, ctx?: { - args: A; - }) => void; -} -type ValueOf = T[keyof T]; -export declare const useAsync: ({ fn, onDone, onError }: useAsyncArgs) => [{ - status: ValueOf; - error: unknown | null; - data: R | null; - isLoading: boolean; -}, (...args: A) => Promise]; -export {}; +export * from "./state"; +export * from "./async"; +export * from "./abortable"; +export * from "./types"; diff --git a/dist/index.js b/dist/index.js index 15a7159..b01b8d9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,88 +1,5 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -import { useCallback, useMemo, useState } from "react"; -export var STATES = { - INITIAL: "INITIAL", - WORKING: "WORKING", - DONE: "DONE", - FAILED: "FAILED", -}; -var noOp = function () { return undefined; }; -export var useAsync = function (_a) { - var fn = _a.fn, _b = _a.onDone, onDone = _b === void 0 ? noOp : _b, _c = _a.onError, onError = _c === void 0 ? noOp : _c; - var _d = useState(null), data = _d[0], setData = _d[1]; - var _e = useState(null), error = _e[0], setError = _e[1]; - var _f = useState(STATES.INITIAL), status = _f[0], setStatus = _f[1]; - var isLoading = useMemo(function () { return status === STATES.WORKING; }, [status]); - var trigger = useCallback(function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - return __awaiter(void 0, void 0, void 0, function () { - var result, error_1; - return __generator(this, function (_a) { - switch (_a.label) { - case 0: - _a.trys.push([0, 2, , 3]); - setStatus(STATES.WORKING); - return [4 /*yield*/, fn.apply(void 0, args)]; - case 1: - result = _a.sent(); - setData(result); - setStatus(STATES.DONE); - onDone(result, { - args: args, - }); - return [2 /*return*/, result]; - case 2: - error_1 = _a.sent(); - setData(null); - setError(error_1); - setStatus(STATES.FAILED); - onError(error_1, { - args: args, - }); - return [2 /*return*/]; - case 3: return [2 /*return*/]; - } - }); - }); - }, [fn, onDone, onError]); - return [{ status: status, data: data, error: error, isLoading: isLoading }, trigger]; -}; +export * from "./state"; +export * from "./async"; +export * from "./abortable"; +export * from "./types"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 45615c9..3293614 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","s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wBACvB,MAAM,CAAC,MAAM,EAAE;4BACb,IAAI,MAAA;yBACL,CAAC,CAAC;wBACH,sBAAO,MAAM,EAAC;;;wBAEd,OAAO,CAAC,IAAI,CAAC,CAAC;wBACd,QAAQ,CAAC,OAAK,CAAC,CAAC;wBAChB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;wBACzB,OAAO,CAAC,OAAK,EAAE;4BACb,IAAI,MAAA;yBACL,CAAC,CAAC;wBACH,sBAAO;;;;;KAEV,EACD,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CACtB,CAAC;IAEF,OAAO,CAAC,EAAE,MAAM,QAAA,EAAE,IAAI,MAAA,EAAE,KAAK,OAAA,EAAE,SAAS,WAAA,EAAE,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"} \ No newline at end of file diff --git a/dist/index.min.js b/dist/index.min.js new file mode 100644 index 0000000..b38dd82 --- /dev/null +++ b/dist/index.min.js @@ -0,0 +1,15 @@ +"use strict";(()=>{var re=Object.create;var V=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty;var q=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ce=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ue(t))!ie.call(e,o)&&o!==n&&V(e,o,{get:()=>t[o],enumerable:!(i=ne(t,o))||i.enumerable});return e};var G=(e,t,n)=>(n=e!=null?re(oe(e)):{},ce(t||!e||!e.__esModule?V(n,"default",{value:e,enumerable:!0}):n,e));var X=q(l=>{"use strict";var E=Symbol.for("react.element"),se=Symbol.for("react.portal"),le=Symbol.for("react.fragment"),ae=Symbol.for("react.strict_mode"),fe=Symbol.for("react.profiler"),ye=Symbol.for("react.provider"),pe=Symbol.for("react.context"),de=Symbol.for("react.forward_ref"),ve=Symbol.for("react.suspense"),he=Symbol.for("react.memo"),_e=Symbol.for("react.lazy"),M=Symbol.iterator;function me(e){return e===null||typeof e!="object"?null:(e=M&&e[M]||e["@@iterator"],typeof e=="function"?e:null)}var K={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},z=Object.assign,B={};function w(e,t,n){this.props=e,this.context=t,this.refs=B,this.updater=n||K}w.prototype.isReactComponent={};w.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};w.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function H(){}H.prototype=w.prototype;function N(e,t,n){this.props=e,this.context=t,this.refs=B,this.updater=n||K}var L=N.prototype=new H;L.constructor=N;z(L,w.prototype);L.isPureReactComponent=!0;var U=Array.isArray,J=Object.prototype.hasOwnProperty,T={current:null},Q={key:!0,ref:!0,__self:!0,__source:!0};function Y(e,t,n){var i,o={},r=null,c=null;if(t!=null)for(i in t.ref!==void 0&&(c=t.ref),t.key!==void 0&&(r=""+t.key),t)J.call(t,i)&&!Q.hasOwnProperty(i)&&(o[i]=t[i]);var s=arguments.length-2;if(s===1)o.children=n;else if(1{"use strict";Z.exports=X()});var h;(function(e){e.INITIAL="INITIAL",e.WORKING="WORKING",e.DONE="DONE",e.FAILED="FAILED"})(h||(h={}));var _=G(P());var Se=function(e,t,n,i){function o(r){return r instanceof n?r:new n(function(c){c(r)})}return new(n||(n=Promise))(function(r,c){function s(f){try{u(i.next(f))}catch(p){c(p)}}function a(f){try{u(i.throw(f))}catch(p){c(p)}}function u(f){f.done?r(f.value):o(f.value).then(s,a)}u((i=i.apply(e,t||[])).next())})},ke=function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,c;return c={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function s(u){return function(f){return a([u,f])}}function a(u){if(i)throw new TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(n=0)),n;)try{if(i=1,o&&(r=u[0]&2?o.return:u[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,u[1])).done)return r;switch(o=0,r&&(u=[u[0]&2,r.value]),u[0]){case 0:case 1:r=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,o=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(r=n.trys,!(r=r.length>0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1]0&&r[r.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!r||u[1]>r[0]&&u[1] undefined;\n\nexport const useAsync = ({\n fn,\n onDone = noOp,\n onError = noOp,\n}: useAsyncArgs): [AsyncState, AsyncTrigger] => {\n const [data, setData] = useState> | null>(null);\n const [error, setError] = useState(null);\n const [status, setStatus] = useState>(\n STATUSES.INITIAL,\n );\n\n const isLoading = useMemo(() => status === STATUSES.WORKING, [status]);\n\n const trigger = useCallback(\n async (...args: Parameters) => {\n try {\n setStatus(STATUSES.WORKING);\n\n const result = await fn(...args);\n\n setData(result);\n setStatus(STATUSES.DONE);\n onDone(result, {\n args,\n });\n return result;\n } catch (error) {\n setData(null);\n setError(error);\n setStatus(STATUSES.FAILED);\n onError(error, {\n args,\n });\n return;\n }\n },\n [fn, onDone, onError],\n );\n\n return [{ status, data, error, isLoading }, trigger];\n};\n", "import { useCallback, useEffect, useRef } from \"react\";\nimport {\n AbortableAsyncAbort,\n AbortableAsyncTrigger,\n AbortableLifecycle,\n AsyncState,\n BasicAsyncFn,\n TupleExceptLast,\n useAsyncArgs,\n} from \"./types\";\nimport { noOp, useAsync } from \"./async\";\n\nexport const useAbortableAsync = ({\n fn,\n onDone = noOp,\n onError = noOp,\n}: useAsyncArgs): [\n AsyncState,\n {\n trigger: AbortableAsyncTrigger;\n abort: AbortableAsyncAbort;\n },\n] => {\n const abortControllerRef = useRef(null);\n\n const [data, asyncTrigger] = useAsync({\n fn,\n onDone,\n onError,\n });\n\n const trigger = useCallback(\n async (...args: TupleExceptLast>) => {\n abortControllerRef.current = new AbortController();\n\n const result = await asyncTrigger(\n ...([\n ...args,\n {\n abortSignal: abortControllerRef.current?.signal,\n } as AbortableLifecycle,\n ] as unknown as Parameters),\n );\n\n return result;\n },\n [asyncTrigger],\n );\n\n const abort = useCallback(() => {\n abortControllerRef.current?.abort();\n }, []);\n\n useEffect(() => {\n return abort;\n }, [abort]);\n\n return [data, { trigger, abort }];\n};\n"], + "mappings": "wiBAAA,IAAAA,EAAAC,EAAAC,GAAA,cASa,IAAIC,EAAE,OAAO,IAAI,eAAe,EAAEC,GAAE,OAAO,IAAI,cAAc,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,mBAAmB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,eAAe,EAAEC,GAAE,OAAO,IAAI,mBAAmB,EAAEC,GAAE,OAAO,IAAI,gBAAgB,EAAEC,GAAE,OAAO,IAAI,YAAY,EAAEC,GAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,SAAS,SAASC,GAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,GAAGE,EAAEF,CAAC,GAAGE,EAAE,YAAY,EAAqB,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,EAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,C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,CAAC,EAEH,CAACP,EAAM,CAAE,QAAOE,EAAE,MAAKK,CAAA,CAAE,CAClC", + "names": ["require_react_production_min", "__commonJSMin", "exports", "l", "n", "p", "q", "r", "t", "u", "v", "w", "x", "y", "z", "A", "a", "B", "C", "D", "E", "b", "e", "F", "G", "H", "I", "K", "L", "M", "d", "c", "k", "h", "g", "f", "m", "N", "O", "escape", "P", "Q", "R", "S", "T", "U", "V", "W", "require_react", "__commonJSMin", "exports", "module", "STATUSES", "import_react", "noOp", "useAsync", "_a", "fn", "_b", "onDone", "_c", "onError", "_d", "data", "setData", "_e", "error", "setError", "_f", "STATUSES", "status", "setStatus", "isLoading", "trigger", "args", "_i", "result", "error_1", "import_react", "useAbortableAsync", "_a", "fn", "_b", "onDone", "noOp", "_c", "onError", "abortControllerRef", "_d", "useAsync", "data", "asyncTrigger", "trigger", "args", "_i", "__spreadArray", "result", "abort"] +} diff --git a/dist/state.d.ts b/dist/state.d.ts new file mode 100644 index 0000000..c6566c5 --- /dev/null +++ b/dist/state.d.ts @@ -0,0 +1,6 @@ +export declare enum STATUSES { + INITIAL = "INITIAL", + WORKING = "WORKING", + DONE = "DONE", + FAILED = "FAILED" +} diff --git a/dist/state.js b/dist/state.js new file mode 100644 index 0000000..10ae800 --- /dev/null +++ b/dist/state.js @@ -0,0 +1,8 @@ +export var STATUSES; +(function (STATUSES) { + STATUSES["INITIAL"] = "INITIAL"; + STATUSES["WORKING"] = "WORKING"; + STATUSES["DONE"] = "DONE"; + STATUSES["FAILED"] = "FAILED"; +})(STATUSES || (STATUSES = {})); +//# sourceMappingURL=state.js.map \ No newline at end of file diff --git a/dist/state.js.map b/dist/state.js.map new file mode 100644 index 0000000..728d4ed --- /dev/null +++ b/dist/state.js.map @@ -0,0 +1 @@ +{"version":3,"file":"state.js","sourceRoot":"","sources":["../src/state.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;IACnB,+BAAmB,CAAA;IACnB,yBAAa,CAAA;IACb,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,KAAR,QAAQ,QAKnB"} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts new file mode 100644 index 0000000..f99286f --- /dev/null +++ b/dist/types.d.ts @@ -0,0 +1,41 @@ +import { STATUSES } from "./state"; +export type ValueOf = T[keyof T]; +export type LastArgs any> = Parameters extends [ + any, + ...infer L +] ? L : never; +export type ParametersExceptFirst = F extends (arg0: any, ...rest: infer R) => any ? R : never; +export type TupleExceptFirst = T extends [any, ...rest: infer R] ? R : never; +export type TupleExceptLast = T extends [...first: infer F, any] ? F : never; +export type BasicAsyncFn = (...args: any[]) => Promise; +export interface useAsyncArgs { + fn: F; + onDone?: (result: Awaited>, ctx: { + args: Parameters; + }) => void; + onError?: (error: unknown, ctx: { + args: Parameters; + }) => void; +} +export interface AsyncState { + status: ValueOf; + error: unknown | null; + data: Awaited> | null; + isLoading: boolean; +} +export type AsyncTrigger = (...args: Parameters) => Promise>>; +export interface AbortableLifecycle { + abortSignal: AbortSignal; +} +export type BasicAbortableAsyncFn = (...args: [...any[], AbortableLifecycle]) => Promise; +export interface useAbortableAsyncArgs { + fn: F; + onDone?: (result?: Awaited>, ctx?: { + args: Parameters; + }) => void; + onError?: (error?: unknown, ctx?: { + args: Parameters; + }) => void; +} +export type AbortableAsyncTrigger = (...args: TupleExceptLast>) => Promise>; +export type AbortableAsyncAbort = () => void; diff --git a/dist/types.js b/dist/types.js new file mode 100644 index 0000000..86bce24 --- /dev/null +++ b/dist/types.js @@ -0,0 +1,6 @@ +export {}; +// const _f1: BasicAbortableAsyncFn = async (a: number, b: string, _lc: AbortableLifecycle) => { +// return a+b; +// } +// const _f2: BasicAsyncFn = _f1; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/types.js.map b/dist/types.js.map new file mode 100644 index 0000000..283a488 --- /dev/null +++ b/dist/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAiEA,gGAAgG;AAChG,gBAAgB;AAChB,IAAI;AAEJ,iCAAiC"} \ No newline at end of file diff --git a/example/.eslintrc.cjs b/example/.eslintrc.cjs index d6c9537..6e8698b 100644 --- a/example/.eslintrc.cjs +++ b/example/.eslintrc.cjs @@ -2,17 +2,17 @@ module.exports = { root: true, env: { browser: true, es2020: true }, extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'plugin:react-hooks/recommended', + "eslint:recommended", + "plugin:@typescript-eslint/recommended", + "plugin:react-hooks/recommended", ], - ignorePatterns: ['dist', '.eslintrc.cjs'], - parser: '@typescript-eslint/parser', - plugins: ['react-refresh'], + ignorePatterns: ["dist", ".eslintrc.cjs"], + parser: "@typescript-eslint/parser", + plugins: ["react-refresh"], rules: { - 'react-refresh/only-export-components': [ - 'warn', + "react-refresh/only-export-components": [ + "warn", { allowConstantExport: true }, ], }, -} +}; diff --git a/example/README.md b/example/README.md index 0d6babe..bb15685 100644 --- a/example/README.md +++ b/example/README.md @@ -17,12 +17,12 @@ If you are developing a production application, we recommend updating the config export default { // other rules... parserOptions: { - ecmaVersion: 'latest', - sourceType: 'module', - project: ['./tsconfig.json', './tsconfig.node.json'], + ecmaVersion: "latest", + sourceType: "module", + project: ["./tsconfig.json", "./tsconfig.node.json"], tsconfigRootDir: __dirname, }, -} +}; ``` - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked` diff --git a/example/src/App.tsx b/example/src/App.tsx index 91f261f..f08b05a 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,20 +1,67 @@ -import { useCallback } from 'react' -import { useAsync } from '../../dist/index'; +import { useCallback } from "react"; +import { AbortableLifecycle, STATUSES, useAbortableAsync, useAsync } from "../../dist/index"; -const sleep = () => new Promise(r => setTimeout(r, 5000)) +const sleep = (ms=5000) => new Promise((r) => setTimeout(r, ms)); -function App() { +function abortbleSleep(ms=5000, {abortSignal}: AbortableLifecycle): Promise{ + return new Promise((resolve, reject) => { + console.log("Promise Started"); + + // eslint-disable-next-line prefer-const + let timeout: ReturnType; + + const abortHandler = () => { + clearTimeout(timeout); + reject(new Error("Aborted")); + } + + // start async operation + timeout = setTimeout(() => { + resolve("Promise Resolved"); + abortSignal?.removeEventListener("abort", abortHandler); + }, ms); + + abortSignal?.addEventListener("abort", abortHandler); + }); +} + +const AbortableDemo = () => { + const [{ data, error, status }, {trigger, abort}] = useAbortableAsync({ + fn: abortbleSleep, + }); + + return ( +
+

Abortable

+

data

+

{data}

+

status

+

{status}

+

error

+

{(error as Error)?.message}

+

+ +

+

+ +

+
+ ) +} + +function AsyncDemo() { const getData = useCallback(async (input: number) => { await sleep(); return input + 1; }, []); - const [{ data, error, status}, trigger] = useAsync({ + const [{ data, error, status }, trigger] = useAsync({ fn: getData, }); return (
+

Async

data

{data}

status

@@ -23,7 +70,16 @@ function App() {

{error as string}

+ ); +} + +const App = () => { + return ( + <> + + + ) } -export default App +export default App; diff --git a/example/src/main.tsx b/example/src/main.tsx index e63eef4..b5c0092 100644 --- a/example/src/main.tsx +++ b/example/src/main.tsx @@ -1,9 +1,9 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './App.tsx' +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App.tsx"; -ReactDOM.createRoot(document.getElementById('root')!).render( +ReactDOM.createRoot(document.getElementById("root")!).render( , -) +); diff --git a/example/vite.config.ts b/example/vite.config.ts index 5a33944..9cc50ea 100644 --- a/example/vite.config.ts +++ b/example/vite.config.ts @@ -1,7 +1,7 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], -}) +}); diff --git a/jest.config.js b/jest.config.js index b860027..ccc0472 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - preset: 'ts-jest', - testEnvironment: 'jsdom', -}; \ No newline at end of file + preset: "ts-jest", + testEnvironment: "jsdom", +}; diff --git a/package.json b/package.json index 7651238..18456e9 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,14 @@ "version": "0.1.0", "description": "React hook for managing the state of an async function", "scripts": { - "build": "tsc", - "test": "jest" + "compile": "tsc", + "minify": "esbuild dist/index.js --bundle --minify --sourcemap --outfile=dist/index.min.js", + "build": "yarn compile && yarn minify", + "test": "jest", + "coverage": "jest --coverage", + "lint": "eslint .", + "format": "prettier --check .", + "format:fix": "prettier --write ." }, "main": "dist/index.js", "repository": { @@ -27,8 +33,15 @@ "@testing-library/react": "^14.1.2", "@types/jest": "^29.5.8", "@types/react": "^18.2.37", + "@typescript-eslint/eslint-plugin": "^6.12.0", + "@typescript-eslint/parser": "^6.12.0", + "esbuild": "^0.19.7", + "eslint": "^8.54.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-react-hooks": "^4.6.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "prettier": "^3.1.0", "react": "^18.2.0", "react-dom": "^18.2.0", "ts-jest": "^29.1.1", diff --git a/src/abortable.ts b/src/abortable.ts new file mode 100644 index 0000000..995a002 --- /dev/null +++ b/src/abortable.ts @@ -0,0 +1,59 @@ +import { useCallback, useEffect, useRef } from "react"; +import { + AbortableAsyncAbort, + AbortableAsyncTrigger, + AbortableLifecycle, + AsyncState, + BasicAsyncFn, + TupleExceptLast, + useAsyncArgs, +} from "./types"; +import { noOp, useAsync } from "./async"; + +export const useAbortableAsync = ({ + fn, + onDone = noOp, + onError = noOp, +}: useAsyncArgs): [ + AsyncState, + { + trigger: AbortableAsyncTrigger; + abort: AbortableAsyncAbort; + }, +] => { + const abortControllerRef = useRef(null); + + const [data, asyncTrigger] = useAsync({ + fn, + onDone, + onError, + }); + + const trigger = useCallback( + async (...args: TupleExceptLast>) => { + abortControllerRef.current = new AbortController(); + + const result = await asyncTrigger( + ...([ + ...args, + { + abortSignal: abortControllerRef.current?.signal, + } as AbortableLifecycle, + ] as unknown as Parameters), + ); + + return result; + }, + [asyncTrigger], + ); + + const abort = useCallback(() => { + abortControllerRef.current?.abort(); + }, []); + + useEffect(() => { + return abort; + }, [abort]); + + return [data, { trigger, abort }]; +}; diff --git a/src/async.ts b/src/async.ts new file mode 100644 index 0000000..05aedf1 --- /dev/null +++ b/src/async.ts @@ -0,0 +1,53 @@ +import { useCallback, useMemo, useState } from "react"; +import { STATUSES } from "./state"; +import { + AsyncState, + AsyncTrigger, + BasicAsyncFn, + ValueOf, + useAsyncArgs, +} from "./types"; + +export const noOp = () => undefined; + +export const useAsync = ({ + fn, + onDone = noOp, + onError = noOp, +}: useAsyncArgs): [AsyncState, AsyncTrigger] => { + const [data, setData] = useState> | null>(null); + const [error, setError] = useState(null); + const [status, setStatus] = useState>( + STATUSES.INITIAL, + ); + + const isLoading = useMemo(() => status === STATUSES.WORKING, [status]); + + const trigger = useCallback( + async (...args: Parameters) => { + try { + setStatus(STATUSES.WORKING); + + const result = await fn(...args); + + setData(result); + setStatus(STATUSES.DONE); + onDone(result, { + args, + }); + return result; + } catch (error) { + setData(null); + setError(error); + setStatus(STATUSES.FAILED); + onError(error, { + args, + }); + return; + } + }, + [fn, onDone, onError], + ); + + return [{ status, data, error, isLoading }, trigger]; +}; diff --git a/src/index.ts b/src/index.ts index a69d516..9e2086c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,58 +1,4 @@ -import { useCallback, useMemo, useState } from "react"; - -export const STATES = { - INITIAL: "INITIAL", - WORKING: "WORKING", - DONE: "DONE", - FAILED: "FAILED", -}; - -const noOp = () => undefined; - -export interface useAsyncArgs
{ - fn: (...args: A) => Promise, - onDone?: (result?: R, ctx?: { args: A}) => void, - onError?: (error?: unknown, ctx?: { args: A}) => void, -} - -type ValueOf = T[keyof T]; - -export const useAsync = ({ fn, onDone = noOp, onError = noOp }: useAsyncArgs): [ - {status: ValueOf, error: unknown|null, data: R|null, isLoading: boolean}, - (...args: A) => Promise -] => { - const [data, setData] = useState(null); - const [error, setError] = useState(null); - const [status, setStatus] = useState>(STATES.INITIAL); - - const isLoading = useMemo(() => status === STATES.WORKING, [status]); - - const trigger = useCallback( - async (...args: A) => { - try { - setStatus(STATES.WORKING); - - const result = await fn(...args); - - setData(result); - setStatus(STATES.DONE); - onDone(result, { - args, - }); - return result; - } catch (error) { - setData(null); - setError(error); - setStatus(STATES.FAILED); - onError(error, { - args, - }); - return; - } - }, - [fn, onDone, onError] - ); - - return [{ status, data, error, isLoading }, trigger]; -}; - +export * from "./state"; +export * from "./async"; +export * from "./abortable"; +export * from "./types"; diff --git a/src/state.ts b/src/state.ts new file mode 100644 index 0000000..549f852 --- /dev/null +++ b/src/state.ts @@ -0,0 +1,6 @@ +export enum STATUSES { + INITIAL = "INITIAL", + WORKING = "WORKING", + DONE = "DONE", + FAILED = "FAILED", +} diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..b0c8b79 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,70 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { STATUSES } from "./state"; + +/* Util Types */ +export type ValueOf = T[keyof T]; +export type LastArgs any> = Parameters extends [ + any, + ...infer L, +] + ? L + : never; +export type ParametersExceptFirst = F extends ( + arg0: any, + ...rest: infer R +) => any + ? R + : never; +export type TupleExceptFirst = T extends [any, ...rest: infer R] ? R : never; +export type TupleExceptLast = T extends [...first: infer F, any] ? F : never; + +export type BasicAsyncFn = (...args: any[]) => Promise; + +export interface useAsyncArgs { + fn: F; + onDone?: ( + result: Awaited>, + ctx: { args: Parameters }, + ) => void; + onError?: (error: unknown, ctx: { args: Parameters }) => void; +} + +export interface AsyncState { + status: ValueOf; + error: unknown | null; + data: Awaited> | null; + isLoading: boolean; +} + +export type AsyncTrigger = ( + ...args: Parameters +) => Promise>>; + +export interface AbortableLifecycle { + abortSignal: AbortSignal; +} + +export type BasicAbortableAsyncFn = ( + ...args: [...any[], AbortableLifecycle] +) => Promise; + +export interface useAbortableAsyncArgs { + fn: F; + onDone?: ( + result?: Awaited>, + ctx?: { args: Parameters }, + ) => void; + onError?: (error?: unknown, ctx?: { args: Parameters }) => void; +} + +export type AbortableAsyncTrigger = ( + ...args: TupleExceptLast> +) => Promise>; + +export type AbortableAsyncAbort = () => void; + +// const _f1: BasicAbortableAsyncFn = async (a: number, b: string, _lc: AbortableLifecycle) => { +// return a+b; +// } + +// const _f2: BasicAsyncFn = _f1; diff --git a/test/abortable.test.ts b/test/abortable.test.ts new file mode 100644 index 0000000..b038a66 --- /dev/null +++ b/test/abortable.test.ts @@ -0,0 +1,152 @@ +import { act, renderHook } from "@testing-library/react"; +import { STATUSES, useAbortableAsync } from "../src"; + +describe("useAbortableAsync", () => { + describe("optional args", () => { + it("should work with only the fn provided", () => { + const { result } = renderHook(() => + useAbortableAsync({ + fn: async () => 1, + }), + ); + + const [bag, { trigger, abort }] = result.current; + + expect(bag).not.toBe(undefined); + expect(trigger).not.toBe(undefined); + expect(abort).not.toBe(undefined); + + const { data, error, status, isLoading } = bag; + expect(data).toBe(null); + expect(error).toBe(null); + expect(status).toBe(STATUSES.INITIAL); + expect(isLoading).toBe(false); + }); + it("should work without onDone", () => { + const { result } = renderHook(() => + useAbortableAsync({ + fn: async () => 1, + onError: () => void 0, + }), + ); + + const [bag, { trigger, abort }] = result.current; + + expect(bag).not.toBe(undefined); + expect(trigger).not.toBe(undefined); + expect(abort).not.toBe(undefined); + + const { data, error, status, isLoading } = bag; + expect(data).toBe(null); + expect(error).toBe(null); + expect(status).toBe(STATUSES.INITIAL); + expect(isLoading).toBe(false); + }); + it("should work without onError", () => { + const { result } = renderHook(() => + useAbortableAsync({ + fn: async () => 1, + onDone: () => void 0, + }), + ); + + const [bag, { trigger, abort }] = result.current; + + expect(bag).not.toBe(undefined); + expect(trigger).not.toBe(undefined); + expect(abort).not.toBe(undefined); + + const { data, error, status, isLoading } = bag; + expect(data).toBe(null); + expect(error).toBe(null); + expect(status).toBe(STATUSES.INITIAL); + expect(isLoading).toBe(false); + }); + }); + + describe("behaviour", () => { + afterEach(jest.resetAllMocks); + + it("should not trigger automatically", () => { + const workFn = jest.fn().mockImplementation(async () => 0); + + renderHook(() => + useAbortableAsync({ + fn: workFn, + onDone: () => void 0, + }), + ); + + expect(workFn.mock.calls.length).toBe(0); + }); + it("should not trigger automatically when props change", () => { + const workFn = jest.fn().mockImplementation(async () => 0); + + const { rerender } = renderHook(() => + useAbortableAsync({ + fn: workFn, + onDone: () => void 0, + }), + ); + + rerender({ + fn: workFn, + onDone: () => void 1, + }); + + expect(workFn.mock.calls.length).toBe(0); + }); + it("should trigger when triggered", async () => { + const workFn = jest.fn().mockImplementation(async () => { + return "TEST_RETURN"; + }); + + const { result } = renderHook(() => + useAbortableAsync({ + fn: workFn, + onDone: () => void 0, + }), + ); + + const [_, { trigger }] = result.current; + + let asyncResult; + await act(async () => { + asyncResult = await trigger(1, 2, 3); + }); + + expect(workFn.mock.calls.length).toBe(1); + expect(workFn.mock.calls.at(0).slice(0, 3)).toStrictEqual([1, 2, 3]); + expect(workFn.mock.calls.at(0).at(3)?.abortSignal).toBeInstanceOf( + AbortSignal, + ); + expect(asyncResult).toBe("TEST_RETURN"); + }); + it("should abort when aborted", async () => { + const abortSpy = jest.spyOn(AbortController.prototype, "abort"); + + const workFn = jest.fn().mockImplementation(async () => { + return "TEST_RETURN"; + }); + + const { result } = renderHook(() => + useAbortableAsync({ + fn: workFn, + onDone: () => void 0, + }), + ); + + const [_, { trigger, abort }] = result.current; + + await act(async () => { + trigger(1, 2, 3); + await abort(); + }); + + expect(abortSpy.mock.calls.length).toBe(1); + + abortSpy.mockRestore(); + }); + it.todo("should use new fn when fn changes"); + }); +}); diff --git a/test/index.test.ts b/test/async.test.ts similarity index 88% rename from test/index.test.ts rename to test/async.test.ts index ad37b25..eb9f478 100644 --- a/test/index.test.ts +++ b/test/async.test.ts @@ -1,5 +1,5 @@ import { act, renderHook, waitFor } from "@testing-library/react"; -import { useAsync, STATES } from "../src"; +import { useAsync, STATUSES } from "../src"; describe("useAsync", () => { describe("optional args", () => { @@ -7,7 +7,7 @@ describe("useAsync", () => { const { result } = renderHook(() => useAsync({ fn: async () => 1, - }) + }), ); const [bag, trigger] = result.current; @@ -18,7 +18,7 @@ describe("useAsync", () => { const { data, error, status, isLoading } = bag; expect(data).toBe(null); expect(error).toBe(null); - expect(status).toBe(STATES.INITIAL); + expect(status).toBe(STATUSES.INITIAL); expect(isLoading).toBe(false); }); it("should work without onDone", () => { @@ -26,7 +26,7 @@ describe("useAsync", () => { useAsync({ fn: async () => 1, onError: () => void 0, - }) + }), ); const [bag, trigger] = result.current; @@ -37,7 +37,7 @@ describe("useAsync", () => { const { data, error, status, isLoading } = bag; expect(data).toBe(null); expect(error).toBe(null); - expect(status).toBe(STATES.INITIAL); + expect(status).toBe(STATUSES.INITIAL); expect(isLoading).toBe(false); }); it("should work without onError", () => { @@ -45,7 +45,7 @@ describe("useAsync", () => { useAsync({ fn: async () => 1, onDone: () => void 0, - }) + }), ); const [bag, trigger] = result.current; @@ -56,7 +56,7 @@ describe("useAsync", () => { const { data, error, status, isLoading } = bag; expect(data).toBe(null); expect(error).toBe(null); - expect(status).toBe(STATES.INITIAL); + expect(status).toBe(STATUSES.INITIAL); expect(isLoading).toBe(false); }); }); @@ -71,7 +71,7 @@ describe("useAsync", () => { useAsync({ fn: workFn, onDone: () => void 0, - }) + }), ); expect(workFn.mock.calls.length).toBe(0); @@ -83,7 +83,7 @@ describe("useAsync", () => { useAsync({ fn: workFn, onDone: () => void 0, - }) + }), ); rerender({ @@ -100,10 +100,10 @@ describe("useAsync", () => { useAsync({ fn: workFn, onDone: () => void 0, - }) + }), ); - const [bag, trigger] = result.current; + const [_, trigger] = result.current; let asyncResult; await act(async () => { @@ -124,18 +124,19 @@ describe("useAsync", () => { const workFn = jest .fn() .mockImplementation( - () => new Promise((r) => setTimeout(() => r("TEST_RESULT"), 1000)) + () => new Promise((r) => setTimeout(() => r("TEST_RESULT"), 1000)), ); const { result } = renderHook(() => useAsync({ fn: workFn, - }) + }), ); - let [{ status, isLoading }, trigger] = result.current; + let [{ status, isLoading }] = result.current; + const [_, trigger] = result.current; - expect(status).toBe(STATES.INITIAL); + expect(status).toBe(STATUSES.INITIAL); expect(isLoading).toBe(false); await act(async () => { @@ -143,13 +144,13 @@ describe("useAsync", () => { }); [{ status, isLoading }] = result.current; - expect(status).toBe(STATES.WORKING); + expect(status).toBe(STATUSES.WORKING); expect(isLoading).toBe(true); jest.advanceTimersByTime(500); [{ status, isLoading }] = result.current; - expect(status).toBe(STATES.WORKING); + expect(status).toBe(STATUSES.WORKING); expect(isLoading).toBe(true); jest.advanceTimersByTime(1500); @@ -161,7 +162,7 @@ describe("useAsync", () => { }); [{ status, isLoading }] = result.current; - expect(status).toBe(STATES.DONE); + expect(status).toBe(STATUSES.DONE); expect(isLoading).toBe(false); jest.useRealTimers(); @@ -172,10 +173,10 @@ describe("useAsync", () => { const { result } = renderHook(() => useAsync({ fn: workFn, - }) + }), ); - let [bag, trigger] = result.current; + const [_bag, trigger] = result.current; await act(async () => { trigger(1, 2, 3); @@ -195,10 +196,10 @@ describe("useAsync", () => { const { result } = renderHook(() => useAsync({ fn: workFn, - }) + }), ); - let [bag, trigger] = result.current; + const [_bag, trigger] = result.current; await act(async () => { trigger(1, 2, 3); @@ -221,10 +222,10 @@ describe("useAsync", () => { useAsync({ fn: workFn, onDone, - }) + }), ); - let [bag, trigger] = result.current; + const [_bag, trigger] = result.current; await act(async () => { trigger(1, 2, 3); @@ -254,10 +255,10 @@ describe("useAsync", () => { useAsync({ fn: workFn, onError, - }) + }), ); - let [bag, trigger] = result.current; + const [_bag, trigger] = result.current; await act(async () => { trigger(1, 2, 3); diff --git a/tsconfig.json b/tsconfig.json index b5b381a..e5a00f6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,9 +11,13 @@ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ /* Language and Environment */ - "target": "ES5", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ - "lib": ["es2015", "es2016", "dom"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ - "jsx": "react", /* Specify what JSX code is generated. */ + "target": "ES5" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */, + "lib": [ + "es2015", + "es2016", + "dom" + ] /* Specify a set of bundled library declaration files that describe the target runtime environment. */, + "jsx": "react" /* Specify what JSX code is generated. */, // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ @@ -25,9 +29,9 @@ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ /* Modules */ - "module": "ESNext", /* Specify what module code is generated. */ + "module": "ESNext" /* Specify what module code is generated. */, // "rootDir": "./", /* Specify the root folder within your source files. */ - "moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */ + "moduleResolution": "Node" /* Specify how TypeScript looks up a file from a given module specifier. */, // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ @@ -49,13 +53,13 @@ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ /* Emit */ - "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */, // "declarationMap": true, /* Create sourcemaps for d.ts files. */ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ - "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + "sourceMap": true /* Create source map files for emitted JavaScript files. */, // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ - "outDir": "./dist", /* Specify an output folder for all emitted files. */ + "outDir": "./dist" /* Specify an output folder for all emitted files. */, // "removeComments": true, /* Disable emitting comments. */ // "noEmit": true, /* Disable emitting files from a compilation. */ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ @@ -77,14 +81,14 @@ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ - "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */, // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ - "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */, /* Type Checking */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ - // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + "strict": true /* Enable all strict type-checking options. */, + "noImplicitAny": true /* Enable error reporting for expressions and declarations with an implied 'any' type. */, + "strictNullChecks": true /* When type checking, take into account 'null' and 'undefined'. */, // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ @@ -104,7 +108,7 @@ /* Completeness */ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ - "skipLibCheck": true /* Skip type checking all .d.ts files. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ }, "include": ["src/**/*"], "exclude": ["**/*.spec.ts", "test"] diff --git a/yarn.lock b/yarn.lock index f0130d1..c7b019b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@aashutoshrathi/word-wrap@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" + integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== + "@adobe/css-tools@^4.3.1": version "4.3.1" resolved "https://registry.yarnpkg.com/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28" @@ -309,6 +314,167 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@esbuild/android-arm64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm64/-/android-arm64-0.19.7.tgz#646156aea43e8e6723de6e94a4ac07c5aed41be1" + integrity sha512-YEDcw5IT7hW3sFKZBkCAQaOCJQLONVcD4bOyTXMZz5fr66pTHnAet46XAtbXAkJRfIn2YVhdC6R9g4xa27jQ1w== + +"@esbuild/android-arm@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/android-arm/-/android-arm-0.19.7.tgz#0827b49aed813c33ea18ee257c1728cdc4a01030" + integrity sha512-YGSPnndkcLo4PmVl2tKatEn+0mlVMr3yEpOOT0BeMria87PhvoJb5dg5f5Ft9fbCVgtAz4pWMzZVgSEGpDAlww== + +"@esbuild/android-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/android-x64/-/android-x64-0.19.7.tgz#fa294ed5214d88219d519e0ab1bbb0253a89b864" + integrity sha512-jhINx8DEjz68cChFvM72YzrqfwJuFbfvSxZAk4bebpngGfNNRm+zRl4rtT9oAX6N9b6gBcFaJHFew5Blf6CvUw== + +"@esbuild/darwin-arm64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-arm64/-/darwin-arm64-0.19.7.tgz#e24d2ed545749ff251eabe8bce11fefa688892d3" + integrity sha512-dr81gbmWN//3ZnBIm6YNCl4p3pjnabg1/ZVOgz2fJoUO1a3mq9WQ/1iuEluMs7mCL+Zwv7AY5e3g1hjXqQZ9Iw== + +"@esbuild/darwin-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/darwin-x64/-/darwin-x64-0.19.7.tgz#02d1f8a572874c90d8f55dde8a859e5145bd06f6" + integrity sha512-Lc0q5HouGlzQEwLkgEKnWcSazqr9l9OdV2HhVasWJzLKeOt0PLhHaUHuzb8s/UIya38DJDoUm74GToZ6Wc7NGQ== + +"@esbuild/freebsd-arm64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.7.tgz#bc6a69b9a7915da278f0a5ebaec069c813982c22" + integrity sha512-+y2YsUr0CxDFF7GWiegWjGtTUF6gac2zFasfFkRJPkMAuMy9O7+2EH550VlqVdpEEchWMynkdhC9ZjtnMiHImQ== + +"@esbuild/freebsd-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/freebsd-x64/-/freebsd-x64-0.19.7.tgz#ec3708488625d70e565968ceea1355e7c8613865" + integrity sha512-CdXOxIbIzPJmJhrpmJTLx+o35NoiKBIgOvmvT+jeSadYiWJn0vFKsl+0bSG/5lwjNHoIDEyMYc/GAPR9jxusTA== + +"@esbuild/linux-arm64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm64/-/linux-arm64-0.19.7.tgz#8e04b66c306858f92d4f90f8222775270755e88a" + integrity sha512-inHqdOVCkUhHNvuQPT1oCB7cWz9qQ/Cz46xmVe0b7UXcuIJU3166aqSunsqkgSGMtUCWOZw3+KMwI6otINuC9g== + +"@esbuild/linux-arm@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-arm/-/linux-arm-0.19.7.tgz#12d5b65e089029ee1fe4c591b60969c9b1a85355" + integrity sha512-Y+SCmWxsJOdQtjcBxoacn/pGW9HDZpwsoof0ttL+2vGcHokFlfqV666JpfLCSP2xLxFpF1lj7T3Ox3sr95YXww== + +"@esbuild/linux-ia32@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ia32/-/linux-ia32-0.19.7.tgz#01eabc2a3ad9039e115db650268e4f48f910dbe2" + integrity sha512-2BbiL7nLS5ZO96bxTQkdO0euGZIUQEUXMTrqLxKUmk/Y5pmrWU84f+CMJpM8+EHaBPfFSPnomEaQiG/+Gmh61g== + +"@esbuild/linux-loong64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-loong64/-/linux-loong64-0.19.7.tgz#70681113632970e6a5766607bbdb98aa18cf4d5f" + integrity sha512-BVFQla72KXv3yyTFCQXF7MORvpTo4uTA8FVFgmwVrqbB/4DsBFWilUm1i2Oq6zN36DOZKSVUTb16jbjedhfSHw== + +"@esbuild/linux-mips64el@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-mips64el/-/linux-mips64el-0.19.7.tgz#f63c022a71a3d70c482d1943a27cb8997021e230" + integrity sha512-DzAYckIaK+pS31Q/rGpvUKu7M+5/t+jI+cdleDgUwbU7KdG2eC3SUbZHlo6Q4P1CfVKZ1lUERRFP8+q0ob9i2w== + +"@esbuild/linux-ppc64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-ppc64/-/linux-ppc64-0.19.7.tgz#614eafd08b0c50212f287b948b3c08d6e60f221f" + integrity sha512-JQ1p0SmUteNdUaaiRtyS59GkkfTW0Edo+e0O2sihnY4FoZLz5glpWUQEKMSzMhA430ctkylkS7+vn8ziuhUugQ== + +"@esbuild/linux-riscv64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-riscv64/-/linux-riscv64-0.19.7.tgz#31d3b63f92f65968268a8e61ba59872538e80e88" + integrity sha512-xGwVJ7eGhkprY/nB7L7MXysHduqjpzUl40+XoYDGC4UPLbnG+gsyS1wQPJ9lFPcxYAaDXbdRXd1ACs9AE9lxuw== + +"@esbuild/linux-s390x@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-s390x/-/linux-s390x-0.19.7.tgz#be94974e0caa0783ae05f9477fd7170b9ac29cb0" + integrity sha512-U8Rhki5PVU0L0nvk+E8FjkV8r4Lh4hVEb9duR6Zl21eIEYEwXz8RScj4LZWA2i3V70V4UHVgiqMpszXvG0Yqhg== + +"@esbuild/linux-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/linux-x64/-/linux-x64-0.19.7.tgz#84e8018a913dd4ecee954623e395984aef3d0007" + integrity sha512-ZYZopyLhm4mcoZXjFt25itRlocKlcazDVkB4AhioiL9hOWhDldU9n38g62fhOI4Pth6vp+Mrd5rFKxD0/S+7aQ== + +"@esbuild/netbsd-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/netbsd-x64/-/netbsd-x64-0.19.7.tgz#98898ba8800374c9df9bb182ca4f69fcecaf4411" + integrity sha512-/yfjlsYmT1O3cum3J6cmGG16Fd5tqKMcg5D+sBYLaOQExheAJhqr8xOAEIuLo8JYkevmjM5zFD9rVs3VBcsjtQ== + +"@esbuild/openbsd-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/openbsd-x64/-/openbsd-x64-0.19.7.tgz#46dc4eda2adb51f16361b1ad10e9b3f4938c4573" + integrity sha512-MYDFyV0EW1cTP46IgUJ38OnEY5TaXxjoDmwiTXPjezahQgZd+j3T55Ht8/Q9YXBM0+T9HJygrSRGV5QNF/YVDQ== + +"@esbuild/sunos-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/sunos-x64/-/sunos-x64-0.19.7.tgz#1650d40dd88412ecc11490119cd23cbaf661a591" + integrity sha512-JcPvgzf2NN/y6X3UUSqP6jSS06V0DZAV/8q0PjsZyGSXsIGcG110XsdmuWiHM+pno7/mJF6fjH5/vhUz/vA9fw== + +"@esbuild/win32-arm64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/win32-arm64/-/win32-arm64-0.19.7.tgz#e61de6c4eb204d83fd912f3ae6812cc8c7d32d25" + integrity sha512-ZA0KSYti5w5toax5FpmfcAgu3ZNJxYSRm0AW/Dao5up0YV1hDVof1NvwLomjEN+3/GMtaWDI+CIyJOMTRSTdMw== + +"@esbuild/win32-ia32@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/win32-ia32/-/win32-ia32-0.19.7.tgz#3d9c159d42c67e37a433e44ef8217c661cb6f6d0" + integrity sha512-CTOnijBKc5Jpk6/W9hQMMvJnsSYRYgveN6O75DTACCY18RA2nqka8dTZR+x/JqXCRiKk84+5+bRKXUSbbwsS0A== + +"@esbuild/win32-x64@0.19.7": + version "0.19.7" + resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.7.tgz#02c4446f802706098d8e6ee70cf2b7aba96ded0b" + integrity sha512-gRaP2sk6hc98N734luX4VpF318l3w+ofrtTu9j5L8EQXF+FzQKV6alCOHMVoJJHvVK/mGbwBXfOL1HETQu9IGQ== + +"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0": + version "4.4.0" + resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" + integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== + dependencies: + eslint-visitor-keys "^3.3.0" + +"@eslint-community/regexpp@^4.5.1", "@eslint-community/regexpp@^4.6.1": + version "4.10.0" + resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63" + integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA== + +"@eslint/eslintrc@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.3.tgz#797470a75fe0fbd5a53350ee715e85e87baff22d" + integrity sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA== + dependencies: + ajv "^6.12.4" + debug "^4.3.2" + espree "^9.6.0" + globals "^13.19.0" + ignore "^5.2.0" + import-fresh "^3.2.1" + js-yaml "^4.1.0" + minimatch "^3.1.2" + strip-json-comments "^3.1.1" + +"@eslint/js@8.54.0": + version "8.54.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.54.0.tgz#4fab9a2ff7860082c304f750e94acd644cf984cf" + integrity sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ== + +"@humanwhocodes/config-array@^0.11.13": + version "0.11.13" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297" + integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ== + dependencies: + "@humanwhocodes/object-schema" "^2.0.1" + debug "^4.1.1" + minimatch "^3.0.5" + +"@humanwhocodes/module-importer@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c" + integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA== + +"@humanwhocodes/object-schema@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044" + integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -549,6 +715,27 @@ "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -691,6 +878,11 @@ "@types/tough-cookie" "*" parse5 "^7.0.0" +"@types/json-schema@^7.0.12": + version "7.0.15" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" + integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== + "@types/node@*": version "20.9.1" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.9.1.tgz#9d578c610ce1e984adda087f685ace940954fe19" @@ -724,6 +916,11 @@ resolved "https://registry.yarnpkg.com/@types/scheduler/-/scheduler-0.16.6.tgz#eb26db6780c513de59bee0b869ef289ad3068711" integrity sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA== +"@types/semver@^7.5.0": + version "7.5.6" + resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339" + integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A== + "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" @@ -746,6 +943,96 @@ dependencies: "@types/yargs-parser" "*" +"@typescript-eslint/eslint-plugin@^6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.12.0.tgz#2a647d278bb48bf397fef07ba0507612ff9dd812" + integrity sha512-XOpZ3IyJUIV1b15M7HVOpgQxPPF7lGXgsfcEIu3yDxFPaf/xZKt7s9QO/pbk7vpWQyVulpJbu4E5LwpZiQo4kA== + dependencies: + "@eslint-community/regexpp" "^4.5.1" + "@typescript-eslint/scope-manager" "6.12.0" + "@typescript-eslint/type-utils" "6.12.0" + "@typescript-eslint/utils" "6.12.0" + "@typescript-eslint/visitor-keys" "6.12.0" + debug "^4.3.4" + graphemer "^1.4.0" + ignore "^5.2.4" + natural-compare "^1.4.0" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/parser@^6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-6.12.0.tgz#9fb21ed7d88065a4a2ee21eb80b8578debb8217c" + integrity sha512-s8/jNFPKPNRmXEnNXfuo1gemBdVmpQsK1pcu+QIvuNJuhFzGrpD7WjOcvDc/+uEdfzSYpNu7U/+MmbScjoQ6vg== + dependencies: + "@typescript-eslint/scope-manager" "6.12.0" + "@typescript-eslint/types" "6.12.0" + "@typescript-eslint/typescript-estree" "6.12.0" + "@typescript-eslint/visitor-keys" "6.12.0" + debug "^4.3.4" + +"@typescript-eslint/scope-manager@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.12.0.tgz#5833a16dbe19cfbad639d4d33bcca5e755c7044b" + integrity sha512-5gUvjg+XdSj8pcetdL9eXJzQNTl3RD7LgUiYTl8Aabdi8hFkaGSYnaS6BLc0BGNaDH+tVzVwmKtWvu0jLgWVbw== + dependencies: + "@typescript-eslint/types" "6.12.0" + "@typescript-eslint/visitor-keys" "6.12.0" + +"@typescript-eslint/type-utils@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-6.12.0.tgz#968f7c95162808d69950ab5dff710ad730e58287" + integrity sha512-WWmRXxhm1X8Wlquj+MhsAG4dU/Blvf1xDgGaYCzfvStP2NwPQh6KBvCDbiOEvaE0filhranjIlK/2fSTVwtBng== + dependencies: + "@typescript-eslint/typescript-estree" "6.12.0" + "@typescript-eslint/utils" "6.12.0" + debug "^4.3.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/types@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.12.0.tgz#ffc5297bcfe77003c8b7b545b51c2505748314ac" + integrity sha512-MA16p/+WxM5JG/F3RTpRIcuOghWO30//VEOvzubM8zuOOBYXsP+IfjoCXXiIfy2Ta8FRh9+IO9QLlaFQUU+10Q== + +"@typescript-eslint/typescript-estree@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.12.0.tgz#764ccc32598549e5b48ec99e3b85f89b1385310c" + integrity sha512-vw9E2P9+3UUWzhgjyyVczLWxZ3GuQNT7QpnIY3o5OMeLO/c8oHljGc8ZpryBMIyympiAAaKgw9e5Hl9dCWFOYw== + dependencies: + "@typescript-eslint/types" "6.12.0" + "@typescript-eslint/visitor-keys" "6.12.0" + debug "^4.3.4" + globby "^11.1.0" + is-glob "^4.0.3" + semver "^7.5.4" + ts-api-utils "^1.0.1" + +"@typescript-eslint/utils@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.12.0.tgz#c6ce8c06fe9b0212620e5674a2036f6f8f611754" + integrity sha512-LywPm8h3tGEbgfyjYnu3dauZ0U7R60m+miXgKcZS8c7QALO9uWJdvNoP+duKTk2XMWc7/Q3d/QiCuLN9X6SWyQ== + dependencies: + "@eslint-community/eslint-utils" "^4.4.0" + "@types/json-schema" "^7.0.12" + "@types/semver" "^7.5.0" + "@typescript-eslint/scope-manager" "6.12.0" + "@typescript-eslint/types" "6.12.0" + "@typescript-eslint/typescript-estree" "6.12.0" + semver "^7.5.4" + +"@typescript-eslint/visitor-keys@6.12.0": + version "6.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.12.0.tgz#5877950de42a0f3344261b7a1eee15417306d7e9" + integrity sha512-rg3BizTZHF1k3ipn8gfrzDXXSFKyOEB5zxYXInQ6z0hUvmQlhaZQzK+YmHmNViMA9HzW5Q9+bPPt90bU6GQwyw== + dependencies: + "@typescript-eslint/types" "6.12.0" + eslint-visitor-keys "^3.4.1" + +"@ungap/structured-clone@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" + integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== + abab@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" @@ -759,12 +1046,17 @@ acorn-globals@^7.0.0: acorn "^8.1.0" acorn-walk "^8.0.2" +acorn-jsx@^5.3.2: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn-walk@^8.0.2: version "8.3.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.0.tgz#2097665af50fd0cf7a2dfccd2b9368964e66540f" integrity sha512-FS7hV565M5l1R08MXqo8odwMTB02C2UqzB17RVgu9EyuYFBqJZ3/ZY97sQD5FewVu1UyDFc1yztUDrAwT0EypA== -acorn@^8.1.0, acorn@^8.8.1: +acorn@^8.1.0, acorn@^8.8.1, acorn@^8.9.0: version "8.11.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== @@ -776,6 +1068,16 @@ agent-base@6: dependencies: debug "4" +ajv@^6.12.4: + version "6.12.6" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" + integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-escapes@^4.2.1: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" @@ -822,6 +1124,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +argparse@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" + integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== + aria-query@5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.1.3.tgz#19db27cd101152773631396f7a95a3b58c22c35e" @@ -844,6 +1151,11 @@ array-buffer-byte-length@^1.0.0: call-bind "^1.0.2" is-array-buffer "^3.0.1" +array-union@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" + integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -1105,7 +1417,7 @@ create-jest@^29.7.0: jest-util "^29.7.0" prompts "^2.0.1" -cross-spawn@^7.0.3: +cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1150,7 +1462,7 @@ data-urls@^3.0.2: whatwg-mimetype "^3.0.0" whatwg-url "^11.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1191,6 +1503,11 @@ deep-equal@^2.0.5: which-collection "^1.0.1" which-typed-array "^1.1.13" +deep-is@^0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831" + integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ== + deepmerge@^4.2.2: version "4.3.1" resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-4.3.1.tgz#44b5f2147cd3b00d4b56137685966f26fd25dd4a" @@ -1234,6 +1551,20 @@ diff-sequences@^29.6.3: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q== +dir-glob@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f" + integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA== + dependencies: + path-type "^4.0.0" + +doctrine@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961" + integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w== + dependencies: + esutils "^2.0.2" + dom-accessibility-api@^0.5.6, dom-accessibility-api@^0.5.9: version "0.5.16" resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453" @@ -1288,6 +1619,34 @@ es-get-iterator@^1.1.3: isarray "^2.0.5" stop-iteration-iterator "^1.0.0" +esbuild@^0.19.7: + version "0.19.7" + resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.19.7.tgz#b9a7235097b81278dcf090e2532ed13c95a2ee84" + integrity sha512-6brbTZVqxhqgbpqBR5MzErImcpA0SQdoKOkcWK/U30HtQxnokIpG3TX2r0IJqbFUzqLjhU/zC1S5ndgakObVCQ== + optionalDependencies: + "@esbuild/android-arm" "0.19.7" + "@esbuild/android-arm64" "0.19.7" + "@esbuild/android-x64" "0.19.7" + "@esbuild/darwin-arm64" "0.19.7" + "@esbuild/darwin-x64" "0.19.7" + "@esbuild/freebsd-arm64" "0.19.7" + "@esbuild/freebsd-x64" "0.19.7" + "@esbuild/linux-arm" "0.19.7" + "@esbuild/linux-arm64" "0.19.7" + "@esbuild/linux-ia32" "0.19.7" + "@esbuild/linux-loong64" "0.19.7" + "@esbuild/linux-mips64el" "0.19.7" + "@esbuild/linux-ppc64" "0.19.7" + "@esbuild/linux-riscv64" "0.19.7" + "@esbuild/linux-s390x" "0.19.7" + "@esbuild/linux-x64" "0.19.7" + "@esbuild/netbsd-x64" "0.19.7" + "@esbuild/openbsd-x64" "0.19.7" + "@esbuild/sunos-x64" "0.19.7" + "@esbuild/win32-arm64" "0.19.7" + "@esbuild/win32-ia32" "0.19.7" + "@esbuild/win32-x64" "0.19.7" + escalade@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" @@ -1303,6 +1662,11 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escodegen@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" @@ -1314,12 +1678,102 @@ escodegen@^2.0.0: optionalDependencies: source-map "~0.6.1" +eslint-config-prettier@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.0.0.tgz#eb25485946dd0c66cd216a46232dc05451518d1f" + integrity sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw== + +eslint-plugin-react-hooks@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz#4c3e697ad95b77e93f8646aaa1630c1ba607edd3" + integrity sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g== + +eslint-scope@^7.2.2: + version "7.2.2" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f" + integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg== + dependencies: + esrecurse "^4.3.0" + estraverse "^5.2.0" + +eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3: + version "3.4.3" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" + integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== + +eslint@^8.54.0: + version "8.54.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.54.0.tgz#588e0dd4388af91a2e8fa37ea64924074c783537" + integrity sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA== + dependencies: + "@eslint-community/eslint-utils" "^4.2.0" + "@eslint-community/regexpp" "^4.6.1" + "@eslint/eslintrc" "^2.1.3" + "@eslint/js" "8.54.0" + "@humanwhocodes/config-array" "^0.11.13" + "@humanwhocodes/module-importer" "^1.0.1" + "@nodelib/fs.walk" "^1.2.8" + "@ungap/structured-clone" "^1.2.0" + ajv "^6.12.4" + chalk "^4.0.0" + cross-spawn "^7.0.2" + debug "^4.3.2" + doctrine "^3.0.0" + escape-string-regexp "^4.0.0" + eslint-scope "^7.2.2" + eslint-visitor-keys "^3.4.3" + espree "^9.6.1" + esquery "^1.4.2" + esutils "^2.0.2" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" + find-up "^5.0.0" + glob-parent "^6.0.2" + globals "^13.19.0" + graphemer "^1.4.0" + ignore "^5.2.0" + imurmurhash "^0.1.4" + is-glob "^4.0.0" + is-path-inside "^3.0.3" + js-yaml "^4.1.0" + json-stable-stringify-without-jsonify "^1.0.1" + levn "^0.4.1" + lodash.merge "^4.6.2" + minimatch "^3.1.2" + natural-compare "^1.4.0" + optionator "^0.9.3" + strip-ansi "^6.0.1" + text-table "^0.2.0" + +espree@^9.6.0, espree@^9.6.1: + version "9.6.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f" + integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ== + dependencies: + acorn "^8.9.0" + acorn-jsx "^5.3.2" + eslint-visitor-keys "^3.4.1" + esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -estraverse@^5.2.0: +esquery@^1.4.2: + version "1.5.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b" + integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg== + dependencies: + estraverse "^5.1.0" + +esrecurse@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921" + integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag== + dependencies: + estraverse "^5.2.0" + +estraverse@^5.1.0, estraverse@^5.2.0: version "5.3.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== @@ -1360,11 +1814,39 @@ expect@^29.0.0, expect@^29.7.0: jest-message-util "^29.7.0" jest-util "^29.7.0" -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.1.0: +fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + +fast-glob@^3.2.9: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== +fast-levenshtein@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" + integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw== + +fastq@^1.6.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a" + integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw== + dependencies: + reusify "^1.0.4" + fb-watchman@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.2.tgz#e9524ee6b5c77e9e5001af0f85f3adbb8623255c" @@ -1372,6 +1854,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== + dependencies: + flat-cache "^3.0.4" + fill-range@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" @@ -1387,6 +1876,28 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" +find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + +flat-cache@^3.0.4: + version "3.2.0" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee" + integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw== + dependencies: + flatted "^3.2.9" + keyv "^4.5.3" + rimraf "^3.0.2" + +flatted@^3.2.9: + version "3.2.9" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf" + integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ== + for-each@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" @@ -1453,6 +1964,20 @@ get-stream@^6.0.0: resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7" integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg== +glob-parent@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + glob@^7.1.3, glob@^7.1.4: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -1470,6 +1995,25 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^13.19.0: + version "13.23.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.23.0.tgz#ef31673c926a0976e1f61dab4dca57e0c0a8af02" + integrity sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA== + dependencies: + type-fest "^0.20.2" + +globby@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" + integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.2.9" + ignore "^5.2.0" + merge2 "^1.4.1" + slash "^3.0.0" + gopd@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" @@ -1482,6 +2026,11 @@ graceful-fs@^4.2.9: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3" integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ== +graphemer@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6" + integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag== + has-bigints@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" @@ -1569,6 +2118,19 @@ iconv-lite@0.6.3: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +ignore@^5.2.0, ignore@^5.2.4: + version "5.3.0" + resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78" + integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg== + +import-fresh@^3.2.1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b" + integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw== + dependencies: + parent-module "^1.0.0" + resolve-from "^4.0.0" + import-local@^3.0.2: version "3.1.0" resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.1.0.tgz#b4479df8a5fd44f6cdce24070675676063c95cb4" @@ -1665,6 +2227,11 @@ is-date-object@^1.0.5: dependencies: has-tostringtag "^1.0.0" +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + is-fullwidth-code-point@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" @@ -1675,6 +2242,13 @@ is-generator-fn@^2.0.0: resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-map@^2.0.1, is-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" @@ -1692,6 +2266,11 @@ is-number@^7.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== +is-path-inside@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283" + integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ== + is-potential-custom-element-name@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" @@ -2204,6 +2783,13 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" +js-yaml@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" + integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== + dependencies: + argparse "^2.0.1" + jsdom@^20.0.0: version "20.0.3" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" @@ -2241,16 +2827,38 @@ jsesc@^2.5.1: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA== +json-buffer@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13" + integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ== + json-parse-even-better-errors@^2.3.0: version "2.3.1" resolved "https://registry.yarnpkg.com/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz#7c47805a94319928e05777405dc12e1f7a4ee02d" integrity sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w== +json-schema-traverse@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" + integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== + +json-stable-stringify-without-jsonify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" + integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== + json5@^2.2.3: version "2.2.3" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== +keyv@^4.5.3: + version "4.5.4" + resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93" + integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw== + dependencies: + json-buffer "3.0.1" + kleur@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/kleur/-/kleur-3.0.3.tgz#a79c9ecc86ee1ce3fa6206d1216c501f147fc07e" @@ -2261,6 +2869,14 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +levn@^0.4.1: + version "0.4.1" + resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade" + integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ== + dependencies: + prelude-ls "^1.2.1" + type-check "~0.4.0" + lines-and-columns@^1.1.6: version "1.2.4" resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" @@ -2273,11 +2889,23 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" +locate-path@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286" + integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw== + dependencies: + p-locate "^5.0.0" + lodash.memoize@4.x: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + lodash@^4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" @@ -2333,6 +2961,11 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== +merge2@^1.3.0, merge2@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + micromatch@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6" @@ -2363,7 +2996,7 @@ min-indent@^1.0.0: resolved "https://registry.yarnpkg.com/min-indent/-/min-indent-1.0.1.tgz#a63f681673b30571fbe8bc25686ae746eefa9869" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -minimatch@^3.0.4, minimatch@^3.1.1: +minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -2449,6 +3082,18 @@ onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" +optionator@^0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64" + integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg== + dependencies: + "@aashutoshrathi/word-wrap" "^1.2.3" + deep-is "^0.1.3" + fast-levenshtein "^2.0.6" + levn "^0.4.1" + prelude-ls "^1.2.1" + type-check "^0.4.0" + p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -2456,7 +3101,7 @@ p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.1.0: +p-limit@^3.0.2, p-limit@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== @@ -2470,11 +3115,25 @@ p-locate@^4.1.0: dependencies: p-limit "^2.2.0" +p-locate@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834" + integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw== + dependencies: + p-limit "^3.0.2" + p-try@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +parent-module@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" + integrity sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g== + dependencies: + callsites "^3.0.0" + parse-json@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -2512,6 +3171,11 @@ path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== +path-type@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" + integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -2534,6 +3198,16 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" +prelude-ls@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" + integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g== + +prettier@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.1.0.tgz#c6d16474a5f764ea1a4a373c593b779697744d5e" + integrity sha512-TQLvXjq5IAibjh8EpBIkNKxO749UEWABoiIZehEPiY4GNpVdhaFKqSTu+QrlU6D2dPAfubRmtJTi4K4YkQ5eXw== + pretty-format@^27.0.2: version "27.5.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.5.1.tgz#2181879fdea51a7a5851fb39d920faa63f01d88e" @@ -2565,7 +3239,7 @@ psl@^1.1.33: resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== -punycode@^2.1.1: +punycode@^2.1.0, punycode@^2.1.1: version "2.3.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5" integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg== @@ -2580,6 +3254,11 @@ querystringify@^2.1.1: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + react-dom@^18.2.0: version "18.2.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.2.0.tgz#22aaf38708db2674ed9ada224ca4aa708d821e3d" @@ -2644,6 +3323,11 @@ resolve-cwd@^3.0.0: dependencies: resolve-from "^5.0.0" +resolve-from@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" + integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== + resolve-from@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" @@ -2663,6 +3347,25 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + "safer-buffer@>= 2.1.2 < 3.0.0": version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -2867,6 +3570,11 @@ test-exclude@^6.0.0: glob "^7.1.4" minimatch "^3.0.4" +text-table@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" + integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw== + tmpl@1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" @@ -2901,6 +3609,11 @@ tr46@^3.0.0: dependencies: punycode "^2.1.1" +ts-api-utils@^1.0.1: + version "1.0.3" + resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331" + integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg== + ts-jest@^29.1.1: version "29.1.1" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" @@ -2915,11 +3628,23 @@ ts-jest@^29.1.1: semver "^7.5.3" yargs-parser "^21.0.1" +type-check@^0.4.0, type-check@~0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" + integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew== + dependencies: + prelude-ls "^1.2.1" + type-detect@4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -2948,6 +3673,13 @@ update-browserslist-db@^1.0.13: escalade "^3.1.1" picocolors "^1.0.0" +uri-js@^4.2.2: + version "4.4.1" + resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e" + integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg== + dependencies: + punycode "^2.1.0" + url-parse@^1.5.3: version "1.5.10" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"