@wordpress/hooks 4.8.1 → 4.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +2 -0
- package/build/createCurrentHook.js +3 -2
- package/build/createCurrentHook.js.map +1 -1
- package/build/createDoingHook.js +3 -3
- package/build/createDoingHook.js.map +1 -1
- package/build/createHooks.js +6 -4
- package/build/createHooks.js.map +1 -1
- package/build/createRunHook.js +37 -16
- package/build/createRunHook.js.map +1 -1
- package/build/index.js +7 -3
- package/build/index.js.map +1 -1
- package/build-module/createCurrentHook.js +3 -2
- package/build-module/createCurrentHook.js.map +1 -1
- package/build-module/createDoingHook.js +3 -3
- package/build-module/createDoingHook.js.map +1 -1
- package/build-module/createHooks.js +6 -4
- package/build-module/createHooks.js.map +1 -1
- package/build-module/createRunHook.js +37 -16
- package/build-module/createRunHook.js.map +1 -1
- package/build-module/index.js +4 -2
- package/build-module/index.js.map +1 -1
- package/build-types/createCurrentHook.d.ts.map +1 -1
- package/build-types/createHooks.d.ts +2 -0
- package/build-types/createHooks.d.ts.map +1 -1
- package/build-types/createRunHook.d.ts +4 -4
- package/build-types/createRunHook.d.ts.map +1 -1
- package/build-types/index.d.ts +4 -2
- package/build-types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/createCurrentHook.js +2 -5
- package/src/createDoingHook.js +5 -5
- package/src/createHooks.js +6 -4
- package/src/createRunHook.js +37 -20
- package/src/index.js +5 -1
- package/src/test/index.test.js +150 -0
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -41,7 +41,9 @@ One notable difference between the JS and PHP hooks API is that in the JS versio
|
|
|
41
41
|
- `removeAllActions( 'hookName' )`
|
|
42
42
|
- `removeAllFilters( 'hookName' )`
|
|
43
43
|
- `doAction( 'hookName', arg1, arg2, moreArgs, finalArg )`
|
|
44
|
+
- `doActionAsync( 'hookName', arg1, arg2, moreArgs, finalArg )`
|
|
44
45
|
- `applyFilters( 'hookName', content, arg1, arg2, moreArgs, finalArg )`
|
|
46
|
+
- `applyFiltersAsync( 'hookName', content, arg1, arg2, moreArgs, finalArg )`
|
|
45
47
|
- `doingAction( 'hookName' )`
|
|
46
48
|
- `doingFilter( 'hookName' )`
|
|
47
49
|
- `didAction( 'hookName' )`
|
|
@@ -16,9 +16,10 @@ exports.default = void 0;
|
|
|
16
16
|
*/
|
|
17
17
|
function createCurrentHook(hooks, storeKey) {
|
|
18
18
|
return function currentHook() {
|
|
19
|
-
var
|
|
19
|
+
var _currentArray$at$name;
|
|
20
20
|
const hooksStore = hooks[storeKey];
|
|
21
|
-
|
|
21
|
+
const currentArray = Array.from(hooksStore.__current);
|
|
22
|
+
return (_currentArray$at$name = currentArray.at(-1)?.name) !== null && _currentArray$at$name !== void 0 ? _currentArray$at$name : null;
|
|
22
23
|
};
|
|
23
24
|
}
|
|
24
25
|
var _default = exports.default = createCurrentHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createCurrentHook","hooks","storeKey","currentHook","
|
|
1
|
+
{"version":3,"names":["createCurrentHook","hooks","storeKey","currentHook","_currentArray$at$name","hooksStore","currentArray","Array","from","__current","at","name","_default","exports","default"],"sources":["@wordpress/hooks/src/createCurrentHook.js"],"sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\t\tconst currentArray = Array.from( hooksStore.__current );\n\t\treturn currentArray.at( -1 )?.name ?? null;\n\t};\n}\n\nexport default createCurrentHook;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiBA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EAC7C,OAAO,SAASC,WAAWA,CAAA,EAAG;IAAA,IAAAC,qBAAA;IAC7B,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;IACpC,MAAMI,YAAY,GAAGC,KAAK,CAACC,IAAI,CAAEH,UAAU,CAACI,SAAU,CAAC;IACvD,QAAAL,qBAAA,GAAOE,YAAY,CAACI,EAAE,CAAE,CAAC,CAAE,CAAC,EAAEC,IAAI,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,IAAI;EAC3C,CAAC;AACF;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcd,iBAAiB","ignoreList":[]}
|
package/build/createDoingHook.js
CHANGED
|
@@ -30,11 +30,11 @@ function createDoingHook(hooks, storeKey) {
|
|
|
30
30
|
|
|
31
31
|
// If the hookName was not passed, check for any current hook.
|
|
32
32
|
if ('undefined' === typeof hookName) {
|
|
33
|
-
return
|
|
33
|
+
return hooksStore.__current.size > 0;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
//
|
|
37
|
-
return hooksStore.__current
|
|
36
|
+
// Find if the `hookName` hook is in `__current`.
|
|
37
|
+
return Array.from(hooksStore.__current).some(hook => hook.name === hookName);
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
40
|
var _default = exports.default = createDoingHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createDoingHook","hooks","storeKey","doingHook","hookName","hooksStore","__current","name","_default","exports","default"],"sources":["@wordpress/hooks/src/createDoingHook.js"],"sourcesContent":["/**\n * @callback DoingHook\n * Returns whether a hook is currently being executed.\n *\n * @param {string} [hookName] The name of the hook to check for. If\n * omitted, will check for any hook being executed.\n *\n * @return {boolean} Whether the hook is being executed.\n */\n\n/**\n * Returns a function which, when invoked, will return whether a hook is\n * currently being executed.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {DoingHook} Function that returns whether a hook is currently\n * being executed.\n */\nfunction createDoingHook( hooks, storeKey ) {\n\treturn function doingHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// If the hookName was not passed, check for any current hook.\n\t\tif ( 'undefined' === typeof hookName ) {\n\t\t\treturn
|
|
1
|
+
{"version":3,"names":["createDoingHook","hooks","storeKey","doingHook","hookName","hooksStore","__current","size","Array","from","some","hook","name","_default","exports","default"],"sources":["@wordpress/hooks/src/createDoingHook.js"],"sourcesContent":["/**\n * @callback DoingHook\n * Returns whether a hook is currently being executed.\n *\n * @param {string} [hookName] The name of the hook to check for. If\n * omitted, will check for any hook being executed.\n *\n * @return {boolean} Whether the hook is being executed.\n */\n\n/**\n * Returns a function which, when invoked, will return whether a hook is\n * currently being executed.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {DoingHook} Function that returns whether a hook is currently\n * being executed.\n */\nfunction createDoingHook( hooks, storeKey ) {\n\treturn function doingHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// If the hookName was not passed, check for any current hook.\n\t\tif ( 'undefined' === typeof hookName ) {\n\t\t\treturn hooksStore.__current.size > 0;\n\t\t}\n\n\t\t// Find if the `hookName` hook is in `__current`.\n\t\treturn Array.from( hooksStore.__current ).some(\n\t\t\t( hook ) => hook.name === hookName\n\t\t);\n\t};\n}\n\nexport default createDoingHook;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAeA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EAC3C,OAAO,SAASC,SAASA,CAAEC,QAAQ,EAAG;IACrC,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;;IAEpC;IACA,IAAK,WAAW,KAAK,OAAOE,QAAQ,EAAG;MACtC,OAAOC,UAAU,CAACC,SAAS,CAACC,IAAI,GAAG,CAAC;IACrC;;IAEA;IACA,OAAOC,KAAK,CAACC,IAAI,CAAEJ,UAAU,CAACC,SAAU,CAAC,CAACI,IAAI,CAC3CC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKR,QAC3B,CAAC;EACF,CAAC;AACF;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcf,eAAe","ignoreList":[]}
|
package/build/createHooks.js
CHANGED
|
@@ -27,11 +27,11 @@ class _Hooks {
|
|
|
27
27
|
constructor() {
|
|
28
28
|
/** @type {import('.').Store} actions */
|
|
29
29
|
this.actions = Object.create(null);
|
|
30
|
-
this.actions.__current =
|
|
30
|
+
this.actions.__current = new Set();
|
|
31
31
|
|
|
32
32
|
/** @type {import('.').Store} filters */
|
|
33
33
|
this.filters = Object.create(null);
|
|
34
|
-
this.filters.__current =
|
|
34
|
+
this.filters.__current = new Set();
|
|
35
35
|
this.addAction = (0, _createAddHook.default)(this, 'actions');
|
|
36
36
|
this.addFilter = (0, _createAddHook.default)(this, 'filters');
|
|
37
37
|
this.removeAction = (0, _createRemoveHook.default)(this, 'actions');
|
|
@@ -40,8 +40,10 @@ class _Hooks {
|
|
|
40
40
|
this.hasFilter = (0, _createHasHook.default)(this, 'filters');
|
|
41
41
|
this.removeAllActions = (0, _createRemoveHook.default)(this, 'actions', true);
|
|
42
42
|
this.removeAllFilters = (0, _createRemoveHook.default)(this, 'filters', true);
|
|
43
|
-
this.doAction = (0, _createRunHook.default)(this, 'actions');
|
|
44
|
-
this.
|
|
43
|
+
this.doAction = (0, _createRunHook.default)(this, 'actions', false, false);
|
|
44
|
+
this.doActionAsync = (0, _createRunHook.default)(this, 'actions', false, true);
|
|
45
|
+
this.applyFilters = (0, _createRunHook.default)(this, 'filters', true, false);
|
|
46
|
+
this.applyFiltersAsync = (0, _createRunHook.default)(this, 'filters', true, true);
|
|
45
47
|
this.currentAction = (0, _createCurrentHook.default)(this, 'actions');
|
|
46
48
|
this.currentFilter = (0, _createCurrentHook.default)(this, 'filters');
|
|
47
49
|
this.doingAction = (0, _createDoingHook.default)(this, 'actions');
|
package/build/createHooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_createAddHook","_interopRequireDefault","require","_createRemoveHook","_createHasHook","_createRunHook","_createCurrentHook","_createDoingHook","_createDidHook","_Hooks","constructor","actions","Object","create","__current","filters","addAction","createAddHook","addFilter","removeAction","createRemoveHook","removeFilter","hasAction","createHasHook","hasFilter","removeAllActions","removeAllFilters","doAction","createRunHook","applyFilters","currentAction","createCurrentHook","currentFilter","doingAction","createDoingHook","doingFilter","didAction","createDidHook","didFilter","exports","createHooks","_default","default"],"sources":["@wordpress/hooks/src/createHooks.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createAddHook from './createAddHook';\nimport createRemoveHook from './createRemoveHook';\nimport createHasHook from './createHasHook';\nimport createRunHook from './createRunHook';\nimport createCurrentHook from './createCurrentHook';\nimport createDoingHook from './createDoingHook';\nimport createDidHook from './createDidHook';\n\n/**\n * Internal class for constructing hooks. Use `createHooks()` function\n *\n * Note, it is necessary to expose this class to make its type public.\n *\n * @private\n */\nexport class _Hooks {\n\tconstructor() {\n\t\t/** @type {import('.').Store} actions */\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current =
|
|
1
|
+
{"version":3,"names":["_createAddHook","_interopRequireDefault","require","_createRemoveHook","_createHasHook","_createRunHook","_createCurrentHook","_createDoingHook","_createDidHook","_Hooks","constructor","actions","Object","create","__current","Set","filters","addAction","createAddHook","addFilter","removeAction","createRemoveHook","removeFilter","hasAction","createHasHook","hasFilter","removeAllActions","removeAllFilters","doAction","createRunHook","doActionAsync","applyFilters","applyFiltersAsync","currentAction","createCurrentHook","currentFilter","doingAction","createDoingHook","doingFilter","didAction","createDidHook","didFilter","exports","createHooks","_default","default"],"sources":["@wordpress/hooks/src/createHooks.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createAddHook from './createAddHook';\nimport createRemoveHook from './createRemoveHook';\nimport createHasHook from './createHasHook';\nimport createRunHook from './createRunHook';\nimport createCurrentHook from './createCurrentHook';\nimport createDoingHook from './createDoingHook';\nimport createDidHook from './createDidHook';\n\n/**\n * Internal class for constructing hooks. Use `createHooks()` function\n *\n * Note, it is necessary to expose this class to make its type public.\n *\n * @private\n */\nexport class _Hooks {\n\tconstructor() {\n\t\t/** @type {import('.').Store} actions */\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current = new Set();\n\n\t\t/** @type {import('.').Store} filters */\n\t\tthis.filters = Object.create( null );\n\t\tthis.filters.__current = new Set();\n\n\t\tthis.addAction = createAddHook( this, 'actions' );\n\t\tthis.addFilter = createAddHook( this, 'filters' );\n\t\tthis.removeAction = createRemoveHook( this, 'actions' );\n\t\tthis.removeFilter = createRemoveHook( this, 'filters' );\n\t\tthis.hasAction = createHasHook( this, 'actions' );\n\t\tthis.hasFilter = createHasHook( this, 'filters' );\n\t\tthis.removeAllActions = createRemoveHook( this, 'actions', true );\n\t\tthis.removeAllFilters = createRemoveHook( this, 'filters', true );\n\t\tthis.doAction = createRunHook( this, 'actions', false, false );\n\t\tthis.doActionAsync = createRunHook( this, 'actions', false, true );\n\t\tthis.applyFilters = createRunHook( this, 'filters', true, false );\n\t\tthis.applyFiltersAsync = createRunHook( this, 'filters', true, true );\n\t\tthis.currentAction = createCurrentHook( this, 'actions' );\n\t\tthis.currentFilter = createCurrentHook( this, 'filters' );\n\t\tthis.doingAction = createDoingHook( this, 'actions' );\n\t\tthis.doingFilter = createDoingHook( this, 'filters' );\n\t\tthis.didAction = createDidHook( this, 'actions' );\n\t\tthis.didFilter = createDidHook( this, 'filters' );\n\t}\n}\n\n/** @typedef {_Hooks} Hooks */\n\n/**\n * Returns an instance of the hooks object.\n *\n * @return {Hooks} A Hooks instance.\n */\nfunction createHooks() {\n\treturn new _Hooks();\n}\n\nexport default createHooks;\n"],"mappings":"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","ignoreList":[]}
|
package/build/createRunHook.js
CHANGED
|
@@ -9,15 +9,15 @@ exports.default = void 0;
|
|
|
9
9
|
* registered to a hook of the specified type, optionally returning the final
|
|
10
10
|
* value of the call chain.
|
|
11
11
|
*
|
|
12
|
-
* @param {import('.').Hooks} hooks
|
|
12
|
+
* @param {import('.').Hooks} hooks Hooks instance.
|
|
13
13
|
* @param {import('.').StoreKey} storeKey
|
|
14
|
-
* @param {boolean}
|
|
15
|
-
*
|
|
14
|
+
* @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.
|
|
15
|
+
* @param {boolean} async Whether the hook callback should be run asynchronously
|
|
16
16
|
*
|
|
17
17
|
* @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
|
|
18
18
|
*/
|
|
19
|
-
function createRunHook(hooks, storeKey, returnFirstArg
|
|
20
|
-
return function
|
|
19
|
+
function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
20
|
+
return function runHook(hookName, ...args) {
|
|
21
21
|
const hooksStore = hooks[storeKey];
|
|
22
22
|
if (!hooksStore[hookName]) {
|
|
23
23
|
hooksStore[hookName] = {
|
|
@@ -42,20 +42,41 @@ function createRunHook(hooks, storeKey, returnFirstArg = false) {
|
|
|
42
42
|
name: hookName,
|
|
43
43
|
currentIndex: 0
|
|
44
44
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
async function asyncRunner() {
|
|
46
|
+
try {
|
|
47
|
+
hooksStore.__current.add(hookInfo);
|
|
48
|
+
let result = returnFirstArg ? args[0] : undefined;
|
|
49
|
+
while (hookInfo.currentIndex < handlers.length) {
|
|
50
|
+
const handler = handlers[hookInfo.currentIndex];
|
|
51
|
+
result = await handler.callback.apply(null, args);
|
|
52
|
+
if (returnFirstArg) {
|
|
53
|
+
args[0] = result;
|
|
54
|
+
}
|
|
55
|
+
hookInfo.currentIndex++;
|
|
56
|
+
}
|
|
57
|
+
return returnFirstArg ? result : undefined;
|
|
58
|
+
} finally {
|
|
59
|
+
hooksStore.__current.delete(hookInfo);
|
|
51
60
|
}
|
|
52
|
-
hookInfo.currentIndex++;
|
|
53
61
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
62
|
+
function syncRunner() {
|
|
63
|
+
try {
|
|
64
|
+
hooksStore.__current.add(hookInfo);
|
|
65
|
+
let result = returnFirstArg ? args[0] : undefined;
|
|
66
|
+
while (hookInfo.currentIndex < handlers.length) {
|
|
67
|
+
const handler = handlers[hookInfo.currentIndex];
|
|
68
|
+
result = handler.callback.apply(null, args);
|
|
69
|
+
if (returnFirstArg) {
|
|
70
|
+
args[0] = result;
|
|
71
|
+
}
|
|
72
|
+
hookInfo.currentIndex++;
|
|
73
|
+
}
|
|
74
|
+
return returnFirstArg ? result : undefined;
|
|
75
|
+
} finally {
|
|
76
|
+
hooksStore.__current.delete(hookInfo);
|
|
77
|
+
}
|
|
57
78
|
}
|
|
58
|
-
return
|
|
79
|
+
return (async ? asyncRunner : syncRunner)();
|
|
59
80
|
};
|
|
60
81
|
}
|
|
61
82
|
var _default = exports.default = createRunHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRunHook","hooks","storeKey","returnFirstArg","
|
|
1
|
+
{"version":3,"names":["createRunHook","hooks","storeKey","returnFirstArg","async","runHook","hookName","args","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","length","undefined","hookInfo","name","currentIndex","asyncRunner","__current","add","result","handler","callback","apply","delete","syncRunner","_default","exports","default"],"sources":["@wordpress/hooks/src/createRunHook.js"],"sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.\n * @param {boolean} async Whether the hook callback should be run asynchronously\n *\n * @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg, async ) {\n\treturn function runHook( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\tasync function asyncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = await handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\tfunction syncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\treturn ( async ? asyncRunner : syncRunner )();\n\t};\n}\n\nexport default createRunHook;\n"],"mappings":"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","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -4,14 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.applyFilters = exports.addFilter = exports.addAction = exports.actions = void 0;
|
|
7
|
+
exports.applyFiltersAsync = exports.applyFilters = exports.addFilter = exports.addAction = exports.actions = void 0;
|
|
8
8
|
Object.defineProperty(exports, "createHooks", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function () {
|
|
11
11
|
return _createHooks.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
exports.removeFilter = exports.removeAllFilters = exports.removeAllActions = exports.removeAction = exports.hasFilter = exports.hasAction = exports.filters = exports.doingFilter = exports.doingAction = exports.doAction = exports.didFilter = exports.didAction = exports.defaultHooks = exports.currentFilter = exports.currentAction = void 0;
|
|
14
|
+
exports.removeFilter = exports.removeAllFilters = exports.removeAllActions = exports.removeAction = exports.hasFilter = exports.hasAction = exports.filters = exports.doingFilter = exports.doingAction = exports.doActionAsync = exports.doAction = exports.didFilter = exports.didAction = exports.defaultHooks = exports.currentFilter = exports.currentAction = void 0;
|
|
15
15
|
var _createHooks = _interopRequireDefault(require("./createHooks"));
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
@@ -39,7 +39,7 @@ var _createHooks = _interopRequireDefault(require("./createHooks"));
|
|
|
39
39
|
*/
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* @typedef {Record<string, Hook> & {__current: Current
|
|
42
|
+
* @typedef {Record<string, Hook> & {__current: Set<Current>}} Store
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
/**
|
|
@@ -61,7 +61,9 @@ const {
|
|
|
61
61
|
removeAllActions,
|
|
62
62
|
removeAllFilters,
|
|
63
63
|
doAction,
|
|
64
|
+
doActionAsync,
|
|
64
65
|
applyFilters,
|
|
66
|
+
applyFiltersAsync,
|
|
65
67
|
currentAction,
|
|
66
68
|
currentFilter,
|
|
67
69
|
doingAction,
|
|
@@ -79,7 +81,9 @@ exports.doingFilter = doingFilter;
|
|
|
79
81
|
exports.doingAction = doingAction;
|
|
80
82
|
exports.currentFilter = currentFilter;
|
|
81
83
|
exports.currentAction = currentAction;
|
|
84
|
+
exports.applyFiltersAsync = applyFiltersAsync;
|
|
82
85
|
exports.applyFilters = applyFilters;
|
|
86
|
+
exports.doActionAsync = doActionAsync;
|
|
83
87
|
exports.doAction = doAction;
|
|
84
88
|
exports.removeAllFilters = removeAllFilters;
|
|
85
89
|
exports.removeAllActions = removeAllActions;
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_createHooks","_interopRequireDefault","require","defaultHooks","exports","createHooks","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","applyFilters","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","actions","filters"],"sources":["@wordpress/hooks/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createHooks from './createHooks';\n\n/** @typedef {(...args: any[])=>any} Callback */\n\n/**\n * @typedef Handler\n * @property {Callback} callback The callback\n * @property {string} namespace The namespace\n * @property {number} priority The namespace\n */\n\n/**\n * @typedef Hook\n * @property {Handler[]} handlers Array of handlers\n * @property {number} runs Run counter\n */\n\n/**\n * @typedef Current\n * @property {string} name Hook name\n * @property {number} currentIndex The index\n */\n\n/**\n * @typedef {Record<string, Hook> & {__current: Current
|
|
1
|
+
{"version":3,"names":["_createHooks","_interopRequireDefault","require","defaultHooks","exports","createHooks","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","doActionAsync","applyFilters","applyFiltersAsync","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","actions","filters"],"sources":["@wordpress/hooks/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createHooks from './createHooks';\n\n/** @typedef {(...args: any[])=>any} Callback */\n\n/**\n * @typedef Handler\n * @property {Callback} callback The callback\n * @property {string} namespace The namespace\n * @property {number} priority The namespace\n */\n\n/**\n * @typedef Hook\n * @property {Handler[]} handlers Array of handlers\n * @property {number} runs Run counter\n */\n\n/**\n * @typedef Current\n * @property {string} name Hook name\n * @property {number} currentIndex The index\n */\n\n/**\n * @typedef {Record<string, Hook> & {__current: Set<Current>}} Store\n */\n\n/**\n * @typedef {'actions' | 'filters'} StoreKey\n */\n\n/**\n * @typedef {import('./createHooks').Hooks} Hooks\n */\n\nexport const defaultHooks = createHooks();\n\nconst {\n\taddAction,\n\taddFilter,\n\tremoveAction,\n\tremoveFilter,\n\thasAction,\n\thasFilter,\n\tremoveAllActions,\n\tremoveAllFilters,\n\tdoAction,\n\tdoActionAsync,\n\tapplyFilters,\n\tapplyFiltersAsync,\n\tcurrentAction,\n\tcurrentFilter,\n\tdoingAction,\n\tdoingFilter,\n\tdidAction,\n\tdidFilter,\n\tactions,\n\tfilters,\n} = defaultHooks;\n\nexport {\n\tcreateHooks,\n\taddAction,\n\taddFilter,\n\tremoveAction,\n\tremoveFilter,\n\thasAction,\n\thasFilter,\n\tremoveAllActions,\n\tremoveAllFilters,\n\tdoAction,\n\tdoActionAsync,\n\tapplyFilters,\n\tapplyFiltersAsync,\n\tcurrentAction,\n\tcurrentFilter,\n\tdoingAction,\n\tdoingFilter,\n\tdidAction,\n\tdidFilter,\n\tactions,\n\tfilters,\n};\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEO,MAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,oBAAW,EAAC,CAAC;AAEzC,MAAM;EACLC,SAAS;EACTC,SAAS;EACTC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,SAAS;EACTC,gBAAgB;EAChBC,gBAAgB;EAChBC,QAAQ;EACRC,aAAa;EACbC,YAAY;EACZC,iBAAiB;EACjBC,aAAa;EACbC,aAAa;EACbC,WAAW;EACXC,WAAW;EACXC,SAAS;EACTC,SAAS;EACTC,OAAO;EACPC;AACD,CAAC,GAAGtB,YAAY;AAACC,OAAA,CAAAqB,OAAA,GAAAA,OAAA;AAAArB,OAAA,CAAAoB,OAAA,GAAAA,OAAA;AAAApB,OAAA,CAAAmB,SAAA,GAAAA,SAAA;AAAAnB,OAAA,CAAAkB,SAAA,GAAAA,SAAA;AAAAlB,OAAA,CAAAiB,WAAA,GAAAA,WAAA;AAAAjB,OAAA,CAAAgB,WAAA,GAAAA,WAAA;AAAAhB,OAAA,CAAAe,aAAA,GAAAA,aAAA;AAAAf,OAAA,CAAAc,aAAA,GAAAA,aAAA;AAAAd,OAAA,CAAAa,iBAAA,GAAAA,iBAAA;AAAAb,OAAA,CAAAY,YAAA,GAAAA,YAAA;AAAAZ,OAAA,CAAAW,aAAA,GAAAA,aAAA;AAAAX,OAAA,CAAAU,QAAA,GAAAA,QAAA;AAAAV,OAAA,CAAAS,gBAAA,GAAAA,gBAAA;AAAAT,OAAA,CAAAQ,gBAAA,GAAAA,gBAAA;AAAAR,OAAA,CAAAO,SAAA,GAAAA,SAAA;AAAAP,OAAA,CAAAM,SAAA,GAAAA,SAAA;AAAAN,OAAA,CAAAK,YAAA,GAAAA,YAAA;AAAAL,OAAA,CAAAI,YAAA,GAAAA,YAAA;AAAAJ,OAAA,CAAAG,SAAA,GAAAA,SAAA;AAAAH,OAAA,CAAAE,SAAA,GAAAA,SAAA","ignoreList":[]}
|
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
*/
|
|
11
11
|
function createCurrentHook(hooks, storeKey) {
|
|
12
12
|
return function currentHook() {
|
|
13
|
-
var
|
|
13
|
+
var _currentArray$at$name;
|
|
14
14
|
const hooksStore = hooks[storeKey];
|
|
15
|
-
|
|
15
|
+
const currentArray = Array.from(hooksStore.__current);
|
|
16
|
+
return (_currentArray$at$name = currentArray.at(-1)?.name) !== null && _currentArray$at$name !== void 0 ? _currentArray$at$name : null;
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
19
|
export default createCurrentHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createCurrentHook","hooks","storeKey","currentHook","
|
|
1
|
+
{"version":3,"names":["createCurrentHook","hooks","storeKey","currentHook","_currentArray$at$name","hooksStore","currentArray","Array","from","__current","at","name"],"sources":["@wordpress/hooks/src/createCurrentHook.js"],"sourcesContent":["/**\n * Returns a function which, when invoked, will return the name of the\n * currently running hook, or `null` if no hook of the given type is currently\n * running.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {() => string | null} Function that returns the current hook name or null.\n */\nfunction createCurrentHook( hooks, storeKey ) {\n\treturn function currentHook() {\n\t\tconst hooksStore = hooks[ storeKey ];\n\t\tconst currentArray = Array.from( hooksStore.__current );\n\t\treturn currentArray.at( -1 )?.name ?? null;\n\t};\n}\n\nexport default createCurrentHook;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiBA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EAC7C,OAAO,SAASC,WAAWA,CAAA,EAAG;IAAA,IAAAC,qBAAA;IAC7B,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;IACpC,MAAMI,YAAY,GAAGC,KAAK,CAACC,IAAI,CAAEH,UAAU,CAACI,SAAU,CAAC;IACvD,QAAAL,qBAAA,GAAOE,YAAY,CAACI,EAAE,CAAE,CAAC,CAAE,CAAC,EAAEC,IAAI,cAAAP,qBAAA,cAAAA,qBAAA,GAAI,IAAI;EAC3C,CAAC;AACF;AAEA,eAAeJ,iBAAiB","ignoreList":[]}
|
|
@@ -24,11 +24,11 @@ function createDoingHook(hooks, storeKey) {
|
|
|
24
24
|
|
|
25
25
|
// If the hookName was not passed, check for any current hook.
|
|
26
26
|
if ('undefined' === typeof hookName) {
|
|
27
|
-
return
|
|
27
|
+
return hooksStore.__current.size > 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
return hooksStore.__current
|
|
30
|
+
// Find if the `hookName` hook is in `__current`.
|
|
31
|
+
return Array.from(hooksStore.__current).some(hook => hook.name === hookName);
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
34
|
export default createDoingHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createDoingHook","hooks","storeKey","doingHook","hookName","hooksStore","__current","name"],"sources":["@wordpress/hooks/src/createDoingHook.js"],"sourcesContent":["/**\n * @callback DoingHook\n * Returns whether a hook is currently being executed.\n *\n * @param {string} [hookName] The name of the hook to check for. If\n * omitted, will check for any hook being executed.\n *\n * @return {boolean} Whether the hook is being executed.\n */\n\n/**\n * Returns a function which, when invoked, will return whether a hook is\n * currently being executed.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {DoingHook} Function that returns whether a hook is currently\n * being executed.\n */\nfunction createDoingHook( hooks, storeKey ) {\n\treturn function doingHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// If the hookName was not passed, check for any current hook.\n\t\tif ( 'undefined' === typeof hookName ) {\n\t\t\treturn
|
|
1
|
+
{"version":3,"names":["createDoingHook","hooks","storeKey","doingHook","hookName","hooksStore","__current","size","Array","from","some","hook","name"],"sources":["@wordpress/hooks/src/createDoingHook.js"],"sourcesContent":["/**\n * @callback DoingHook\n * Returns whether a hook is currently being executed.\n *\n * @param {string} [hookName] The name of the hook to check for. If\n * omitted, will check for any hook being executed.\n *\n * @return {boolean} Whether the hook is being executed.\n */\n\n/**\n * Returns a function which, when invoked, will return whether a hook is\n * currently being executed.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {DoingHook} Function that returns whether a hook is currently\n * being executed.\n */\nfunction createDoingHook( hooks, storeKey ) {\n\treturn function doingHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// If the hookName was not passed, check for any current hook.\n\t\tif ( 'undefined' === typeof hookName ) {\n\t\t\treturn hooksStore.__current.size > 0;\n\t\t}\n\n\t\t// Find if the `hookName` hook is in `__current`.\n\t\treturn Array.from( hooksStore.__current ).some(\n\t\t\t( hook ) => hook.name === hookName\n\t\t);\n\t};\n}\n\nexport default createDoingHook;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAeA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EAC3C,OAAO,SAASC,SAASA,CAAEC,QAAQ,EAAG;IACrC,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;;IAEpC;IACA,IAAK,WAAW,KAAK,OAAOE,QAAQ,EAAG;MACtC,OAAOC,UAAU,CAACC,SAAS,CAACC,IAAI,GAAG,CAAC;IACrC;;IAEA;IACA,OAAOC,KAAK,CAACC,IAAI,CAAEJ,UAAU,CAACC,SAAU,CAAC,CAACI,IAAI,CAC3CC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAKR,QAC3B,CAAC;EACF,CAAC;AACF;AAEA,eAAeJ,eAAe","ignoreList":[]}
|
|
@@ -20,11 +20,11 @@ export class _Hooks {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
/** @type {import('.').Store} actions */
|
|
22
22
|
this.actions = Object.create(null);
|
|
23
|
-
this.actions.__current =
|
|
23
|
+
this.actions.__current = new Set();
|
|
24
24
|
|
|
25
25
|
/** @type {import('.').Store} filters */
|
|
26
26
|
this.filters = Object.create(null);
|
|
27
|
-
this.filters.__current =
|
|
27
|
+
this.filters.__current = new Set();
|
|
28
28
|
this.addAction = createAddHook(this, 'actions');
|
|
29
29
|
this.addFilter = createAddHook(this, 'filters');
|
|
30
30
|
this.removeAction = createRemoveHook(this, 'actions');
|
|
@@ -33,8 +33,10 @@ export class _Hooks {
|
|
|
33
33
|
this.hasFilter = createHasHook(this, 'filters');
|
|
34
34
|
this.removeAllActions = createRemoveHook(this, 'actions', true);
|
|
35
35
|
this.removeAllFilters = createRemoveHook(this, 'filters', true);
|
|
36
|
-
this.doAction = createRunHook(this, 'actions');
|
|
37
|
-
this.
|
|
36
|
+
this.doAction = createRunHook(this, 'actions', false, false);
|
|
37
|
+
this.doActionAsync = createRunHook(this, 'actions', false, true);
|
|
38
|
+
this.applyFilters = createRunHook(this, 'filters', true, false);
|
|
39
|
+
this.applyFiltersAsync = createRunHook(this, 'filters', true, true);
|
|
38
40
|
this.currentAction = createCurrentHook(this, 'actions');
|
|
39
41
|
this.currentFilter = createCurrentHook(this, 'filters');
|
|
40
42
|
this.doingAction = createDoingHook(this, 'actions');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createAddHook","createRemoveHook","createHasHook","createRunHook","createCurrentHook","createDoingHook","createDidHook","_Hooks","constructor","actions","Object","create","__current","filters","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","applyFilters","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","createHooks"],"sources":["@wordpress/hooks/src/createHooks.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createAddHook from './createAddHook';\nimport createRemoveHook from './createRemoveHook';\nimport createHasHook from './createHasHook';\nimport createRunHook from './createRunHook';\nimport createCurrentHook from './createCurrentHook';\nimport createDoingHook from './createDoingHook';\nimport createDidHook from './createDidHook';\n\n/**\n * Internal class for constructing hooks. Use `createHooks()` function\n *\n * Note, it is necessary to expose this class to make its type public.\n *\n * @private\n */\nexport class _Hooks {\n\tconstructor() {\n\t\t/** @type {import('.').Store} actions */\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current =
|
|
1
|
+
{"version":3,"names":["createAddHook","createRemoveHook","createHasHook","createRunHook","createCurrentHook","createDoingHook","createDidHook","_Hooks","constructor","actions","Object","create","__current","Set","filters","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","doActionAsync","applyFilters","applyFiltersAsync","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","createHooks"],"sources":["@wordpress/hooks/src/createHooks.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createAddHook from './createAddHook';\nimport createRemoveHook from './createRemoveHook';\nimport createHasHook from './createHasHook';\nimport createRunHook from './createRunHook';\nimport createCurrentHook from './createCurrentHook';\nimport createDoingHook from './createDoingHook';\nimport createDidHook from './createDidHook';\n\n/**\n * Internal class for constructing hooks. Use `createHooks()` function\n *\n * Note, it is necessary to expose this class to make its type public.\n *\n * @private\n */\nexport class _Hooks {\n\tconstructor() {\n\t\t/** @type {import('.').Store} actions */\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current = new Set();\n\n\t\t/** @type {import('.').Store} filters */\n\t\tthis.filters = Object.create( null );\n\t\tthis.filters.__current = new Set();\n\n\t\tthis.addAction = createAddHook( this, 'actions' );\n\t\tthis.addFilter = createAddHook( this, 'filters' );\n\t\tthis.removeAction = createRemoveHook( this, 'actions' );\n\t\tthis.removeFilter = createRemoveHook( this, 'filters' );\n\t\tthis.hasAction = createHasHook( this, 'actions' );\n\t\tthis.hasFilter = createHasHook( this, 'filters' );\n\t\tthis.removeAllActions = createRemoveHook( this, 'actions', true );\n\t\tthis.removeAllFilters = createRemoveHook( this, 'filters', true );\n\t\tthis.doAction = createRunHook( this, 'actions', false, false );\n\t\tthis.doActionAsync = createRunHook( this, 'actions', false, true );\n\t\tthis.applyFilters = createRunHook( this, 'filters', true, false );\n\t\tthis.applyFiltersAsync = createRunHook( this, 'filters', true, true );\n\t\tthis.currentAction = createCurrentHook( this, 'actions' );\n\t\tthis.currentFilter = createCurrentHook( this, 'filters' );\n\t\tthis.doingAction = createDoingHook( this, 'actions' );\n\t\tthis.doingFilter = createDoingHook( this, 'filters' );\n\t\tthis.didAction = createDidHook( this, 'actions' );\n\t\tthis.didFilter = createDidHook( this, 'filters' );\n\t}\n}\n\n/** @typedef {_Hooks} Hooks */\n\n/**\n * Returns an instance of the hooks object.\n *\n * @return {Hooks} A Hooks instance.\n */\nfunction createHooks() {\n\treturn new _Hooks();\n}\n\nexport default createHooks;\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,aAAa,MAAM,iBAAiB;;AAE3C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,CAAC;EACnBC,WAAWA,CAAA,EAAG;IACb;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAE,IAAK,CAAC;IACpC,IAAI,CAACF,OAAO,CAACG,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;;IAElC;IACA,IAAI,CAACC,OAAO,GAAGJ,MAAM,CAACC,MAAM,CAAE,IAAK,CAAC;IACpC,IAAI,CAACG,OAAO,CAACF,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;IAElC,IAAI,CAACE,SAAS,GAAGf,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACgB,SAAS,GAAGhB,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACiB,YAAY,GAAGhB,gBAAgB,CAAE,IAAI,EAAE,SAAU,CAAC;IACvD,IAAI,CAACiB,YAAY,GAAGjB,gBAAgB,CAAE,IAAI,EAAE,SAAU,CAAC;IACvD,IAAI,CAACkB,SAAS,GAAGjB,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACkB,SAAS,GAAGlB,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACmB,gBAAgB,GAAGpB,gBAAgB,CAAE,IAAI,EAAE,SAAS,EAAE,IAAK,CAAC;IACjE,IAAI,CAACqB,gBAAgB,GAAGrB,gBAAgB,CAAE,IAAI,EAAE,SAAS,EAAE,IAAK,CAAC;IACjE,IAAI,CAACsB,QAAQ,GAAGpB,aAAa,CAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAM,CAAC;IAC9D,IAAI,CAACqB,aAAa,GAAGrB,aAAa,CAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAK,CAAC;IAClE,IAAI,CAACsB,YAAY,GAAGtB,aAAa,CAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAM,CAAC;IACjE,IAAI,CAACuB,iBAAiB,GAAGvB,aAAa,CAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAK,CAAC;IACrE,IAAI,CAACwB,aAAa,GAAGvB,iBAAiB,CAAE,IAAI,EAAE,SAAU,CAAC;IACzD,IAAI,CAACwB,aAAa,GAAGxB,iBAAiB,CAAE,IAAI,EAAE,SAAU,CAAC;IACzD,IAAI,CAACyB,WAAW,GAAGxB,eAAe,CAAE,IAAI,EAAE,SAAU,CAAC;IACrD,IAAI,CAACyB,WAAW,GAAGzB,eAAe,CAAE,IAAI,EAAE,SAAU,CAAC;IACrD,IAAI,CAAC0B,SAAS,GAAGzB,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAAC0B,SAAS,GAAG1B,aAAa,CAAE,IAAI,EAAE,SAAU,CAAC;EAClD;AACD;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS2B,WAAWA,CAAA,EAAG;EACtB,OAAO,IAAI1B,MAAM,CAAC,CAAC;AACpB;AAEA,eAAe0B,WAAW","ignoreList":[]}
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* registered to a hook of the specified type, optionally returning the final
|
|
4
4
|
* value of the call chain.
|
|
5
5
|
*
|
|
6
|
-
* @param {import('.').Hooks} hooks
|
|
6
|
+
* @param {import('.').Hooks} hooks Hooks instance.
|
|
7
7
|
* @param {import('.').StoreKey} storeKey
|
|
8
|
-
* @param {boolean}
|
|
9
|
-
*
|
|
8
|
+
* @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.
|
|
9
|
+
* @param {boolean} async Whether the hook callback should be run asynchronously
|
|
10
10
|
*
|
|
11
11
|
* @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
|
|
12
12
|
*/
|
|
13
|
-
function createRunHook(hooks, storeKey, returnFirstArg
|
|
14
|
-
return function
|
|
13
|
+
function createRunHook(hooks, storeKey, returnFirstArg, async) {
|
|
14
|
+
return function runHook(hookName, ...args) {
|
|
15
15
|
const hooksStore = hooks[storeKey];
|
|
16
16
|
if (!hooksStore[hookName]) {
|
|
17
17
|
hooksStore[hookName] = {
|
|
@@ -36,20 +36,41 @@ function createRunHook(hooks, storeKey, returnFirstArg = false) {
|
|
|
36
36
|
name: hookName,
|
|
37
37
|
currentIndex: 0
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
async function asyncRunner() {
|
|
40
|
+
try {
|
|
41
|
+
hooksStore.__current.add(hookInfo);
|
|
42
|
+
let result = returnFirstArg ? args[0] : undefined;
|
|
43
|
+
while (hookInfo.currentIndex < handlers.length) {
|
|
44
|
+
const handler = handlers[hookInfo.currentIndex];
|
|
45
|
+
result = await handler.callback.apply(null, args);
|
|
46
|
+
if (returnFirstArg) {
|
|
47
|
+
args[0] = result;
|
|
48
|
+
}
|
|
49
|
+
hookInfo.currentIndex++;
|
|
50
|
+
}
|
|
51
|
+
return returnFirstArg ? result : undefined;
|
|
52
|
+
} finally {
|
|
53
|
+
hooksStore.__current.delete(hookInfo);
|
|
45
54
|
}
|
|
46
|
-
hookInfo.currentIndex++;
|
|
47
55
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
function syncRunner() {
|
|
57
|
+
try {
|
|
58
|
+
hooksStore.__current.add(hookInfo);
|
|
59
|
+
let result = returnFirstArg ? args[0] : undefined;
|
|
60
|
+
while (hookInfo.currentIndex < handlers.length) {
|
|
61
|
+
const handler = handlers[hookInfo.currentIndex];
|
|
62
|
+
result = handler.callback.apply(null, args);
|
|
63
|
+
if (returnFirstArg) {
|
|
64
|
+
args[0] = result;
|
|
65
|
+
}
|
|
66
|
+
hookInfo.currentIndex++;
|
|
67
|
+
}
|
|
68
|
+
return returnFirstArg ? result : undefined;
|
|
69
|
+
} finally {
|
|
70
|
+
hooksStore.__current.delete(hookInfo);
|
|
71
|
+
}
|
|
51
72
|
}
|
|
52
|
-
return
|
|
73
|
+
return (async ? asyncRunner : syncRunner)();
|
|
53
74
|
};
|
|
54
75
|
}
|
|
55
76
|
export default createRunHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createRunHook","hooks","storeKey","returnFirstArg","
|
|
1
|
+
{"version":3,"names":["createRunHook","hooks","storeKey","returnFirstArg","async","runHook","hookName","args","hooksStore","handlers","runs","process","env","NODE_ENV","all","push","length","undefined","hookInfo","name","currentIndex","asyncRunner","__current","add","result","handler","callback","apply","delete","syncRunner"],"sources":["@wordpress/hooks/src/createRunHook.js"],"sourcesContent":["/**\n * Returns a function which, when invoked, will execute all callbacks\n * registered to a hook of the specified type, optionally returning the final\n * value of the call chain.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.\n * @param {boolean} async Whether the hook callback should be run asynchronously\n *\n * @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.\n */\nfunction createRunHook( hooks, storeKey, returnFirstArg, async ) {\n\treturn function runHook( hookName, ...args ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\thooksStore[ hookName ].runs++;\n\n\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t// The following code is stripped from production builds.\n\t\tif ( 'production' !== process.env.NODE_ENV ) {\n\t\t\t// Handle any 'all' hooks registered.\n\t\t\tif ( 'hookAdded' !== hookName && hooksStore.all ) {\n\t\t\t\thandlers.push( ...hooksStore.all.handlers );\n\t\t\t}\n\t\t}\n\n\t\tif ( ! handlers || ! handlers.length ) {\n\t\t\treturn returnFirstArg ? args[ 0 ] : undefined;\n\t\t}\n\n\t\tconst hookInfo = {\n\t\t\tname: hookName,\n\t\t\tcurrentIndex: 0,\n\t\t};\n\n\t\tasync function asyncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = await handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\tfunction syncRunner() {\n\t\t\ttry {\n\t\t\t\thooksStore.__current.add( hookInfo );\n\t\t\t\tlet result = returnFirstArg ? args[ 0 ] : undefined;\n\t\t\t\twhile ( hookInfo.currentIndex < handlers.length ) {\n\t\t\t\t\tconst handler = handlers[ hookInfo.currentIndex ];\n\t\t\t\t\tresult = handler.callback.apply( null, args );\n\t\t\t\t\tif ( returnFirstArg ) {\n\t\t\t\t\t\targs[ 0 ] = result;\n\t\t\t\t\t}\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t\treturn returnFirstArg ? result : undefined;\n\t\t\t} finally {\n\t\t\t\thooksStore.__current.delete( hookInfo );\n\t\t\t}\n\t\t}\n\n\t\treturn ( async ? asyncRunner : syncRunner )();\n\t};\n}\n\nexport default createRunHook;\n"],"mappings":"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","ignoreList":[]}
|
package/build-module/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import createHooks from './createHooks';
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @typedef {Record<string, Hook> & {__current: Current
|
|
28
|
+
* @typedef {Record<string, Hook> & {__current: Set<Current>}} Store
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -47,7 +47,9 @@ const {
|
|
|
47
47
|
removeAllActions,
|
|
48
48
|
removeAllFilters,
|
|
49
49
|
doAction,
|
|
50
|
+
doActionAsync,
|
|
50
51
|
applyFilters,
|
|
52
|
+
applyFiltersAsync,
|
|
51
53
|
currentAction,
|
|
52
54
|
currentFilter,
|
|
53
55
|
doingAction,
|
|
@@ -57,5 +59,5 @@ const {
|
|
|
57
59
|
actions,
|
|
58
60
|
filters
|
|
59
61
|
} = defaultHooks;
|
|
60
|
-
export { createHooks, addAction, addFilter, removeAction, removeFilter, hasAction, hasFilter, removeAllActions, removeAllFilters, doAction, applyFilters, currentAction, currentFilter, doingAction, doingFilter, didAction, didFilter, actions, filters };
|
|
62
|
+
export { createHooks, addAction, addFilter, removeAction, removeFilter, hasAction, hasFilter, removeAllActions, removeAllFilters, doAction, doActionAsync, applyFilters, applyFiltersAsync, currentAction, currentFilter, doingAction, doingFilter, didAction, didFilter, actions, filters };
|
|
61
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createHooks","defaultHooks","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","applyFilters","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","actions","filters"],"sources":["@wordpress/hooks/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createHooks from './createHooks';\n\n/** @typedef {(...args: any[])=>any} Callback */\n\n/**\n * @typedef Handler\n * @property {Callback} callback The callback\n * @property {string} namespace The namespace\n * @property {number} priority The namespace\n */\n\n/**\n * @typedef Hook\n * @property {Handler[]} handlers Array of handlers\n * @property {number} runs Run counter\n */\n\n/**\n * @typedef Current\n * @property {string} name Hook name\n * @property {number} currentIndex The index\n */\n\n/**\n * @typedef {Record<string, Hook> & {__current: Current
|
|
1
|
+
{"version":3,"names":["createHooks","defaultHooks","addAction","addFilter","removeAction","removeFilter","hasAction","hasFilter","removeAllActions","removeAllFilters","doAction","doActionAsync","applyFilters","applyFiltersAsync","currentAction","currentFilter","doingAction","doingFilter","didAction","didFilter","actions","filters"],"sources":["@wordpress/hooks/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createHooks from './createHooks';\n\n/** @typedef {(...args: any[])=>any} Callback */\n\n/**\n * @typedef Handler\n * @property {Callback} callback The callback\n * @property {string} namespace The namespace\n * @property {number} priority The namespace\n */\n\n/**\n * @typedef Hook\n * @property {Handler[]} handlers Array of handlers\n * @property {number} runs Run counter\n */\n\n/**\n * @typedef Current\n * @property {string} name Hook name\n * @property {number} currentIndex The index\n */\n\n/**\n * @typedef {Record<string, Hook> & {__current: Set<Current>}} Store\n */\n\n/**\n * @typedef {'actions' | 'filters'} StoreKey\n */\n\n/**\n * @typedef {import('./createHooks').Hooks} Hooks\n */\n\nexport const defaultHooks = createHooks();\n\nconst {\n\taddAction,\n\taddFilter,\n\tremoveAction,\n\tremoveFilter,\n\thasAction,\n\thasFilter,\n\tremoveAllActions,\n\tremoveAllFilters,\n\tdoAction,\n\tdoActionAsync,\n\tapplyFilters,\n\tapplyFiltersAsync,\n\tcurrentAction,\n\tcurrentFilter,\n\tdoingAction,\n\tdoingFilter,\n\tdidAction,\n\tdidFilter,\n\tactions,\n\tfilters,\n} = defaultHooks;\n\nexport {\n\tcreateHooks,\n\taddAction,\n\taddFilter,\n\tremoveAction,\n\tremoveFilter,\n\thasAction,\n\thasFilter,\n\tremoveAllActions,\n\tremoveAllFilters,\n\tdoAction,\n\tdoActionAsync,\n\tapplyFilters,\n\tapplyFiltersAsync,\n\tcurrentAction,\n\tcurrentFilter,\n\tdoingAction,\n\tdoingFilter,\n\tdidAction,\n\tdidFilter,\n\tactions,\n\tfilters,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,WAAW,MAAM,eAAe;;AAEvC;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,OAAO,MAAMC,YAAY,GAAGD,WAAW,CAAC,CAAC;AAEzC,MAAM;EACLE,SAAS;EACTC,SAAS;EACTC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,SAAS;EACTC,gBAAgB;EAChBC,gBAAgB;EAChBC,QAAQ;EACRC,aAAa;EACbC,YAAY;EACZC,iBAAiB;EACjBC,aAAa;EACbC,aAAa;EACbC,WAAW;EACXC,WAAW;EACXC,SAAS;EACTC,SAAS;EACTC,OAAO;EACPC;AACD,CAAC,GAAGpB,YAAY;AAEhB,SACCD,WAAW,EACXE,SAAS,EACTC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,SAAS,EACTC,gBAAgB,EAChBC,gBAAgB,EAChBC,QAAQ,EACRC,aAAa,EACbC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,EACbC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,OAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCurrentHook.d.ts","sourceRoot":"","sources":["../src/createCurrentHook.js"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AACH,0CALW,OAAO,GAAG,EAAE,KAAK,YACjB,OAAO,GAAG,EAAE,QAAQ,GAEnB,MAAM,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"createCurrentHook.d.ts","sourceRoot":"","sources":["../src/createCurrentHook.js"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;AACH,0CALW,OAAO,GAAG,EAAE,KAAK,YACjB,OAAO,GAAG,EAAE,QAAQ,GAEnB,MAAM,MAAM,GAAG,IAAI,CAQ9B"}
|
|
@@ -19,7 +19,9 @@ export class _Hooks {
|
|
|
19
19
|
removeAllActions: import("./createRemoveHook").RemoveHook;
|
|
20
20
|
removeAllFilters: import("./createRemoveHook").RemoveHook;
|
|
21
21
|
doAction: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
22
|
+
doActionAsync: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
22
23
|
applyFilters: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
24
|
+
applyFiltersAsync: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
23
25
|
currentAction: () => string | null;
|
|
24
26
|
currentFilter: () => string | null;
|
|
25
27
|
doingAction: import("./createDoingHook").DoingHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createHooks.d.ts","sourceRoot":"","sources":["../src/createHooks.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH;IAEE,wCAAwC;IACxC,SADW,OAAO,GAAG,EAAE,KAAK,CACQ;IAGpC,wCAAwC;IACxC,SADW,OAAO,GAAG,EAAE,KAAK,CACQ;IAGpC,6CAAiD;IACjD,6CAAiD;IACjD,sDAAuD;IACvD,sDAAuD;IACvD,6CAAiD;IACjD,6CAAiD;IACjD,0DAAiE;IACjE,0DAAiE;IACjE,
|
|
1
|
+
{"version":3,"file":"createHooks.d.ts","sourceRoot":"","sources":["../src/createHooks.js"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH;IAEE,wCAAwC;IACxC,SADW,OAAO,GAAG,EAAE,KAAK,CACQ;IAGpC,wCAAwC;IACxC,SADW,OAAO,GAAG,EAAE,KAAK,CACQ;IAGpC,6CAAiD;IACjD,6CAAiD;IACjD,sDAAuD;IACvD,sDAAuD;IACvD,6CAAiD;IACjD,6CAAiD;IACjD,0DAAiE;IACjE,0DAAiE;IACjE,wEAA8D;IAC9D,6EAAkE;IAClE,4EAAiE;IACjE,iFAAqE;IACrE,mCAAyD;IACzD,mCAAyD;IACzD,mDAAqD;IACrD,mDAAqD;IACrD,6CAAiD;IACjD,6CAAiD;CAElD;;oBAEa,MAAM;AAApB,8BAA8B;AAE9B;;;;GAIG;AACH,gCAFY,KAAK,CAIhB"}
|
|
@@ -4,12 +4,12 @@ export default createRunHook;
|
|
|
4
4
|
* registered to a hook of the specified type, optionally returning the final
|
|
5
5
|
* value of the call chain.
|
|
6
6
|
*
|
|
7
|
-
* @param {import('.').Hooks} hooks
|
|
7
|
+
* @param {import('.').Hooks} hooks Hooks instance.
|
|
8
8
|
* @param {import('.').StoreKey} storeKey
|
|
9
|
-
* @param {boolean}
|
|
10
|
-
*
|
|
9
|
+
* @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.
|
|
10
|
+
* @param {boolean} async Whether the hook callback should be run asynchronously
|
|
11
11
|
*
|
|
12
12
|
* @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
|
|
13
13
|
*/
|
|
14
|
-
declare function createRunHook(hooks: import(".").Hooks, storeKey: import(".").StoreKey, returnFirstArg
|
|
14
|
+
declare function createRunHook(hooks: import(".").Hooks, storeKey: import(".").StoreKey, returnFirstArg: boolean, async: boolean): (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
15
15
|
//# sourceMappingURL=createRunHook.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRunHook.d.ts","sourceRoot":"","sources":["../src/createRunHook.js"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AACH,sCAPW,OAAO,GAAG,EAAE,KAAK,YACjB,OAAO,GAAG,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"createRunHook.d.ts","sourceRoot":"","sources":["../src/createRunHook.js"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;AACH,sCAPW,OAAO,GAAG,EAAE,KAAK,YACjB,OAAO,GAAG,EAAE,QAAQ,kBACpB,OAAO,SACP,OAAO,GAEN,CAAC,QAAQ,EAAC,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,SAAS,GAAC,OAAO,CAwErE"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* @property {number} currentIndex The index
|
|
17
17
|
*/
|
|
18
18
|
/**
|
|
19
|
-
* @typedef {Record<string, Hook> & {__current: Current
|
|
19
|
+
* @typedef {Record<string, Hook> & {__current: Set<Current>}} Store
|
|
20
20
|
*/
|
|
21
21
|
/**
|
|
22
22
|
* @typedef {'actions' | 'filters'} StoreKey
|
|
@@ -61,7 +61,7 @@ export type Current = {
|
|
|
61
61
|
currentIndex: number;
|
|
62
62
|
};
|
|
63
63
|
export type Store = Record<string, Hook> & {
|
|
64
|
-
__current: Current
|
|
64
|
+
__current: Set<Current>;
|
|
65
65
|
};
|
|
66
66
|
export type StoreKey = "actions" | "filters";
|
|
67
67
|
export type Hooks = import("./createHooks").Hooks;
|
|
@@ -75,7 +75,9 @@ export const hasFilter: import("./createHasHook").HasHook;
|
|
|
75
75
|
export const removeAllActions: import("./createRemoveHook").RemoveHook;
|
|
76
76
|
export const removeAllFilters: import("./createRemoveHook").RemoveHook;
|
|
77
77
|
export const doAction: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
78
|
+
export const doActionAsync: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
78
79
|
export const applyFilters: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
80
|
+
export const applyFiltersAsync: (hookName: string, ...args: unknown[]) => undefined | unknown;
|
|
79
81
|
export const currentAction: () => string | null;
|
|
80
82
|
export const currentFilter: () => string | null;
|
|
81
83
|
export const doingAction: import("./createDoingHook").DoingHook;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAKA,gDAAgD;AAEhD;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH,0DAA0C;uBAjC5B,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAG,GAAG;;;;;cAIrB,QAAQ;;;;eACR,MAAM;;;;cACN,MAAM;;;;;;cAKN,OAAO,EAAE;;;;UACT,MAAM;;;;;;UAKN,MAAM;;;;kBACN,MAAM;;oBAIP,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG;IAAC,SAAS,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAKA,gDAAgD;AAEhD;;;;;GAKG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH,0DAA0C;uBAjC5B,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAG,GAAG;;;;;cAIrB,QAAQ;;;;eACR,MAAM;;;;cACN,MAAM;;;;;;cAKN,OAAO,EAAE;;;;UACT,MAAM;;;;;;UAKN,MAAM;;;;kBACN,MAAM;;oBAIP,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG;IAAC,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CAAC;uBAIhD,SAAS,GAAG,SAAS;oBAIrB,OAAO,eAAe,EAAE,KAAK;wBAhClB,eAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/hooks",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.2",
|
|
4
4
|
"description": "WordPress hooks library.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "6187079697e13c3292eb098d6338523a6676c6e8"
|
|
36
36
|
}
|
package/src/createCurrentHook.js
CHANGED
|
@@ -11,11 +11,8 @@
|
|
|
11
11
|
function createCurrentHook( hooks, storeKey ) {
|
|
12
12
|
return function currentHook() {
|
|
13
13
|
const hooksStore = hooks[ storeKey ];
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
hooksStore.__current[ hooksStore.__current.length - 1 ]?.name ??
|
|
17
|
-
null
|
|
18
|
-
);
|
|
14
|
+
const currentArray = Array.from( hooksStore.__current );
|
|
15
|
+
return currentArray.at( -1 )?.name ?? null;
|
|
19
16
|
};
|
|
20
17
|
}
|
|
21
18
|
|
package/src/createDoingHook.js
CHANGED
|
@@ -24,13 +24,13 @@ function createDoingHook( hooks, storeKey ) {
|
|
|
24
24
|
|
|
25
25
|
// If the hookName was not passed, check for any current hook.
|
|
26
26
|
if ( 'undefined' === typeof hookName ) {
|
|
27
|
-
return
|
|
27
|
+
return hooksStore.__current.size > 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
//
|
|
31
|
-
return hooksStore.__current
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
// Find if the `hookName` hook is in `__current`.
|
|
31
|
+
return Array.from( hooksStore.__current ).some(
|
|
32
|
+
( hook ) => hook.name === hookName
|
|
33
|
+
);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
|
package/src/createHooks.js
CHANGED
|
@@ -20,11 +20,11 @@ export class _Hooks {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
/** @type {import('.').Store} actions */
|
|
22
22
|
this.actions = Object.create( null );
|
|
23
|
-
this.actions.__current =
|
|
23
|
+
this.actions.__current = new Set();
|
|
24
24
|
|
|
25
25
|
/** @type {import('.').Store} filters */
|
|
26
26
|
this.filters = Object.create( null );
|
|
27
|
-
this.filters.__current =
|
|
27
|
+
this.filters.__current = new Set();
|
|
28
28
|
|
|
29
29
|
this.addAction = createAddHook( this, 'actions' );
|
|
30
30
|
this.addFilter = createAddHook( this, 'filters' );
|
|
@@ -34,8 +34,10 @@ export class _Hooks {
|
|
|
34
34
|
this.hasFilter = createHasHook( this, 'filters' );
|
|
35
35
|
this.removeAllActions = createRemoveHook( this, 'actions', true );
|
|
36
36
|
this.removeAllFilters = createRemoveHook( this, 'filters', true );
|
|
37
|
-
this.doAction = createRunHook( this, 'actions' );
|
|
38
|
-
this.
|
|
37
|
+
this.doAction = createRunHook( this, 'actions', false, false );
|
|
38
|
+
this.doActionAsync = createRunHook( this, 'actions', false, true );
|
|
39
|
+
this.applyFilters = createRunHook( this, 'filters', true, false );
|
|
40
|
+
this.applyFiltersAsync = createRunHook( this, 'filters', true, true );
|
|
39
41
|
this.currentAction = createCurrentHook( this, 'actions' );
|
|
40
42
|
this.currentFilter = createCurrentHook( this, 'filters' );
|
|
41
43
|
this.doingAction = createDoingHook( this, 'actions' );
|
package/src/createRunHook.js
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
* registered to a hook of the specified type, optionally returning the final
|
|
4
4
|
* value of the call chain.
|
|
5
5
|
*
|
|
6
|
-
* @param {import('.').Hooks} hooks
|
|
6
|
+
* @param {import('.').Hooks} hooks Hooks instance.
|
|
7
7
|
* @param {import('.').StoreKey} storeKey
|
|
8
|
-
* @param {boolean}
|
|
9
|
-
*
|
|
8
|
+
* @param {boolean} returnFirstArg Whether each hook callback is expected to return its first argument.
|
|
9
|
+
* @param {boolean} async Whether the hook callback should be run asynchronously
|
|
10
10
|
*
|
|
11
11
|
* @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
|
|
12
12
|
*/
|
|
13
|
-
function createRunHook( hooks, storeKey, returnFirstArg
|
|
14
|
-
return function
|
|
13
|
+
function createRunHook( hooks, storeKey, returnFirstArg, async ) {
|
|
14
|
+
return function runHook( hookName, ...args ) {
|
|
15
15
|
const hooksStore = hooks[ storeKey ];
|
|
16
16
|
|
|
17
17
|
if ( ! hooksStore[ hookName ] ) {
|
|
@@ -42,26 +42,43 @@ function createRunHook( hooks, storeKey, returnFirstArg = false ) {
|
|
|
42
42
|
currentIndex: 0,
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
async function asyncRunner() {
|
|
46
|
+
try {
|
|
47
|
+
hooksStore.__current.add( hookInfo );
|
|
48
|
+
let result = returnFirstArg ? args[ 0 ] : undefined;
|
|
49
|
+
while ( hookInfo.currentIndex < handlers.length ) {
|
|
50
|
+
const handler = handlers[ hookInfo.currentIndex ];
|
|
51
|
+
result = await handler.callback.apply( null, args );
|
|
52
|
+
if ( returnFirstArg ) {
|
|
53
|
+
args[ 0 ] = result;
|
|
54
|
+
}
|
|
55
|
+
hookInfo.currentIndex++;
|
|
56
|
+
}
|
|
57
|
+
return returnFirstArg ? result : undefined;
|
|
58
|
+
} finally {
|
|
59
|
+
hooksStore.__current.delete( hookInfo );
|
|
53
60
|
}
|
|
54
|
-
|
|
55
|
-
hookInfo.currentIndex++;
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
function syncRunner() {
|
|
64
|
+
try {
|
|
65
|
+
hooksStore.__current.add( hookInfo );
|
|
66
|
+
let result = returnFirstArg ? args[ 0 ] : undefined;
|
|
67
|
+
while ( hookInfo.currentIndex < handlers.length ) {
|
|
68
|
+
const handler = handlers[ hookInfo.currentIndex ];
|
|
69
|
+
result = handler.callback.apply( null, args );
|
|
70
|
+
if ( returnFirstArg ) {
|
|
71
|
+
args[ 0 ] = result;
|
|
72
|
+
}
|
|
73
|
+
hookInfo.currentIndex++;
|
|
74
|
+
}
|
|
75
|
+
return returnFirstArg ? result : undefined;
|
|
76
|
+
} finally {
|
|
77
|
+
hooksStore.__current.delete( hookInfo );
|
|
78
|
+
}
|
|
62
79
|
}
|
|
63
80
|
|
|
64
|
-
return
|
|
81
|
+
return ( async ? asyncRunner : syncRunner )();
|
|
65
82
|
};
|
|
66
83
|
}
|
|
67
84
|
|
package/src/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import createHooks from './createHooks';
|
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @typedef {Record<string, Hook> & {__current: Current
|
|
28
|
+
* @typedef {Record<string, Hook> & {__current: Set<Current>}} Store
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -48,7 +48,9 @@ const {
|
|
|
48
48
|
removeAllActions,
|
|
49
49
|
removeAllFilters,
|
|
50
50
|
doAction,
|
|
51
|
+
doActionAsync,
|
|
51
52
|
applyFilters,
|
|
53
|
+
applyFiltersAsync,
|
|
52
54
|
currentAction,
|
|
53
55
|
currentFilter,
|
|
54
56
|
doingAction,
|
|
@@ -70,7 +72,9 @@ export {
|
|
|
70
72
|
removeAllActions,
|
|
71
73
|
removeAllFilters,
|
|
72
74
|
doAction,
|
|
75
|
+
doActionAsync,
|
|
73
76
|
applyFilters,
|
|
77
|
+
applyFiltersAsync,
|
|
74
78
|
currentAction,
|
|
75
79
|
currentFilter,
|
|
76
80
|
doingAction,
|
package/src/test/index.test.js
CHANGED
|
@@ -12,7 +12,9 @@ import {
|
|
|
12
12
|
removeAllActions,
|
|
13
13
|
removeAllFilters,
|
|
14
14
|
doAction,
|
|
15
|
+
doActionAsync,
|
|
15
16
|
applyFilters,
|
|
17
|
+
applyFiltersAsync,
|
|
16
18
|
currentAction,
|
|
17
19
|
currentFilter,
|
|
18
20
|
doingAction,
|
|
@@ -943,3 +945,151 @@ test( 'checking hasFilter with named callbacks and removeAllActions', () => {
|
|
|
943
945
|
expect( hasFilter( 'test.filter', 'my_callback' ) ).toBe( false );
|
|
944
946
|
expect( hasFilter( 'test.filter', 'my_second_callback' ) ).toBe( false );
|
|
945
947
|
} );
|
|
948
|
+
|
|
949
|
+
describe( 'async filter', () => {
|
|
950
|
+
test( 'runs all registered handlers', async () => {
|
|
951
|
+
addFilter( 'test.async.filter', 'callback_plus1', ( value ) => {
|
|
952
|
+
return new Promise( ( r ) =>
|
|
953
|
+
setTimeout( () => r( value + 1 ), 10 )
|
|
954
|
+
);
|
|
955
|
+
} );
|
|
956
|
+
addFilter( 'test.async.filter', 'callback_times2', ( value ) => {
|
|
957
|
+
return new Promise( ( r ) =>
|
|
958
|
+
setTimeout( () => r( value * 2 ), 10 )
|
|
959
|
+
);
|
|
960
|
+
} );
|
|
961
|
+
|
|
962
|
+
expect( await applyFiltersAsync( 'test.async.filter', 2 ) ).toBe( 6 );
|
|
963
|
+
} );
|
|
964
|
+
|
|
965
|
+
test( 'aborts when handler throws an error', async () => {
|
|
966
|
+
const sqrt = jest.fn( async ( value ) => {
|
|
967
|
+
if ( value < 0 ) {
|
|
968
|
+
throw new Error( 'cannot pass negative value to sqrt' );
|
|
969
|
+
}
|
|
970
|
+
return Math.sqrt( value );
|
|
971
|
+
} );
|
|
972
|
+
|
|
973
|
+
const plus1 = jest.fn( async ( value ) => {
|
|
974
|
+
return value + 1;
|
|
975
|
+
} );
|
|
976
|
+
|
|
977
|
+
addFilter( 'test.async.filter', 'callback_sqrt', sqrt );
|
|
978
|
+
addFilter( 'test.async.filter', 'callback_plus1', plus1 );
|
|
979
|
+
|
|
980
|
+
await expect(
|
|
981
|
+
applyFiltersAsync( 'test.async.filter', -1 )
|
|
982
|
+
).rejects.toThrow( 'cannot pass negative value to sqrt' );
|
|
983
|
+
expect( sqrt ).toHaveBeenCalledTimes( 1 );
|
|
984
|
+
expect( plus1 ).not.toHaveBeenCalled();
|
|
985
|
+
} );
|
|
986
|
+
|
|
987
|
+
test( 'is correctly tracked by doingFilter and didFilter', async () => {
|
|
988
|
+
addFilter( 'test.async.filter', 'callback_doing', async ( value ) => {
|
|
989
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
990
|
+
expect( doingFilter( 'test.async.filter' ) ).toBe( true );
|
|
991
|
+
return value;
|
|
992
|
+
} );
|
|
993
|
+
|
|
994
|
+
expect( doingFilter( 'test.async.filter' ) ).toBe( false );
|
|
995
|
+
expect( didFilter( 'test.async.filter' ) ).toBe( 0 );
|
|
996
|
+
await applyFiltersAsync( 'test.async.filter', 0 );
|
|
997
|
+
expect( doingFilter( 'test.async.filter' ) ).toBe( false );
|
|
998
|
+
expect( didFilter( 'test.async.filter' ) ).toBe( 1 );
|
|
999
|
+
} );
|
|
1000
|
+
|
|
1001
|
+
test( 'is correctly tracked when multiple filters run at once', async () => {
|
|
1002
|
+
addFilter( 'test.async.filter1', 'callback_doing', async ( value ) => {
|
|
1003
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1004
|
+
expect( doingFilter( 'test.async.filter1' ) ).toBe( true );
|
|
1005
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1006
|
+
return value;
|
|
1007
|
+
} );
|
|
1008
|
+
addFilter( 'test.async.filter2', 'callback_doing', async ( value ) => {
|
|
1009
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1010
|
+
expect( doingFilter( 'test.async.filter2' ) ).toBe( true );
|
|
1011
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1012
|
+
return value;
|
|
1013
|
+
} );
|
|
1014
|
+
|
|
1015
|
+
await Promise.all( [
|
|
1016
|
+
applyFiltersAsync( 'test.async.filter1', 0 ),
|
|
1017
|
+
applyFiltersAsync( 'test.async.filter2', 0 ),
|
|
1018
|
+
] );
|
|
1019
|
+
} );
|
|
1020
|
+
} );
|
|
1021
|
+
|
|
1022
|
+
describe( 'async action', () => {
|
|
1023
|
+
test( 'runs all registered handlers sequentially', async () => {
|
|
1024
|
+
const outputs = [];
|
|
1025
|
+
const action1 = async () => {
|
|
1026
|
+
outputs.push( 1 );
|
|
1027
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1028
|
+
outputs.push( 2 );
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
const action2 = async () => {
|
|
1032
|
+
outputs.push( 3 );
|
|
1033
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1034
|
+
outputs.push( 4 );
|
|
1035
|
+
};
|
|
1036
|
+
|
|
1037
|
+
addAction( 'test.async.action', 'action1', action1 );
|
|
1038
|
+
addAction( 'test.async.action', 'action2', action2 );
|
|
1039
|
+
|
|
1040
|
+
await doActionAsync( 'test.async.action' );
|
|
1041
|
+
expect( outputs ).toEqual( [ 1, 2, 3, 4 ] );
|
|
1042
|
+
} );
|
|
1043
|
+
|
|
1044
|
+
test( 'aborts when handler throws an error', async () => {
|
|
1045
|
+
const outputs = [];
|
|
1046
|
+
const action1 = async () => {
|
|
1047
|
+
throw new Error( 'aborting' );
|
|
1048
|
+
};
|
|
1049
|
+
|
|
1050
|
+
const action2 = async () => {
|
|
1051
|
+
outputs.push( 3 );
|
|
1052
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1053
|
+
outputs.push( 4 );
|
|
1054
|
+
};
|
|
1055
|
+
|
|
1056
|
+
addAction( 'test.async.action', 'action1', action1 );
|
|
1057
|
+
addAction( 'test.async.action', 'action2', action2 );
|
|
1058
|
+
|
|
1059
|
+
await expect( doActionAsync( 'test.async.action' ) ).rejects.toThrow(
|
|
1060
|
+
'aborting'
|
|
1061
|
+
);
|
|
1062
|
+
expect( outputs ).toEqual( [] );
|
|
1063
|
+
} );
|
|
1064
|
+
|
|
1065
|
+
test( 'is correctly tracked by doingAction and didAction', async () => {
|
|
1066
|
+
addAction( 'test.async.action', 'callback_doing', async () => {
|
|
1067
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1068
|
+
expect( doingAction( 'test.async.action' ) ).toBe( true );
|
|
1069
|
+
} );
|
|
1070
|
+
|
|
1071
|
+
expect( doingAction( 'test.async.action' ) ).toBe( false );
|
|
1072
|
+
expect( didAction( 'test.async.action' ) ).toBe( 0 );
|
|
1073
|
+
await doActionAsync( 'test.async.action', 0 );
|
|
1074
|
+
expect( doingAction( 'test.async.action' ) ).toBe( false );
|
|
1075
|
+
expect( didAction( 'test.async.action' ) ).toBe( 1 );
|
|
1076
|
+
} );
|
|
1077
|
+
|
|
1078
|
+
test( 'is correctly tracked when multiple actions run at once', async () => {
|
|
1079
|
+
addAction( 'test.async.action1', 'callback_doing', async () => {
|
|
1080
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1081
|
+
expect( doingAction( 'test.async.action1' ) ).toBe( true );
|
|
1082
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1083
|
+
} );
|
|
1084
|
+
addAction( 'test.async.action2', 'callback_doing', async () => {
|
|
1085
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1086
|
+
expect( doingAction( 'test.async.action2' ) ).toBe( true );
|
|
1087
|
+
await new Promise( ( r ) => setTimeout( () => r(), 10 ) );
|
|
1088
|
+
} );
|
|
1089
|
+
|
|
1090
|
+
await Promise.all( [
|
|
1091
|
+
doActionAsync( 'test.async.action1', 0 ),
|
|
1092
|
+
doActionAsync( 'test.async.action2', 0 ),
|
|
1093
|
+
] );
|
|
1094
|
+
} );
|
|
1095
|
+
} );
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.string.d.ts","../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.object.d.ts","../../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/validateNamespace.js","./src/validateHookName.js","./src/createRemoveHook.js","./src/createHasHook.js","./src/createRunHook.js","./src/createCurrentHook.js","./src/createDoingHook.js","./src/createDidHook.js","./src/createHooks.js","./src/index.js","./src/createAddHook.js","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"16fb2ca91cf5fe9e857e5214a31311487524ae87e69b23c7371040bb1a82eaa2","signature":"b5497c7dc69c7b5229d0b905c891103ab9b51bfa4d4687992898c4ed5425216f"},{"version":"acf2c9ac7d645ac867c9c6cf8238b1bf9d592c21e9aff3253aecbc546b605858","signature":"9b1069a77f42334ed54cd4e68591b85bf26e5f47052bb3049b52ebd9b7543520"},{"version":"6ade2d4a5b7fbd0d08bed49004ff33b2a39d8e90886a639f6014de17ecc15510","signature":"406a8b30598c33638390e65c1b18d65804784069a176ec900aa033b2b0038673"},{"version":"5c268d6816af1e751d387a9e573e9376cce62aeef7c7f772aa0572f9aab31726","signature":"0b48405ec967a9982c1001d4222b1c64091aba1441fc4318b08bc1cd4036794a"},{"version":"44eca2f22f2f3fb8dfc8d42a6a0d59305e70759127c97a6c18f39ac791fa6c61","signature":"62badc47276ffa34cdc3ea50af5d6e9be875a4416be39a468286462c75b37fcf"},{"version":"26df58dcd89c4225b8d5fe7acd52c98237eb8420e259b6401a257f4f241628fe","signature":"cba32c3504f555c7210c70e4f45ee7f364eb7e12fc1ed9015806a5b36ed44f0c"},{"version":"90acf630245d1df8d3bc9ddadbb686ca41cbbafd03436b9b1a816d62be4beabc","signature":"12324a25a603147ab9cf9724d762a767dd8b22c3b4f3ea44357bb937565509c3"},{"version":"062731f93b86ef4bdf0f4f26b28248169cc6beb751c6c20626655f9342e31b6a","signature":"7966497f2357f63036d7c12917ee20d91b7a74c4d9d682e75c44f7b7f6ea4e5b"},{"version":"8835293f95a59a22184bd02c10230993231124240e6da9f6844ee7902ea1ca3f","signature":"154d6cd3d408e0ac27d063a1c05eba3fbe6218643059f07abf83a8db7b78e5cc"},{"version":"27aec6ca27a761f6f7de7f0481b1bf13e82b127e9f6de77c2fdae142c0be2ec7","signature":"0213daac422dfdc25a92d4a95859fb7d9d451fdd67fa675d3705884289019fd9"},{"version":"60282105d2e5ca8103d56b34a8a4dd200f2565529638bf299ad4c31d6c696307","signature":"20f2b0befb27c07049565340fac3ab264c94afebacb3234dfb945e1c4a8ab5fb"},{"version":"cd62baba8e325afe998a6537894fcc0420146c242e1b6fdfdaaadfd21dc0d969","affectsGlobalScope":true}],"root":[[74,84]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"fileIdsList":[[74,75,83],[83],[75,83],[76,77,78,79,80,81,83,84],[82]],"referencedMap":[[84,1],[79,2],[81,3],[80,2],[77,2],[82,4],[76,1],[78,2],[83,5]],"latestChangedDtsFile":"./build-types/createAddHook.d.ts"},"version":"5.5.3"}
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/typescript/lib/lib.es2023.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../node_modules/typescript/lib/lib.esnext.string.d.ts","../../node_modules/typescript/lib/lib.esnext.promise.d.ts","../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../node_modules/typescript/lib/lib.esnext.object.d.ts","../../node_modules/typescript/lib/lib.esnext.regexp.d.ts","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","./src/validateNamespace.js","./src/validateHookName.js","./src/createRemoveHook.js","./src/createHasHook.js","./src/createRunHook.js","./src/createCurrentHook.js","./src/createDoingHook.js","./src/createDidHook.js","./src/createHooks.js","./src/index.js","./src/createAddHook.js","../../typings/gutenberg-env/index.d.ts"],"fileInfos":[{"version":"44e584d4f6444f58791784f1d530875970993129442a847597db702a073ca68c","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","9a68c0c07ae2fa71b44384a839b7b8d81662a236d4b9ac30916718f7510b1b2d","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","27bdc30a0e32783366a5abeda841bc22757c1797de8681bbe81fbc735eeb1c10","17edc026abf73c5c2dd508652d63f68ec4efd9d4856e3469890d27598209feb5",{"version":"4af6b0c727b7a2896463d512fafd23634229adf69ac7c00e2ae15a09cb084fad","affectsGlobalScope":true},{"version":"9c00a480825408b6a24c63c1b71362232927247595d7c97659bc24dc68ae0757","affectsGlobalScope":true},{"version":"6920e1448680767498a0b77c6a00a8e77d14d62c3da8967b171f1ddffa3c18e4","affectsGlobalScope":true},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"bc47685641087c015972a3f072480889f0d6c65515f12bd85222f49a98952ed7","affectsGlobalScope":true},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true},{"version":"93495ff27b8746f55d19fcbcdbaccc99fd95f19d057aed1bd2c0cafe1335fbf0","affectsGlobalScope":true},{"version":"6fc23bb8c3965964be8c597310a2878b53a0306edb71d4b5a4dfe760186bcc01","affectsGlobalScope":true},{"version":"ea011c76963fb15ef1cdd7ce6a6808b46322c527de2077b6cfdf23ae6f5f9ec7","affectsGlobalScope":true},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true},{"version":"bb42a7797d996412ecdc5b2787720de477103a0b2e53058569069a0e2bae6c7e","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"b541a838a13f9234aba650a825393ffc2292dc0fc87681a5d81ef0c96d281e7a","affectsGlobalScope":true},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true},{"version":"ae37d6ccd1560b0203ab88d46987393adaaa78c919e51acf32fb82c86502e98c","affectsGlobalScope":true},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"5e07ed3809d48205d5b985642a59f2eba47c402374a7cf8006b686f79efadcbd","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"479553e3779be7d4f68e9f40cdb82d038e5ef7592010100410723ceced22a0f7","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"d3d7b04b45033f57351c8434f60b6be1ea71a2dfec2d0a0c3c83badbb0e3e693","affectsGlobalScope":true},{"version":"956d27abdea9652e8368ce029bb1e0b9174e9678a273529f426df4b3d90abd60","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"e6633e05da3ff36e6da2ec170d0d03ccf33de50ca4dc6f5aeecb572cedd162fb","affectsGlobalScope":true},{"version":"d8670852241d4c6e03f2b89d67497a4bbefe29ecaa5a444e2c11a9b05e6fccc6","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"caccc56c72713969e1cfe5c3d44e5bab151544d9d2b373d7dbe5a1e4166652be","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true},{"version":"08a58483392df5fcc1db57d782e87734f77ae9eab42516028acbfe46f29a3ef7","affectsGlobalScope":true},{"version":"436aaf437562f276ec2ddbee2f2cdedac7664c1e4c1d2c36839ddd582eeb3d0a","affectsGlobalScope":true},{"version":"8e3c06ea092138bf9fa5e874a1fdbc9d54805d074bee1de31b99a11e2fec239d","affectsGlobalScope":true},{"version":"0b11f3ca66aa33124202c80b70cd203219c3d4460cfc165e0707aa9ec710fc53","affectsGlobalScope":true},{"version":"6a3f5a0129cc80cf439ab71164334d649b47059a4f5afca90282362407d0c87f","affectsGlobalScope":true},{"version":"811c71eee4aa0ac5f7adf713323a5c41b0cf6c4e17367a34fbce379e12bbf0a4","affectsGlobalScope":true},{"version":"15b98a533864d324e5f57cd3cfc0579b231df58c1c0f6063ea0fcb13c3c74ff9","affectsGlobalScope":true},{"version":"0a6282c8827e4b9a95f4bf4f5c205673ada31b982f50572d27103df8ceb8013c","affectsGlobalScope":true},{"version":"ac77cb3e8c6d3565793eb90a8373ee8033146315a3dbead3bde8db5eaf5e5ec6","affectsGlobalScope":true},{"version":"d4b1d2c51d058fc21ec2629fff7a76249dec2e36e12960ea056e3ef89174080f","affectsGlobalScope":true},{"version":"2fef54945a13095fdb9b84f705f2b5994597640c46afeb2ce78352fab4cb3279","affectsGlobalScope":true},{"version":"56e4ed5aab5f5920980066a9409bfaf53e6d21d3f8d020c17e4de584d29600ad","affectsGlobalScope":true},{"version":"33358442698bb565130f52ba79bfd3d4d484ac85fe33f3cb1759c54d18201393","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"16fb2ca91cf5fe9e857e5214a31311487524ae87e69b23c7371040bb1a82eaa2","signature":"b5497c7dc69c7b5229d0b905c891103ab9b51bfa4d4687992898c4ed5425216f"},{"version":"acf2c9ac7d645ac867c9c6cf8238b1bf9d592c21e9aff3253aecbc546b605858","signature":"9b1069a77f42334ed54cd4e68591b85bf26e5f47052bb3049b52ebd9b7543520"},{"version":"6ade2d4a5b7fbd0d08bed49004ff33b2a39d8e90886a639f6014de17ecc15510","signature":"406a8b30598c33638390e65c1b18d65804784069a176ec900aa033b2b0038673"},{"version":"5c268d6816af1e751d387a9e573e9376cce62aeef7c7f772aa0572f9aab31726","signature":"0b48405ec967a9982c1001d4222b1c64091aba1441fc4318b08bc1cd4036794a"},{"version":"b5635ed8c0615131b296047b407baea64cd1673fb593c3d7e4a890dbe602a00f","signature":"f256b4c6469e0698e65216d1ed3378d5e433c1abe261b7b227d88cf4509524e4"},{"version":"4b4540f5d80dcd96c24a1f7ec24681dfa5d9761cb8a4abba54c6b2a9fa254b99","signature":"cba32c3504f555c7210c70e4f45ee7f364eb7e12fc1ed9015806a5b36ed44f0c"},{"version":"13cb1c07b4e5200c362fb7265b6bacc63984c536b688a2e5b32754fe5ad13671","signature":"12324a25a603147ab9cf9724d762a767dd8b22c3b4f3ea44357bb937565509c3"},{"version":"062731f93b86ef4bdf0f4f26b28248169cc6beb751c6c20626655f9342e31b6a","signature":"7966497f2357f63036d7c12917ee20d91b7a74c4d9d682e75c44f7b7f6ea4e5b"},{"version":"cee85c588cb78e9c801ae75ee12a68c5c5b53e7d689e750f6e7bccdd9878aa4a","signature":"4fa795e77b24d2a64eab73b8bc2c8c5992b629570e0c2bfc9bb475c312d79c65"},{"version":"aeb715f7ecb4a05818f7c05773dfff8ca0020ba069c23fa9cedbee7c29c18462","signature":"5061f5719dccae0d9ed5b195d2dc4ec5c08d1a34c84d57c7b3b9be8a820b58bd"},{"version":"60282105d2e5ca8103d56b34a8a4dd200f2565529638bf299ad4c31d6c696307","signature":"20f2b0befb27c07049565340fac3ab264c94afebacb3234dfb945e1c4a8ab5fb"},{"version":"cd62baba8e325afe998a6537894fcc0420146c242e1b6fdfdaaadfd21dc0d969","affectsGlobalScope":true}],"root":[[74,84]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"checkJs":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"rootDir":"./src","skipDefaultLibCheck":true,"strict":true,"target":99},"fileIdsList":[[74,75,83],[83],[75,83],[76,77,78,79,80,81,83,84],[82]],"referencedMap":[[84,1],[79,2],[81,3],[80,2],[77,2],[82,4],[76,1],[78,2],[83,5]],"latestChangedDtsFile":"./build-types/createAddHook.d.ts"},"version":"5.5.3"}
|