unctx
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -21,3 +21,3 @@ interface UseContext<T> { | ||
*/ | ||
call: <R>(instance: T, cb: () => R) => R; | ||
call: <R>(instance: T, callback: () => R) => R; | ||
/** | ||
@@ -27,3 +27,3 @@ * Exclude an asynchronous function with the provided context. | ||
*/ | ||
callAsync: <R>(instance: T, cb: () => R | Promise<R>) => Promise<R>; | ||
callAsync: <R>(instance: T, callback: () => R | Promise<R>) => Promise<R>; | ||
} | ||
@@ -34,4 +34,4 @@ declare function createContext<T = any>(): UseContext<T>; | ||
} | ||
declare function createNamespace(): { | ||
get(key: any): UseContext<any>; | ||
declare function createNamespace<T = any>(): { | ||
get(key: any): UseContext<T>; | ||
}; | ||
@@ -41,6 +41,6 @@ declare const defaultNamespace: ContextNamespace; | ||
declare const useContext: <T>(key: string) => () => T; | ||
declare type AsyncFn<T> = () => Promise<T>; | ||
declare function executeAsync<T>(fn: AsyncFn<T>): [Promise<T>, () => void]; | ||
declare function withAsyncContext<T = any>(fn: AsyncFn<T>, transformed?: boolean): AsyncFn<T>; | ||
declare type AsyncFunction<T> = () => Promise<T>; | ||
declare function executeAsync<T>(function_: AsyncFunction<T>): [Promise<T>, () => void]; | ||
declare function withAsyncContext<T = any>(function_: AsyncFunction<T>, transformed?: boolean): AsyncFunction<T>; | ||
export { ContextNamespace, UseContext, createContext, createNamespace, defaultNamespace, executeAsync, getContext, useContext, withAsyncContext }; |
@@ -8,4 +8,4 @@ import * as unplugin from 'unplugin'; | ||
} | ||
declare const unctxPlugin: unplugin.UnpluginInstance<UnctxPluginOptions>; | ||
declare const unctxPlugin: unplugin.UnpluginInstance<UnctxPluginOptions, false>; | ||
export { UnctxPluginOptions, unctxPlugin }; |
@@ -20,3 +20,3 @@ import MagicString from 'magic-string'; | ||
declare function createTransformer(options?: TransformerOptions): { | ||
transform: (code: string, opts?: { | ||
transform: (code: string, options_?: { | ||
force?: false; | ||
@@ -23,0 +23,0 @@ }) => { |
{ | ||
"name": "unctx", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "Composition-api in Vanilla js", | ||
@@ -38,22 +38,21 @@ "repository": "unjs/unctx", | ||
"dependencies": { | ||
"acorn": "^8.8.0", | ||
"acorn": "^8.8.1", | ||
"estree-walker": "^3.0.1", | ||
"magic-string": "^0.26.2", | ||
"unplugin": "^0.9.5" | ||
"magic-string": "^0.26.7", | ||
"unplugin": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@nuxtjs/eslint-config-typescript": "latest", | ||
"@types/estree": "latest", | ||
"@types/jest": "latest", | ||
"@types/node": "latest", | ||
"@vitest/coverage-c8": "^0.22.1", | ||
"c8": "latest", | ||
"eslint": "latest", | ||
"jiti": "^1.14.0", | ||
"standard-version": "latest", | ||
"typescript": "latest", | ||
"unbuild": "latest", | ||
"vitest": "latest" | ||
"@types/estree": "^1.0.0", | ||
"@types/jest": "^29.2.2", | ||
"@types/node": "^18.11.9", | ||
"@vitest/coverage-c8": "^0.25.2", | ||
"eslint": "^8.27.0", | ||
"eslint-config-unjs": "^0.0.2", | ||
"jiti": "^1.16.0", | ||
"standard-version": "^9.5.0", | ||
"typescript": "^4.8.4", | ||
"unbuild": "^0.9.4", | ||
"vitest": "^0.25.2" | ||
}, | ||
"packageManager": "pnpm@7.9.5", | ||
"packageManager": "pnpm@7.16.0", | ||
"scripts": { | ||
@@ -60,0 +59,0 @@ "build": "unbuild", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11
25795
574
+ Addedunplugin@1.10.1(transitive)
+ Addedwebpack-virtual-modules@0.6.2(transitive)
- Removedunplugin@0.9.6(transitive)
- Removedwebpack-virtual-modules@0.4.6(transitive)
Updatedacorn@^8.8.1
Updatedmagic-string@^0.26.7
Updatedunplugin@^1.0.0