@static-suite/static-suite-data-server 0.0.1

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 (484) hide show
  1. package/.eslintignore +4 -0
  2. package/.eslintrc.json +49 -0
  3. package/.nvmrc +1 -0
  4. package/.prettierrc +10 -0
  5. package/.vscode/launch.json +44 -0
  6. package/LICENSE.txt +339 -0
  7. package/README.md +300 -0
  8. package/__mocks__/clear-module.js +7 -0
  9. package/api-extractor.json +339 -0
  10. package/dist/bin/serve.d.ts +3 -0
  11. package/dist/bin/serve.d.ts.map +1 -0
  12. package/dist/bin/serve.js +105 -0
  13. package/dist/http/README.md +300 -0
  14. package/dist/http/httpServer.d.ts +4 -0
  15. package/dist/http/httpServer.d.ts.map +1 -0
  16. package/dist/http/httpServer.js +24 -0
  17. package/dist/http/public/assets/bulma/bulma-tooltip.min.css +2 -0
  18. package/dist/http/public/assets/bulma/bulma.min.css +1 -0
  19. package/dist/http/public/assets/clipboard/clipboard.min.js +7 -0
  20. package/dist/http/public/assets/simple-datatables/index.js +12 -0
  21. package/dist/http/public/assets/simple-datatables/style.css +173 -0
  22. package/dist/http/routes/cache.d.ts +4 -0
  23. package/dist/http/routes/cache.d.ts.map +1 -0
  24. package/dist/http/routes/cache.js +19 -0
  25. package/dist/http/routes/data.d.ts +4 -0
  26. package/dist/http/routes/data.d.ts.map +1 -0
  27. package/dist/http/routes/data.js +104 -0
  28. package/dist/http/routes/docs.d.ts +3 -0
  29. package/dist/http/routes/docs.d.ts.map +1 -0
  30. package/dist/http/routes/docs.js +14 -0
  31. package/dist/http/routes/dump.d.ts +8 -0
  32. package/dist/http/routes/dump.d.ts.map +1 -0
  33. package/dist/http/routes/dump.js +57 -0
  34. package/dist/http/routes/home.d.ts +3 -0
  35. package/dist/http/routes/home.d.ts.map +1 -0
  36. package/dist/http/routes/home.js +17 -0
  37. package/dist/http/routes/index.d.ts +3 -0
  38. package/dist/http/routes/index.d.ts.map +1 -0
  39. package/dist/http/routes/index.js +33 -0
  40. package/dist/http/routes/query.d.ts +5 -0
  41. package/dist/http/routes/query.d.ts.map +1 -0
  42. package/dist/http/routes/query.js +21 -0
  43. package/dist/http/routes/status.d.ts +9 -0
  44. package/dist/http/routes/status.d.ts.map +1 -0
  45. package/dist/http/routes/status.js +74 -0
  46. package/dist/http/routes/task.d.ts +5 -0
  47. package/dist/http/routes/task.d.ts.map +1 -0
  48. package/dist/http/routes/task.js +22 -0
  49. package/dist/http/views/cacheClear.pug +17 -0
  50. package/dist/http/views/cacheIndex.pug +19 -0
  51. package/dist/http/views/data.pug +68 -0
  52. package/dist/http/views/docs.pug +7 -0
  53. package/dist/http/views/dumpIndex.pug +14 -0
  54. package/dist/http/views/home.pug +15 -0
  55. package/dist/http/views/includes/layout.pug +23 -0
  56. package/dist/http/views/queryIndex.pug +17 -0
  57. package/dist/http/views/statusIndex.pug +14 -0
  58. package/dist/http/views/taskIndex.pug +17 -0
  59. package/dist/lib/config/config.d.ts +26 -0
  60. package/dist/lib/config/config.d.ts.map +1 -0
  61. package/dist/lib/config/config.js +122 -0
  62. package/dist/lib/config/config.types.d.ts +74 -0
  63. package/dist/lib/config/config.types.d.ts.map +1 -0
  64. package/dist/lib/config/config.types.js +2 -0
  65. package/dist/lib/config/error/InvalidRunMode.d.ts +15 -0
  66. package/dist/lib/config/error/InvalidRunMode.d.ts.map +1 -0
  67. package/dist/lib/config/error/InvalidRunMode.js +20 -0
  68. package/dist/lib/config/error/MissingDirectory.d.ts +24 -0
  69. package/dist/lib/config/error/MissingDirectory.d.ts.map +1 -0
  70. package/dist/lib/config/error/MissingDirectory.js +23 -0
  71. package/dist/lib/config/error/MissingRequiredOption.d.ts +19 -0
  72. package/dist/lib/config/error/MissingRequiredOption.d.ts.map +1 -0
  73. package/dist/lib/config/error/MissingRequiredOption.js +21 -0
  74. package/dist/lib/config/error/NonWritableDirectory.d.ts +24 -0
  75. package/dist/lib/config/error/NonWritableDirectory.d.ts.map +1 -0
  76. package/dist/lib/config/error/NonWritableDirectory.js +23 -0
  77. package/dist/lib/config/error/index.d.ts +5 -0
  78. package/dist/lib/config/error/index.d.ts.map +1 -0
  79. package/dist/lib/config/error/index.js +16 -0
  80. package/dist/lib/config/index.d.ts +2 -0
  81. package/dist/lib/config/index.d.ts.map +1 -0
  82. package/dist/lib/config/index.js +13 -0
  83. package/dist/lib/dataServer.d.ts +21 -0
  84. package/dist/lib/dataServer.d.ts.map +1 -0
  85. package/dist/lib/dataServer.js +56 -0
  86. package/dist/lib/dataServer.types.d.ts +84 -0
  87. package/dist/lib/dataServer.types.d.ts.map +1 -0
  88. package/dist/lib/dataServer.types.js +13 -0
  89. package/dist/lib/error/DomainError.d.ts +9 -0
  90. package/dist/lib/error/DomainError.d.ts.map +1 -0
  91. package/dist/lib/error/DomainError.js +20 -0
  92. package/dist/lib/index.d.ts +2 -0
  93. package/dist/lib/index.d.ts.map +1 -0
  94. package/dist/lib/index.js +15 -0
  95. package/dist/lib/query/index.d.ts +3 -0
  96. package/dist/lib/query/index.d.ts.map +1 -0
  97. package/dist/lib/query/index.js +14 -0
  98. package/dist/lib/query/query.types.d.ts +206 -0
  99. package/dist/lib/query/query.types.d.ts.map +1 -0
  100. package/dist/lib/query/query.types.js +21 -0
  101. package/dist/lib/query/queryManager.d.ts +10 -0
  102. package/dist/lib/query/queryManager.d.ts.map +1 -0
  103. package/dist/lib/query/queryManager.js +12 -0
  104. package/dist/lib/query/queryRunner copy.d.ts +3 -0
  105. package/dist/lib/query/queryRunner copy.d.ts.map +1 -0
  106. package/dist/lib/query/queryRunner copy.js +87 -0
  107. package/dist/lib/query/queryRunner.d.ts +3 -0
  108. package/dist/lib/query/queryRunner.d.ts.map +1 -0
  109. package/dist/lib/query/queryRunner.js +96 -0
  110. package/dist/lib/query/queryTagManager.d.ts +3 -0
  111. package/dist/lib/query/queryTagManager.d.ts.map +1 -0
  112. package/dist/lib/query/queryTagManager.js +47 -0
  113. package/dist/lib/store/dataDir/dataDir.types.d.ts +36 -0
  114. package/dist/lib/store/dataDir/dataDir.types.d.ts.map +1 -0
  115. package/dist/lib/store/dataDir/dataDir.types.js +2 -0
  116. package/dist/lib/store/dataDir/dataDirManager.d.ts +3 -0
  117. package/dist/lib/store/dataDir/dataDirManager.d.ts.map +1 -0
  118. package/dist/lib/store/dataDir/dataDirManager.js +97 -0
  119. package/dist/lib/store/dataDir/index.d.ts +2 -0
  120. package/dist/lib/store/dataDir/index.d.ts.map +1 -0
  121. package/dist/lib/store/dataDir/index.js +13 -0
  122. package/dist/lib/store/dependency/dependency.types.d.ts +70 -0
  123. package/dist/lib/store/dependency/dependency.types.d.ts.map +1 -0
  124. package/dist/lib/store/dependency/dependency.types.js +2 -0
  125. package/dist/lib/store/dependency/dependencyFileHelper.d.ts +6 -0
  126. package/dist/lib/store/dependency/dependencyFileHelper.d.ts.map +1 -0
  127. package/dist/lib/store/dependency/dependencyFileHelper.js +46 -0
  128. package/dist/lib/store/dependency/dependencyManager copy.d.ts +6 -0
  129. package/dist/lib/store/dependency/dependencyManager copy.d.ts.map +1 -0
  130. package/dist/lib/store/dependency/dependencyManager copy.js +91 -0
  131. package/dist/lib/store/dependency/dependencyManager.d.ts +6 -0
  132. package/dist/lib/store/dependency/dependencyManager.d.ts.map +1 -0
  133. package/dist/lib/store/dependency/dependencyManager.js +78 -0
  134. package/dist/lib/store/dependency/dependencyManager.types.d.ts +48 -0
  135. package/dist/lib/store/dependency/dependencyManager.types.d.ts.map +1 -0
  136. package/dist/lib/store/dependency/dependencyManager.types.js +2 -0
  137. package/dist/lib/store/dependency/dependencyTagManager.d.ts +6 -0
  138. package/dist/lib/store/dependency/dependencyTagManager.d.ts.map +1 -0
  139. package/dist/lib/store/dependency/dependencyTagManager.js +33 -0
  140. package/dist/lib/store/dependency/dependencyTagger.d.ts +11 -0
  141. package/dist/lib/store/dependency/dependencyTagger.d.ts.map +1 -0
  142. package/dist/lib/store/dependency/dependencyTagger.js +99 -0
  143. package/dist/lib/store/diff/diffManager.d.ts +3 -0
  144. package/dist/lib/store/diff/diffManager.d.ts.map +1 -0
  145. package/dist/lib/store/diff/diffManager.js +114 -0
  146. package/dist/lib/store/diff/diffManager.types.d.ts +50 -0
  147. package/dist/lib/store/diff/diffManager.types.d.ts.map +1 -0
  148. package/dist/lib/store/diff/diffManager.types.js +2 -0
  149. package/dist/lib/store/diff/index.d.ts +2 -0
  150. package/dist/lib/store/diff/index.d.ts.map +1 -0
  151. package/dist/lib/store/diff/index.js +13 -0
  152. package/dist/lib/store/diff/tracker.d.ts +3 -0
  153. package/dist/lib/store/diff/tracker.d.ts.map +1 -0
  154. package/dist/lib/store/diff/tracker.js +82 -0
  155. package/dist/lib/store/diff/tracker.types.d.ts +31 -0
  156. package/dist/lib/store/diff/tracker.types.d.ts.map +1 -0
  157. package/dist/lib/store/diff/tracker.types.js +2 -0
  158. package/dist/lib/store/dump/dumpManager.d.ts +3 -0
  159. package/dist/lib/store/dump/dumpManager.d.ts.map +1 -0
  160. package/dist/lib/store/dump/dumpManager.js +199 -0
  161. package/dist/lib/store/dump/dumpManager.types.d.ts +62 -0
  162. package/dist/lib/store/dump/dumpManager.types.d.ts.map +1 -0
  163. package/dist/lib/store/dump/dumpManager.types.js +2 -0
  164. package/dist/lib/store/dump/index.d.ts +2 -0
  165. package/dist/lib/store/dump/index.d.ts.map +1 -0
  166. package/dist/lib/store/dump/index.js +13 -0
  167. package/dist/lib/store/hook/hook.types.d.ts +205 -0
  168. package/dist/lib/store/hook/hook.types.d.ts.map +1 -0
  169. package/dist/lib/store/hook/hook.types.js +2 -0
  170. package/dist/lib/store/hook/hookManager.d.ts +6 -0
  171. package/dist/lib/store/hook/hookManager.d.ts.map +1 -0
  172. package/dist/lib/store/hook/hookManager.js +168 -0
  173. package/dist/lib/store/hook/index.d.ts +2 -0
  174. package/dist/lib/store/hook/index.d.ts.map +1 -0
  175. package/dist/lib/store/hook/index.js +13 -0
  176. package/dist/lib/store/include/includeIndex.d.ts +6 -0
  177. package/dist/lib/store/include/includeIndex.d.ts.map +1 -0
  178. package/dist/lib/store/include/includeIndex.js +65 -0
  179. package/dist/lib/store/include/includeIndex.types.d.ts +29 -0
  180. package/dist/lib/store/include/includeIndex.types.d.ts.map +1 -0
  181. package/dist/lib/store/include/includeIndex.types.js +2 -0
  182. package/dist/lib/store/include/includeParser.d.ts +3 -0
  183. package/dist/lib/store/include/includeParser.d.ts.map +1 -0
  184. package/dist/lib/store/include/includeParser.js +46 -0
  185. package/dist/lib/store/include/includeParser.types.d.ts +88 -0
  186. package/dist/lib/store/include/includeParser.types.d.ts.map +1 -0
  187. package/dist/lib/store/include/includeParser.types.js +2 -0
  188. package/dist/lib/store/include/index.d.ts +2 -0
  189. package/dist/lib/store/include/index.d.ts.map +1 -0
  190. package/dist/lib/store/include/index.js +13 -0
  191. package/dist/lib/store/include/parsers/configIncludeParser.d.ts +3 -0
  192. package/dist/lib/store/include/parsers/configIncludeParser.d.ts.map +1 -0
  193. package/dist/lib/store/include/parsers/configIncludeParser.js +8 -0
  194. package/dist/lib/store/include/parsers/customIncludeParser.d.ts +3 -0
  195. package/dist/lib/store/include/parsers/customIncludeParser.d.ts.map +1 -0
  196. package/dist/lib/store/include/parsers/customIncludeParser.js +8 -0
  197. package/dist/lib/store/include/parsers/entityIncludeParser.d.ts +3 -0
  198. package/dist/lib/store/include/parsers/entityIncludeParser.d.ts.map +1 -0
  199. package/dist/lib/store/include/parsers/entityIncludeParser.js +13 -0
  200. package/dist/lib/store/include/parsers/index.d.ts +6 -0
  201. package/dist/lib/store/include/parsers/index.d.ts.map +1 -0
  202. package/dist/lib/store/include/parsers/index.js +17 -0
  203. package/dist/lib/store/include/parsers/localeIncludeParser.d.ts +3 -0
  204. package/dist/lib/store/include/parsers/localeIncludeParser.d.ts.map +1 -0
  205. package/dist/lib/store/include/parsers/localeIncludeParser.js +8 -0
  206. package/dist/lib/store/include/parsers/queryIncludeParser.d.ts +11 -0
  207. package/dist/lib/store/include/parsers/queryIncludeParser.d.ts.map +1 -0
  208. package/dist/lib/store/include/parsers/queryIncludeParser.js +45 -0
  209. package/dist/lib/store/include/parsers/types/aliasIncludeParser.d.ts +3 -0
  210. package/dist/lib/store/include/parsers/types/aliasIncludeParser.d.ts.map +1 -0
  211. package/dist/lib/store/include/parsers/types/aliasIncludeParser.js +10 -0
  212. package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.d.ts +8 -0
  213. package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.d.ts.map +1 -0
  214. package/dist/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.js +18 -0
  215. package/dist/lib/store/index.d.ts +2 -0
  216. package/dist/lib/store/index.d.ts.map +1 -0
  217. package/dist/lib/store/index.js +13 -0
  218. package/dist/lib/store/store.d.ts +7 -0
  219. package/dist/lib/store/store.d.ts.map +1 -0
  220. package/dist/lib/store/store.js +89 -0
  221. package/dist/lib/store/store.types.d.ts +231 -0
  222. package/dist/lib/store/store.types.d.ts.map +1 -0
  223. package/dist/lib/store/store.types.js +2 -0
  224. package/dist/lib/store/storeManager.d.ts +3 -0
  225. package/dist/lib/store/storeManager.d.ts.map +1 -0
  226. package/dist/lib/store/storeManager.js +149 -0
  227. package/dist/lib/store/workDir/index.d.ts +2 -0
  228. package/dist/lib/store/workDir/index.d.ts.map +1 -0
  229. package/dist/lib/store/workDir/index.js +13 -0
  230. package/dist/lib/store/workDir/storage/getChangedLinesSince.d.ts +9 -0
  231. package/dist/lib/store/workDir/storage/getChangedLinesSince.d.ts.map +1 -0
  232. package/dist/lib/store/workDir/storage/getChangedLinesSince.js +47 -0
  233. package/dist/lib/store/workDir/storage/getDataFromLogLine.d.ts +10 -0
  234. package/dist/lib/store/workDir/storage/getDataFromLogLine.d.ts.map +1 -0
  235. package/dist/lib/store/workDir/storage/getDataFromLogLine.js +33 -0
  236. package/dist/lib/store/workDir/storage/getLogFile.d.ts +8 -0
  237. package/dist/lib/store/workDir/storage/getLogFile.d.ts.map +1 -0
  238. package/dist/lib/store/workDir/storage/getLogFile.js +11 -0
  239. package/dist/lib/store/workDir/storage/index.d.ts +4 -0
  240. package/dist/lib/store/workDir/storage/index.d.ts.map +1 -0
  241. package/dist/lib/store/workDir/storage/index.js +20 -0
  242. package/dist/lib/store/workDir/workDir.types.d.ts +44 -0
  243. package/dist/lib/store/workDir/workDir.types.d.ts.map +1 -0
  244. package/dist/lib/store/workDir/workDir.types.js +2 -0
  245. package/dist/lib/store/workDir/workDirHelper.d.ts +20 -0
  246. package/dist/lib/store/workDir/workDirHelper.d.ts.map +1 -0
  247. package/dist/lib/store/workDir/workDirHelper.js +52 -0
  248. package/dist/lib/task/index.d.ts +3 -0
  249. package/dist/lib/task/index.d.ts.map +1 -0
  250. package/dist/lib/task/index.js +14 -0
  251. package/dist/lib/task/task.types.d.ts +140 -0
  252. package/dist/lib/task/task.types.d.ts.map +1 -0
  253. package/dist/lib/task/task.types.js +11 -0
  254. package/dist/lib/task/taskManager.d.ts +10 -0
  255. package/dist/lib/task/taskManager.d.ts.map +1 -0
  256. package/dist/lib/task/taskManager.js +12 -0
  257. package/dist/lib/task/taskRunner.d.ts +3 -0
  258. package/dist/lib/task/taskRunner.d.ts.map +1 -0
  259. package/dist/lib/task/taskRunner.js +71 -0
  260. package/dist/lib/tsdoc-metadata.json +11 -0
  261. package/dist/lib/utils/array/arrayUtils.d.ts +2 -0
  262. package/dist/lib/utils/array/arrayUtils.d.ts.map +1 -0
  263. package/dist/lib/utils/array/arrayUtils.js +11 -0
  264. package/dist/lib/utils/cache/cacheBinManager.d.ts +37 -0
  265. package/dist/lib/utils/cache/cacheBinManager.d.ts.map +1 -0
  266. package/dist/lib/utils/cache/cacheBinManager.js +53 -0
  267. package/dist/lib/utils/cache/index.d.ts +2 -0
  268. package/dist/lib/utils/cache/index.d.ts.map +1 -0
  269. package/dist/lib/utils/cache/index.js +13 -0
  270. package/dist/lib/utils/fs/fs.types.d.ts +20 -0
  271. package/dist/lib/utils/fs/fs.types.d.ts.map +1 -0
  272. package/dist/lib/utils/fs/fs.types.js +2 -0
  273. package/dist/lib/utils/fs/fsUtils.d.ts +62 -0
  274. package/dist/lib/utils/fs/fsUtils.d.ts.map +1 -0
  275. package/dist/lib/utils/fs/fsUtils.js +137 -0
  276. package/dist/lib/utils/fs/index.d.ts +2 -0
  277. package/dist/lib/utils/fs/index.d.ts.map +1 -0
  278. package/dist/lib/utils/fs/index.js +13 -0
  279. package/dist/lib/utils/logger/index.d.ts +2 -0
  280. package/dist/lib/utils/logger/index.d.ts.map +1 -0
  281. package/dist/lib/utils/logger/index.js +13 -0
  282. package/dist/lib/utils/logger/logger.d.ts +32 -0
  283. package/dist/lib/utils/logger/logger.d.ts.map +1 -0
  284. package/dist/lib/utils/logger/logger.js +82 -0
  285. package/dist/lib/utils/logger/logger.types.d.ts +37 -0
  286. package/dist/lib/utils/logger/logger.types.d.ts.map +1 -0
  287. package/dist/lib/utils/logger/logger.types.js +15 -0
  288. package/dist/lib/utils/module/dirBasedModuleGroupManager.d.ts +30 -0
  289. package/dist/lib/utils/module/dirBasedModuleGroupManager.d.ts.map +1 -0
  290. package/dist/lib/utils/module/dirBasedModuleGroupManager.js +78 -0
  291. package/dist/lib/utils/module/index.d.ts +3 -0
  292. package/dist/lib/utils/module/index.d.ts.map +1 -0
  293. package/dist/lib/utils/module/index.js +14 -0
  294. package/dist/lib/utils/module/module.types.d.ts +53 -0
  295. package/dist/lib/utils/module/module.types.d.ts.map +1 -0
  296. package/dist/lib/utils/module/module.types.js +2 -0
  297. package/dist/lib/utils/module/moduleManager.d.ts +64 -0
  298. package/dist/lib/utils/module/moduleManager.d.ts.map +1 -0
  299. package/dist/lib/utils/module/moduleManager.js +139 -0
  300. package/dist/lib/utils/object/index.d.ts +2 -0
  301. package/dist/lib/utils/object/index.d.ts.map +1 -0
  302. package/dist/lib/utils/object/index.js +13 -0
  303. package/dist/lib/utils/object/object.types.d.ts +72 -0
  304. package/dist/lib/utils/object/object.types.d.ts.map +1 -0
  305. package/dist/lib/utils/object/object.types.js +2 -0
  306. package/dist/lib/utils/object/objectUtils.d.ts +45 -0
  307. package/dist/lib/utils/object/objectUtils.d.ts.map +1 -0
  308. package/dist/lib/utils/object/objectUtils.js +64 -0
  309. package/dist/lib/utils/string/index.d.ts +2 -0
  310. package/dist/lib/utils/string/index.d.ts.map +1 -0
  311. package/dist/lib/utils/string/index.js +13 -0
  312. package/dist/lib/utils/string/string.types.d.ts +2 -0
  313. package/dist/lib/utils/string/string.types.d.ts.map +1 -0
  314. package/dist/lib/utils/string/string.types.js +2 -0
  315. package/dist/lib/utils/string/stringUtils.d.ts +37 -0
  316. package/dist/lib/utils/string/stringUtils.d.ts.map +1 -0
  317. package/dist/lib/utils/string/stringUtils.js +62 -0
  318. package/dist/lib/watcher/index.d.ts +2 -0
  319. package/dist/lib/watcher/index.d.ts.map +1 -0
  320. package/dist/lib/watcher/index.js +13 -0
  321. package/dist/lib/watcher/watcher.d.ts +17 -0
  322. package/dist/lib/watcher/watcher.d.ts.map +1 -0
  323. package/dist/lib/watcher/watcher.js +65 -0
  324. package/dist/static-suite-data-server.d.ts +392 -0
  325. package/package.json +102 -0
  326. package/scripts/copy-http-files-to-src.js +45 -0
  327. package/src/__tests__/fixtures/data/en/en.json +3 -0
  328. package/src/__tests__/fixtures/data/en/entity/entity.json +3 -0
  329. package/src/__tests__/fixtures/data/en/entity/node/article/article1--card.json +3 -0
  330. package/src/__tests__/fixtures/data/en/entity/node/article/article1--small.json +3 -0
  331. package/src/__tests__/fixtures/data/en/entity/node/article/article1.json +40 -0
  332. package/src/__tests__/fixtures/data/en/entity/node/article/article2--card.json +3 -0
  333. package/src/__tests__/fixtures/data/en/entity/node/article/article2--small.json +3 -0
  334. package/src/__tests__/fixtures/data/en/entity/node/article/article2.json +40 -0
  335. package/src/__tests__/fixtures/data/en/entity/node/article/article3--card.json +3 -0
  336. package/src/__tests__/fixtures/data/en/entity/node/article/article3--small.json +3 -0
  337. package/src/__tests__/fixtures/data/en/entity/node/article/article3.json +7 -0
  338. package/src/__tests__/fixtures/data/en/entity/node/node.json +3 -0
  339. package/src/__tests__/fixtures/data/en/entity/node/page/page1--card.json +3 -0
  340. package/src/__tests__/fixtures/data/en/entity/node/page/page1--small.json +3 -0
  341. package/src/__tests__/fixtures/data/en/entity/node/page/page1.json +3 -0
  342. package/src/__tests__/fixtures/data/en/entity/node/page/page2--card.json +3 -0
  343. package/src/__tests__/fixtures/data/en/entity/node/page/page2--small.json +3 -0
  344. package/src/__tests__/fixtures/data/en/entity/node/page/page2.json +3 -0
  345. package/src/__tests__/fixtures/data/global--block.json +3 -0
  346. package/src/__tests__/fixtures/data/global.json +3 -0
  347. package/src/__tests__/fixtures/hook/main.hook.js +15 -0
  348. package/src/__tests__/fixtures/hook/taxonomy/main.hook.js +15 -0
  349. package/src/__tests__/fixtures/hook/taxonomy/taxo.hook.js +15 -0
  350. package/src/__tests__/fixtures/query/error.query.js +6 -0
  351. package/src/__tests__/fixtures/query/noHandler.query.js +14 -0
  352. package/src/__tests__/fixtures/query/query1.query.js +15 -0
  353. package/src/__tests__/fixtures/query/query2.query.js +14 -0
  354. package/src/__tests__/fixtures/query/wrongNamequery.js +14 -0
  355. package/src/__tests__/fixtures/task/error.task.js +6 -0
  356. package/src/__tests__/fixtures/task/noHandler.task.js +13 -0
  357. package/src/__tests__/fixtures/task/task1.task.js +14 -0
  358. package/src/__tests__/fixtures/task/task2.task.js +13 -0
  359. package/src/__tests__/fixtures/task/wrongNametask.js +13 -0
  360. package/src/bin/serve.ts +107 -0
  361. package/src/http/httpServer.ts +21 -0
  362. package/src/http/routes/cache.ts +17 -0
  363. package/src/http/routes/data.ts +114 -0
  364. package/src/http/routes/docs.ts +9 -0
  365. package/src/http/routes/dump.ts +61 -0
  366. package/src/http/routes/home.ts +16 -0
  367. package/src/http/routes/index.ts +47 -0
  368. package/src/http/routes/query.ts +27 -0
  369. package/src/http/routes/status.ts +89 -0
  370. package/src/http/routes/task.ts +29 -0
  371. package/src/http/views/cacheClear.pug +17 -0
  372. package/src/http/views/cacheIndex.pug +19 -0
  373. package/src/http/views/data.pug +68 -0
  374. package/src/http/views/docs.pug +7 -0
  375. package/src/http/views/dumpIndex.pug +14 -0
  376. package/src/http/views/home.pug +15 -0
  377. package/src/http/views/includes/layout.pug +23 -0
  378. package/src/http/views/queryIndex.pug +17 -0
  379. package/src/http/views/statusIndex.pug +14 -0
  380. package/src/http/views/taskIndex.pug +17 -0
  381. package/src/lib/config/__tests__/config.test.ts +132 -0
  382. package/src/lib/config/config.ts +143 -0
  383. package/src/lib/config/config.types.ts +87 -0
  384. package/src/lib/config/error/InvalidRunMode.ts +17 -0
  385. package/src/lib/config/error/MissingDirectory.ts +30 -0
  386. package/src/lib/config/error/MissingRequiredOption.ts +23 -0
  387. package/src/lib/config/error/NonWritableDirectory.ts +30 -0
  388. package/src/lib/config/error/index.ts +4 -0
  389. package/src/lib/config/index.ts +1 -0
  390. package/src/lib/dataServer.ts +81 -0
  391. package/src/lib/dataServer.types.ts +98 -0
  392. package/src/lib/error/DomainError.ts +18 -0
  393. package/src/lib/index.ts +4 -0
  394. package/src/lib/query/__tests__/queryRunner.test.ts +61 -0
  395. package/src/lib/query/index.ts +2 -0
  396. package/src/lib/query/query.types.ts +231 -0
  397. package/src/lib/query/queryManager.ts +11 -0
  398. package/src/lib/query/queryRunner.ts +110 -0
  399. package/src/lib/query/queryTagManager.ts +53 -0
  400. package/src/lib/store/dataDir/__tests__/dataDirManager.test.ts +15 -0
  401. package/src/lib/store/dataDir/dataDir.types.ts +38 -0
  402. package/src/lib/store/dataDir/dataDirManager.ts +121 -0
  403. package/src/lib/store/dataDir/index.ts +1 -0
  404. package/src/lib/store/dependency/dependency.types.ts +78 -0
  405. package/src/lib/store/dependency/dependencyFileHelper.ts +50 -0
  406. package/src/lib/store/dependency/dependencyManager.ts +82 -0
  407. package/src/lib/store/dependency/dependencyTagger.ts +105 -0
  408. package/src/lib/store/diff/diffManager.ts +122 -0
  409. package/src/lib/store/diff/diffManager.types.ts +51 -0
  410. package/src/lib/store/diff/index.ts +1 -0
  411. package/src/lib/store/dump/dumpManager.ts +235 -0
  412. package/src/lib/store/dump/dumpManager.types.ts +61 -0
  413. package/src/lib/store/dump/index.ts +1 -0
  414. package/src/lib/store/hook/hook.types.ts +232 -0
  415. package/src/lib/store/hook/hookManager.ts +180 -0
  416. package/src/lib/store/hook/index.ts +1 -0
  417. package/src/lib/store/include/__tests__/includeParser.test.ts +80 -0
  418. package/src/lib/store/include/includeParser.ts +54 -0
  419. package/src/lib/store/include/includeParser.types.ts +99 -0
  420. package/src/lib/store/include/index.ts +1 -0
  421. package/src/lib/store/include/parsers/__tests__/entityIncludeParser.test.ts +43 -0
  422. package/src/lib/store/include/parsers/configIncludeParser.ts +8 -0
  423. package/src/lib/store/include/parsers/customIncludeParser.ts +8 -0
  424. package/src/lib/store/include/parsers/entityIncludeParser.ts +15 -0
  425. package/src/lib/store/include/parsers/index.ts +5 -0
  426. package/src/lib/store/include/parsers/localeIncludeParser.ts +8 -0
  427. package/src/lib/store/include/parsers/queryIncludeParser.ts +51 -0
  428. package/src/lib/store/include/parsers/types/__tests__/aliasIncludeParser.test.ts +37 -0
  429. package/src/lib/store/include/parsers/types/__tests__/aliasWithoutTypeIncludeParser.test.ts +43 -0
  430. package/src/lib/store/include/parsers/types/aliasIncludeParser.ts +13 -0
  431. package/src/lib/store/include/parsers/types/aliasWithoutTypeIncludeParser.ts +22 -0
  432. package/src/lib/store/index.ts +1 -0
  433. package/src/lib/store/store.ts +105 -0
  434. package/src/lib/store/store.types.ts +251 -0
  435. package/src/lib/store/storeManager.ts +187 -0
  436. package/src/lib/store/workDir/__tests__/workDirHelper.test.ts +25 -0
  437. package/src/lib/store/workDir/index.ts +1 -0
  438. package/src/lib/store/workDir/storage/__tests__/getChangedLinesSince.test.ts +23 -0
  439. package/src/lib/store/workDir/storage/__tests__/getDataFromLogLine.test.ts +21 -0
  440. package/src/lib/store/workDir/storage/getChangedLinesSince.ts +47 -0
  441. package/src/lib/store/workDir/storage/getDataFromLogLine.ts +31 -0
  442. package/src/lib/store/workDir/storage/getLogFile.ts +11 -0
  443. package/src/lib/store/workDir/storage/index.ts +8 -0
  444. package/src/lib/store/workDir/workDir.types.ts +48 -0
  445. package/src/lib/store/workDir/workDirHelper.ts +59 -0
  446. package/src/lib/task/__tests__/taskRunner.test.ts +47 -0
  447. package/src/lib/task/index.ts +2 -0
  448. package/src/lib/task/task.types.ts +151 -0
  449. package/src/lib/task/taskManager.ts +11 -0
  450. package/src/lib/task/taskRunner.ts +79 -0
  451. package/src/lib/utils/array/__tests__/arrayUtils.test.ts +16 -0
  452. package/src/lib/utils/array/arrayUtils.ts +7 -0
  453. package/src/lib/utils/cache/__tests__/cache.test.ts +24 -0
  454. package/src/lib/utils/cache/cacheBinManager.ts +88 -0
  455. package/src/lib/utils/cache/index.ts +1 -0
  456. package/src/lib/utils/fs/__tests__/fixtures/file.json +3 -0
  457. package/src/lib/utils/fs/__tests__/fixtures/file.txt +3 -0
  458. package/src/lib/utils/fs/__tests__/fsUtils.test.ts +93 -0
  459. package/src/lib/utils/fs/fs.types.ts +21 -0
  460. package/src/lib/utils/fs/fsUtils.ts +141 -0
  461. package/src/lib/utils/fs/index.ts +1 -0
  462. package/src/lib/utils/logger/__tests__/logger.test.ts +12 -0
  463. package/src/lib/utils/logger/index.ts +1 -0
  464. package/src/lib/utils/logger/logger.ts +87 -0
  465. package/src/lib/utils/logger/logger.types.ts +41 -0
  466. package/src/lib/utils/module/__mocks__/dummyModule.query.js +4 -0
  467. package/src/lib/utils/module/__mocks__/dummyModule2.query.js +4 -0
  468. package/src/lib/utils/module/__tests__/dirBasedModuleGroupManager.test.ts +34 -0
  469. package/src/lib/utils/module/__tests__/moduleHandler.test.ts +100 -0
  470. package/src/lib/utils/module/dirBasedModuleGroupManager.ts +78 -0
  471. package/src/lib/utils/module/index.ts +2 -0
  472. package/src/lib/utils/module/module.types.ts +57 -0
  473. package/src/lib/utils/module/moduleManager.ts +144 -0
  474. package/src/lib/utils/object/__tests__/objectUtils.test.ts +62 -0
  475. package/src/lib/utils/object/index.ts +1 -0
  476. package/src/lib/utils/object/object.types.ts +74 -0
  477. package/src/lib/utils/object/objectUtils.ts +71 -0
  478. package/src/lib/utils/string/__tests__/stringUtils.test.ts +30 -0
  479. package/src/lib/utils/string/index.ts +1 -0
  480. package/src/lib/utils/string/string.types.ts +1 -0
  481. package/src/lib/utils/string/stringUtils.ts +61 -0
  482. package/src/lib/watcher/index.ts +1 -0
  483. package/src/lib/watcher/watcher.ts +66 -0
  484. package/tsconfig.json +83 -0
package/README.md ADDED
@@ -0,0 +1,300 @@
1
+ # Static Suite Data Server
2
+
3
+ A flexible, fast and developer friendly Data Server for [Static Suite](https://www.drupal.org/project/static_suite).
4
+
5
+ - flexible: it honors the structure of Static Suite's data directory, non imposing any opinionated structure. Every directory and its contents can be retrieved as simple arrays, so they can be queried using common [array functions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) like `filter()`, `find()`, `forEach()`, etc.
6
+ - fast: on a cold start, ~20k json files are usually loaded in ~2 seconds. Once the server is running, reloading those ~20k files usually takes ~100ms. Queries take ~1 ms, depending on their complexity. Once queries are cached, it executes ~150k queries per second.
7
+ - developer friendly: when run on `dev` mode, any change made to data files, queries or hooks (more on this later) is automatically reloaded in milliseconds. Queries are easy to create (they are just a function) and debug using a HTTP endpoint.
8
+
9
+ This Data Server supports static JSON includes (`entityInclude`, `configInclude`, `localeInclude` and `customInclude`) and the dynamic `queryInclude`.
10
+
11
+ ## Options
12
+
13
+ - `dataDir` / `--data-dir`: path to the directory where data from Static Suite is stored. Required.
14
+ - `workDir` / `--work-dir`: path to the directory where work data from Static Suite is stored. Optional.
15
+ - `queryDir` / `--query-dir`: path to the directory where queries are stored. Optional.
16
+ - `hookDir` / `--hook-dir`: path to the directory where hooks are stored. Optional.
17
+ - `logLevel` / `--log-level`: log level verbosity: `error`, `warn`, `info` or `debug`. Optional. Defaults to `info`.
18
+ - `logFile` / `--log-file`: path to the log file. Data server logs its errors to the stdOut, but they can also be saved into a log file. Optional.
19
+ - `logFileLevel` / `--log-file-level`: log level verbosity for the log file: `error`, `warn`, `info` or `debug`. Optional. Defaults to the value of `logLevel` / `--log-level`
20
+ - `runMode` / `--run-mode`: "dev" or "prod". Default is "prod". Optional.
21
+ - `--port`: port number for the HTTP endpoint. Default is `57471`. Optional.
22
+
23
+ ## Usage
24
+
25
+ There are three main use cases:
26
+
27
+ - during the develop/build phase of the SSG of your choice (Gatsby, Next.js, etc)
28
+ - previewing a content from Drupal
29
+ - developing/debugging queries on a local environment
30
+
31
+ ### SSG develop/build phase
32
+
33
+ Require `dist/lib/dataServer.js` inside the SSG, and call its `init()` function:
34
+
35
+ ```javascript
36
+ const { dataServer } = require('dist/lib/dataServer');
37
+
38
+ // Init the Data Server.
39
+ const { store, queryRunner } = dataServer.init({
40
+ dataDir: '../data/prod',
41
+ workDir: '../data/prod/.work',
42
+ queryDir: './src/data-server/query',
43
+ hookDir: './src/data-server/hook',
44
+ logFile: '/var/log/static-suite-data-server/error.log',
45
+ logLevel: 'debug',
46
+ runMode: 'prod',
47
+ });
48
+
49
+ // Loop over all articles of a given language
50
+ store.data.subset({ dir: 'en/entity/node/article/' }).forEach(article => {
51
+ // do something
52
+ });
53
+ ```
54
+
55
+ ### Previewing a content from Drupal
56
+
57
+ Static Suite detects any use of the `queryInclude` tag and asks the Data Server to execute that query with its parameters. That communication is done using HTTP, sending an internal request from Drupal to an HTTP endpoint where the Data Server is listening. That HTTP endpoint is provided by Static Suite Data Server and must be started before any `queryInclude` can be resolved.
58
+
59
+ ```shell
60
+ yarn serve http --port 57471 --data-dir=../data/prod --work-dir=../data/prod/.work/ --query-dir=./src/data-server/query --hook-dir=./src/data-server/hook --log-file=/var/log/static-suite-data-server/error.log --run-mode=prod
61
+ ```
62
+
63
+ The above command starts an HTTP server listening at http://localhost:57471
64
+
65
+ Given a `queryInclude` defined as `"queryInclude": "queryId?arg1=value1&arg2=value2&argN=valueN"`, Drupal will send a request to http://localhost:57471/?query=queryId&arg1=value1&arg2=value2&argN=valueN and include its results in the original JSON data.
66
+
67
+ The Data Server will load queries from the directory defined in `queryDir` / `--query-dir`, based on their id. Hence, it will try to find and load a file named "queryId.query.js". Please refer to "Queries" section for more information on queries.
68
+
69
+ ### Developing/debugging queries on a local environment
70
+
71
+ While developing on a local environment, you can access the same HTTP endpoint that Drupal uses to execute and debug any query.
72
+
73
+ To be able to do so, you need to start the Data Server HTTP endpoint as stated in "Usage > Previewing a content from Drupal". It should be started in "dev" mode. Please refer to "Run modes > Dev run mode" to learn more about `dev` mode.
74
+
75
+ ## Data structure
76
+
77
+ The Data Server honors the structure of Static Suite's data directory. Each file is stored in a Map, keyed by its filepath, and subsets of files can be easily retrieved.
78
+
79
+ ### Getting a file
80
+
81
+ Each file is stored inside a native JavaScript Map, keyed by its filepath, so they can be accessed by standard Map methods like `get()`, `has()`, etc
82
+
83
+ ```javascript
84
+ // Get the contents of a file located at "en/entity/node/article/40000/41234.json"
85
+ const fileContents = store.data.get('en/entity/node/article/40000/41234.json');
86
+ ```
87
+
88
+ ### Getting a subset of files
89
+
90
+ To get a subset of the files stored in the aforementioned Map, you should use the `subset()` helper function provided at `store.data`, which returns an array with all files in store that match the given arguments.
91
+
92
+ #### Subset options
93
+
94
+ `subset()` function accepts an object with the following options:
95
+
96
+ - `dir`: optional base directory to filter files. It requires a trailing slash, but not a leading slash, e.g.- `en/entity/node/article/`
97
+ - `variant`: Optional name of a variant file.
98
+ - Use `_main` to obtain the default variant.
99
+ - Use any other string, e.g.- `card`, to obtain the card variant.
100
+ - Use null to avoid searching for any variant.
101
+ - Defaults to `_main`.
102
+ - `ext`: Optional file extension, without dots. Defaults to `json`.
103
+ - `recursive`: Optional flag to search for files recursively. Defaults to `true`.
104
+
105
+ All subsets are automatically cached, so passing the same arguments will return the same subset from the cache.
106
+
107
+ This is the preferred way of getting a subset of the store files, since it is a simple function that most of the times only requires the first argument.
108
+
109
+ ```javascript
110
+ // Get a subset of all nodes with "json" extension.
111
+ dataServer.store.data.subset({ dir: 'en/entity/node/' });
112
+
113
+ // Get a subset of all articles in all languages with "json" extension.
114
+ dataServer.store.data.subset({ dir: '.+/entity/node/article/' });
115
+
116
+ // Get a subset of all articles in English, regardless of their extension.
117
+ dataServer.store.data.subset({ dir: 'en/entity/node/article/', ext: null });
118
+
119
+ // Get a subset of all card variants for articles in English, with "json" extension.
120
+ dataServer.store.data.subset({ dir: 'en/entity/node/article/', variant: null });
121
+
122
+ // Get a subset of articles in English, with "yml" extension, non-recursively.
123
+ dataServer.store.data.subset({
124
+ dir: 'en/entity/node/article/',
125
+ ext: 'yml',
126
+ recursive: false,
127
+ });
128
+ ```
129
+
130
+ This way, queries can be run on any set of data, limiting the amount of data to by analyzed.
131
+
132
+ ```javascript
133
+ // Find articles that contain "foo" inside their title.
134
+ const results = store.data
135
+ .subset({ dir: '.+/entity/node/article/' })
136
+ .filter(article => article.data.content.title.indexOf('foo') !== 1);
137
+ ```
138
+
139
+ ```javascript
140
+ // Find "teaser" article variants that contain "foo" inside their title.
141
+ const results = store.data
142
+ .subset({ dir: '.+/entity/node/article/', variant: 'teaser' })
143
+ .filter(article => article.data.content.title.indexOf('foo') !== 1);
144
+ ```
145
+
146
+ ## Queries
147
+
148
+ When the Data Server is executed within Node.js, you have full access to all its data through the `store` object returned by the `dataServer.init()` function.
149
+
150
+ However, when using a `queryInclude` or the preview system from Drupal, the Data Server needs each query to be stored in its own file, inside a directory defined by the `queryDir` / `--query-dir` option.
151
+
152
+ Each query is a file named `${queryId}.query.js`, and it must export a default function which receives two arguments:
153
+
154
+ - `store`: the object that holds all data. Being a shared object, any operation that could alter it must be executed on a local copy (i.e.- using `slice()` or similar functions)
155
+ - `args`: object with arguments used by that query
156
+
157
+ It must return an object with the following keys:
158
+
159
+ - `results`: result returned .
160
+ - `cacheable`: optional boolean flag telling whether this query can be cached or not. Defaults to true.
161
+
162
+ Example: find all contents by title passed in "q" argument
163
+
164
+ ```javascript
165
+ const findContentsByTitle = (storeData, args) => {
166
+ const q = args.q?.toLowerCase();
167
+ const results = storeData._json.main
168
+ .filter(
169
+ node =>
170
+ node.data?.content?.title &&
171
+ node.data?.content?.title?.toLowerCase().indexOf(q) !== -1,
172
+ )
173
+ .map(node => ({
174
+ id: node.data?.content?.id,
175
+ title: node.data?.content?.title,
176
+ path: node.data?.content?.url.path,
177
+ }));
178
+ return { results, cacheable: true };
179
+ };
180
+
181
+ module.exports = findContentByTitle;
182
+ ```
183
+
184
+ Example: list latest contents. Note the use of slice() to make a copy of the data and avoid `sort()` altering the original object.
185
+
186
+ ```javascript
187
+ const latestContents = (storeData, args = {}) => {
188
+ const results = storeData._json.main
189
+ .slice()
190
+ .sort((a, b) => b.changed - a.changed)
191
+ .slice(0, args.limit || 10)
192
+ .map(node => ({
193
+ id: node.data?.content?.id,
194
+ title: node.data?.content?.title,
195
+ path: node.data?.content?.url.path,
196
+ }));
197
+ return { results, cacheable: false };
198
+ };
199
+
200
+ module.exports = latestContents;
201
+ ```
202
+
203
+ The Data Server uses internally a `queryRunner` to execute those queries, encapsulating the query function results into an object with the following shape:
204
+
205
+ ```javascript
206
+ {
207
+ data: results,
208
+ metadata: {
209
+ contentType: 'application/json',
210
+ execTime: [int],
211
+ cache: ['miss'|'hit'],
212
+ num: results.length,
213
+ }
214
+ },
215
+ ```
216
+
217
+ ## Post processors
218
+
219
+ The Data Server allows altering the way data is processed and added to the store. To do so, it uses a special file, called the "post processor". This file must export a default object with three optional functions as keys:
220
+
221
+ ```javascript
222
+ const main = {
223
+ processFile: (options = {}) => {
224
+ // Do something...
225
+ return {
226
+ rawFileContents: foo,
227
+ jsonFileContents: bar,
228
+ };
229
+ },
230
+
231
+ storeAdd: (options = {}) => {
232
+ // Do something...
233
+ },
234
+
235
+ storeRemove: (options = {}) => {
236
+ // Do something...
237
+ },
238
+ };
239
+
240
+ module.exports = main;
241
+ ```
242
+
243
+ The post processor is a single file, instead of several ones like queries. The reason for this is to be able to easily execute different post processors in a given order, or bypass some of them (or even sorting them differently) given some conditions.
244
+
245
+ ### processFile
246
+
247
+ Executed after a file is read from disk, and before adding it to the store. It receives an object with the following options:
248
+
249
+ - `dataDir`: path to the data directory
250
+ - `file`: relative path to the file being processed
251
+ - `rawFileContents`: raw file contents
252
+ - `jsonFileContents`: JSON file contents
253
+ - `store`
254
+
255
+ It must return an object with two keys, that will replace the original file contents:
256
+
257
+ - `rawFileContents`
258
+ - `jsonFileContents`
259
+
260
+ ### storeAdd
261
+
262
+ Executed after a file is added to the store. It receives an object with the following options:
263
+
264
+ - `dataDir`: path to the data directory
265
+ - `file`: relative path to the file being processed
266
+ - `rawFileContents`: raw file contents
267
+ - `jsonFileContents`: JSON file contents
268
+ - `store`
269
+
270
+ It must return nothing (`void`).
271
+
272
+ ### storeRemove
273
+
274
+ Executed after a file is removed from the store. It receives an object with the following options:
275
+
276
+ - `file`: relative path to the file being processed
277
+ - `store`
278
+
279
+ It must return nothing (`void`).
280
+
281
+ ## Run modes
282
+
283
+ There are two valid run modes: `dev` and `prod`
284
+
285
+ ### Dev run mode
286
+
287
+ Disables the query cache and watches for changes in the post processor and query files:
288
+
289
+ - When a file inside the `queryDir` / `--query-dir` changes, all files inside that directory are reloaded to ensure any module or sub module is properly refreshed
290
+ - When a file inside the directory that holds the post processor changes, all files inside that directory are reloaded, and the store is reloaded and passed through the post processor, so any changes in it are applied to all data files.
291
+
292
+ This is the intended mode when developing queries (executing it by directly requesting the HTTP endpoint to execute a query). This mode is not required for the develop phase of a SSG, since the SSG will get the data from the Data Server only once.
293
+
294
+ ### Prod run mode
295
+
296
+ The query cache is enabled, and no watching is enabled for the post processor and query files.
297
+
298
+ This is the intended mode for the HTTP endpoint in production, and for the develop/build phase of the SSG.
299
+
300
+ In both cases (dev and prod), when a query is executed using the HTTP endpoint, the Data Server detects which _data_ files have changed since last execution, and updates them so fresh data is always available. This behavior is mainly intended for the preview system inside Drupal, and is disabled when running a build phase of a SSG.
@@ -0,0 +1,7 @@
1
+ module.exports = moduleId => {
2
+ // Jest completely takes over the require system for the
3
+ // code under test. Therefore, it does not implement require.cache.
4
+ // Until that problem is fixed, we must reset all modules
5
+ // when clear-module is used.
6
+ jest.resetModules();
7
+ };
@@ -0,0 +1,339 @@
1
+ /**
2
+ * Config file for API Extractor. For more info, please visit: https://api-extractor.com
3
+ */
4
+ {
5
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
6
+ /**
7
+ * Optionally specifies another JSON config file that this file extends from. This provides a way for
8
+ * standard settings to be shared across multiple projects.
9
+ *
10
+ * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains
11
+ * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be
12
+ * resolved using NodeJS require().
13
+ *
14
+ * SUPPORTED TOKENS: none
15
+ * DEFAULT VALUE: ""
16
+ */
17
+ // "extends": "./shared/api-extractor-base.json"
18
+ // "extends": "my-package/include/api-extractor-base.json"
19
+ /**
20
+ * Determines the "<projectFolder>" token that can be used with other config file settings. The project folder
21
+ * typically contains the tsconfig.json and package.json config files, but the path is user-defined.
22
+ *
23
+ * The path is resolved relative to the folder of the config file that contains the setting.
24
+ *
25
+ * The default value for "projectFolder" is the token "<lookup>", which means the folder is determined by traversing
26
+ * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder
27
+ * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error
28
+ * will be reported.
29
+ *
30
+ * SUPPORTED TOKENS: <lookup>
31
+ * DEFAULT VALUE: "<lookup>"
32
+ */
33
+ // "projectFolder": "..",
34
+ /**
35
+ * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor
36
+ * analyzes the symbols exported by this module.
37
+ *
38
+ * The file extension must be ".d.ts" and not ".ts".
39
+ *
40
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
41
+ * prepend a folder token such as "<projectFolder>".
42
+ *
43
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
44
+ */
45
+ "mainEntryPointFilePath": "<projectFolder>/dist/lib/index.d.ts",
46
+ /**
47
+ * A list of NPM package names whose exports should be treated as part of this package.
48
+ *
49
+ * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1",
50
+ * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part
51
+ * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly
52
+ * imports library2. To avoid this, we can specify:
53
+ *
54
+ * "bundledPackages": [ "library2" ],
55
+ *
56
+ * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been
57
+ * local files for library1.
58
+ */
59
+ "bundledPackages": [],
60
+ /**
61
+ * Determines how the TypeScript compiler engine will be invoked by API Extractor.
62
+ */
63
+ "compiler": {
64
+ /**
65
+ * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project.
66
+ *
67
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
68
+ * prepend a folder token such as "<projectFolder>".
69
+ *
70
+ * Note: This setting will be ignored if "overrideTsconfig" is used.
71
+ *
72
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
73
+ * DEFAULT VALUE: "<projectFolder>/tsconfig.json"
74
+ */
75
+ // "tsconfigFilePath": "<projectFolder>/tsconfig.json",
76
+ /**
77
+ * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk.
78
+ * The object must conform to the TypeScript tsconfig schema:
79
+ *
80
+ * http://json.schemastore.org/tsconfig
81
+ *
82
+ * If omitted, then the tsconfig.json file will be read from the "projectFolder".
83
+ *
84
+ * DEFAULT VALUE: no overrideTsconfig section
85
+ */
86
+ // "overrideTsconfig": {
87
+ // . . .
88
+ // }
89
+ /**
90
+ * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended
91
+ * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when
92
+ * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses
93
+ * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck.
94
+ *
95
+ * DEFAULT VALUE: false
96
+ */
97
+ // "skipLibCheck": true,
98
+ },
99
+ /**
100
+ * Configures how the API report file (*.api.md) will be generated.
101
+ */
102
+ "apiReport": {
103
+ /**
104
+ * (REQUIRED) Whether to generate an API report.
105
+ */
106
+ "enabled": false
107
+ /**
108
+ * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
109
+ * a full file path.
110
+ *
111
+ * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/".
112
+ *
113
+ * SUPPORTED TOKENS: <packageName>, <unscopedPackageName>
114
+ * DEFAULT VALUE: "<unscopedPackageName>.api.md"
115
+ */
116
+ // "reportFileName": "<unscopedPackageName>.api.md",
117
+ /**
118
+ * Specifies the folder where the API report file is written. The file name portion is determined by
119
+ * the "reportFileName" setting.
120
+ *
121
+ * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy,
122
+ * e.g. for an API review.
123
+ *
124
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
125
+ * prepend a folder token such as "<projectFolder>".
126
+ *
127
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
128
+ * DEFAULT VALUE: "<projectFolder>/etc/"
129
+ */
130
+ // "reportFolder": "<projectFolder>/etc/",
131
+ /**
132
+ * Specifies the folder where the temporary report file is written. The file name portion is determined by
133
+ * the "reportFileName" setting.
134
+ *
135
+ * After the temporary file is written to disk, it is compared with the file in the "reportFolder".
136
+ * If they are different, a production build will fail.
137
+ *
138
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
139
+ * prepend a folder token such as "<projectFolder>".
140
+ *
141
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
142
+ * DEFAULT VALUE: "<projectFolder>/temp/"
143
+ */
144
+ // "reportTempFolder": "<projectFolder>/temp/"
145
+ },
146
+ /**
147
+ * Configures how the doc model file (*.api.json) will be generated.
148
+ */
149
+ "docModel": {
150
+ /**
151
+ * (REQUIRED) Whether to generate a doc model file.
152
+ */
153
+ "enabled": false
154
+ /**
155
+ * The output path for the doc model file. The file extension should be ".api.json".
156
+ *
157
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
158
+ * prepend a folder token such as "<projectFolder>".
159
+ *
160
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
161
+ * DEFAULT VALUE: "<projectFolder>/temp/<unscopedPackageName>.api.json"
162
+ */
163
+ // "apiJsonFilePath": "<projectFolder>/temp/<unscopedPackageName>.api.json"
164
+ },
165
+ /**
166
+ * Configures how the .d.ts rollup file will be generated.
167
+ */
168
+ "dtsRollup": {
169
+ /**
170
+ * (REQUIRED) Whether to generate the .d.ts rollup file.
171
+ */
172
+ "enabled": true
173
+ /**
174
+ * Specifies the output path for a .d.ts rollup file to be generated without any trimming.
175
+ * This file will include all declarations that are exported by the main entry point.
176
+ *
177
+ * If the path is an empty string, then this file will not be written.
178
+ *
179
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
180
+ * prepend a folder token such as "<projectFolder>".
181
+ *
182
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
183
+ * DEFAULT VALUE: "<projectFolder>/dist/<unscopedPackageName>.d.ts"
184
+ */
185
+ // "untrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>.d.ts",
186
+ /**
187
+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release.
188
+ * This file will include only declarations that are marked as "@public" or "@beta".
189
+ *
190
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
191
+ * prepend a folder token such as "<projectFolder>".
192
+ *
193
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
194
+ * DEFAULT VALUE: ""
195
+ */
196
+ // "betaTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-beta.d.ts",
197
+ /**
198
+ * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release.
199
+ * This file will include only declarations that are marked as "@public".
200
+ *
201
+ * If the path is an empty string, then this file will not be written.
202
+ *
203
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
204
+ * prepend a folder token such as "<projectFolder>".
205
+ *
206
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
207
+ * DEFAULT VALUE: ""
208
+ */
209
+ // "publicTrimmedFilePath": "<projectFolder>/dist/<unscopedPackageName>-public.d.ts",
210
+ /**
211
+ * When a declaration is trimmed, by default it will be replaced by a code comment such as
212
+ * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the
213
+ * declaration completely.
214
+ *
215
+ * DEFAULT VALUE: false
216
+ */
217
+ // "omitTrimmingComments": true
218
+ },
219
+ /**
220
+ * Configures how the tsdoc-metadata.json file will be generated.
221
+ */
222
+ "tsdocMetadata": {
223
+ /**
224
+ * Whether to generate the tsdoc-metadata.json file.
225
+ *
226
+ * DEFAULT VALUE: true
227
+ */
228
+ // "enabled": true,
229
+ /**
230
+ * Specifies where the TSDoc metadata file should be written.
231
+ *
232
+ * The path is resolved relative to the folder of the config file that contains the setting; to change this,
233
+ * prepend a folder token such as "<projectFolder>".
234
+ *
235
+ * The default value is "<lookup>", which causes the path to be automatically inferred from the "tsdocMetadata",
236
+ * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup
237
+ * falls back to "tsdoc-metadata.json" in the package folder.
238
+ *
239
+ * SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
240
+ * DEFAULT VALUE: "<lookup>"
241
+ */
242
+ // "tsdocMetadataFilePath": "<projectFolder>/dist/tsdoc-metadata.json"
243
+ },
244
+ /**
245
+ * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files
246
+ * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead.
247
+ * To use the OS's default newline kind, specify "os".
248
+ *
249
+ * DEFAULT VALUE: "crlf"
250
+ */
251
+ // "newlineKind": "crlf",
252
+ /**
253
+ * Configures how API Extractor reports error and warning messages produced during analysis.
254
+ *
255
+ * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages.
256
+ */
257
+ "messages": {
258
+ /**
259
+ * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing
260
+ * the input .d.ts files.
261
+ *
262
+ * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551"
263
+ *
264
+ * DEFAULT VALUE: A single "default" entry with logLevel=warning.
265
+ */
266
+ "compilerMessageReporting": {
267
+ /**
268
+ * Configures the default routing for messages that don't match an explicit rule in this table.
269
+ */
270
+ "default": {
271
+ /**
272
+ * Specifies whether the message should be written to the the tool's output log. Note that
273
+ * the "addToApiReportFile" property may supersede this option.
274
+ *
275
+ * Possible values: "error", "warning", "none"
276
+ *
277
+ * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail
278
+ * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes
279
+ * the "--local" option), the warning is displayed but the build will not fail.
280
+ *
281
+ * DEFAULT VALUE: "warning"
282
+ */
283
+ "logLevel": "warning"
284
+ /**
285
+ * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md),
286
+ * then the message will be written inside that file; otherwise, the message is instead logged according to
287
+ * the "logLevel" option.
288
+ *
289
+ * DEFAULT VALUE: false
290
+ */
291
+ // "addToApiReportFile": false
292
+ }
293
+ // "TS2551": {
294
+ // "logLevel": "warning",
295
+ // "addToApiReportFile": true
296
+ // },
297
+ //
298
+ // . . .
299
+ },
300
+ /**
301
+ * Configures handling of messages reported by API Extractor during its analysis.
302
+ *
303
+ * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag"
304
+ *
305
+ * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings
306
+ */
307
+ "extractorMessageReporting": {
308
+ "default": {
309
+ "logLevel": "warning"
310
+ // "addToApiReportFile": false
311
+ }
312
+ // "ae-extra-release-tag": {
313
+ // "logLevel": "warning",
314
+ // "addToApiReportFile": true
315
+ // },
316
+ //
317
+ // . . .
318
+ },
319
+ /**
320
+ * Configures handling of messages reported by the TSDoc parser when analyzing code comments.
321
+ *
322
+ * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text"
323
+ *
324
+ * DEFAULT VALUE: A single "default" entry with logLevel=warning.
325
+ */
326
+ "tsdocMessageReporting": {
327
+ "default": {
328
+ "logLevel": "warning"
329
+ // "addToApiReportFile": false
330
+ }
331
+ // "tsdoc-link-tag-unescaped-text": {
332
+ // "logLevel": "warning",
333
+ // "addToApiReportFile": true
334
+ // },
335
+ //
336
+ // . . .
337
+ }
338
+ }
339
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=serve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/bin/serve.ts"],"names":[],"mappings":""}