hookable 6.0.1 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/package.json +23 -22
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ declare class Hookable<HooksT extends Record<string, any> = Record<string, HookC
|
|
|
39
39
|
}): () => void;
|
|
40
40
|
hookOnce<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): () => void;
|
|
41
41
|
removeHook<NameT extends HookNameT>(name: NameT, function_: InferCallback<HooksT, NameT>): void;
|
|
42
|
+
clearHook<NameT extends HookNameT>(name: NameT): void;
|
|
42
43
|
deprecateHook<NameT extends HookNameT>(name: NameT, deprecated: HookKeys<HooksT> | DeprecatedHook<HooksT>): void;
|
|
43
44
|
deprecateHooks(deprecatedHooks: Partial<Record<HookNameT, DeprecatedHook<HooksT>>>): void;
|
|
44
45
|
addHooks(configHooks: NestedHooks<HooksT>): () => void;
|
|
@@ -99,8 +100,7 @@ interface CreateDebuggerOptions {
|
|
|
99
100
|
}
|
|
100
101
|
/** Start debugging hook names and timing in console */
|
|
101
102
|
declare function createDebugger(hooks: Hookable<any>, _options?: CreateDebuggerOptions): {
|
|
102
|
-
/** Stop debugging and remove listeners */
|
|
103
|
-
close: () => void;
|
|
103
|
+
/** Stop debugging and remove listeners */close: () => void;
|
|
104
104
|
};
|
|
105
105
|
//#endregion
|
|
106
106
|
export { CreateDebuggerOptions, DeprecatedHook, DeprecatedHooks, HookCallback, HookKeys, Hookable, HookableCore, Hooks, NestedHooks, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
package/dist/index.mjs
CHANGED
|
@@ -57,7 +57,6 @@ function parallelCaller(hooks, args) {
|
|
|
57
57
|
function callEachWith(callbacks, arg0) {
|
|
58
58
|
for (const callback of [...callbacks]) callback(arg0);
|
|
59
59
|
}
|
|
60
|
-
|
|
61
60
|
//#endregion
|
|
62
61
|
//#region src/hookable.ts
|
|
63
62
|
var Hookable = class {
|
|
@@ -127,6 +126,9 @@ var Hookable = class {
|
|
|
127
126
|
if (hooks.length === 0) this._hooks[name] = void 0;
|
|
128
127
|
}
|
|
129
128
|
}
|
|
129
|
+
clearHook(name) {
|
|
130
|
+
this._hooks[name] = void 0;
|
|
131
|
+
}
|
|
130
132
|
deprecateHook(name, deprecated) {
|
|
131
133
|
this._deprecatedHooks[name] = typeof deprecated === "string" ? { to: deprecated } : deprecated;
|
|
132
134
|
const _hooks = this._hooks[name] || [];
|
|
@@ -225,7 +227,6 @@ var HookableCore = class {
|
|
|
225
227
|
return callHooks(hooks, args, 0);
|
|
226
228
|
}
|
|
227
229
|
};
|
|
228
|
-
|
|
229
230
|
//#endregion
|
|
230
231
|
//#region src/debugger.ts
|
|
231
232
|
const isBrowser = typeof window !== "undefined";
|
|
@@ -261,6 +262,5 @@ function createDebugger(hooks, _options = {}) {
|
|
|
261
262
|
unsubscribeAfter();
|
|
262
263
|
} };
|
|
263
264
|
}
|
|
264
|
-
|
|
265
265
|
//#endregion
|
|
266
|
-
export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
|
266
|
+
export { Hookable, HookableCore, createDebugger, createHooks, flatHooks, mergeHooks, parallelCaller, serial, serialCaller };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hookable",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "Awaitable hook system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hook",
|
|
@@ -9,44 +9,45 @@
|
|
|
9
9
|
"tapable",
|
|
10
10
|
"tappable"
|
|
11
11
|
],
|
|
12
|
-
"repository": "unjs/hookable",
|
|
13
12
|
"license": "MIT",
|
|
14
|
-
"
|
|
13
|
+
"repository": "unjs/hookable",
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
15
17
|
"type": "module",
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"main": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
16
21
|
"exports": {
|
|
17
22
|
".": "./dist/index.mjs"
|
|
18
23
|
},
|
|
19
|
-
"main": "./dist/index.mjs",
|
|
20
|
-
"types": "./dist/index.d.mts",
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
24
|
"scripts": {
|
|
25
25
|
"bench": "node --expose-gc --allow-natives-syntax test/bench.ts",
|
|
26
26
|
"build": "obuild src/index.ts",
|
|
27
27
|
"dev": "vitest",
|
|
28
|
-
"lint": "
|
|
29
|
-
"lint:fix": "
|
|
28
|
+
"lint": "oxlint . && oxfmt --check src test",
|
|
29
|
+
"lint:fix": "oxlint . --fix && oxfmt src test",
|
|
30
30
|
"prepublish": "pnpm build",
|
|
31
31
|
"release": "pnpm test && pnpm build && changelogen --release --publish --push",
|
|
32
32
|
"test": "pnpm lint && vitest run --coverage",
|
|
33
|
-
"test:types": "
|
|
33
|
+
"test:types": "tsgo --noEmit"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@types/node": "^25.0
|
|
37
|
-
"@
|
|
36
|
+
"@types/node": "^25.5.0",
|
|
37
|
+
"@typescript/native-preview": "7.0.0-dev.20260314.1",
|
|
38
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
38
39
|
"changelogen": "^0.6.2",
|
|
39
|
-
"esbuild": "^0.27.
|
|
40
|
-
"eslint": "^
|
|
41
|
-
"eslint-config-unjs": "^0.5.0",
|
|
40
|
+
"esbuild": "^0.27.4",
|
|
41
|
+
"eslint-config-unjs": "^0.6.2",
|
|
42
42
|
"expect-type": "^1.3.0",
|
|
43
|
-
"hookable-prev": "npm:hookable@^
|
|
43
|
+
"hookable-prev": "npm:hookable@^6.0.1",
|
|
44
44
|
"mitata": "^1.0.34",
|
|
45
|
-
"obuild": "^0.4.
|
|
46
|
-
"
|
|
45
|
+
"obuild": "^0.4.32",
|
|
46
|
+
"oxfmt": "^0.40.0",
|
|
47
|
+
"oxlint": "^1.55.0",
|
|
47
48
|
"typescript": "^5.9.3",
|
|
48
|
-
"vite": "^
|
|
49
|
-
"vitest": "^4.0
|
|
49
|
+
"vite": "^8.0.0",
|
|
50
|
+
"vitest": "^4.1.0"
|
|
50
51
|
},
|
|
51
|
-
"packageManager": "pnpm@10.
|
|
52
|
+
"packageManager": "pnpm@10.32.1"
|
|
52
53
|
}
|