@wordpress/hooks 4.26.1-next.719a03cbe.0 → 4.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/createAddHook.js +5 -13
  3. package/build/createAddHook.js.map +1 -1
  4. package/build/createCurrentHook.js +7 -3
  5. package/build/createCurrentHook.js.map +1 -1
  6. package/build/createDidHook.js +4 -8
  7. package/build/createDidHook.js.map +1 -1
  8. package/build/createDoingHook.js +7 -8
  9. package/build/createDoingHook.js.map +1 -1
  10. package/build/createHasHook.js +8 -10
  11. package/build/createHasHook.js.map +1 -1
  12. package/build/createHooks.js +2 -8
  13. package/build/createHooks.js.map +1 -1
  14. package/build/createRemoveHook.js +8 -15
  15. package/build/createRemoveHook.js.map +1 -1
  16. package/build/createRunHook.js +9 -5
  17. package/build/createRunHook.js.map +1 -1
  18. package/build/index.js +36 -33
  19. package/build/index.js.map +1 -1
  20. package/build/types.js +6 -0
  21. package/build/types.js.map +1 -0
  22. package/build/validateHookName.js +4 -4
  23. package/build/validateHookName.js.map +1 -1
  24. package/build/validateNamespace.js +3 -3
  25. package/build/validateNamespace.js.map +1 -1
  26. package/build-module/createAddHook.js +5 -13
  27. package/build-module/createAddHook.js.map +1 -1
  28. package/build-module/createCurrentHook.js +7 -3
  29. package/build-module/createCurrentHook.js.map +1 -1
  30. package/build-module/createDidHook.js +4 -8
  31. package/build-module/createDidHook.js.map +1 -1
  32. package/build-module/createDoingHook.js +7 -8
  33. package/build-module/createDoingHook.js.map +1 -1
  34. package/build-module/createHasHook.js +8 -10
  35. package/build-module/createHasHook.js.map +1 -1
  36. package/build-module/createHooks.js +1 -8
  37. package/build-module/createHooks.js.map +1 -1
  38. package/build-module/createRemoveHook.js +8 -15
  39. package/build-module/createRemoveHook.js.map +1 -1
  40. package/build-module/createRunHook.js +9 -5
  41. package/build-module/createRunHook.js.map +1 -1
  42. package/build-module/index.js +1 -34
  43. package/build-module/index.js.map +1 -1
  44. package/build-module/types.js +2 -0
  45. package/build-module/types.js.map +1 -0
  46. package/build-module/validateHookName.js +4 -4
  47. package/build-module/validateHookName.js.map +1 -1
  48. package/build-module/validateNamespace.js +3 -3
  49. package/build-module/validateNamespace.js.map +1 -1
  50. package/build-types/createAddHook.d.ts +22 -14
  51. package/build-types/createAddHook.d.ts.map +1 -1
  52. package/build-types/createCurrentHook.d.ts +9 -5
  53. package/build-types/createCurrentHook.d.ts.map +1 -1
  54. package/build-types/createDidHook.d.ts +11 -13
  55. package/build-types/createDidHook.d.ts.map +1 -1
  56. package/build-types/createDoingHook.d.ts +12 -12
  57. package/build-types/createDoingHook.d.ts.map +1 -1
  58. package/build-types/createHasHook.d.ts +16 -14
  59. package/build-types/createHasHook.d.ts.map +1 -1
  60. package/build-types/createHooks.d.ts +35 -26
  61. package/build-types/createHooks.d.ts.map +1 -1
  62. package/build-types/createRemoveHook.d.ts +16 -18
  63. package/build-types/createRemoveHook.d.ts.map +1 -1
  64. package/build-types/createRunHook.d.ts +12 -7
  65. package/build-types/createRunHook.d.ts.map +1 -1
  66. package/build-types/index.d.ts +5 -86
  67. package/build-types/index.d.ts.map +1 -1
  68. package/build-types/types.d.ts +27 -0
  69. package/build-types/types.d.ts.map +1 -0
  70. package/build-types/validateHookName.d.ts +5 -5
  71. package/build-types/validateHookName.d.ts.map +1 -1
  72. package/build-types/validateNamespace.d.ts +4 -4
  73. package/build-types/validateNamespace.d.ts.map +1 -1
  74. package/package.json +2 -2
  75. package/src/{createAddHook.js → createAddHook.ts} +29 -16
  76. package/src/{createCurrentHook.js → createCurrentHook.ts} +12 -4
  77. package/src/{createDidHook.js → createDidHook.ts} +12 -9
  78. package/src/{createDoingHook.js → createDoingHook.ts} +15 -9
  79. package/src/{createHasHook.js → createHasHook.ts} +19 -11
  80. package/src/{createHooks.js → createHooks.ts} +26 -5
  81. package/src/{createRemoveHook.js → createRemoveHook.ts} +24 -16
  82. package/src/{createRunHook.js → createRunHook.ts} +21 -6
  83. package/src/{index.js → index.ts} +1 -32
  84. package/src/types.ts +31 -0
  85. package/src/{validateHookName.js → validateHookName.ts} +5 -5
  86. package/src/{validateNamespace.js → validateNamespace.ts} +4 -4
  87. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 4.27.0 (2025-07-23)
6
+
5
7
  ## 4.26.0 (2025-06-25)
6
8
 
7
9
  ## 4.25.0 (2025-06-04)
@@ -5,30 +5,24 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _validateNamespace = _interopRequireDefault(require("./validateNamespace.js"));
9
- var _validateHookName = _interopRequireDefault(require("./validateHookName.js"));
8
+ var _validateNamespace = _interopRequireDefault(require("./validateNamespace"));
9
+ var _validateHookName = _interopRequireDefault(require("./validateHookName"));
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
14
  /**
15
- * @callback AddHook
16
15
  *
17
16
  * Adds the hook to the appropriate hooks container.
18
- *
19
- * @param {string} hookName Name of hook to add
20
- * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.
21
- * @param {import('.').Callback} callback Function to call when the hook is run
22
- * @param {number} [priority=10] Priority of this hook
23
17
  */
24
18
 
25
19
  /**
26
20
  * Returns a function which, when invoked, will add a hook.
27
21
  *
28
- * @param {import('.').Hooks} hooks Hooks instance.
29
- * @param {import('.').StoreKey} storeKey
22
+ * @param hooks Hooks instance.
23
+ * @param storeKey
30
24
  *
31
- * @return {AddHook} Function that adds a new hook.
25
+ * @return Function that adds a new hook.
32
26
  */
33
27
  function createAddHook(hooks, storeKey) {
34
28
  return function addHook(hookName, namespace, callback, priority = 10) {
@@ -59,8 +53,6 @@ function createAddHook(hooks, storeKey) {
59
53
  if (hooksStore[hookName]) {
60
54
  // Find the correct insert index of the new hook.
61
55
  const handlers = hooksStore[hookName].handlers;
62
-
63
- /** @type {number} */
64
56
  let i;
65
57
  for (i = handlers.length; i > 0; i--) {
66
58
  if (priority >= handlers[i - 1].priority) {
@@ -1 +1 @@
1
- {"version":3,"names":["_validateNamespace","_interopRequireDefault","require","_validateHookName","createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","validateHookName","validateNamespace","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction","_default","exports","default"],"sources":["@wordpress/hooks/src/createAddHook.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback AddHook\n *\n * Adds the hook to the appropriate hooks container.\n *\n * @param {string} hookName Name of hook to add\n * @param {string} namespace The unique namespace identifying the callback in the form `vendor/plugin/function`.\n * @param {import('.').Callback} callback Function to call when the hook is run\n * @param {number} [priority=10] Priority of this hook\n */\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {AddHook} Function that adds a new hook.\n */\nfunction createAddHook( hooks, storeKey ) {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\t/** @type {number} */\n\t\t\tlet i;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,aAAaA,CAAE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,IAAM;QAC7C,IACCA,QAAQ,CAACC,IAAI,KAAKjB,QAAQ,IAC1BgB,QAAQ,CAACE,YAAY,IAAIP,CAAC,EACzB;UACDK,QAAQ,CAACE,YAAY,EAAE;QACxB;MACD,CAAE,CAAC;IACJ,CAAC,MAAM;MACN;MACAd,UAAU,CAAEJ,QAAQ,CAAE,GAAG;QACxBU,QAAQ,EAAE,CAAED,OAAO,CAAE;QACrBU,IAAI,EAAE;MACP,CAAC;IACF;IAEA,IAAKnB,QAAQ,KAAK,WAAW,EAAG;MAC/BH,KAAK,CAACuB,QAAQ,CACb,WAAW,EACXpB,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QACD,CAAC;IACF;EACD,CAAC;AACF;AAAC,IAAAkB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3B,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_validateNamespace","_interopRequireDefault","require","_validateHookName","createAddHook","hooks","storeKey","addHook","hookName","namespace","callback","priority","hooksStore","validateHookName","validateNamespace","console","error","handler","handlers","i","length","splice","__current","forEach","hookInfo","name","currentIndex","runs","doAction","_default","exports","default"],"sources":["@wordpress/hooks/src/createAddHook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace';\nimport validateHookName from './validateHookName';\nimport type { Callback, Hooks, StoreKey } from '.';\nimport type { Handler, HookInfo } from './types';\n\n/**\n *\n * Adds the hook to the appropriate hooks container.\n */\nexport type AddHook = (\n\t/**\n\t * Name of hook to add\n\t */\n\thookName: string,\n\t/**\n\t * The unique namespace identifying the callback in the form.\n\t */\n\tnamespace: string,\n\t/**\n\t * Function to call when the hook is run.\n\t */\n\tcallback: Callback,\n\t/**\n\t * Priority of this hook\n\t */\n\tpriority?: number\n) => void;\n\n/**\n * Returns a function which, when invoked, will add a hook.\n *\n * @param hooks Hooks instance.\n * @param storeKey\n *\n * @return Function that adds a new hook.\n */\nfunction createAddHook( hooks: Hooks, storeKey: StoreKey ): AddHook {\n\treturn function addHook( hookName, namespace, callback, priority = 10 ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( 'function' !== typeof callback ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error( 'The hook callback must be a function.' );\n\t\t\treturn;\n\t\t}\n\n\t\t// Validate numeric priority\n\t\tif ( 'number' !== typeof priority ) {\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.error(\n\t\t\t\t'If specified, the hook priority must be a number.'\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst handler: Handler = { callback, priority, namespace };\n\n\t\tif ( hooksStore[ hookName ] ) {\n\t\t\t// Find the correct insert index of the new hook.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\n\t\t\tlet i: number;\n\t\t\tfor ( i = handlers.length; i > 0; i-- ) {\n\t\t\t\tif ( priority >= handlers[ i - 1 ].priority ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( i === handlers.length ) {\n\t\t\t\t// If append, operate via direct assignment.\n\t\t\t\thandlers[ i ] = handler;\n\t\t\t} else {\n\t\t\t\t// Otherwise, insert before index via splice.\n\t\t\t\thandlers.splice( i, 0, handler );\n\t\t\t}\n\n\t\t\t// We may also be currently executing this hook. If the callback\n\t\t\t// we're adding would come after the current callback, there's no\n\t\t\t// problem; otherwise we need to increase the execution index of\n\t\t\t// any other runs by 1 to account for the added element.\n\t\t\thooksStore.__current.forEach( ( hookInfo: HookInfo ) => {\n\t\t\t\tif (\n\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t) {\n\t\t\t\t\thookInfo.currentIndex++;\n\t\t\t\t}\n\t\t\t} );\n\t\t} else {\n\t\t\t// This is the first hook of its type.\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\thandlers: [ handler ],\n\t\t\t\truns: 0,\n\t\t\t};\n\t\t}\n\n\t\tif ( hookName !== 'hookAdded' ) {\n\t\t\thooks.doAction(\n\t\t\t\t'hookAdded',\n\t\t\t\thookName,\n\t\t\t\tnamespace,\n\t\t\t\tcallback,\n\t\t\t\tpriority\n\t\t\t);\n\t\t}\n\t};\n}\n\nexport default createAddHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAMA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,aAAaA,CAAEC,KAAY,EAAEC,QAAkB,EAAY;EACnE,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,GAAG,EAAE,EAAG;IACvE,MAAMC,UAAU,GAAGP,KAAK,CAAEC,QAAQ,CAAE;IAEpC,IAAK,CAAE,IAAAO,yBAAgB,EAAEL,QAAS,CAAC,EAAG;MACrC;IACD;IAEA,IAAK,CAAE,IAAAM,0BAAiB,EAAEL,SAAU,CAAC,EAAG;MACvC;IACD;IAEA,IAAK,UAAU,KAAK,OAAOC,QAAQ,EAAG;MACrC;MACAK,OAAO,CAACC,KAAK,CAAE,uCAAwC,CAAC;MACxD;IACD;;IAEA;IACA,IAAK,QAAQ,KAAK,OAAOL,QAAQ,EAAG;MACnC;MACAI,OAAO,CAACC,KAAK,CACZ,mDACD,CAAC;MACD;IACD;IAEA,MAAMC,OAAgB,GAAG;MAAEP,QAAQ;MAAEC,QAAQ;MAAEF;IAAU,CAAC;IAE1D,IAAKG,UAAU,CAAEJ,QAAQ,CAAE,EAAG;MAC7B;MACA,MAAMU,QAAQ,GAAGN,UAAU,CAAEJ,QAAQ,CAAE,CAACU,QAAQ;MAEhD,IAAIC,CAAS;MACb,KAAMA,CAAC,GAAGD,QAAQ,CAACE,MAAM,EAAED,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAG;QACvC,IAAKR,QAAQ,IAAIO,QAAQ,CAAEC,CAAC,GAAG,CAAC,CAAE,CAACR,QAAQ,EAAG;UAC7C;QACD;MACD;MAEA,IAAKQ,CAAC,KAAKD,QAAQ,CAACE,MAAM,EAAG;QAC5B;QACAF,QAAQ,CAAEC,CAAC,CAAE,GAAGF,OAAO;MACxB,CAAC,MAAM;QACN;QACAC,QAAQ,CAACG,MAAM,CAAEF,CAAC,EAAE,CAAC,EAAEF,OAAQ,CAAC;MACjC;;MAEA;MACA;MACA;MACA;MACAL,UAAU,CAACU,SAAS,CAACC,OAAO,CAAIC,QAAkB,IAAM;QACvD,IACCA,QAAQ,CAACC,IAAI,KAAKjB,QAAQ,IAC1BgB,QAAQ,CAACE,YAAY,IAAIP,CAAC,EACzB;UACDK,QAAQ,CAACE,YAAY,EAAE;QACxB;MACD,CAAE,CAAC;IACJ,CAAC,MAAM;MACN;MACAd,UAAU,CAAEJ,QAAQ,CAAE,GAAG;QACxBU,QAAQ,EAAE,CAAED,OAAO,CAAE;QACrBU,IAAI,EAAE;MACP,CAAC;IACF;IAEA,IAAKnB,QAAQ,KAAK,WAAW,EAAG;MAC/BH,KAAK,CAACuB,QAAQ,CACb,WAAW,EACXpB,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,QACD,CAAC;IACF;EACD,CAAC;AACF;AAAC,IAAAkB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc3B,aAAa","ignoreList":[]}
@@ -4,15 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
7
11
  /**
8
12
  * Returns a function which, when invoked, will return the name of the
9
13
  * currently running hook, or `null` if no hook of the given type is currently
10
14
  * running.
11
15
  *
12
- * @param {import('.').Hooks} hooks Hooks instance.
13
- * @param {import('.').StoreKey} storeKey
16
+ * @param hooks Hooks instance.
17
+ * @param storeKey
14
18
  *
15
- * @return {() => string | null} Function that returns the current hook name or null.
19
+ * @return Function that returns the current hook name or null.
16
20
  */
17
21
  function createCurrentHook(hooks, storeKey) {
18
22
  return function currentHook() {
@@ -1 +1 @@
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":[]}
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.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Hooks, StoreKey } from './types';\n\n/**\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 hooks Hooks instance.\n * @param storeKey\n *\n * @return Function that returns the current hook name or null.\n */\nfunction createCurrentHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey\n): () => string | null {\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;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAiBA,CACzBC,KAAY,EACZC,QAAkB,EACI;EACtB,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":[]}
@@ -5,29 +5,25 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _validateHookName = _interopRequireDefault(require("./validateHookName.js"));
8
+ var _validateHookName = _interopRequireDefault(require("./validateHookName"));
9
9
  /**
10
10
  * Internal dependencies
11
11
  */
12
12
 
13
13
  /**
14
- * @callback DidHook
15
14
  *
16
15
  * Returns the number of times an action has been fired.
17
16
  *
18
- * @param {string} hookName The hook name to check.
19
- *
20
- * @return {number | undefined} The number of times the hook has run.
21
17
  */
22
18
 
23
19
  /**
24
20
  * Returns a function which, when invoked, will return the number of times a
25
21
  * hook has been called.
26
22
  *
27
- * @param {import('.').Hooks} hooks Hooks instance.
28
- * @param {import('.').StoreKey} storeKey
23
+ * @param hooks Hooks instance.
24
+ * @param storeKey
29
25
  *
30
- * @return {DidHook} Function that returns a hook's call count.
26
+ * @return Function that returns a hook's call count.
31
27
  */
32
28
  function createDidHook(hooks, storeKey) {
33
29
  return function didHook(hookName) {
@@ -1 +1 @@
1
- {"version":3,"names":["_validateHookName","_interopRequireDefault","require","createDidHook","hooks","storeKey","didHook","hookName","hooksStore","validateHookName","runs","_default","exports","default"],"sources":["@wordpress/hooks/src/createDidHook.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback DidHook\n *\n * Returns the number of times an action has been fired.\n *\n * @param {string} hookName The hook name to check.\n *\n * @return {number | undefined} The number of times the hook has run.\n */\n\n/**\n * Returns a function which, when invoked, will return the number of times a\n * hook has been called.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {DidHook} Function that returns a hook's call count.\n */\nfunction createDidHook( hooks, storeKey ) {\n\treturn function didHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn hooksStore[ hookName ] && hooksStore[ hookName ].runs\n\t\t\t? hooksStore[ hookName ].runs\n\t\t\t: 0;\n\t};\n}\n\nexport default createDidHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EACzC,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAG;IACnC,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;IAEpC,IAAK,CAAE,IAAAI,yBAAgB,EAAEF,QAAS,CAAC,EAAG;MACrC;IACD;IAEA,OAAOC,UAAU,CAAED,QAAQ,CAAE,IAAIC,UAAU,CAAED,QAAQ,CAAE,CAACG,IAAI,GACzDF,UAAU,CAAED,QAAQ,CAAE,CAACG,IAAI,GAC3B,CAAC;EACL,CAAC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["_validateHookName","_interopRequireDefault","require","createDidHook","hooks","storeKey","didHook","hookName","hooksStore","validateHookName","runs","_default","exports","default"],"sources":["@wordpress/hooks/src/createDidHook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateHookName from './validateHookName';\nimport type { Hooks, StoreKey } from './types';\n\n/**\n *\n * Returns the number of times an action has been fired.\n *\n */\nexport type DidHook = (\n\t/**\n\t * The hook name to check.\n\t */\n\thookName: string\n) => number | undefined;\n\n/**\n * Returns a function which, when invoked, will return the number of times a\n * hook has been called.\n *\n * @param hooks Hooks instance.\n * @param storeKey\n *\n * @return Function that returns a hook's call count.\n */\nfunction createDidHook( hooks: Hooks, storeKey: StoreKey ): DidHook {\n\treturn function didHook( hookName ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn hooksStore[ hookName ] && hooksStore[ hookName ].runs\n\t\t\t? hooksStore[ hookName ].runs\n\t\t\t: 0;\n\t};\n}\n\nexport default createDidHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,aAAaA,CAAEC,KAAY,EAAEC,QAAkB,EAAY;EACnE,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAG;IACnC,MAAMC,UAAU,GAAGJ,KAAK,CAAEC,QAAQ,CAAE;IAEpC,IAAK,CAAE,IAAAI,yBAAgB,EAAEF,QAAS,CAAC,EAAG;MACrC;IACD;IAEA,OAAOC,UAAU,CAAED,QAAQ,CAAE,IAAIC,UAAU,CAAED,QAAQ,CAAE,CAACG,IAAI,GACzDF,UAAU,CAAED,QAAQ,CAAE,CAACG,IAAI,GAC3B,CAAC;EACL,CAAC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcV,aAAa","ignoreList":[]}
@@ -5,23 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @callback DoingHook
8
+ * Internal dependencies
9
+ */
10
+
11
+ /**
9
12
  * Returns whether a hook is currently being executed.
10
13
  *
11
- * @param {string} [hookName] The name of the hook to check for. If
12
- * omitted, will check for any hook being executed.
13
- *
14
- * @return {boolean} Whether the hook is being executed.
15
14
  */
16
15
 
17
16
  /**
18
17
  * Returns a function which, when invoked, will return whether a hook is
19
18
  * currently being executed.
20
19
  *
21
- * @param {import('.').Hooks} hooks Hooks instance.
22
- * @param {import('.').StoreKey} storeKey
20
+ * @param hooks Hooks instance.
21
+ * @param storeKey
23
22
  *
24
- * @return {DoingHook} Function that returns whether a hook is currently
23
+ * @return Function that returns whether a hook is currently
25
24
  * being executed.
26
25
  */
27
26
  function createDoingHook(hooks, storeKey) {
@@ -1 +1 @@
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":[]}
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.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Hooks, StoreKey } from './types';\n\n/**\n * Returns whether a hook is currently being executed.\n *\n */\nexport type DoingHook = (\n\t/**\n\t * The name of the hook to check for.\n\t * If omitted, will check for any hook being executed.\n\t */ hookName?: string\n) => boolean;\n\n/**\n * Returns a function which, when invoked, will return whether a hook is\n * currently being executed.\n *\n * @param hooks Hooks instance.\n * @param storeKey\n *\n * @return Function that returns whether a hook is currently\n * being executed.\n */\nfunction createDoingHook( hooks: Hooks, storeKey: StoreKey ): DoingHook {\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;;AAGA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAeA,CAAEC,KAAY,EAAEC,QAAkB,EAAc;EACvE,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":[]}
@@ -5,24 +5,22 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  /**
8
- * @callback HasHook
8
+ * Internal dependencies
9
+ */
10
+
11
+ /**
9
12
  *
10
13
  * Returns whether any handlers are attached for the given hookName and optional namespace.
11
- *
12
- * @param {string} hookName The name of the hook to check for.
13
- * @param {string} [namespace] Optional. The unique namespace identifying the callback
14
- * in the form `vendor/plugin/function`.
15
- *
16
- * @return {boolean} Whether there are handlers that are attached to the given hook.
17
14
  */
15
+
18
16
  /**
19
17
  * Returns a function which, when invoked, will return whether any handlers are
20
18
  * attached to a particular hook.
21
19
  *
22
- * @param {import('.').Hooks} hooks Hooks instance.
23
- * @param {import('.').StoreKey} storeKey
20
+ * @param hooks Hooks instance.
21
+ * @param storeKey
24
22
  *
25
- * @return {HasHook} Function that returns whether any handlers are
23
+ * @return Function that returns whether any handlers are
26
24
  * attached to a particular hook and optional namespace.
27
25
  */
28
26
  function createHasHook(hooks, storeKey) {
@@ -1 +1 @@
1
- {"version":3,"names":["createHasHook","hooks","storeKey","hasHook","hookName","namespace","hooksStore","handlers","some","hook","_default","exports","default"],"sources":["@wordpress/hooks/src/createHasHook.js"],"sourcesContent":["/**\n * @callback HasHook\n *\n * Returns whether any handlers are attached for the given hookName and optional namespace.\n *\n * @param {string} hookName The name of the hook to check for.\n * @param {string} [namespace] Optional. The unique namespace identifying the callback\n * in the form `vendor/plugin/function`.\n *\n * @return {boolean} Whether there are handlers that are attached to the given hook.\n */\n/**\n * Returns a function which, when invoked, will return whether any handlers are\n * attached to a particular hook.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n *\n * @return {HasHook} Function that returns whether any handlers are\n * attached to a particular hook and optional namespace.\n */\nfunction createHasHook( hooks, storeKey ) {\n\treturn function hasHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// Use the namespace if provided.\n\t\tif ( 'undefined' !== typeof namespace ) {\n\t\t\treturn (\n\t\t\t\thookName in hooksStore &&\n\t\t\t\thooksStore[ hookName ].handlers.some(\n\t\t\t\t\t( hook ) => hook.namespace === namespace\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn hookName in hooksStore;\n\t};\n}\n\nexport default createHasHook;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAAEC,KAAK,EAAEC,QAAQ,EAAG;EACzC,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAEC,SAAS,EAAG;IAC9C,MAAMC,UAAU,GAAGL,KAAK,CAAEC,QAAQ,CAAE;;IAEpC;IACA,IAAK,WAAW,KAAK,OAAOG,SAAS,EAAG;MACvC,OACCD,QAAQ,IAAIE,UAAU,IACtBA,UAAU,CAAEF,QAAQ,CAAE,CAACG,QAAQ,CAACC,IAAI,CACjCC,IAAI,IAAMA,IAAI,CAACJ,SAAS,KAAKA,SAChC,CAAC;IAEH;IAEA,OAAOD,QAAQ,IAAIE,UAAU;EAC9B,CAAC;AACF;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["createHasHook","hooks","storeKey","hasHook","hookName","namespace","hooksStore","handlers","some","hook","_default","exports","default"],"sources":["@wordpress/hooks/src/createHasHook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Hooks, StoreKey } from './types';\n/**\n *\n * Returns whether any handlers are attached for the given hookName and optional namespace.\n */\nexport type HasHook = (\n\t/**\n\t * The name of the hook to check for.\n\t */\n\thookname: string,\n\t/**\n\t * The unique namespace identifying the callback in the form `vendor/plugin/function`.\n\t */\n\tnamespace?: string\n) => boolean;\n\n/**\n * Returns a function which, when invoked, will return whether any handlers are\n * attached to a particular hook.\n *\n * @param hooks Hooks instance.\n * @param storeKey\n *\n * @return Function that returns whether any handlers are\n * attached to a particular hook and optional namespace.\n */\nfunction createHasHook( hooks: Hooks, storeKey: StoreKey ): HasHook {\n\treturn function hasHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\t// Use the namespace if provided.\n\t\tif ( 'undefined' !== typeof namespace ) {\n\t\t\treturn (\n\t\t\t\thookName in hooksStore &&\n\t\t\t\thooksStore[ hookName ].handlers.some(\n\t\t\t\t\t( hook ) => hook.namespace === namespace\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\n\t\treturn hookName in hooksStore;\n\t};\n}\n\nexport default createHasHook;\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAAEC,KAAY,EAAEC,QAAkB,EAAY;EACnE,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAEC,SAAS,EAAG;IAC9C,MAAMC,UAAU,GAAGL,KAAK,CAAEC,QAAQ,CAAE;;IAEpC;IACA,IAAK,WAAW,KAAK,OAAOG,SAAS,EAAG;MACvC,OACCD,QAAQ,IAAIE,UAAU,IACtBA,UAAU,CAAEF,QAAQ,CAAE,CAACG,QAAQ,CAACC,IAAI,CACjCC,IAAI,IAAMA,IAAI,CAACJ,SAAS,KAAKA,SAChC,CAAC;IAEH;IAEA,OAAOD,QAAQ,IAAIE,UAAU;EAC9B,CAAC;AACF;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcZ,aAAa","ignoreList":[]}
@@ -25,11 +25,8 @@ var _createDidHook = _interopRequireDefault(require("./createDidHook"));
25
25
  */
26
26
  class _Hooks {
27
27
  constructor() {
28
- /** @type {import('.').Store} actions */
29
28
  this.actions = Object.create(null);
30
29
  this.actions.__current = new Set();
31
-
32
- /** @type {import('.').Store} filters */
33
30
  this.filters = Object.create(null);
34
31
  this.filters.__current = new Set();
35
32
  this.addAction = (0, _createAddHook.default)(this, 'actions');
@@ -52,15 +49,12 @@ class _Hooks {
52
49
  this.didFilter = (0, _createDidHook.default)(this, 'filters');
53
50
  }
54
51
  }
55
-
56
- /** @typedef {_Hooks} Hooks */
57
-
52
+ exports._Hooks = _Hooks;
58
53
  /**
59
54
  * Returns an instance of the hooks object.
60
55
  *
61
- * @return {Hooks} A Hooks instance.
56
+ * @return A Hooks instance.
62
57
  */
63
- exports._Hooks = _Hooks;
64
58
  function createHooks() {
65
59
  return new _Hooks();
66
60
  }
@@ -1 +1 @@
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":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,kBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,MAAM,CAAC;EACnBC,WAAWA,CAAA,EAAG;IACb;IACA,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAE,IAAK,CAAC;IACpC,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;IACrE,IAAI,CAACI,aAAa,GAAG,IAAAC,0BAAiB,EAAE,IAAI,EAAE,SAAU,CAAC;IACzD,IAAI,CAACC,aAAa,GAAG,IAAAD,0BAAiB,EAAE,IAAI,EAAE,SAAU,CAAC;IACzD,IAAI,CAACE,WAAW,GAAG,IAAAC,wBAAe,EAAE,IAAI,EAAE,SAAU,CAAC;IACrD,IAAI,CAACC,WAAW,GAAG,IAAAD,wBAAe,EAAE,IAAI,EAAE,SAAU,CAAC;IACrD,IAAI,CAACE,SAAS,GAAG,IAAAC,sBAAa,EAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACC,SAAS,GAAG,IAAAD,sBAAa,EAAE,IAAI,EAAE,SAAU,CAAC;EAClD;AACD;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AAJAE,OAAA,CAAAjC,MAAA,GAAAA,MAAA;AAKA,SAASkC,WAAWA,CAAA,EAAG;EACtB,OAAO,IAAIlC,MAAM,CAAC,CAAC;AACpB;AAAC,IAAAmC,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEcF,WAAW","ignoreList":[]}
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.ts"],"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';\nimport type { Store } from './types';\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\tpublic actions: Store;\n\tpublic filters: Store;\n\n\tpublic addAction: ReturnType< typeof createAddHook >;\n\tpublic addFilter: ReturnType< typeof createAddHook >;\n\tpublic removeAction: ReturnType< typeof createRemoveHook >;\n\tpublic removeFilter: ReturnType< typeof createRemoveHook >;\n\tpublic hasAction: ReturnType< typeof createHasHook >;\n\tpublic hasFilter: ReturnType< typeof createHasHook >;\n\tpublic removeAllActions: ReturnType< typeof createRemoveHook >;\n\tpublic removeAllFilters: ReturnType< typeof createRemoveHook >;\n\tpublic doAction: ReturnType< typeof createRunHook >;\n\tpublic doActionAsync: ReturnType< typeof createRunHook >;\n\tpublic applyFilters: ReturnType< typeof createRunHook >;\n\tpublic applyFiltersAsync: ReturnType< typeof createRunHook >;\n\tpublic currentAction: ReturnType< typeof createCurrentHook >;\n\tpublic currentFilter: ReturnType< typeof createCurrentHook >;\n\tpublic doingAction: ReturnType< typeof createDoingHook >;\n\tpublic doingFilter: ReturnType< typeof createDoingHook >;\n\tpublic didAction: ReturnType< typeof createDidHook >;\n\tpublic didFilter: ReturnType< typeof createDidHook >;\n\n\tconstructor() {\n\t\tthis.actions = Object.create( null );\n\t\tthis.actions.__current = new Set();\n\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\nexport type Hooks = _Hooks;\n\n/**\n * Returns an instance of the hooks object.\n *\n * @return A Hooks instance.\n */\nfunction createHooks(): Hooks {\n\treturn new _Hooks();\n}\n\nexport default createHooks;\n"],"mappings":";;;;;;;AAGA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,cAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,cAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,kBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,gBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,cAAA,GAAAP,sBAAA,CAAAC,OAAA;AATA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMO,MAAM,CAAC;EAuBnBC,WAAWA,CAAA,EAAG;IACb,IAAI,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAAE,IAAK,CAAC;IACpC,IAAI,CAACF,OAAO,CAACG,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC;IAElC,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,GAAG,IAAAC,sBAAa,EAAE,IAAI,EAAE,SA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Ae,EAAE,IAAI,EAAE,SAAU,CAAC;IACrD,IAAI,CAACE,SAAS,GAAG,IAAAC,sBAAa,EAAE,IAAI,EAAE,SAAU,CAAC;IACjD,IAAI,CAACC,SAAS,GAAG,IAAAD,sBAAa,EAAE,IAAI,EAAE,SAAU,CAAC;EAClD;AACD;AAACE,OAAA,CAAAjC,MAAA,GAAAA,MAAA;AAID;AACA;AACA;AACA;AACA;AACA,SAASkC,WAAWA,CAAA,EAAU;EAC7B,OAAO,IAAIlC,MAAM,CAAC,CAAC;AACpB;AAAC,IAAAmC,QAAA,GAAAF,OAAA,CAAAG,OAAA,GAEcF,WAAW","ignoreList":[]}
@@ -5,35 +5,28 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
- var _validateNamespace = _interopRequireDefault(require("./validateNamespace.js"));
9
- var _validateHookName = _interopRequireDefault(require("./validateHookName.js"));
8
+ var _validateNamespace = _interopRequireDefault(require("./validateNamespace"));
9
+ var _validateHookName = _interopRequireDefault(require("./validateHookName"));
10
10
  /**
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
14
  /**
15
- * @callback RemoveHook
16
15
  * Removes the specified callback (or all callbacks) from the hook with a given hookName
17
16
  * and namespace.
18
- *
19
- * @param {string} hookName The name of the hook to modify.
20
- * @param {string} namespace The unique namespace identifying the callback in the
21
- * form `vendor/plugin/function`.
22
- *
23
- * @return {number | undefined} The number of callbacks removed.
24
17
  */
25
18
 
26
19
  /**
27
20
  * Returns a function which, when invoked, will remove a specified hook or all
28
21
  * hooks by the given name.
29
22
  *
30
- * @param {import('.').Hooks} hooks Hooks instance.
31
- * @param {import('.').StoreKey} storeKey
32
- * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,
33
- * without regard to namespace. Used to create
34
- * `removeAll*` functions.
23
+ * @param hooks Hooks instance.
24
+ * @param storeKey
25
+ * @param [removeAll=false] Whether to remove all callbacks for a hookName,
26
+ * without regard to namespace. Used to create
27
+ * `removeAll*` functions.
35
28
  *
36
- * @return {RemoveHook} Function that removes hooks.
29
+ * @return Function that removes hooks.
37
30
  */
38
31
  function createRemoveHook(hooks, storeKey, removeAll = false) {
39
32
  return function removeHook(hookName, namespace) {
@@ -1 +1 @@
1
- {"version":3,"names":["_validateNamespace","_interopRequireDefault","require","_validateHookName","createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","validateHookName","validateNamespace","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction","_default","exports","default"],"sources":["@wordpress/hooks/src/createRemoveHook.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace.js';\nimport validateHookName from './validateHookName.js';\n\n/**\n * @callback RemoveHook\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n *\n * @param {string} hookName The name of the hook to modify.\n * @param {string} namespace The unique namespace identifying the callback in the\n * form `vendor/plugin/function`.\n *\n * @return {number | undefined} The number of callbacks removed.\n */\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param {import('.').Hooks} hooks Hooks instance.\n * @param {import('.').StoreKey} storeKey\n * @param {boolean} [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return {RemoveHook} Function that removes hooks.\n */\nfunction createRemoveHook( hooks, storeKey, removeAll = false ) {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,GAAG,KAAK,EAAG;EAC/D,OAAO,SAASC,UAAUA,CAAEC,QAAQ,EAAEC,SAAS,EAAG;IACjD,MAAM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,QAAQ,EAAEC,SAAU,CAAC;IACrD;IAEA,OAAOI,eAAe;EACvB,CAAC;AACF;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxB,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["_validateNamespace","_interopRequireDefault","require","_validateHookName","createRemoveHook","hooks","storeKey","removeAll","removeHook","hookName","namespace","hooksStore","validateHookName","validateNamespace","handlersRemoved","handlers","length","runs","i","splice","__current","forEach","hookInfo","name","currentIndex","doAction","_default","exports","default"],"sources":["@wordpress/hooks/src/createRemoveHook.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport validateNamespace from './validateNamespace';\nimport validateHookName from './validateHookName';\nimport type { Hooks, StoreKey } from './types';\n\n/**\n * Removes the specified callback (or all callbacks) from the hook with a given hookName\n * and namespace.\n */\nexport type RemoveHook = (\n\t/**\n\t * The name of the hook to modify.\n\t */\n\thookName: string,\n\t/**\n\t * The unique namespace identifying the callback in the form `vendor/plugin/function`.\n\t */\n\tnamespace: string\n) => number | undefined;\n\n/**\n * Returns a function which, when invoked, will remove a specified hook or all\n * hooks by the given name.\n *\n * @param hooks Hooks instance.\n * @param storeKey\n * @param [removeAll=false] Whether to remove all callbacks for a hookName,\n * without regard to namespace. Used to create\n * `removeAll*` functions.\n *\n * @return Function that removes hooks.\n */\nfunction createRemoveHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey,\n\tremoveAll: boolean = false\n): RemoveHook {\n\treturn function removeHook( hookName, namespace ) {\n\t\tconst hooksStore = hooks[ storeKey ];\n\n\t\tif ( ! validateHookName( hookName ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! removeAll && ! validateNamespace( namespace ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Bail if no hooks exist by this name.\n\t\tif ( ! hooksStore[ hookName ] ) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet handlersRemoved = 0;\n\n\t\tif ( removeAll ) {\n\t\t\thandlersRemoved = hooksStore[ hookName ].handlers.length;\n\t\t\thooksStore[ hookName ] = {\n\t\t\t\truns: hooksStore[ hookName ].runs,\n\t\t\t\thandlers: [],\n\t\t\t};\n\t\t} else {\n\t\t\t// Try to find the specified callback to remove.\n\t\t\tconst handlers = hooksStore[ hookName ].handlers;\n\t\t\tfor ( let i = handlers.length - 1; i >= 0; i-- ) {\n\t\t\t\tif ( handlers[ i ].namespace === namespace ) {\n\t\t\t\t\thandlers.splice( i, 1 );\n\t\t\t\t\thandlersRemoved++;\n\t\t\t\t\t// This callback may also be part of a hook that is\n\t\t\t\t\t// currently executing. If the callback we're removing\n\t\t\t\t\t// comes after the current callback, there's no problem;\n\t\t\t\t\t// otherwise we need to decrease the execution index of any\n\t\t\t\t\t// other runs by 1 to account for the removed element.\n\t\t\t\t\thooksStore.__current.forEach( ( hookInfo ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thookInfo.name === hookName &&\n\t\t\t\t\t\t\thookInfo.currentIndex >= i\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\thookInfo.currentIndex--;\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( hookName !== 'hookRemoved' ) {\n\t\t\thooks.doAction( 'hookRemoved', hookName, namespace );\n\t\t}\n\n\t\treturn handlersRemoved;\n\t};\n}\n\nexport default createRemoveHook;\n"],"mappings":";;;;;;;AAGA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AAJA;AACA;AACA;;AAKA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CACxBC,KAAY,EACZC,QAAkB,EAClBC,SAAkB,GAAG,KAAK,EACb;EACb,OAAO,SAASC,UAAUA,CAAEC,QAAQ,EAAEC,SAAS,EAAG;IACjD,MAAMC,UAAU,GAAGN,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SAAU,CAAC;IACrD;IAEA,OAAOI,eAAe;EACvB,CAAC;AACF;AAAC,IAAAY,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxB,gBAAgB","ignoreList":[]}
@@ -4,17 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+
7
11
  /**
8
12
  * Returns a function which, when invoked, will execute all callbacks
9
13
  * registered to a hook of the specified type, optionally returning the final
10
14
  * value of the call chain.
11
15
  *
12
- * @param {import('.').Hooks} hooks Hooks instance.
13
- * @param {import('.').StoreKey} storeKey
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
+ * @param hooks Hooks instance.
17
+ * @param storeKey
18
+ * @param returnFirstArg Whether each hook callback is expected to return its first argument.
19
+ * @param async Whether the hook callback should be run asynchronously
16
20
  *
17
- * @return {(hookName:string, ...args: unknown[]) => undefined|unknown} Function that runs hook callbacks.
21
+ * @return Function that runs hook callbacks.
18
22
  */
19
23
  function createRunHook(hooks, storeKey, returnFirstArg, async) {
20
24
  return function runHook(hookName, ...args) {
@@ -1 +1 @@
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":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAAEC,KAAK,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,KAAK,EAAG;EAChE,OAAO,SAASC,OAAOA,CAAEC,QAAQ,EAAE,GAAGC,IAAI,EAAG;IAC5C,MAAMC,UAAU,GAAGP,KAAK,CAAEC,QAAQ,CAAE;IAEpC,IAAK,CAAEM,UAAU,CAAEF,QAAQ,CAAE,EAAG;MAC/BE,UAAU,CAAEF,QAAQ,CAAE,GAAG;QACxBG,QAAQ,EAAE,EAAE;QACZC,IAAI,EAAE;MACP,CAAC;IACF;IAEAF,UAAU,CAAEF,QAAQ,CAAE,CAACI,IAAI,EAAE;IAE7B,MAAMD,QAAQ,GAAGD,UAAU,CAAEF,QAAQ,CAAE,CAACG,QAAQ;;IAEhD;IACA,IAAK,YAAY,KAAKE,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAG;MAC5C;MACA,IAAK,WAAW,KAAKP,QAAQ,IAAIE,UAAU,CAACM,GAAG,EAAG;QACjDL,QAAQ,CAACM,IAAI,CAAE,GAAGP,UAAU,CAACM,GAAG,CAACL,QAAS,CAAC;MAC5C;IACD;IAEA,IAAK,CAAEA,QAAQ,IAAI,CAAEA,QAAQ,CAACO,MAAM,EAAG;MACtC,OAAOb,cAAc,GAAGI,IAAI,CAAE,CAAC,CAAE,GAAGU,SAAS;IAC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EAAE;QACxB;QACA,OAAOjB,cAAc,GAAGqB,MAAM,GAAGP,SAAS;MAC3C,CAAC,SAAS;QACTT,UAAU,CAACc,SAAS,CAACM,MAAM,CAAEV,QAAS,CAAC;MACxC;IACD;IAEA,OAAO,CAAEd,KAAK,GAAGiB,WAAW,GAAGQ,UAAU,EAAG,CAAC;EAC9C,CAAC;AACF;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchC,aAAa","ignoreList":[]}
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.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport type { Hooks, StoreKey } from './types';\n\nexport type RunHook = (\n\thookName: string,\n\t...args: unknown[]\n) => undefined | unknown;\n\n/**\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 hooks Hooks instance.\n * @param storeKey\n * @param returnFirstArg Whether each hook callback is expected to return its first argument.\n * @param async Whether the hook callback should be run asynchronously\n *\n * @return Function that runs hook callbacks.\n */\nfunction createRunHook(\n\thooks: Hooks,\n\tstoreKey: StoreKey,\n\treturnFirstArg: boolean,\n\tasync: boolean\n): RunHook {\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":";;;;;;AAAA;AACA;AACA;;AAQA;AACA;AACA;AACA;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/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
+ var _exportNames = {
8
+ defaultHooks: true,
9
+ addAction: true,
10
+ addFilter: true,
11
+ removeAction: true,
12
+ removeFilter: true,
13
+ hasAction: true,
14
+ hasFilter: true,
15
+ removeAllActions: true,
16
+ removeAllFilters: true,
17
+ doAction: true,
18
+ doActionAsync: true,
19
+ applyFilters: true,
20
+ applyFiltersAsync: true,
21
+ currentAction: true,
22
+ currentFilter: true,
23
+ doingAction: true,
24
+ doingFilter: true,
25
+ didAction: true,
26
+ didFilter: true,
27
+ actions: true,
28
+ filters: true,
29
+ createHooks: true
30
+ };
7
31
  exports.applyFiltersAsync = exports.applyFilters = exports.addFilter = exports.addAction = exports.actions = void 0;
8
32
  Object.defineProperty(exports, "createHooks", {
9
33
  enumerable: true,
@@ -13,43 +37,22 @@ Object.defineProperty(exports, "createHooks", {
13
37
  });
14
38
  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
39
  var _createHooks = _interopRequireDefault(require("./createHooks"));
40
+ var _types = require("./types");
41
+ Object.keys(_types).forEach(function (key) {
42
+ if (key === "default" || key === "__esModule") return;
43
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
44
+ if (key in exports && exports[key] === _types[key]) return;
45
+ Object.defineProperty(exports, key, {
46
+ enumerable: true,
47
+ get: function () {
48
+ return _types[key];
49
+ }
50
+ });
51
+ });
16
52
  /**
17
53
  * Internal dependencies
18
54
  */
19
55
 
20
- /** @typedef {(...args: any[])=>any} Callback */
21
-
22
- /**
23
- * @typedef Handler
24
- * @property {Callback} callback The callback
25
- * @property {string} namespace The namespace
26
- * @property {number} priority The namespace
27
- */
28
-
29
- /**
30
- * @typedef Hook
31
- * @property {Handler[]} handlers Array of handlers
32
- * @property {number} runs Run counter
33
- */
34
-
35
- /**
36
- * @typedef Current
37
- * @property {string} name Hook name
38
- * @property {number} currentIndex The index
39
- */
40
-
41
- /**
42
- * @typedef {Record<string, Hook> & {__current: Set<Current>}} Store
43
- */
44
-
45
- /**
46
- * @typedef {'actions' | 'filters'} StoreKey
47
- */
48
-
49
- /**
50
- * @typedef {import('./createHooks').Hooks} Hooks
51
- */
52
-
53
56
  const defaultHooks = exports.defaultHooks = (0, _createHooks.default)();
54
57
  const {
55
58
  addAction,
@@ -1 +1 @@
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":[]}
1
+ {"version":3,"names":["_createHooks","_interopRequireDefault","require","_types","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","defaultHooks","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.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createHooks from './createHooks';\n\nexport * from './types';\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\tremove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A,CAAAsB,SAAA,GAAAA,SAAA;AAAAtB,OAAA,CAAAqB,WAAA,GAAAA,WAAA;AAAArB,OAAA,CAAAoB,WAAA,GAAAA,WAAA;AAAApB,OAAA,CAAAmB,aAAA,GAAAA,aAAA;AAAAnB,OAAA,CAAAkB,aAAA,GAAAA,aAAA;AAAAlB,OAAA,CAAAiB,iBAAA,GAAAA,iBAAA;AAAAjB,OAAA,CAAAgB,YAAA,GAAAA,YAAA;AAAAhB,OAAA,CAAAe,aAAA,GAAAA,aAAA;AAAAf,OAAA,CAAAc,QAAA,GAAAA,QAAA;AAAAd,OAAA,CAAAa,gBAAA,GAAAA,gBAAA;AAAAb,OAAA,CAAAY,gBAAA,GAAAA,gBAAA;AAAAZ,OAAA,CAAAW,SAAA,GAAAA,SAAA;AAAAX,OAAA,CAAAU,SAAA,GAAAA,SAAA;AAAAV,OAAA,CAAAS,YAAA,GAAAA,YAAA;AAAAT,OAAA,CAAAQ,YAAA,GAAAA,YAAA;AAAAR,OAAA,CAAAO,SAAA,GAAAA,SAAA;AAAAP,OAAA,CAAAM,SAAA,GAAAA,SAAA","ignoreList":[]}
package/build/types.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["@wordpress/hooks/src/types.ts"],"sourcesContent":["/**\n * Internal dependencies\n */\nexport type { Hooks } from './createHooks';\n\nexport type Callback = ( ...args: any[] ) => any;\n\nexport type Handler = {\n\tcallback: Callback;\n\tnamespace: string;\n\tpriority: number;\n};\n\nexport type Hook = {\n\thandlers: Handler[];\n\truns: number;\n};\n\nexport type Current = {\n\tname: string;\n\tcurrentIndex: number;\n};\n\nexport type HookInfo = {\n\tname: string;\n\tcurrentIndex: number;\n};\n\nexport type Store = Record< string, Hook > & { __current: Set< Current > };\n\nexport type StoreKey = 'actions' | 'filters';\n"],"mappings":"","ignoreList":[]}
@@ -7,11 +7,11 @@ exports.default = void 0;
7
7
  /**
8
8
  * Validate a hookName string.
9
9
  *
10
- * @param {string} hookName The hook name to validate. Should be a non empty string containing
11
- * only numbers, letters, dashes, periods and underscores. Also,
12
- * the hook name cannot begin with `__`.
10
+ * @param hookName The hook name to validate. Should be a non empty string containing
11
+ * only numbers, letters, dashes, periods and underscores. Also,
12
+ * the hook name cannot begin with `__`.
13
13
  *
14
- * @return {boolean} Whether the hook name is valid.
14
+ * @return Whether the hook name is valid.
15
15
  */
16
16
  function validateHookName(hookName) {
17
17
  if ('string' !== typeof hookName || '' === hookName) {
@@ -1 +1 @@
1
- {"version":3,"names":["validateHookName","hookName","console","error","test","_default","exports","default"],"sources":["@wordpress/hooks/src/validateHookName.js"],"sourcesContent":["/**\n * Validate a hookName string.\n *\n * @param {string} hookName The hook name to validate. Should be a non empty string containing\n * only numbers, letters, dashes, periods and underscores. Also,\n * the hook name cannot begin with `__`.\n *\n * @return {boolean} Whether the hook name is valid.\n */\nfunction validateHookName( hookName ) {\n\tif ( 'string' !== typeof hookName || '' === hookName ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error( 'The hook name must be a non-empty string.' );\n\t\treturn false;\n\t}\n\n\tif ( /^__/.test( hookName ) ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error( 'The hook name cannot begin with `__`.' );\n\t\treturn false;\n\t}\n\n\tif ( ! /^[a-zA-Z][a-zA-Z0-9_.-]*$/.test( hookName ) ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error(\n\t\t\t'The hook name can only contain numbers, letters, dashes, periods and underscores.'\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nexport default validateHookName;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgBA,CAAEC,QAAQ,EAAG;EACrC,IAAK,QAAQ,KAAK,OAAOA,QAAQ,IAAI,EAAE,KAAKA,QAAQ,EAAG;IACtD;IACAC,OAAO,CAACC,KAAK,CAAE,2CAA4C,CAAC;IAC5D,OAAO,KAAK;EACb;EAEA,IAAK,KAAK,CAACC,IAAI,CAAEH,QAAS,CAAC,EAAG;IAC7B;IACAC,OAAO,CAACC,KAAK,CAAE,uCAAwC,CAAC;IACxD,OAAO,KAAK;EACb;EAEA,IAAK,CAAE,2BAA2B,CAACC,IAAI,CAAEH,QAAS,CAAC,EAAG;IACrD;IACAC,OAAO,CAACC,KAAK,CACZ,mFACD,CAAC;IACD,OAAO,KAAK;EACb;EAEA,OAAO,IAAI;AACZ;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,gBAAgB","ignoreList":[]}
1
+ {"version":3,"names":["validateHookName","hookName","console","error","test","_default","exports","default"],"sources":["@wordpress/hooks/src/validateHookName.ts"],"sourcesContent":["/**\n * Validate a hookName string.\n *\n * @param hookName The hook name to validate. Should be a non empty string containing\n * only numbers, letters, dashes, periods and underscores. Also,\n * the hook name cannot begin with `__`.\n *\n * @return Whether the hook name is valid.\n */\nfunction validateHookName( hookName: string ): boolean {\n\tif ( 'string' !== typeof hookName || '' === hookName ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error( 'The hook name must be a non-empty string.' );\n\t\treturn false;\n\t}\n\n\tif ( /^__/.test( hookName ) ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error( 'The hook name cannot begin with `__`.' );\n\t\treturn false;\n\t}\n\n\tif ( ! /^[a-zA-Z][a-zA-Z0-9_.-]*$/.test( hookName ) ) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.error(\n\t\t\t'The hook name can only contain numbers, letters, dashes, periods and underscores.'\n\t\t);\n\t\treturn false;\n\t}\n\n\treturn true;\n}\n\nexport default validateHookName;\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgBA,CAAEC,QAAgB,EAAY;EACtD,IAAK,QAAQ,KAAK,OAAOA,QAAQ,IAAI,EAAE,KAAKA,QAAQ,EAAG;IACtD;IACAC,OAAO,CAACC,KAAK,CAAE,2CAA4C,CAAC;IAC5D,OAAO,KAAK;EACb;EAEA,IAAK,KAAK,CAACC,IAAI,CAAEH,QAAS,CAAC,EAAG;IAC7B;IACAC,OAAO,CAACC,KAAK,CAAE,uCAAwC,CAAC;IACxD,OAAO,KAAK;EACb;EAEA,IAAK,CAAE,2BAA2B,CAACC,IAAI,CAAEH,QAAS,CAAC,EAAG;IACrD;IACAC,OAAO,CAACC,KAAK,CACZ,mFACD,CAAC;IACD,OAAO,KAAK;EACb;EAEA,OAAO,IAAI;AACZ;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcP,gBAAgB","ignoreList":[]}