bajo 0.3.10 → 1.0.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.
Files changed (163) hide show
  1. package/README.md +127 -26
  2. package/bajoI18N/resource/id.json +31 -0
  3. package/boot/class/app.js +69 -0
  4. package/boot/class/bajo-core/helper/attach-method.js +30 -0
  5. package/boot/{boot-order.js → class/bajo-core/helper/boot-order.js} +10 -10
  6. package/boot/class/bajo-core/helper/boot-plugins.js +19 -0
  7. package/boot/class/bajo-core/helper/build-config.js +61 -0
  8. package/boot/class/bajo-core/helper/build-plugins.js +26 -0
  9. package/boot/class/bajo-core/helper/collect-config-handlers.js +21 -0
  10. package/boot/{exit-handler.js → class/bajo-core/helper/exit-handler.js} +10 -16
  11. package/boot/class/bajo-core/helper/run-as-applet.js +26 -0
  12. package/boot/class/bajo-core/method/arrange-array.js +18 -0
  13. package/boot/class/bajo-core/method/break-ns-path-from-file.js +24 -0
  14. package/boot/class/bajo-core/method/break-ns-path.js +29 -0
  15. package/boot/class/bajo-core/method/build-collections.js +46 -0
  16. package/boot/class/bajo-core/method/call-handler.js +29 -0
  17. package/boot/{helper → class/bajo-core/method}/defaults-deep.js +1 -1
  18. package/boot/class/bajo-core/method/each-plugins.js +55 -0
  19. package/boot/class/bajo-core/method/envs.js +7 -0
  20. package/boot/{helper → class/bajo-core/method}/generate-id.js +4 -0
  21. package/boot/{helper → class/bajo-core/method}/get-global-module-dir.js +5 -6
  22. package/boot/class/bajo-core/method/get-method.js +10 -0
  23. package/boot/{helper → class/bajo-core/method}/get-module-dir.js +3 -4
  24. package/boot/{helper → class/bajo-core/method}/get-plugin-data-dir.js +2 -3
  25. package/boot/class/bajo-core/method/get-plugin-file.js +18 -0
  26. package/boot/class/bajo-core/method/get-plugin.js +23 -0
  27. package/boot/{helper → class/bajo-core/method}/import-module.js +4 -10
  28. package/boot/{helper → class/bajo-core/method}/import-pkg.js +9 -3
  29. package/boot/class/bajo-core/method/includes.js +13 -0
  30. package/boot/class/bajo-core/method/is-class.js +7 -0
  31. package/boot/{helper → class/bajo-core/method}/is-log-in-range.js +1 -1
  32. package/boot/{helper → class/bajo-core/method}/is-valid-app.js +2 -2
  33. package/boot/class/bajo-core/method/join.js +15 -0
  34. package/boot/class/bajo-core/method/log-levels.js +9 -0
  35. package/boot/class/bajo-core/method/num-unit.js +9 -0
  36. package/boot/{helper → class/bajo-core/method}/parse-object.js +24 -8
  37. package/boot/class/bajo-core/method/read-config.js +48 -0
  38. package/boot/{helper → class/bajo-core/method}/read-json.js +2 -2
  39. package/boot/class/bajo-core/method/run-hook.js +26 -0
  40. package/boot/{helper → class/bajo-core/method}/save-as-download.js +2 -2
  41. package/boot/class/bajo-core/method/slice-string.js +13 -0
  42. package/boot/class/bajo-core/method/titleize.js +23 -0
  43. package/boot/class/bajo-core.js +30 -0
  44. package/boot/class/bajo-plugin/helper/attach-method.js +14 -0
  45. package/boot/class/bajo-plugin/helper/build-config.js +10 -0
  46. package/boot/class/bajo-plugin/helper/check-clash.js +16 -0
  47. package/boot/class/bajo-plugin/helper/check-dependency.js +37 -0
  48. package/boot/class/bajo-plugin/helper/collect-exit-handlers.js +14 -0
  49. package/boot/class/bajo-plugin/helper/collect-hooks.js +29 -0
  50. package/boot/class/bajo-plugin/helper/run.js +20 -0
  51. package/boot/class/bajo-plugin.js +78 -0
  52. package/boot/class/error.js +59 -0
  53. package/boot/class/log.js +67 -0
  54. package/boot/class/plugin.js +51 -0
  55. package/boot/class/print.js +103 -0
  56. package/boot/index.js +4 -51
  57. package/boot/lib/create-method.js +30 -0
  58. package/boot/{helper → lib}/current-loc.js +1 -1
  59. package/boot/lib/get-global-module-path.js +189 -0
  60. package/boot/lib/omitted-plugin-keys.js +1 -1
  61. package/boot/lib/parse-args-argv.js +8 -11
  62. package/boot/lib/parse-env.js +7 -6
  63. package/boot/lib/read-all-configs.js +36 -0
  64. package/boot/lib/translate.js +18 -0
  65. package/docs/ecosystem.md +55 -0
  66. package/docs/hook.md +11 -0
  67. package/package.json +54 -56
  68. package/test/{helper-isSet.js → method/isSet.js} +6 -4
  69. package/waibuStatic/virtual.json +7 -0
  70. package/boot/attach-helper.js +0 -40
  71. package/boot/build-config.js +0 -99
  72. package/boot/create-scope.js +0 -36
  73. package/boot/helper/break-ns-path.js +0 -20
  74. package/boot/helper/build-collections.js +0 -43
  75. package/boot/helper/build-name.js +0 -17
  76. package/boot/helper/call-helper-or-handler.js +0 -15
  77. package/boot/helper/dump.js +0 -14
  78. package/boot/helper/each-plugins.js +0 -106
  79. package/boot/helper/envs.js +0 -14
  80. package/boot/helper/error.js +0 -77
  81. package/boot/helper/fatal.js +0 -13
  82. package/boot/helper/get-config.js +0 -19
  83. package/boot/helper/get-helper.js +0 -12
  84. package/boot/helper/get-item-by-name.js +0 -26
  85. package/boot/helper/get-plugin-file.js +0 -16
  86. package/boot/helper/get-plugin-name.js +0 -39
  87. package/boot/helper/get-plugin.js +0 -14
  88. package/boot/helper/join.js +0 -11
  89. package/boot/helper/log-levels.js +0 -19
  90. package/boot/helper/read-config.js +0 -48
  91. package/boot/helper/resolve-tpl-path.js +0 -15
  92. package/boot/helper/run-hook.js +0 -49
  93. package/boot/helper/spinner.js +0 -9
  94. package/boot/helper/start-plugin.js +0 -7
  95. package/boot/helper/titleize.js +0 -14
  96. package/boot/lib/build-helper.js +0 -60
  97. package/boot/lib/logger.js +0 -76
  98. package/boot/lib/print.js +0 -138
  99. package/boot/plugins/attach-helper.js +0 -20
  100. package/boot/plugins/build-config.js +0 -68
  101. package/boot/plugins/check-clash.js +0 -18
  102. package/boot/plugins/check-dependency.js +0 -37
  103. package/boot/plugins/collect-config-handlers.js +0 -22
  104. package/boot/plugins/collect-exit-handlers.js +0 -18
  105. package/boot/plugins/collect-hooks.js +0 -34
  106. package/boot/plugins/extend-config.js +0 -21
  107. package/boot/plugins/index.js +0 -27
  108. package/boot/plugins/run.js +0 -26
  109. package/boot/run-tool.js +0 -41
  110. package/docs/boot_build-config.js.html +0 -75
  111. package/docs/boot_create-scope.js.html +0 -25
  112. package/docs/boot_index.js.html +0 -43
  113. package/docs/data/search.json +0 -1
  114. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  115. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  116. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  117. package/docs/helper_emit.js.html +0 -18
  118. package/docs/helper_envs.js.html +0 -16
  119. package/docs/helper_error.js.html +0 -25
  120. package/docs/helper_get-bajo.js.html +0 -42
  121. package/docs/helper_index.js.html +0 -39
  122. package/docs/helper_log-levels.js.html +0 -20
  123. package/docs/helper_set-hook.js.html +0 -38
  124. package/docs/helper_walk-bajos.js.html +0 -51
  125. package/docs/index.html +0 -16
  126. package/docs/module-boot.html +0 -3
  127. package/docs/module-boot_buildConfig.html +0 -3
  128. package/docs/module-boot_createScope.html +0 -3
  129. package/docs/module-helper.html +0 -7
  130. package/docs/module-helper_setHook.html +0 -4
  131. package/docs/module-helper_walkBajos.html +0 -6
  132. package/docs/scripts/core.js +0 -655
  133. package/docs/scripts/core.min.js +0 -23
  134. package/docs/scripts/resize.js +0 -90
  135. package/docs/scripts/search.js +0 -265
  136. package/docs/scripts/search.min.js +0 -6
  137. package/docs/scripts/third-party/Apache-License-2.0.txt +0 -202
  138. package/docs/scripts/third-party/fuse.js +0 -9
  139. package/docs/scripts/third-party/hljs-line-num-original.js +0 -369
  140. package/docs/scripts/third-party/hljs-line-num.js +0 -1
  141. package/docs/scripts/third-party/hljs-original.js +0 -5171
  142. package/docs/scripts/third-party/hljs.js +0 -1
  143. package/docs/scripts/third-party/popper.js +0 -5
  144. package/docs/scripts/third-party/tippy.js +0 -1
  145. package/docs/scripts/third-party/tocbot.js +0 -672
  146. package/docs/scripts/third-party/tocbot.min.js +0 -1
  147. package/docs/styles/clean-jsdoc-theme-base.css +0 -975
  148. package/docs/styles/clean-jsdoc-theme-dark.css +0 -407
  149. package/docs/styles/clean-jsdoc-theme-light.css +0 -388
  150. package/docs/styles/clean-jsdoc-theme.min.css +0 -1
  151. package/test/helper-error.js +0 -25
  152. package/test/helper-pathResolve.js +0 -28
  153. /package/boot/{helper → class/bajo-core/method}/get-key-by-value.js +0 -0
  154. /package/boot/{helper → class/bajo-core/method}/is-empty-dir.js +0 -0
  155. /package/boot/{helper → class/bajo-core/method}/is-set.js +0 -0
  156. /package/boot/{helper → class/bajo-core/method}/is-valid-plugin.js +0 -0
  157. /package/boot/{helper → class/bajo-core/method}/paginate.js +0 -0
  158. /package/boot/{helper → class/bajo-core/method}/pascal-case.js +0 -0
  159. /package/boot/{helper → class/bajo-core/method}/pick.js +0 -0
  160. /package/boot/{helper → class/bajo-core/method}/resolve-path.js +0 -0
  161. /package/boot/{helper → class/bajo-core/method}/round.js +0 -0
  162. /package/boot/{helper → class/bajo-core/method}/sec-to-hms.js +0 -0
  163. /package/boot/{helper → class/bajo-core/method}/white-space.js +0 -0
@@ -1,6 +0,0 @@
1
- <!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Module: helper/eachPlugins</title><!--[if lt IE 9]>
2
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
3
- <![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="",baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body class="dark" data-theme="dark"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Bajo Framework</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="giIwooOtbeeq9fbiwZEz4"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-boot.html">boot</a></div><div class="sidebar-section-children"><a href="module-boot_buildConfig.html">boot/buildConfig</a></div><div class="sidebar-section-children"><a href="module-boot_createScope.html">boot/createScope</a></div><div class="sidebar-section-children"><a href="module-helper.html">helper</a></div><div class="sidebar-section-children"><a href="module-helper_runHook.html">helper/runHook</a></div><div class="sidebar-section-children"><a href="module-helper_eachPlugins.html">helper/eachPlugins</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"><div class="navbar-item"><a id="" href="https://www.npmjs.com/package/bajo" target="">NPM</a></div><div class="navbar-item"><a id="" href="https://github.com/ardhi/bajo" target="">Github</a></div></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section><header></header><article><div class="container-overview"></div><h2 id="methods" class="subsection-title has-anchor">Methods</h2><h3 class="name has-anchor" id="eachPlugins"><span class="type-signature">(async) </span>eachPlugins<span class="signature">(handlerFn, options<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Object}</span></h3><div class="description"><p>Walk through all plugins and execute the callback handler</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th>Attributes</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>handlerFn</code></td><td class="type"><span class="param-type">function</span></td><td class="attributes"></td><td class="description last"><p><a href="module-helper_eachPlugins.html#~handlerFn">The callback</a></p></td></tr><tr><td class="name"><code>options</code></td><td class="type"><span class="param-type">Object</span></td><td class="attributes">&lt;optional><br></td><td class="description last"><p>Optional parameter</p><h6>Properties</h6><table class="params"><thead><tr><th>Name</th><th>Type</th><th>Attributes</th><th>Default</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>key</code></td><td class="type"><span class="param-type">string</span></td><td class="attributes">&lt;optional><br></td><td class="default">name</td><td class="description last"><p>Key of Bajo's config object that will be used as the key of returned object</p></td></tr></tbody></table></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="helper_walk-plugins.js.html">helper/walk-plugins.js</a>, <a href="helper_walk-plugins.js.html#line34">line 34</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><div class="param-desc"><p>Results from callback execution through all Bajos</p></div><dl class="param-type"><dt>Type:&nbsp;</dt><dd><span class="param-type">Object</span></dd></dl></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Example</strong><div class="rel"><pre class="prettyprint"><code>const { eachPlugins } = this.bajo.helperrunHookrunHook
4
- await eachPlugins(async function ({ name }) => {
5
- console.log(name)
6
- })</code></pre></div></div><h2 id="type-definitions" class="subsection-title has-anchor">Type Definitions</h2><h3 class="name has-anchor" id="~handlerFn"><span class="type-signature">(async) </span>handlerFn<span class="signature">(argument)</span><span class="type-signature"> &rarr; {Object|boolean|undefined}</span></h3><div class="description"><p>Callback function that will be executed while walking through all Bajos</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>argument</code></td><td class="type"><span class="param-type">Object</span></td><td class="description last"><p>Provides information about current Bajo</p><h6>Properties</h6><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>name</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"><p>Bajo's name</p></td></tr><tr><td class="name"><code>pkg</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"><p>Bajo's package name</p></td></tr><tr><td class="name"><code>cfg</code></td><td class="type"><span class="param-type">Object</span></td><td class="description last"><p>Bajo's config object</p></td></tr></tbody></table></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="helper_walk-plugins.js.html">helper/walk-plugins.js</a>, <a href="helper_walk-plugins.js.html#line5">line 5</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type:&nbsp;</dt><dd><span class="param-type">Object</span> |<wbr> <span class="param-type">boolean</span> |<wbr> <span class="param-type">undefined</span></dd></dl></div></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Bajo Framework</a><div class="mobile-nav-links"><div class="navbar-item"><a id="" href="https://www.npmjs.com/package/bajo" target="">NPM</a></div><div class="navbar-item"><a id="" href="https://github.com/ardhi/bajo" target="">Github</a></div></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="giIwooOtbeeq9fbiwZEz4"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-boot.html">boot</a></div><div class="sidebar-section-children"><a href="module-boot_buildConfig.html">boot/buildConfig</a></div><div class="sidebar-section-children"><a href="module-boot_createScope.html">boot/createScope</a></div><div class="sidebar-section-children"><a href="module-helper.html">helper</a></div><div class="sidebar-section-children"><a href="module-helper_setHook.html">helper/setHook</a></div><div class="sidebar-section-children"><a href="module-helper_eachPlugins.html">helper/eachPlugins</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#light-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
@@ -1,655 +0,0 @@
1
- /* global document */
2
- var accordionLocalStorageKey = 'accordion-id';
3
- var themeLocalStorageKey = 'theme';
4
- var fontSizeLocalStorageKey = 'font-size';
5
- var html = document.querySelector('html');
6
-
7
- var MAX_FONT_SIZE = 30;
8
- var MIN_FONT_SIZE = 10;
9
-
10
- // eslint-disable-next-line no-undef
11
- var localStorage = window.localStorage;
12
-
13
- function getTheme() {
14
- var body = document.body;
15
-
16
- return body.getAttribute('data-theme');
17
- }
18
-
19
- function updateTheme(theme) {
20
- var body = document.body;
21
- var svgUse = document.querySelectorAll('.theme-svg-use');
22
- var iconID = theme === 'dark' ? '#light-theme-icon' : '#dark-theme-icon';
23
-
24
- body.setAttribute('data-theme', theme);
25
- body.classList.remove('dark', 'light');
26
- body.classList.add(theme);
27
-
28
- svgUse.forEach(function (svg) {
29
- svg.setAttribute('xlink:href', iconID);
30
- });
31
-
32
- localStorage.setItem(themeLocalStorageKey, theme);
33
- }
34
-
35
- function toggleTheme() {
36
- var body = document.body;
37
- var theme = body.getAttribute('data-theme');
38
-
39
- var newTheme = theme === 'dark' ? 'light' : 'dark';
40
-
41
- updateTheme(newTheme);
42
- }
43
-
44
- (function () {
45
- var theme = getTheme();
46
-
47
- var themeStoredInLocalStorage = localStorage.getItem(themeLocalStorageKey);
48
-
49
- if (themeStoredInLocalStorage) {
50
- if (theme === themeStoredInLocalStorage) {
51
- return;
52
- }
53
-
54
- updateTheme(themeStoredInLocalStorage);
55
- } else {
56
- localStorage.setItem(themeLocalStorageKey, theme);
57
- }
58
- })();
59
-
60
- /**
61
- * Function to set accordion id to localStorage.
62
- * @param {string} id Accordion id
63
- */
64
- function setAccordionIdToLocalStorage(id) {
65
- /**
66
- * @type {object}
67
- */
68
- var ids = JSON.parse(localStorage.getItem(accordionLocalStorageKey));
69
-
70
- ids[id] = id;
71
- localStorage.setItem(accordionLocalStorageKey, JSON.stringify(ids));
72
- }
73
-
74
- /**
75
- * Function to remove accordion id from localStorage.
76
- * @param {string} id Accordion id
77
- */
78
- function removeAccordionIdFromLocalStorage(id) {
79
- /**
80
- * @type {object}
81
- */
82
- var ids = JSON.parse(localStorage.getItem(accordionLocalStorageKey));
83
-
84
- delete ids[id];
85
- localStorage.setItem(accordionLocalStorageKey, JSON.stringify(ids));
86
- }
87
-
88
- /**
89
- * Function to get all accordion ids from localStorage.
90
- *
91
- * @returns {object}
92
- */
93
- function getAccordionIdsFromLocalStorage() {
94
- /**
95
- * @type {object}
96
- */
97
- var ids = JSON.parse(localStorage.getItem(accordionLocalStorageKey));
98
-
99
- return ids || {};
100
- }
101
-
102
- function toggleAccordion(element) {
103
- var currentNode = element;
104
- var isCollapsed = currentNode.getAttribute('data-isopen') === 'false';
105
-
106
- if (isCollapsed) {
107
- currentNode.setAttribute('data-isopen', 'true');
108
- setAccordionIdToLocalStorage(currentNode.id);
109
- } else {
110
- currentNode.setAttribute('data-isopen', 'false');
111
- removeAccordionIdFromLocalStorage(currentNode.id);
112
- }
113
- }
114
-
115
- function initAccordion() {
116
- if (
117
- localStorage.getItem(accordionLocalStorageKey) === undefined ||
118
- localStorage.getItem(accordionLocalStorageKey) === null
119
- ) {
120
- localStorage.setItem(accordionLocalStorageKey, '{}');
121
- }
122
- var allAccordion = document.querySelectorAll('.sidebar-section-title');
123
- var ids = getAccordionIdsFromLocalStorage();
124
-
125
- allAccordion.forEach(function (item) {
126
- item.addEventListener('click', function () {
127
- toggleAccordion(item);
128
- });
129
- if (item.id in ids) {
130
- toggleAccordion(item);
131
- }
132
- });
133
- }
134
-
135
- function isSourcePage() {
136
- return Boolean(document.querySelector('#source-page'));
137
- }
138
-
139
- function bringElementIntoView(element, updateHistory = true) {
140
- // If element is null then we are not going further
141
- if (!element) {
142
- return;
143
- }
144
-
145
- /**
146
- * tocbotInstance is defined in layout.tmpl
147
- * It is defined when we are initializing tocbot.
148
- *
149
- */
150
- // eslint-disable-next-line no-undef
151
- if (tocbotInstance) {
152
- // eslint-disable-next-line no-undef
153
- setTimeout(() => tocbotInstance.updateTocListActiveElement(element), 60)
154
- }
155
- var navbar = document.querySelector('.navbar-container');
156
- var body = document.querySelector('.main-content');
157
- var elementTop = element.getBoundingClientRect().top;
158
-
159
- var offset = 16;
160
-
161
- if (navbar) {
162
- offset += navbar.scrollHeight;
163
- }
164
-
165
- if (body) {
166
- body.scrollBy(0, elementTop - offset);
167
- }
168
-
169
- if (updateHistory) {
170
- // eslint-disable-next-line no-undef
171
- history.pushState(null, null, '#' + element.id);
172
- }
173
- }
174
-
175
- // eslint-disable-next-line no-unused-vars
176
- function bringLinkToView(event) {
177
- event.preventDefault();
178
- event.stopPropagation();
179
- var id = event.currentTarget.getAttribute('href');
180
-
181
- if (!id) {
182
- return;
183
- }
184
-
185
- var element = document.getElementById(id.slice(1));
186
-
187
- if (element) {
188
- bringElementIntoView(element);
189
- }
190
- }
191
-
192
- function bringIdToViewOnMount() {
193
- if (isSourcePage()) {
194
- return;
195
- }
196
-
197
- // eslint-disable-next-line no-undef
198
- var id = window.location.hash;
199
-
200
- if (id === '') {
201
- return;
202
- }
203
-
204
- var element = document.getElementById(id.slice(1));
205
-
206
- if (!element) {
207
- id = decodeURI(id);
208
- element = document.getElementById(id.slice(1));
209
- }
210
-
211
- if (element) {
212
- bringElementIntoView(element, false);
213
- }
214
- }
215
-
216
- function createAnchorElement(id) {
217
- var anchor = document.createElement('a');
218
-
219
- anchor.textContent = '#';
220
- anchor.href = '#' + id;
221
- anchor.classList.add('link-anchor');
222
- anchor.onclick = bringLinkToView;
223
-
224
- return anchor;
225
- }
226
-
227
- function addAnchor() {
228
- var main = document.querySelector('.main-content').querySelector('section');
229
-
230
- var h1 = main.querySelectorAll('h1');
231
- var h2 = main.querySelectorAll('h2');
232
- var h3 = main.querySelectorAll('h3');
233
- var h4 = main.querySelectorAll('h4');
234
-
235
- var targets = [h1, h2, h3, h4];
236
-
237
- targets.forEach(function (target) {
238
- target.forEach(function (heading) {
239
- var anchor = createAnchorElement(heading.id);
240
-
241
- heading.classList.add('has-anchor');
242
- heading.append(anchor);
243
- });
244
- });
245
- }
246
-
247
- /**
248
- *
249
- * @param {string} value
250
- */
251
- function copy(value) {
252
- console.log(value);
253
- const el = document.createElement('textarea');
254
-
255
- el.value = value;
256
- document.body.appendChild(el);
257
- el.select();
258
- document.execCommand('copy');
259
- document.body.removeChild(el);
260
- }
261
-
262
- function showTooltip(id) {
263
- var tooltip = document.getElementById(id);
264
-
265
- tooltip.classList.add('show-tooltip');
266
- setTimeout(function () {
267
- tooltip.classList.remove('show-tooltip');
268
- }, 3000);
269
- }
270
-
271
- /* eslint-disable-next-line */
272
- function copyFunction(id) {
273
- // selecting the pre element
274
- var code = document.getElementById(id);
275
-
276
- // selecting the ol.linenums
277
- var element = code.querySelector('.linenums');
278
-
279
- if (!element) {
280
- // selecting the code block
281
- element = code.querySelector('code');
282
- }
283
-
284
- // copy
285
- copy(element.innerText.trim().replace(/(^\t)/gm, ''));
286
-
287
- // show tooltip
288
- showTooltip('tooltip-' + id);
289
- }
290
-
291
- function hideTocOnSourcePage() {
292
- if (isSourcePage()) {
293
- document.querySelector('.toc-container').style.display = 'none';
294
- }
295
- }
296
-
297
- function getPreTopBar(id, lang = '') {
298
- // tooltip
299
- var tooltip = '<div class="tooltip" id="tooltip-' + id + '">Copied!</div>';
300
-
301
- // template of copy to clipboard icon container
302
- var copyToClipboard =
303
- '<button aria-label="copy code" class="icon-button copy-code" onclick="copyFunction(\'' +
304
- id +
305
- '\')"><svg class="sm-icon" alt="click to copy"><use xlink:href="#copy-icon"></use></svg>' +
306
- tooltip +
307
- '</button>';
308
-
309
- var langNameDiv =
310
- '<div class="code-lang-name-container"><div class="code-lang-name">' +
311
- lang.toLocaleUpperCase() +
312
- '</div></div>';
313
-
314
- var topBar =
315
- '<div class="pre-top-bar-container">' +
316
- langNameDiv +
317
- copyToClipboard +
318
- '</div>';
319
-
320
- return topBar;
321
- }
322
-
323
- function getPreDiv() {
324
- var divElement = document.createElement('div');
325
-
326
- divElement.classList.add('pre-div');
327
-
328
- return divElement;
329
- }
330
-
331
- function processAllPre() {
332
- var targets = document.querySelectorAll('pre');
333
- var footer = document.querySelector('#PeOAagUepe');
334
- var navbar = document.querySelector('#VuAckcnZhf');
335
-
336
- var navbarHeight = 0;
337
- var footerHeight = 0;
338
-
339
- if (footer) {
340
- footerHeight = footer.getBoundingClientRect().height;
341
- }
342
-
343
- if (navbar) {
344
- navbarHeight = navbar.getBoundingClientRect().height;
345
- }
346
-
347
- // eslint-disable-next-line no-undef
348
- var preMaxHeight = window.innerHeight - navbarHeight - footerHeight - 250;
349
-
350
- targets.forEach(function (pre, idx) {
351
- var parent = pre.parentNode;
352
-
353
- if (parent && parent.getAttribute('data-skip-pre-process') === 'true') {
354
- return;
355
- }
356
-
357
- var div = getPreDiv();
358
- var id = 'ScDloZOMdL' + idx;
359
-
360
- var lang = pre.getAttribute('data-lang') || 'code';
361
- var topBar = getPreTopBar(id, lang);
362
-
363
- div.innerHTML = topBar;
364
-
365
- pre.style.maxHeight = preMaxHeight + 'px';
366
- pre.id = id;
367
- pre.classList.add('prettyprint');
368
- pre.parentNode.insertBefore(div, pre);
369
- div.appendChild(pre);
370
- });
371
- }
372
-
373
- function highlightAndBringLineIntoView() {
374
- // eslint-disable-next-line no-undef
375
- var lineNumber = window.location.hash.replace('#line', '');
376
-
377
- try {
378
- var selector = '[data-line-number="' + lineNumber + '"';
379
-
380
- var element = document.querySelector(selector);
381
-
382
- element.scrollIntoView();
383
- element.parentNode.classList.add('selected');
384
- } catch (error) {
385
- console.error(error);
386
- }
387
- }
388
-
389
- function getFontSize() {
390
- var currentFontSize = 16;
391
-
392
- try {
393
- currentFontSize = Number.parseInt(
394
- html.style.fontSize.split('px')[0],
395
- 10
396
- );
397
- } catch (error) {
398
- console.log(error);
399
- }
400
-
401
- return currentFontSize;
402
- }
403
-
404
- function updateFontSize(fontSize) {
405
- html.style.fontSize = fontSize + 'px';
406
- localStorage.setItem(fontSizeLocalStorageKey, fontSize);
407
- var fontSizeText = document.querySelector(
408
- '#b77a68a492f343baabea06fad81f651e'
409
- );
410
-
411
- if (fontSizeText) {
412
- fontSizeText.innerHTML = fontSize;
413
- }
414
- }
415
-
416
- (function () {
417
- var fontSize = getFontSize();
418
- var fontSizeInLocalStorage = localStorage.getItem(fontSizeLocalStorageKey);
419
-
420
- if (fontSizeInLocalStorage) {
421
- var n = Number.parseInt(fontSizeInLocalStorage, 10);
422
-
423
- if (n === fontSize) {
424
- return;
425
- }
426
- updateFontSize(n);
427
- } else {
428
- updateFontSize(fontSize);
429
- }
430
- })();
431
-
432
- // eslint-disable-next-line no-unused-vars
433
- function incrementFont(event) {
434
- var n = getFontSize();
435
-
436
- if (n < MAX_FONT_SIZE) {
437
- updateFontSize(n + 1);
438
- }
439
- }
440
-
441
- // eslint-disable-next-line no-unused-vars
442
- function decrementFont(event) {
443
- var n = getFontSize();
444
-
445
- if (n > MIN_FONT_SIZE) {
446
- updateFontSize(n - 1);
447
- }
448
- }
449
-
450
- function fontSizeTooltip() {
451
- var fontSize = getFontSize();
452
-
453
- return `
454
- <div class="font-size-tooltip">
455
- <button aria-label="decrease-font-size" class="icon-button ${fontSize >= MAX_FONT_SIZE ? 'disabled' : ''
456
- }" onclick="decrementFont(event)">
457
- <svg>
458
- <use xlink:href="#minus-icon"></use>
459
- </svg>
460
- </button>
461
- <div class="font-size-text" id="b77a68a492f343baabea06fad81f651e">
462
- ${fontSize}
463
- </div>
464
- <button aria-label="increase-font-size" class="icon-button ${fontSize <= MIN_FONT_SIZE ? 'disabled' : ''
465
- }" onclick="incrementFont(event)">
466
- <svg>
467
- <use xlink:href="#add-icon"></use>
468
- </svg>
469
- </button>
470
- <button class="icon-button" onclick="updateFontSize(16)">
471
- <svg>
472
- <use xlink:href="#reset-icon"></use>
473
- </svg>
474
- </button>
475
- </div>
476
-
477
- `;
478
- }
479
-
480
- function initTooltip() {
481
- // add tooltip to navbar item
482
- // eslint-disable-next-line no-undef
483
- tippy('.theme-toggle', {
484
- content: 'Toggle Theme',
485
- delay: 500
486
- });
487
-
488
- // eslint-disable-next-line no-undef
489
- tippy('.search-button', {
490
- content: 'Search',
491
- delay: 500
492
- });
493
-
494
- // eslint-disable-next-line no-undef
495
- tippy('.font-size', {
496
- content: 'Change font size',
497
- delay: 500
498
- });
499
-
500
- // eslint-disable-next-line no-undef
501
- tippy('.codepen-button', {
502
- content: 'Open code in CodePen',
503
- placement: 'left'
504
- });
505
-
506
- // eslint-disable-next-line no-undef
507
- tippy('.copy-code', {
508
- content: 'Copy this code',
509
- placement: 'left'
510
- });
511
-
512
- // eslint-disable-next-line no-undef
513
- tippy('.font-size', {
514
- content: fontSizeTooltip(),
515
- trigger: 'click',
516
- interactive: true,
517
- allowHTML: true,
518
- placement: 'left'
519
- });
520
- }
521
-
522
- function fixTable() {
523
- const tables = document.querySelectorAll('table');
524
-
525
- for (const table of tables) {
526
- if (table.classList.contains('hljs-ln')) {
527
- // don't want to wrap code blocks.
528
- return;
529
- }
530
-
531
- var div = document.createElement('div');
532
-
533
- div.classList.add('table-div');
534
- table.parentNode.insertBefore(div, table);
535
- div.appendChild(table);
536
- }
537
- }
538
-
539
- function hideMobileMenu() {
540
- var mobileMenuContainer = document.querySelector('#mobile-sidebar');
541
- var target = document.querySelector('#mobile-menu');
542
- var svgUse = target.querySelector('use');
543
-
544
- if (mobileMenuContainer) {
545
- mobileMenuContainer.classList.remove('show');
546
- }
547
- if (target) {
548
- target.setAttribute('data-isopen', 'false');
549
- }
550
- if (svgUse) {
551
- svgUse.setAttribute('xlink:href', '#menu-icon');
552
- }
553
- }
554
-
555
- function showMobileMenu() {
556
- var mobileMenuContainer = document.querySelector('#mobile-sidebar');
557
- var target = document.querySelector('#mobile-menu');
558
- var svgUse = target.querySelector('use');
559
-
560
- if (mobileMenuContainer) {
561
- mobileMenuContainer.classList.add('show');
562
- }
563
- if (target) {
564
- target.setAttribute('data-isopen', 'true');
565
- }
566
- if (svgUse) {
567
- svgUse.setAttribute('xlink:href', '#close-icon');
568
- }
569
- }
570
-
571
- function onMobileMenuClick() {
572
- var target = document.querySelector('#mobile-menu');
573
- var isOpen = target.getAttribute('data-isopen') === 'true';
574
-
575
- if (isOpen) {
576
- hideMobileMenu();
577
- } else {
578
- showMobileMenu();
579
- }
580
- }
581
-
582
- function initMobileMenu() {
583
- var menu = document.querySelector('#mobile-menu');
584
-
585
- if (menu) {
586
- menu.addEventListener('click', onMobileMenuClick);
587
- }
588
- }
589
-
590
- function addHrefToSidebarTitle() {
591
- var titles = document.querySelectorAll('.sidebar-title-anchor');
592
-
593
- titles.forEach(function (title) {
594
- // eslint-disable-next-line no-undef
595
- title.setAttribute('href', baseURL);
596
- });
597
- }
598
-
599
- function onDomContentLoaded() {
600
- var themeButton = document.querySelectorAll('.theme-toggle');
601
-
602
- initMobileMenu();
603
-
604
- if (themeButton) {
605
- themeButton.forEach(function (button) {
606
- button.addEventListener('click', toggleTheme);
607
- });
608
- }
609
-
610
- // Highlighting code
611
-
612
- // eslint-disable-next-line no-undef
613
- hljs.addPlugin({
614
- 'after:highlightElement': function (obj) {
615
- // Replace 'code' with result.language when
616
- // we are able to cross-check the correctness of
617
- // result.
618
- obj.el.parentNode.setAttribute('data-lang', 'code');
619
- }
620
- });
621
- // eslint-disable-next-line no-undef
622
- hljs.highlightAll();
623
- // eslint-disable-next-line no-undef
624
- hljs.initLineNumbersOnLoad({
625
- singleLine: true
626
- });
627
-
628
- // Highlight complete
629
-
630
- initAccordion();
631
- addAnchor();
632
- processAllPre();
633
- hideTocOnSourcePage();
634
- setTimeout(function () {
635
- bringIdToViewOnMount();
636
- if (isSourcePage()) {
637
- highlightAndBringLineIntoView();
638
- }
639
- }, 1000);
640
- initTooltip();
641
- fixTable();
642
- addHrefToSidebarTitle();
643
- }
644
-
645
- // eslint-disable-next-line no-undef
646
- window.addEventListener('DOMContentLoaded', onDomContentLoaded);
647
-
648
- // eslint-disable-next-line no-undef
649
- window.addEventListener('hashchange', (event) => {
650
- const url = new URL(event.newURL);
651
-
652
- if (url.hash !== '') {
653
- bringIdToViewOnMount(url.hash);
654
- }
655
- });