miqro 6.0.14 → 6.1.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 (318) hide show
  1. package/README.md +12 -0
  2. package/build/editor.bundle.js +37 -50409
  3. package/build/esm/src/bin/compile.js +0 -1
  4. package/build/esm/src/bin/doc-md.js +0 -1
  5. package/build/esm/src/bin/generate-doc.d.ts +3 -1
  6. package/build/esm/src/bin/generate-doc.js +16 -12
  7. package/build/esm/src/bin/test.js +0 -1
  8. package/build/esm/src/bin/types.js +0 -1
  9. package/build/esm/src/cluster.js +0 -1
  10. package/build/esm/src/common/arguments.d.ts +12 -0
  11. package/build/esm/src/common/arguments.js +111 -10
  12. package/build/esm/src/common/assets.js +2 -3
  13. package/build/esm/src/common/checksum.js +0 -1
  14. package/build/esm/src/common/constants.js +0 -1
  15. package/build/esm/src/common/content-type.js +0 -1
  16. package/build/esm/src/common/esbuild.js +0 -1
  17. package/build/esm/src/common/exit.js +0 -1
  18. package/build/esm/src/common/fs.js +0 -1
  19. package/build/esm/src/common/help.d.ts +1 -1
  20. package/build/esm/src/common/help.js +4 -1
  21. package/build/esm/src/common/jsx.d.ts +8 -1
  22. package/build/esm/src/common/jsx.js +84 -2
  23. package/build/esm/src/common/paths.d.ts +4 -0
  24. package/build/esm/src/common/paths.js +41 -2
  25. package/build/esm/src/common/watch.js +0 -1
  26. package/build/esm/src/inflate/inflate-sea.js +27 -16
  27. package/build/esm/src/inflate/inflate.js +2 -1
  28. package/build/esm/src/inflate/md.d.ts +1 -0
  29. package/build/esm/src/inflate/md.js +9 -6
  30. package/build/esm/src/inflate/setup-auth.js +0 -1
  31. package/build/esm/src/inflate/setup-cors.js +0 -1
  32. package/build/esm/src/inflate/setup-db.js +0 -1
  33. package/build/esm/src/inflate/setup-error.d.ts +3 -0
  34. package/build/esm/src/inflate/setup-error.js +40 -0
  35. package/build/esm/src/inflate/setup-http.js +13 -4
  36. package/build/esm/src/inflate/setup-log.js +0 -1
  37. package/build/esm/src/inflate/setup-middleware.d.ts +4 -0
  38. package/build/esm/src/inflate/setup-middleware.js +42 -0
  39. package/build/esm/src/inflate/setup-server-config.js +0 -1
  40. package/build/esm/src/inflate/setup-test.js +0 -1
  41. package/build/esm/src/inflate/setup-ws.js +0 -1
  42. package/build/esm/src/inflate/setup.doc.d.ts +4 -0
  43. package/build/esm/src/inflate/setup.doc.js +62 -0
  44. package/build/esm/src/inflate/utils/sea-utils.js +0 -1
  45. package/build/esm/src/lib.js +0 -1
  46. package/build/esm/src/main.js +3 -4
  47. package/build/esm/src/services/app.d.ts +1 -0
  48. package/build/esm/src/services/app.js +18 -2
  49. package/build/esm/src/services/editor.js +0 -1
  50. package/build/esm/src/services/globals.js +0 -1
  51. package/build/esm/src/services/hot-reload.js +0 -1
  52. package/build/esm/src/services/migrations.js +0 -1
  53. package/build/esm/src/services/utils/admin-interface.js +0 -1
  54. package/build/esm/src/services/utils/cache.js +0 -1
  55. package/build/esm/src/services/utils/cluster-cache.js +0 -1
  56. package/build/esm/src/services/utils/cluster-ws.js +0 -1
  57. package/build/esm/src/services/utils/db-manager.js +0 -1
  58. package/build/esm/src/services/utils/get-route.js +0 -1
  59. package/build/esm/src/services/utils/log-transport.js +0 -1
  60. package/build/esm/src/services/utils/log.js +2 -2
  61. package/build/esm/src/services/utils/server-interface.js +0 -1
  62. package/build/esm/src/services/utils/websocketmanager.js +0 -1
  63. package/build/esm/src/types.d.ts +16 -1
  64. package/build/esm/src/types.js +0 -1
  65. package/build/lib.cjs +890 -322
  66. package/package.json +4 -2
  67. package/sea/types.json +1 -1
  68. package/tsconfig.json +1 -1
  69. package/bin/miqro +0 -34
  70. package/build/esm/editor/auth.d.ts +0 -6
  71. package/build/esm/editor/auth.js +0 -42
  72. package/build/esm/editor/auth.js.map +0 -1
  73. package/build/esm/editor/common/admin-interface.d.ts +0 -36
  74. package/build/esm/editor/common/admin-interface.js +0 -45
  75. package/build/esm/editor/common/admin-interface.js.map +0 -1
  76. package/build/esm/editor/common/constants.d.ts +0 -4
  77. package/build/esm/editor/common/constants.js +0 -21
  78. package/build/esm/editor/common/constants.js.map +0 -1
  79. package/build/esm/editor/common/constants.server.d.ts +0 -2
  80. package/build/esm/editor/common/constants.server.js +0 -5
  81. package/build/esm/editor/common/constants.server.js.map +0 -1
  82. package/build/esm/editor/common/editor-index.d.ts +0 -2
  83. package/build/esm/editor/common/editor-index.js +0 -15
  84. package/build/esm/editor/common/editor-index.js.map +0 -1
  85. package/build/esm/editor/common/html-encode.d.ts +0 -1
  86. package/build/esm/editor/common/html-encode.js +0 -15
  87. package/build/esm/editor/common/html-encode.js.map +0 -1
  88. package/build/esm/editor/common/log-socket.d.ts +0 -15
  89. package/build/esm/editor/common/log-socket.js +0 -71
  90. package/build/esm/editor/common/log-socket.js.map +0 -1
  91. package/build/esm/editor/common/templates.d.ts +0 -11
  92. package/build/esm/editor/common/templates.js +0 -444
  93. package/build/esm/editor/common/templates.js.map +0 -1
  94. package/build/esm/editor/components/api-preview.d.ts +0 -11
  95. package/build/esm/editor/components/api-preview.js +0 -91
  96. package/build/esm/editor/components/api-preview.js.map +0 -1
  97. package/build/esm/editor/components/editor.d.ts +0 -16
  98. package/build/esm/editor/components/editor.js +0 -358
  99. package/build/esm/editor/components/editor.js.map +0 -1
  100. package/build/esm/editor/components/file-browser.d.ts +0 -37
  101. package/build/esm/editor/components/file-browser.js +0 -127
  102. package/build/esm/editor/components/file-browser.js.map +0 -1
  103. package/build/esm/editor/components/file-editor-toolbar.d.ts +0 -22
  104. package/build/esm/editor/components/file-editor-toolbar.js +0 -94
  105. package/build/esm/editor/components/file-editor-toolbar.js.map +0 -1
  106. package/build/esm/editor/components/file-editor.d.ts +0 -32
  107. package/build/esm/editor/components/file-editor.js +0 -60
  108. package/build/esm/editor/components/file-editor.js.map +0 -1
  109. package/build/esm/editor/components/filter-query.d.ts +0 -1
  110. package/build/esm/editor/components/filter-query.js +0 -23
  111. package/build/esm/editor/components/filter-query.js.map +0 -1
  112. package/build/esm/editor/components/highlight-text-area.d.ts +0 -11
  113. package/build/esm/editor/components/highlight-text-area.js +0 -139
  114. package/build/esm/editor/components/highlight-text-area.js.map +0 -1
  115. package/build/esm/editor/components/log-viewer.d.ts +0 -6
  116. package/build/esm/editor/components/log-viewer.js +0 -70
  117. package/build/esm/editor/components/log-viewer.js.map +0 -1
  118. package/build/esm/editor/components/new-file.d.ts +0 -10
  119. package/build/esm/editor/components/new-file.js +0 -118
  120. package/build/esm/editor/components/new-file.js.map +0 -1
  121. package/build/esm/editor/components/scroll-query.d.ts +0 -7
  122. package/build/esm/editor/components/scroll-query.js +0 -22
  123. package/build/esm/editor/components/scroll-query.js.map +0 -1
  124. package/build/esm/editor/components/start-page.d.ts +0 -13
  125. package/build/esm/editor/components/start-page.js +0 -31
  126. package/build/esm/editor/components/start-page.js.map +0 -1
  127. package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +0 -3
  128. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +0 -30
  129. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +0 -1
  130. package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +0 -5
  131. package/build/esm/editor/http/admin/editor/api/fs/read.api.js +0 -50
  132. package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +0 -1
  133. package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +0 -4
  134. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +0 -40
  135. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +0 -1
  136. package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +0 -26
  137. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +0 -150
  138. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js.map +0 -1
  139. package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +0 -3
  140. package/build/esm/editor/http/admin/editor/api/fs/write.api.js +0 -39
  141. package/build/esm/editor/http/admin/editor/api/fs/write.api.js.map +0 -1
  142. package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +0 -10
  143. package/build/esm/editor/http/admin/editor/api/server/reload.api.js +0 -47
  144. package/build/esm/editor/http/admin/editor/api/server/reload.api.js.map +0 -1
  145. package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +0 -10
  146. package/build/esm/editor/http/admin/editor/api/server/restart.api.js +0 -46
  147. package/build/esm/editor/http/admin/editor/api/server/restart.api.js.map +0 -1
  148. package/build/esm/editor/http/admin/editor/editor.d.ts +0 -1
  149. package/build/esm/editor/http/admin/editor/editor.js +0 -8
  150. package/build/esm/editor/http/admin/editor/editor.js.map +0 -1
  151. package/build/esm/editor/http/admin/editor/index.api.d.ts +0 -3
  152. package/build/esm/editor/http/admin/editor/index.api.js +0 -22
  153. package/build/esm/editor/http/admin/editor/index.api.js.map +0 -1
  154. package/build/esm/editor/server.d.ts +0 -3
  155. package/build/esm/editor/server.js +0 -50
  156. package/build/esm/editor/server.js.map +0 -1
  157. package/build/esm/editor/ws.d.ts +0 -3
  158. package/build/esm/editor/ws.js +0 -12
  159. package/build/esm/editor/ws.js.map +0 -1
  160. package/build/esm/src/bin/compile.js.map +0 -1
  161. package/build/esm/src/bin/doc-md.js.map +0 -1
  162. package/build/esm/src/bin/generate-doc.js.map +0 -1
  163. package/build/esm/src/bin/test.js.map +0 -1
  164. package/build/esm/src/bin/types.js.map +0 -1
  165. package/build/esm/src/cluster.js.map +0 -1
  166. package/build/esm/src/common/arguments.js.map +0 -1
  167. package/build/esm/src/common/assets.js.map +0 -1
  168. package/build/esm/src/common/checksum.js.map +0 -1
  169. package/build/esm/src/common/constants.js.map +0 -1
  170. package/build/esm/src/common/content-type.js.map +0 -1
  171. package/build/esm/src/common/esbuild.js.map +0 -1
  172. package/build/esm/src/common/exit.js.map +0 -1
  173. package/build/esm/src/common/fs.js.map +0 -1
  174. package/build/esm/src/common/help.js.map +0 -1
  175. package/build/esm/src/common/jsx.js.map +0 -1
  176. package/build/esm/src/common/paths.js.map +0 -1
  177. package/build/esm/src/common/watch.js.map +0 -1
  178. package/build/esm/src/inflate/inflate-sea.js.map +0 -1
  179. package/build/esm/src/inflate/inflate.js.map +0 -1
  180. package/build/esm/src/inflate/md.js.map +0 -1
  181. package/build/esm/src/inflate/setup-auth.js.map +0 -1
  182. package/build/esm/src/inflate/setup-cors.js.map +0 -1
  183. package/build/esm/src/inflate/setup-db.js.map +0 -1
  184. package/build/esm/src/inflate/setup-http.js.map +0 -1
  185. package/build/esm/src/inflate/setup-log.js.map +0 -1
  186. package/build/esm/src/inflate/setup-server-config.js.map +0 -1
  187. package/build/esm/src/inflate/setup-test.js.map +0 -1
  188. package/build/esm/src/inflate/setup-ws.js.map +0 -1
  189. package/build/esm/src/inflate/utils/sea-utils.js.map +0 -1
  190. package/build/esm/src/lib.js.map +0 -1
  191. package/build/esm/src/main.js.map +0 -1
  192. package/build/esm/src/services/app.js.map +0 -1
  193. package/build/esm/src/services/editor.js.map +0 -1
  194. package/build/esm/src/services/globals.js.map +0 -1
  195. package/build/esm/src/services/hot-reload.js.map +0 -1
  196. package/build/esm/src/services/migrations.js.map +0 -1
  197. package/build/esm/src/services/utils/admin-interface.js.map +0 -1
  198. package/build/esm/src/services/utils/cache.js.map +0 -1
  199. package/build/esm/src/services/utils/cluster-cache.js.map +0 -1
  200. package/build/esm/src/services/utils/cluster-ws.js.map +0 -1
  201. package/build/esm/src/services/utils/db-manager.js.map +0 -1
  202. package/build/esm/src/services/utils/get-route.js.map +0 -1
  203. package/build/esm/src/services/utils/log-transport.js.map +0 -1
  204. package/build/esm/src/services/utils/log.js.map +0 -1
  205. package/build/esm/src/services/utils/server-interface.js.map +0 -1
  206. package/build/esm/src/services/utils/websocketmanager.js.map +0 -1
  207. package/build/esm/src/types.js.map +0 -1
  208. package/editor/auth.ts +0 -51
  209. package/editor/common/admin-interface.ts +0 -84
  210. package/editor/common/constants.server.ts +0 -5
  211. package/editor/common/constants.ts +0 -21
  212. package/editor/common/editor-index.tsx +0 -17
  213. package/editor/common/html-encode.ts +0 -14
  214. package/editor/common/log-socket.tsx +0 -85
  215. package/editor/common/templates.ts +0 -448
  216. package/editor/components/api-preview.tsx +0 -116
  217. package/editor/components/editor.tsx +0 -486
  218. package/editor/components/file-browser.tsx +0 -308
  219. package/editor/components/file-editor-toolbar.tsx +0 -191
  220. package/editor/components/file-editor.tsx +0 -122
  221. package/editor/components/filter-query.tsx +0 -22
  222. package/editor/components/highlight-text-area.tsx +0 -159
  223. package/editor/components/log-viewer.tsx +0 -110
  224. package/editor/components/new-file.tsx +0 -169
  225. package/editor/components/scroll-query.tsx +0 -22
  226. package/editor/components/start-page.tsx +0 -49
  227. package/editor/http/admin/editor/api/fs/delete.api.tsx +0 -32
  228. package/editor/http/admin/editor/api/fs/read.api.tsx +0 -55
  229. package/editor/http/admin/editor/api/fs/rename.api.tsx +0 -41
  230. package/editor/http/admin/editor/api/fs/scan.api.tsx +0 -181
  231. package/editor/http/admin/editor/api/fs/write.api.tsx +0 -41
  232. package/editor/http/admin/editor/api/server/reload.api.ts +0 -53
  233. package/editor/http/admin/editor/api/server/restart.api.tsx +0 -52
  234. package/editor/http/admin/editor/editor.tsx +0 -8
  235. package/editor/http/admin/editor/index.api.tsx +0 -39
  236. package/editor/server.ts +0 -57
  237. package/editor/static/android-chrome-192x192.png +0 -0
  238. package/editor/static/android-chrome-512x512.png +0 -0
  239. package/editor/static/apple-touch-icon.png +0 -0
  240. package/editor/static/editor.bundle.in.mjs +0 -20
  241. package/editor/static/favicon-16x16.png +0 -0
  242. package/editor/static/favicon-32x32.png +0 -0
  243. package/editor/static/favicon.ico +0 -0
  244. package/editor/static/site.webmanifest +0 -19
  245. package/editor/ws.ts +0 -15
  246. package/sea/base64.js +0 -3
  247. package/sea/compile.sh +0 -127
  248. package/sea/copy-types.sh +0 -46
  249. package/sea/editor-assets/editor.bundle.in.mjs +0 -19
  250. package/sea/generate-global-types-asset-json.js +0 -34
  251. package/sea/release-tar.sh +0 -5
  252. package/sea/tsc.sh +0 -1
  253. package/sea/version.tag.js +0 -11
  254. package/src/bin/compile.ts +0 -35
  255. package/src/bin/doc-md.ts +0 -210
  256. package/src/bin/generate-doc.ts +0 -58
  257. package/src/bin/test.ts +0 -92
  258. package/src/bin/types.ts +0 -22
  259. package/src/cluster.ts +0 -27
  260. package/src/common/arguments.ts +0 -382
  261. package/src/common/assets.ts +0 -128
  262. package/src/common/checksum.ts +0 -58
  263. package/src/common/constants.ts +0 -18
  264. package/src/common/content-type.ts +0 -84
  265. package/src/common/esbuild.ts +0 -94
  266. package/src/common/exit.ts +0 -91
  267. package/src/common/fs.ts +0 -17
  268. package/src/common/help.ts +0 -47
  269. package/src/common/jsx.ts +0 -426
  270. package/src/common/paths.ts +0 -117
  271. package/src/common/watch.ts +0 -85
  272. package/src/inflate/inflate-sea.ts +0 -194
  273. package/src/inflate/inflate.ts +0 -96
  274. package/src/inflate/md.ts +0 -20
  275. package/src/inflate/setup-auth.ts +0 -40
  276. package/src/inflate/setup-cors.ts +0 -40
  277. package/src/inflate/setup-db.ts +0 -113
  278. package/src/inflate/setup-http.ts +0 -643
  279. package/src/inflate/setup-log.ts +0 -44
  280. package/src/inflate/setup-server-config.ts +0 -47
  281. package/src/inflate/setup-test.ts +0 -23
  282. package/src/inflate/setup-ws.ts +0 -48
  283. package/src/inflate/utils/sea-utils.ts +0 -14
  284. package/src/lib.ts +0 -19
  285. package/src/main.ts +0 -87
  286. package/src/services/app.ts +0 -640
  287. package/src/services/editor.tsx +0 -101
  288. package/src/services/globals.ts +0 -143
  289. package/src/services/hot-reload.ts +0 -48
  290. package/src/services/migrations.ts +0 -66
  291. package/src/services/utils/admin-interface.ts +0 -37
  292. package/src/services/utils/cache.ts +0 -88
  293. package/src/services/utils/cluster-cache.ts +0 -230
  294. package/src/services/utils/cluster-ws.ts +0 -197
  295. package/src/services/utils/db-manager.ts +0 -92
  296. package/src/services/utils/get-route.ts +0 -70
  297. package/src/services/utils/log-transport.ts +0 -75
  298. package/src/services/utils/log.ts +0 -91
  299. package/src/services/utils/server-interface.ts +0 -172
  300. package/src/services/utils/websocketmanager.ts +0 -149
  301. package/src/types/@esbuild.d.ts +0 -1
  302. package/src/types/@miqro/core.d.ts +0 -2
  303. package/src/types/@miqro/jsx.d.ts +0 -2
  304. package/src/types/@miqro/parser.d.ts +0 -2
  305. package/src/types/@miqro/query.d.ts +0 -2
  306. package/src/types/@miqro/request.d.ts +0 -2
  307. package/src/types/@miqro/test.d.ts +0 -2
  308. package/src/types/@miqro.d.ts +0 -1
  309. package/src/types/@types.d.ts +0 -1
  310. package/src/types/browser.globals.d.ts +0 -9
  311. package/src/types/globals.d.ts +0 -2
  312. package/src/types/jsx.globals.d.ts +0 -37
  313. package/src/types/miqro.d.ts +0 -111
  314. package/src/types/postject.d.ts +0 -1
  315. package/src/types/server.globals.d.ts +0 -72
  316. package/src/types.ts +0 -204
  317. /package/{editor/http/admin/editor → build}/font.ttf +0 -0
  318. /package/{editor/http/admin/editor → build}/style.css +0 -0
@@ -28,4 +28,3 @@ export async function compileSH(args) {
28
28
  }
29
29
  });
30
30
  }
31
- //# sourceMappingURL=compile.js.map
@@ -184,4 +184,3 @@ function getTabulation(n, header = false) {
184
184
  }
185
185
  return out;
186
186
  }
187
- //# sourceMappingURL=doc-md.js.map
@@ -1,4 +1,6 @@
1
- import { Logger } from "@miqro/core";
1
+ import { Logger, Router } from "@miqro/core";
2
2
  import { Arguments } from "../common/arguments.js";
3
3
  import { InflatedResult } from "../services/app.js";
4
+ import { RouteFileMap } from "../inflate/setup-http.js";
4
5
  export declare function generateDocs(args: Arguments, logger: Logger, result: InflatedResult): Promise<void>;
6
+ export declare function getDocOutput(router: Router, fileMap: RouteFileMap, generateDocAll: boolean, generateDocType: "MD" | "JSON" | "HTML"): Promise<string>;
@@ -1,15 +1,18 @@
1
1
  import { writeFileSync } from "node:fs";
2
2
  import { getMDDoc } from "./doc-md.js";
3
3
  import { EXIT_CODES } from "../common/constants.js";
4
+ import { inflateMDString2HTML } from "../inflate/md.js";
4
5
  export async function generateDocs(args, logger, result) {
6
+ logger.info("writing [%s]", args.generateDocOut);
7
+ writeFileSync(args.generateDocOut, await getDocOutput(result.router, result.fileMap, args.generateDocAll, args.generateDocType));
8
+ }
9
+ export async function getDocOutput(router, fileMap, generateDocAll, generateDocType) {
5
10
  /*
6
- ** TODO FIX THIS MESS
7
- */
8
- const router = result.router;
9
- const fileMap = result.fileMap;
11
+ ** TODO FIX THIS MESS
12
+ */
10
13
  const fileMapAPIRouteList = Object.keys(fileMap).map(f => fileMap[f]).filter(fMap => fMap.previewMethod === "api").map(fMap => fMap.routes);
11
14
  const jsonDoc = router.getJSONDoc();
12
- if (!args.generateDocAll) {
15
+ if (!generateDocAll) {
13
16
  Object.keys(jsonDoc).forEach(path => {
14
17
  const methods = Object.keys(jsonDoc[path]);
15
18
  methods.forEach(method => {
@@ -32,18 +35,19 @@ export async function generateDocs(args, logger, result) {
32
35
  });
33
36
  });
34
37
  }
35
- switch (args.generateDocType) {
38
+ switch (generateDocType) {
36
39
  case "JSON":
37
- logger.info("writing [%s]", args.generateDocOut);
38
- writeFileSync(args.generateDocOut, JSON.stringify(jsonDoc, undefined, 4));
40
+ return JSON.stringify(jsonDoc, undefined, 2);
39
41
  break;
40
42
  case "MD":
41
- logger.info("writing [%s]", args.generateDocOut);
42
- writeFileSync(args.generateDocOut, await getMDDoc({ showFilePath: true, jsonDoc }));
43
+ return await getMDDoc({ showFilePath: true, jsonDoc });
44
+ break;
45
+ case "HTML":
46
+ const md = await getMDDoc({ showFilePath: true, jsonDoc });
47
+ const html = inflateMDString2HTML(md);
48
+ return html;
43
49
  break;
44
50
  default:
45
- logger.error("--generate-doc-type invalid!");
46
51
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
47
52
  }
48
53
  }
49
- //# sourceMappingURL=generate-doc.js.map
@@ -65,4 +65,3 @@ export async function testMain(app) {
65
65
  }
66
66
  await app.dbManager.closeAll();
67
67
  }
68
- //# sourceMappingURL=test.js.map
@@ -18,4 +18,3 @@ export async function installTypings(args, logger) {
18
18
  }
19
19
  process.exit(EXIT_CODES.NORMAL_EXIT);
20
20
  }
21
- //# sourceMappingURL=types.js.map
@@ -18,4 +18,3 @@ else {
18
18
  console.log(CMD);
19
19
  execSync(CMD, { stdio: 'inherit' });
20
20
  }
21
- //# sourceMappingURL=cluster.js.map
@@ -1,11 +1,22 @@
1
+ interface MiqroJSON {
2
+ services?: string[];
3
+ port?: string | number;
4
+ inflateDir?: string;
5
+ name?: string;
6
+ }
7
+ export declare function importMiqroJSON(inFile: string): MiqroJSON;
1
8
  export declare function getPORT(): string;
2
9
  export interface Arguments {
10
+ name: string;
3
11
  installTypes: boolean;
4
12
  installTSConfig: boolean;
5
13
  test: boolean;
14
+ port: string;
6
15
  inflate: boolean;
7
16
  generateDoc: boolean;
8
17
  generateDocOut: string;
18
+ miqroJSONPath: string | false;
19
+ disableMiqroJSON: boolean;
9
20
  generateDocAll: boolean;
10
21
  generateDocType: "JSON" | "MD";
11
22
  migrateUp: boolean;
@@ -21,3 +32,4 @@ export interface Arguments {
21
32
  * parse process.argv arguments
22
33
  */
23
34
  export declare function parseArguments(): Arguments;
35
+ export {};
@@ -1,15 +1,36 @@
1
1
  import { checkEnvVariable } from "@miqro/core";
2
2
  import { existsSync, readFileSync, statSync } from "node:fs";
3
- import { resolve } from "node:path";
3
+ import { basename, dirname, join, relative, resolve } from "node:path";
4
4
  import { cwd, env, platform, arch } from "node:process";
5
5
  import { EXIT_CODES } from "./constants.js";
6
6
  import { tmpdir } from "node:os";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { BIN_NAME, help, usage } from "./help.js";
9
- import { TEST_SOCKET } from "./paths.js";
9
+ import { getMiqroJSONPath, TEST_SOCKET } from "./paths.js";
10
10
  import { isSea } from "node:sea";
11
11
  import cluster from "node:cluster";
12
12
  import { __package_dirname, getVersion } from "./assets.js";
13
+ import { Parser } from "@miqro/parser";
14
+ const parser = new Parser();
15
+ const MiqroJSONSchema = {
16
+ type: "object",
17
+ properties: {
18
+ name: "string?",
19
+ services: "string[]?",
20
+ port: "number?|string?",
21
+ inflateDir: "string?"
22
+ }
23
+ };
24
+ export function importMiqroJSON(inFile) {
25
+ const mod = JSON.parse(readFileSync(inFile).toString());
26
+ const module = parser.parse(mod, MiqroJSONSchema, basename(inFile));
27
+ if (module !== undefined) {
28
+ return module;
29
+ }
30
+ else {
31
+ throw new Error(`error loading [${inFile}] undefined`);
32
+ }
33
+ }
13
34
  export function getPORT() {
14
35
  return checkEnvVariable("PORT", "8080");
15
36
  }
@@ -20,8 +41,12 @@ export function parseArguments() {
20
41
  //env["LOG_FILE"] = env["LOG_FILE"] ? env["LOG_FILE"] : "./server.log";
21
42
  const args = cluster.isPrimary ? process.argv.slice(2, process.argv.length) : process.argv.slice(3, process.argv.length);
22
43
  const flags = {
44
+ name: null,
23
45
  hotreload: null,
46
+ miqroJSONPath: null,
47
+ disableMiqroJSON: null,
24
48
  installTypes: null,
49
+ port: null,
25
50
  installTSConfig: null,
26
51
  migrateUp: null,
27
52
  migrateDown: null,
@@ -60,6 +85,29 @@ export function parseArguments() {
60
85
  console.log(usage);
61
86
  console.log(help);
62
87
  process.exit(EXIT_CODES.NORMAL_EXIT);
88
+ case "--disable-miqrojson":
89
+ if (flags.disableMiqroJSON !== null || flags.miqroJSONPath !== null) {
90
+ console.error("bad arguments.");
91
+ console.error(usage);
92
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
93
+ }
94
+ flags.disableMiqroJSON = true;
95
+ continue;
96
+ case "--config":
97
+ if (flags.miqroJSONPath !== null || flags.disableMiqroJSON !== null) {
98
+ console.error("bad arguments.");
99
+ console.error(usage);
100
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
101
+ }
102
+ const cPath = String(args[i + 1]).toUpperCase();
103
+ if (typeof cPath !== "string") {
104
+ console.error("bad arguments. --config must be a string.");
105
+ console.error(usage);
106
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
107
+ }
108
+ flags.miqroJSONPath = cPath;
109
+ i++;
110
+ continue;
63
111
  case "--install-tsconfig":
64
112
  if (flags.inflate !== null || flags.installTSConfig !== null) {
65
113
  console.error("bad arguments.");
@@ -76,6 +124,36 @@ export function parseArguments() {
76
124
  }
77
125
  flags.hotreload = true;
78
126
  continue;
127
+ case "--port":
128
+ if (flags.port !== null) {
129
+ console.error("bad arguments.");
130
+ console.error(usage);
131
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
132
+ }
133
+ const cPort = String(args[i + 1]).toUpperCase();
134
+ if (typeof cPort !== "string") {
135
+ console.error("bad arguments. --port must be a string.");
136
+ console.error(usage);
137
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
138
+ }
139
+ flags.port = cPort;
140
+ i++;
141
+ continue;
142
+ case "--name":
143
+ if (flags.name !== null) {
144
+ console.error("bad arguments.");
145
+ console.error(usage);
146
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
147
+ }
148
+ const cName = String(args[i + 1]).toUpperCase();
149
+ if (typeof cName !== "string") {
150
+ console.error("bad arguments. --port must be a string.");
151
+ console.error(usage);
152
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
153
+ }
154
+ flags.name = cName;
155
+ i++;
156
+ continue;
79
157
  case "--generate-doc":
80
158
  if (flags.generateDoc !== null) {
81
159
  console.error("bad arguments.");
@@ -164,7 +242,6 @@ export function parseArguments() {
164
242
  console.error(usage);
165
243
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
166
244
  }
167
- env["HOT_RELOAD"] = env["HOT_RELOAD"] ? env["HOT_RELOAD"] : "0";
168
245
  flags.migrateUp = true;
169
246
  continue;
170
247
  case "--migrate-down":
@@ -173,7 +250,6 @@ export function parseArguments() {
173
250
  console.error(usage);
174
251
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
175
252
  }
176
- env["HOT_RELOAD"] = env["HOT_RELOAD"] ? env["HOT_RELOAD"] : "0";
177
253
  flags.migrateDown = true;
178
254
  continue;
179
255
  case "--inflate":
@@ -182,7 +258,6 @@ export function parseArguments() {
182
258
  console.error(usage);
183
259
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
184
260
  }
185
- env["HOT_RELOAD"] = env["HOT_RELOAD"] ? env["HOT_RELOAD"] : "0";
186
261
  flags.inflate = true;
187
262
  continue;
188
263
  case "--test":
@@ -191,7 +266,6 @@ export function parseArguments() {
191
266
  console.error(usage);
192
267
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
193
268
  }
194
- env["HOT_RELOAD"] = env["HOT_RELOAD"] ? env["HOT_RELOAD"] : "0";
195
269
  env["BROWSER"] = env["BROWSER"] ? env["BROWSER"] : "none";
196
270
  env["PORT"] = TEST_SOCKET;
197
271
  flags.test = true;
@@ -233,13 +307,37 @@ export function parseArguments() {
233
307
  continue;*/
234
308
  }
235
309
  }
236
- if (process.env["CLUSTER_NODE_NUMBER"]) {
237
- env["HOT_RELOAD"] = env["HOT_RELOAD"] ? env["HOT_RELOAD"] : "0";
238
- }
239
310
  flags.inflate = flags.inflate ? flags.inflate : false;
240
311
  flags.editor = flags.editor ? flags.editor : false;
241
312
  flags.test = flags.test ? flags.test : false;
242
313
  flags.inflateDir = flags.inflateDir ? flags.inflateDir : undefined;
314
+ const miqroJSONPath = !flags.disableMiqroJSON ? flags.miqroJSONPath ? resolve(flags.miqroJSONPath) : getMiqroJSONPath() : false;
315
+ const miqroRC = miqroJSONPath ? importMiqroJSON(miqroJSONPath) : {};
316
+ // try to load .miqrorc
317
+ if (!flags.disableMiqroJSON && miqroJSONPath) {
318
+ if (services.length === 0) {
319
+ if (miqroRC.services) {
320
+ for (const service of miqroRC.services) {
321
+ services.push(join(relative(cwd(), dirname(miqroJSONPath)), service));
322
+ }
323
+ }
324
+ }
325
+ if (!flags.port) {
326
+ if (miqroRC.port) {
327
+ flags.port = String(miqroRC.port);
328
+ }
329
+ }
330
+ if (!flags.inflateDir && flags.inflate) {
331
+ if (miqroRC.inflateDir) {
332
+ flags.inflateDir = miqroRC.inflateDir;
333
+ }
334
+ }
335
+ if (!flags.name) {
336
+ if (miqroRC.name) {
337
+ flags.name = miqroRC.name;
338
+ }
339
+ }
340
+ }
243
341
  if (services.length === 0 && (!flags.installTSConfig && !flags.installTypes)) {
244
342
  flags.inflateDir = flags.inflateDir ? flags.inflateDir : undefined;
245
343
  console.error(`bad arguments. missing --service argument`);
@@ -304,11 +402,15 @@ export function parseArguments() {
304
402
  }
305
403
  const generateDocType = flags.generateDocType ? flags.generateDocType : "MD";
306
404
  return {
405
+ name: flags.name ? flags.name : undefined,
307
406
  generateDocAll: flags.generateDocAll ? true : false,
308
407
  hotreload: flags.hotreload ? true : false,
408
+ disableMiqroJSON: flags.disableMiqroJSON !== null ? flags.disableMiqroJSON : false,
409
+ miqroJSONPath: miqroJSONPath ? miqroJSONPath : false,
309
410
  installTypes: flags.installTypes ? true : false,
310
411
  installTSConfig: flags.installTSConfig ? true : false,
311
412
  inflate: flags.inflate,
413
+ port: flags.port ? flags.port : getPORT(),
312
414
  migrateUp: flags.migrateUp ? true : false,
313
415
  migrateDown: flags.migrateDown ? true : false,
314
416
  test: flags.test ? true : false,
@@ -322,4 +424,3 @@ export function parseArguments() {
322
424
  editor: flags.editor ? true : false
323
425
  };
324
426
  }
325
- //# sourceMappingURL=arguments.js.map
@@ -24,8 +24,8 @@ const ASSETS_ROUTER = {
24
24
  "jsx.dom.js": "build/jsx.dom.js",
25
25
  "types.json": "sea/types.json",
26
26
  "editor-assets/editor.bundle.js": "build/editor.bundle.js",
27
- "editor-assets/style.css": "editor/http/admin/editor/style.css",
28
- "editor-assets/font.ttf": "editor/http/admin/editor/font.ttf"
27
+ "editor-assets/style.css": "build/style.css",
28
+ "editor-assets/font.ttf": "build/font.ttf"
29
29
  };
30
30
  export function getAsset(key) {
31
31
  if (isSea()) {
@@ -121,4 +121,3 @@ export async function initAsset(logger, path, buffer, executable, checksum, logI
121
121
  }
122
122
  }
123
123
  }
124
- //# sourceMappingURL=assets.js.map
@@ -54,4 +54,3 @@ export async function calculateChecksumFromBuffer(buffer) {
54
54
  }
55
55
  });
56
56
  }
57
- //# sourceMappingURL=checksum.js.map
@@ -11,4 +11,3 @@ export const EDITOR_CONFIG_KEY = "$$editor$$";
11
11
  export const HOT_RELOAD_PATH = "/hot-reload";
12
12
  //export const SERVER_IDENTIFIER = cluster.isPrimary ? "SERVER" : process.env["CLUSTER_NODE_NUMBER"] ? `WORKER_${process.env["CLUSTER_NODE_NUMBER"]}` : "WORKER";
13
13
  //export const DB_IDENTIFIER = cluster.isPrimary ? "DATABASE" : process.env["CLUSTER_NODE_NUMBER"] ? `WORKER_${process.env["CLUSTER_NODE_NUMBER"]}_DATABASE` : "WORKER_DATABASE";
14
- //# sourceMappingURL=constants.js.map
@@ -79,4 +79,3 @@ export const CONTENT_TYPE_MAP = {
79
79
  ".3g2": "video/3gpp2; audio/3gpp2",
80
80
  ".7z": "application/x-7z-compressed"
81
81
  };
82
- //# sourceMappingURL=content-type.js.map
@@ -76,4 +76,3 @@ export async function esBuild(options, logger) {
76
76
  }
77
77
  });
78
78
  }
79
- //# sourceMappingURL=esbuild.js.map
@@ -81,4 +81,3 @@ export function setupExitHandlers(app) {
81
81
  process.exit(EXIT_CODES.ABNORMAL_UNCONTROLLED);
82
82
  });
83
83
  }
84
- //# sourceMappingURL=exit.js.map
@@ -14,4 +14,3 @@ export function describeFilePath(filePath) {
14
14
  filePath
15
15
  };
16
16
  }
17
- //# sourceMappingURL=fs.js.map
@@ -1,3 +1,3 @@
1
1
  export declare const BIN_NAME = "miqro";
2
2
  export declare const usage = "usage: miqro [...FLAGS] --service app/\n\n==examples==\n\nmiqro --watch --service front/\nPORT=8181 miqro --service api/ --service front/\nmiqro --test --service front/\nmiqro --inflate --service front/\nmiqro --generate-doc --generate-doc-out API.md --service front/\nCLUSTER_COUNT=10 miqro-cluster --service api/";
3
- export declare const help = "\n==flags==\n\n-v, --version\t\toutputs the version number\n-h, --help\t\toutputs this page.\n--watch\t\t\tuse to enable the hot-reload functionality.\n--test\t\t\trun the tests for a service.\n--migrate-up\t\tmigrations up.\n--migrate-down\t\tmigrations down.\n--inflate\t\tinflates the application.\n--inflate-dir\t\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\t\truns the application with a built-in editor.\n--generate-doc\t\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\toutputs all the server routes in the documentation output.\n--compile\t\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\t\tinflates the application with sea compilation scripts.\n--install-tsconfig\tcreates a tsconfig.json configured to use with --install-types.\n--install-types\t\tcreates and updates the .types/ folder use together with --install-tsconfig.\n\n==environment variables==\n\nPORT\t\t\toverride the default 8080 port.\nLOG_FILE\t\toverride the default ./server.log file\nDB\t\t\tenable the server.db features\nDB_STORAGE\t\toverride the default local db location ./db.sqlite3\nDB_DIALECT\t\toverride the default node:sqlite\nDB_CONNECTION\t\toverride the default connection url\nCLEAR_JSX_CACHE\t\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\t\t\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
3
+ export declare const help = "\n==flags==\n\n-v, --version\t\toutputs the version number\n-h, --help\t\toutputs this page.\n--watch\t\t\tuse to enable the hot-reload functionality.\n--test\t\t\trun the tests for a service.\n--migrate-up\t\tmigrations up.\n--migrate-down\t\tmigrations down.\n--inflate\t\tinflates the application.\n--inflate-dir\t\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\t\truns the application with a built-in editor.\n--generate-doc\t\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\toutputs all the server routes in the documentation output.\n--compile\t\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\t\tinflates the application with sea compilation scripts.\n--install-tsconfig\tcreates a tsconfig.json configured to use with --install-types.\n--install-types\t\tcreates and updates the .types/ folder use together with --install-tsconfig.\n--disable-miqrojson\tdisables the load of miqro.json file.\n--config\toverrides the default miqro.json path with a new one.\n--port\toverrides the default port loading from environment variables.\n--name\toverrides the default name of the server.\n\n==environment variables==\n\nPORT\t\t\toverride the default 8080 port.\nLOG_FILE\t\toverride the default ./server.log file\nDB\t\t\tenable the server.db features\nDB_STORAGE\t\toverride the default local db location ./db.sqlite3\nDB_DIALECT\t\toverride the default node:sqlite\nDB_CONNECTION\t\toverride the default connection url\nCLEAR_JSX_CACHE\t\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\t\t\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
@@ -30,6 +30,10 @@ export const help = `
30
30
  --inflate-sea\t\tinflates the application with sea compilation scripts.
31
31
  --install-tsconfig\tcreates a tsconfig.json configured to use with --install-types.
32
32
  --install-types\t\tcreates and updates the .types/ folder use together with --install-tsconfig.
33
+ --disable-miqrojson\tdisables the load of miqro.json file.
34
+ --config\toverrides the default miqro.json path with a new one.
35
+ --port\toverrides the default port loading from environment variables.
36
+ --name\toverrides the default name of the server.
33
37
 
34
38
  ==environment variables==
35
39
 
@@ -42,4 +46,3 @@ DB_CONNECTION\t\toverride the default connection url
42
46
  CLEAR_JSX_CACHE\t\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.
43
47
  JSX_TMP\t\t\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.
44
48
  `;
45
- //# sourceMappingURL=help.js.map
@@ -1,7 +1,7 @@
1
1
  import { Runtime } from "@miqro/jsx";
2
2
  import { Request, Response, CORSOptions, Logger, APIRoute } from "@miqro/core";
3
3
  import { Schema } from "@miqro/parser";
4
- import { APIOptions, ServerConfig, WSConfig, AuthConfig, DBConfig, LogConfig } from "../types.js";
4
+ import { APIOptions, ServerConfig, WSConfig, AuthConfig, DBConfig, LogConfig, MiddlewareConfig, ErrorConfig, DocConfig } from "../types.js";
5
5
  import { Migration } from "@miqro/query";
6
6
  export declare function initJSXJS(logger: Logger): Promise<void>;
7
7
  export declare function validateJSXJS(logger: Logger): Promise<boolean>;
@@ -38,11 +38,18 @@ export declare const DBConfigSchema: Schema<DBConfig>;
38
38
  export declare const ServerConfigSchema: Schema<ServerConfig>;
39
39
  export declare const LogConfigSchema: Schema<LogConfig>;
40
40
  export declare const AuthConfigSchema: Schema<AuthConfig>;
41
+ export declare const MiddlewareConfigSchema: Schema<MiddlewareConfig>;
42
+ export declare const ErrorConfigSchema: Schema<ErrorConfig>;
43
+ export declare const DocConfigSchema: Schema<DocConfig>;
41
44
  export declare function importAPIRoute(inFile: string, logger?: Logger): Promise<APIRoute>;
42
45
  export declare function importMigrationModule(inFile: string, logger?: Logger): Promise<Migration>;
43
46
  export declare function importHTMLModule(inFile: string, logger?: Logger): Promise<any>;
44
47
  export declare function importJSONModule(inFile: string, logger?: Logger): Promise<any>;
45
48
  export declare function importAuthModule(inFile: string, logger?: Logger): Promise<AuthConfig>;
49
+ export declare function importMiddlewareConfigModule(inFile: string, logger?: Logger): Promise<MiddlewareConfig>;
50
+ export declare function importErrorConfigModule(inFile: string, logger?: Logger): Promise<ErrorConfig>;
51
+ export declare function importDocConfigModule(inFile: string, logger?: Logger): Promise<DocConfig>;
52
+ export declare function importConfigConfigModule(inFile: string, logger?: Logger): Promise<MiddlewareConfig>;
46
53
  export declare function importCORSModule(inFile: string, logger?: Logger): Promise<CORSOptions>;
47
54
  export declare function importWSConfigModule(inFile: string, logger?: Logger): Promise<WSConfig>;
48
55
  export declare function importDBConfigModule(inFile: string, logger?: Logger): Promise<DBConfig>;
@@ -11,7 +11,7 @@ import { getJSXJSPath, JSX_TMP_DIR } from "./paths.js";
11
11
  import { CLEAR_JSX_CACHE } from "./constants.js";
12
12
  import { getAsset, initAsset, validateAsset } from "./assets.js";
13
13
  import { calculateChecksumFromBuffer } from "./checksum.js";
14
- import { RouteOptionsSchema } from "@miqro/core/build/types.js";
14
+ import { HandlerWithOptionsSchema, RouteOptionsSchema } from "@miqro/core/build/types.js";
15
15
  let jsxJSBuffer = null; // Buffer.from(getAsset("jsx.dom.js"));
16
16
  let jsxJSBufferChecksumPromise = null; // calculateChecksumFromBuffer(jsxJSBuffer);
17
17
  export async function initJSXJS(logger) {
@@ -214,6 +214,53 @@ export const AuthConfigSchema = {
214
214
  },
215
215
  //mode:"add_extra"
216
216
  };
217
+ export const MiddlewareConfigSchema = {
218
+ type: "object",
219
+ properties: {
220
+ middleware: {
221
+ type: "Array",
222
+ arrayType: "function|object",
223
+ required: false,
224
+ properties: {
225
+ ...HandlerWithOptionsSchema.properties
226
+ }
227
+ },
228
+ post: {
229
+ type: "Array",
230
+ arrayType: "function|object",
231
+ required: false,
232
+ properties: {
233
+ ...HandlerWithOptionsSchema.properties
234
+ }
235
+ }
236
+ },
237
+ };
238
+ export const ErrorConfigSchema = {
239
+ type: "object",
240
+ properties: {
241
+ catch: {
242
+ type: "Array",
243
+ required: false,
244
+ arrayType: "function"
245
+ }
246
+ },
247
+ };
248
+ export const DocConfigSchema = {
249
+ type: "object",
250
+ properties: {
251
+ publish: {
252
+ type: "dict?",
253
+ dictType: "object",
254
+ properties: {
255
+ type: {
256
+ type: "enum?",
257
+ enumValues: ["HTML", "MD", "JSON"]
258
+ },
259
+ all: "boolean?"
260
+ }
261
+ }
262
+ }
263
+ };
217
264
  export async function importAPIRoute(inFile, logger) {
218
265
  const mod = (await importJSXFile(inFile, logger)).default;
219
266
  const module = typeof mod === "function" ? { handler: mod } : parser.parse(mod, APIRouteSchema, basename(inFile));
@@ -264,6 +311,42 @@ export async function importAuthModule(inFile, logger) {
264
311
  throw new Error(`error with module [${inFile}] undefined`);
265
312
  }
266
313
  }
314
+ export async function importMiddlewareConfigModule(inFile, logger) {
315
+ const module = parser.parse((await importJSXFile(inFile, logger)).default, MiddlewareConfigSchema, basename(inFile));
316
+ if (module !== undefined) {
317
+ return module;
318
+ }
319
+ else {
320
+ throw new Error(`error with module [${inFile}] undefined`);
321
+ }
322
+ }
323
+ export async function importErrorConfigModule(inFile, logger) {
324
+ const module = parser.parse((await importJSXFile(inFile, logger)).default, ErrorConfigSchema, basename(inFile));
325
+ if (module !== undefined) {
326
+ return module;
327
+ }
328
+ else {
329
+ throw new Error(`error with module [${inFile}] undefined`);
330
+ }
331
+ }
332
+ export async function importDocConfigModule(inFile, logger) {
333
+ const module = parser.parse((await importJSXFile(inFile, logger)).default, DocConfigSchema, basename(inFile));
334
+ if (module !== undefined) {
335
+ return module;
336
+ }
337
+ else {
338
+ throw new Error(`error with module [${inFile}] undefined`);
339
+ }
340
+ }
341
+ export async function importConfigConfigModule(inFile, logger) {
342
+ const module = parser.parse((await importJSXFile(inFile, logger)).default, MiddlewareConfigSchema, basename(inFile));
343
+ if (module !== undefined) {
344
+ return module;
345
+ }
346
+ else {
347
+ throw new Error(`error with module [${inFile}] undefined`);
348
+ }
349
+ }
267
350
  export async function importCORSModule(inFile, logger) {
268
351
  const module = parser.parse((await importJSXFile(inFile, logger)).default, CORSOptionsSchema, basename(inFile));
269
352
  if (module !== undefined) {
@@ -376,4 +459,3 @@ export function jsx2HTML(out, runtime) {
376
459
  //console.log("jsx2HTML [%s]", HTML);
377
460
  return HTML;
378
461
  }
379
- //# sourceMappingURL=jsx.js.map
@@ -7,6 +7,10 @@ export declare function getServerConfigPath(servicePath: string): string | false
7
7
  export declare function getWSConfigPath(servicePath: string): string | false;
8
8
  export declare function getDBConfigPath(servicePath: string): string | false;
9
9
  export declare function getStaticFilesPath(servicePath: string): string | false;
10
+ export declare function getMiddlewareConfigPath(servicePath: string): string | false;
11
+ export declare function getErrorConfigPath(servicePath: string): string | false;
12
+ export declare function getDocConfigPath(servicePath: string): string | false;
13
+ export declare function getMiqroJSONPath(): string | false;
10
14
  export declare function getAuthConfigPath(servicePath: string): string | false;
11
15
  export declare function getHTTPRouterPath(servicePath: string): string | false;
12
16
  export declare function getMigrationsPath(servicePath: string): string | false;
@@ -71,13 +71,53 @@ export function getStaticFilesPath(servicePath) {
71
71
  }
72
72
  return false;
73
73
  }
74
+ export function getMiddlewareConfigPath(servicePath) {
75
+ const middlewarePath = resolve(servicePath, "middleware.ts");
76
+ const middlewarePathJS = resolve(servicePath, "middleware.js");
77
+ if (existsSync(middlewarePath) && !statSync(middlewarePath).isDirectory()) {
78
+ return middlewarePath;
79
+ }
80
+ else if (existsSync(middlewarePathJS) && !statSync(middlewarePathJS).isDirectory()) {
81
+ return middlewarePathJS;
82
+ }
83
+ return false;
84
+ }
85
+ export function getErrorConfigPath(servicePath) {
86
+ const errorPath = resolve(servicePath, "catch.ts");
87
+ const errorPathJS = resolve(servicePath, "catch.js");
88
+ if (existsSync(errorPath) && !statSync(errorPath).isDirectory()) {
89
+ return errorPath;
90
+ }
91
+ else if (existsSync(errorPathJS) && !statSync(errorPathJS).isDirectory()) {
92
+ return errorPathJS;
93
+ }
94
+ return false;
95
+ }
96
+ export function getDocConfigPath(servicePath) {
97
+ const docPath = resolve(servicePath, "doc.ts");
98
+ const docPathJS = resolve(servicePath, "doc.js");
99
+ if (existsSync(docPath) && !statSync(docPath).isDirectory()) {
100
+ return docPath;
101
+ }
102
+ else if (existsSync(docPathJS) && !statSync(docPathJS).isDirectory()) {
103
+ return docPathJS;
104
+ }
105
+ return false;
106
+ }
107
+ export function getMiqroJSONPath() {
108
+ const miqroRCPath = resolve(cwd(), "miqro.json");
109
+ if (existsSync(miqroRCPath) && !statSync(miqroRCPath).isDirectory()) {
110
+ return miqroRCPath;
111
+ }
112
+ return false;
113
+ }
74
114
  export function getAuthConfigPath(servicePath) {
75
115
  const authPath = resolve(servicePath, "auth.ts");
76
116
  const authPathJS = resolve(servicePath, "auth.js");
77
117
  if (existsSync(authPath) && !statSync(authPath).isDirectory()) {
78
118
  return authPath;
79
119
  }
80
- else if (existsSync(authPath) && !statSync(authPath).isDirectory()) {
120
+ else if (existsSync(authPathJS) && !statSync(authPathJS).isDirectory()) {
81
121
  return authPathJS;
82
122
  }
83
123
  return false;
@@ -107,4 +147,3 @@ export function getESBuildBinaryPath() {
107
147
  export function getJSXJSPath() {
108
148
  return resolve(JSX_TMP_DIR, String(process.pid), "jsx.js");
109
149
  }
110
- //# sourceMappingURL=paths.js.map
@@ -76,4 +76,3 @@ export async function watchAndServer(app) {
76
76
  }
77
77
  };
78
78
  }
79
- //# sourceMappingURL=watch.js.map