miqro 7.1.0 → 7.2.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 (222) hide show
  1. package/README.md +92 -24
  2. package/build/editor.bundle.js +3 -3
  3. package/build/esm/editor/auth.js +3 -1
  4. package/build/esm/editor/auth.js.map +1 -0
  5. package/build/esm/editor/common/admin-interface.js +1 -0
  6. package/build/esm/editor/common/admin-interface.js.map +1 -0
  7. package/build/esm/editor/common/constants.js +1 -0
  8. package/build/esm/editor/common/constants.js.map +1 -0
  9. package/build/esm/editor/common/constants.server.js +1 -0
  10. package/build/esm/editor/common/constants.server.js.map +1 -0
  11. package/build/esm/editor/common/editor-index.js +1 -0
  12. package/build/esm/editor/common/editor-index.js.map +1 -0
  13. package/build/esm/editor/common/html-encode.js +1 -0
  14. package/build/esm/editor/common/html-encode.js.map +1 -0
  15. package/build/esm/editor/common/log-socket.js +1 -0
  16. package/build/esm/editor/common/log-socket.js.map +1 -0
  17. package/build/esm/editor/common/templates.js +1 -0
  18. package/build/esm/editor/common/templates.js.map +1 -0
  19. package/build/esm/editor/components/api-preview.js +1 -0
  20. package/build/esm/editor/components/api-preview.js.map +1 -0
  21. package/build/esm/editor/components/editor.js +1 -0
  22. package/build/esm/editor/components/editor.js.map +1 -0
  23. package/build/esm/editor/components/file-browser.js +1 -0
  24. package/build/esm/editor/components/file-browser.js.map +1 -0
  25. package/build/esm/editor/components/file-editor-toolbar.js +1 -0
  26. package/build/esm/editor/components/file-editor-toolbar.js.map +1 -0
  27. package/build/esm/editor/components/file-editor.js +1 -0
  28. package/build/esm/editor/components/file-editor.js.map +1 -0
  29. package/build/esm/editor/components/filter-query.js +1 -0
  30. package/build/esm/editor/components/filter-query.js.map +1 -0
  31. package/build/esm/editor/components/highlight-text-area.js +1 -0
  32. package/build/esm/editor/components/highlight-text-area.js.map +1 -0
  33. package/build/esm/editor/components/log-viewer.js +1 -0
  34. package/build/esm/editor/components/log-viewer.js.map +1 -0
  35. package/build/esm/editor/components/new-file.js +1 -0
  36. package/build/esm/editor/components/new-file.js.map +1 -0
  37. package/build/esm/editor/components/scroll-query.js +1 -0
  38. package/build/esm/editor/components/scroll-query.js.map +1 -0
  39. package/build/esm/editor/components/start-page.js +1 -0
  40. package/build/esm/editor/components/start-page.js.map +1 -0
  41. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +1 -0
  42. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js.map +1 -0
  43. package/build/esm/editor/http/admin/editor/api/fs/read.api.js +3 -2
  44. package/build/esm/editor/http/admin/editor/api/fs/read.api.js.map +1 -0
  45. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +1 -0
  46. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js.map +1 -0
  47. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +1 -0
  48. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js.map +1 -0
  49. package/build/esm/editor/http/admin/editor/api/fs/write.api.js +1 -0
  50. package/build/esm/editor/http/admin/editor/api/fs/write.api.js.map +1 -0
  51. package/build/esm/editor/http/admin/editor/api/server/reload.api.js +1 -0
  52. package/build/esm/editor/http/admin/editor/api/server/reload.api.js.map +1 -0
  53. package/build/esm/editor/http/admin/editor/api/server/restart.api.js +1 -0
  54. package/build/esm/editor/http/admin/editor/api/server/restart.api.js.map +1 -0
  55. package/build/esm/editor/http/admin/editor/editor.js +1 -0
  56. package/build/esm/editor/http/admin/editor/editor.js.map +1 -0
  57. package/build/esm/editor/http/admin/editor/index.api.js +1 -0
  58. package/build/esm/editor/http/admin/editor/index.api.js.map +1 -0
  59. package/build/esm/editor/server.js +1 -0
  60. package/build/esm/editor/server.js.map +1 -0
  61. package/build/esm/editor/ws.js +2 -1
  62. package/build/esm/editor/ws.js.map +1 -0
  63. package/build/esm/src/bin/compile.js +1 -0
  64. package/build/esm/src/bin/compile.js.map +1 -0
  65. package/build/esm/src/bin/doc-md.js +1 -0
  66. package/build/esm/src/bin/doc-md.js.map +1 -0
  67. package/build/esm/src/bin/generate-doc.js +1 -0
  68. package/build/esm/src/bin/generate-doc.js.map +1 -0
  69. package/build/esm/src/bin/test.d.ts +2 -1
  70. package/build/esm/src/bin/test.js +3 -2
  71. package/build/esm/src/bin/test.js.map +1 -0
  72. package/build/esm/src/bin/types.js +1 -0
  73. package/build/esm/src/bin/types.js.map +1 -0
  74. package/build/esm/src/cluster.js +1 -0
  75. package/build/esm/src/cluster.js.map +1 -0
  76. package/build/esm/src/common/arguments.d.ts +8 -0
  77. package/build/esm/src/common/arguments.js +78 -1
  78. package/build/esm/src/common/arguments.js.map +1 -0
  79. package/build/esm/src/common/assets.d.ts +1 -1
  80. package/build/esm/src/common/assets.js +2 -1
  81. package/build/esm/src/common/assets.js.map +1 -0
  82. package/build/esm/src/common/checksum.js +1 -0
  83. package/build/esm/src/common/checksum.js.map +1 -0
  84. package/build/esm/src/common/constants.d.ts +1 -0
  85. package/build/esm/src/common/constants.js +2 -0
  86. package/build/esm/src/common/constants.js.map +1 -0
  87. package/build/esm/src/common/content-type.js +1 -0
  88. package/build/esm/src/common/content-type.js.map +1 -0
  89. package/build/esm/src/common/esbuild.js +2 -1
  90. package/build/esm/src/common/esbuild.js.map +1 -0
  91. package/build/esm/src/common/exit.js +1 -0
  92. package/build/esm/src/common/exit.js.map +1 -0
  93. package/build/esm/src/common/fs.js +1 -0
  94. package/build/esm/src/common/fs.js.map +1 -0
  95. package/build/esm/src/common/help.d.ts +1 -1
  96. package/build/esm/src/common/help.js +7 -1
  97. package/build/esm/src/common/help.js.map +1 -0
  98. package/build/esm/src/common/jsx.d.ts +20 -16
  99. package/build/esm/src/common/jsx.js +34 -29
  100. package/build/esm/src/common/jsx.js.map +1 -0
  101. package/build/esm/src/common/jwt.js +1 -0
  102. package/build/esm/src/common/jwt.js.map +1 -0
  103. package/build/esm/src/common/paths.js +1 -0
  104. package/build/esm/src/common/paths.js.map +1 -0
  105. package/build/esm/src/common/watch.js +1 -0
  106. package/build/esm/src/common/watch.js.map +1 -0
  107. package/build/esm/src/inflate/inflate-sea.js +1 -0
  108. package/build/esm/src/inflate/inflate-sea.js.map +1 -0
  109. package/build/esm/src/inflate/inflate.d.ts +5 -1
  110. package/build/esm/src/inflate/inflate.js +6 -5
  111. package/build/esm/src/inflate/inflate.js.map +1 -0
  112. package/build/esm/src/inflate/md.js +1 -0
  113. package/build/esm/src/inflate/md.js.map +1 -0
  114. package/build/esm/src/inflate/setup-auth.d.ts +2 -2
  115. package/build/esm/src/inflate/setup-auth.js +3 -2
  116. package/build/esm/src/inflate/setup-auth.js.map +1 -0
  117. package/build/esm/src/inflate/setup-cors.d.ts +2 -2
  118. package/build/esm/src/inflate/setup-cors.js +3 -2
  119. package/build/esm/src/inflate/setup-cors.js.map +1 -0
  120. package/build/esm/src/inflate/setup-db.d.ts +3 -3
  121. package/build/esm/src/inflate/setup-db.js +6 -5
  122. package/build/esm/src/inflate/setup-db.js.map +1 -0
  123. package/build/esm/src/inflate/setup-error.d.ts +2 -2
  124. package/build/esm/src/inflate/setup-error.js +3 -2
  125. package/build/esm/src/inflate/setup-error.js.map +1 -0
  126. package/build/esm/src/inflate/setup-http.d.ts +7 -2
  127. package/build/esm/src/inflate/setup-http.js +54 -45
  128. package/build/esm/src/inflate/setup-http.js.map +1 -0
  129. package/build/esm/src/inflate/setup-log.d.ts +2 -2
  130. package/build/esm/src/inflate/setup-log.js +3 -2
  131. package/build/esm/src/inflate/setup-log.js.map +1 -0
  132. package/build/esm/src/inflate/setup-middleware.d.ts +2 -2
  133. package/build/esm/src/inflate/setup-middleware.js +3 -2
  134. package/build/esm/src/inflate/setup-middleware.js.map +1 -0
  135. package/build/esm/src/inflate/setup-server-config.d.ts +2 -2
  136. package/build/esm/src/inflate/setup-server-config.js +3 -2
  137. package/build/esm/src/inflate/setup-server-config.js.map +1 -0
  138. package/build/esm/src/inflate/setup-test.d.ts +2 -1
  139. package/build/esm/src/inflate/setup-test.js +3 -2
  140. package/build/esm/src/inflate/setup-test.js.map +1 -0
  141. package/build/esm/src/inflate/setup-ws.d.ts +2 -2
  142. package/build/esm/src/inflate/setup-ws.js +3 -2
  143. package/build/esm/src/inflate/setup-ws.js.map +1 -0
  144. package/build/esm/src/inflate/setup.doc.d.ts +2 -2
  145. package/build/esm/src/inflate/setup.doc.js +5 -4
  146. package/build/esm/src/inflate/setup.doc.js.map +1 -0
  147. package/build/esm/src/inflate/utils/sea-utils.js +1 -0
  148. package/build/esm/src/inflate/utils/sea-utils.js.map +1 -0
  149. package/build/esm/src/lib.js +1 -0
  150. package/build/esm/src/lib.js.map +1 -0
  151. package/build/esm/src/main.js +9 -2
  152. package/build/esm/src/main.js.map +1 -0
  153. package/build/esm/src/services/app.d.ts +5 -2
  154. package/build/esm/src/services/app.js +22 -9
  155. package/build/esm/src/services/app.js.map +1 -0
  156. package/build/esm/src/services/editor.js +1 -0
  157. package/build/esm/src/services/editor.js.map +1 -0
  158. package/build/esm/src/services/hot-reload.d.ts +1 -0
  159. package/build/esm/src/services/hot-reload.js +9 -5
  160. package/build/esm/src/services/hot-reload.js.map +1 -0
  161. package/build/esm/src/services/migrations.d.ts +3 -2
  162. package/build/esm/src/services/migrations.js +5 -4
  163. package/build/esm/src/services/migrations.js.map +1 -0
  164. package/build/esm/src/services/utils/admin-interface.js +1 -0
  165. package/build/esm/src/services/utils/admin-interface.js.map +1 -0
  166. package/build/esm/src/services/utils/cache.js +1 -0
  167. package/build/esm/src/services/utils/cache.js.map +1 -0
  168. package/build/esm/src/services/utils/cluster-cache.js +91 -64
  169. package/build/esm/src/services/utils/cluster-cache.js.map +1 -0
  170. package/build/esm/src/services/utils/cluster-ws.js +1 -0
  171. package/build/esm/src/services/utils/cluster-ws.js.map +1 -0
  172. package/build/esm/src/services/utils/db-manager.js +1 -0
  173. package/build/esm/src/services/utils/db-manager.js.map +1 -0
  174. package/build/esm/src/services/utils/get-route.js +1 -0
  175. package/build/esm/src/services/utils/get-route.js.map +1 -0
  176. package/build/esm/src/services/utils/jwt.js +1 -0
  177. package/build/esm/src/services/utils/jwt.js.map +1 -0
  178. package/build/esm/src/services/utils/log-transport.js +1 -0
  179. package/build/esm/src/services/utils/log-transport.js.map +1 -0
  180. package/build/esm/src/services/utils/log.js +1 -0
  181. package/build/esm/src/services/utils/log.js.map +1 -0
  182. package/build/esm/src/services/utils/middleware.js +1 -0
  183. package/build/esm/src/services/utils/middleware.js.map +1 -0
  184. package/build/esm/src/services/utils/server-interface.js +1 -0
  185. package/build/esm/src/services/utils/server-interface.js.map +1 -0
  186. package/build/esm/src/services/utils/websocketmanager.js +3 -1
  187. package/build/esm/src/services/utils/websocketmanager.js.map +1 -0
  188. package/build/esm/src/types.js +1 -0
  189. package/build/esm/src/types.js.map +1 -0
  190. package/build/lib.cjs +1178 -1153
  191. package/editor/auth.ts +2 -1
  192. package/editor/http/admin/editor/api/fs/read.api.tsx +2 -2
  193. package/editor/ws.ts +1 -1
  194. package/package.json +10 -10
  195. package/sea/install-esbuild.sh +1 -1
  196. package/sea/install-nodejs.sh +1 -1
  197. package/sea/node.version.tag +1 -1
  198. package/src/bin/test.ts +3 -2
  199. package/src/common/arguments.ts +92 -1
  200. package/src/common/assets.ts +2 -2
  201. package/src/common/constants.ts +1 -0
  202. package/src/common/esbuild.ts +1 -1
  203. package/src/common/help.ts +6 -1
  204. package/src/common/jsx.ts +41 -30
  205. package/src/inflate/inflate.ts +9 -5
  206. package/src/inflate/setup-auth.ts +3 -3
  207. package/src/inflate/setup-cors.ts +4 -3
  208. package/src/inflate/setup-db.ts +6 -6
  209. package/src/inflate/setup-error.ts +3 -3
  210. package/src/inflate/setup-http.ts +61 -45
  211. package/src/inflate/setup-log.ts +3 -3
  212. package/src/inflate/setup-middleware.ts +3 -3
  213. package/src/inflate/setup-server-config.ts +3 -3
  214. package/src/inflate/setup-test.ts +3 -3
  215. package/src/inflate/setup-ws.ts +3 -3
  216. package/src/inflate/setup.doc.ts +5 -5
  217. package/src/main.ts +8 -2
  218. package/src/services/app.ts +27 -12
  219. package/src/services/hot-reload.ts +9 -5
  220. package/src/services/migrations.ts +5 -5
  221. package/src/services/utils/cluster-cache.ts +90 -65
  222. package/src/services/utils/websocketmanager.ts +2 -1
package/editor/auth.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { timingSafeEqual } from "node:crypto";
1
2
  import { AuthConfig, ServerRequest } from "../src/types.js";
2
3
  import { AdminRequest } from "./common/admin-interface.js";
3
4
 
@@ -27,7 +28,7 @@ export default {
27
28
  //console.log("\n\nqueryToken[%s] cookieToken[%s] KEY[%s]\n\n", queryToken, cookieToken, KEY);
28
29
 
29
30
  if (queryToken) {
30
- if (queryToken === KEY) {
31
+ if (typeof queryToken === "string" && timingSafeEqual(Buffer.from(queryToken), Buffer.from(KEY))) {
31
32
  args.res.setCookie(ADMIN_EDITOR_AUTH_COOKIE, KEY, {
32
33
  expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 31 * 12 * 500),
33
34
  httpOnly: true,
@@ -1,5 +1,5 @@
1
1
  import { APIRoute, JSONParser } from "@miqro/core";
2
- import { readFileSync } from "node:fs";
2
+ import { readFileSync, realpathSync } from "node:fs";
3
3
  import { SUPPORTED_LANGUAGES } from "../../../../../common/constants.js";
4
4
  import { relative, resolve } from "node:path";
5
5
  import { getLanguage } from "./scan.api.js";
@@ -45,7 +45,7 @@ export function readFile(path: string) {
45
45
  }
46
46
 
47
47
  export function getPath(path: string) {
48
- const realPath = resolve(BASE_PATH, path);
48
+ const realPath = realpathSync(resolve(BASE_PATH, path));
49
49
 
50
50
  if (relative(BASE_PATH, realPath).startsWith("..")) {
51
51
  throw new Error("invalid path! [" + path + "]");
package/editor/ws.ts CHANGED
@@ -10,6 +10,6 @@ export default {
10
10
 
11
11
  const KEY = cache.get("AUTH_KEY");
12
12
  const cookieToken = req.cookies["auth"];
13
- return cookieToken === KEY ? true : false;
13
+ return cookieToken && KEY && cookieToken === KEY ? true : false;
14
14
  },
15
15
  } as WSConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miqro",
3
- "version": "7.1.0",
3
+ "version": "7.2.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "build/esm/src/lib.js",
@@ -34,24 +34,24 @@
34
34
  "miqro-cluster": "build/esm/src/cluster.js"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/node": "^22.10.2",
37
+ "@types/node": "^24.9.1",
38
38
  "@types/showdown": "2.0.6",
39
39
  "highlight.js": "11.11.1",
40
- "typescript": "^5.7.2"
40
+ "typescript": "^5.9.3"
41
41
  },
42
42
  "dependencies": {
43
43
  "postject": "1.0.0-alpha.6",
44
- "@miqro/core": "^5.0.16",
44
+ "@miqro/core": "^5.0.17",
45
45
  "@miqro/jsx": "^1.0.1",
46
46
  "@miqro/jsx-dom": "^1.0.4",
47
47
  "@miqro/jsx-node": "^1.0.6",
48
- "@miqro/parser": "^2.0.4",
49
- "@miqro/query": "^0.0.4",
50
- "@miqro/runner": "^2.0.1",
48
+ "@miqro/parser": "^2.0.5",
49
+ "@miqro/query": "^0.0.5",
50
+ "@miqro/runner": "^2.0.2",
51
51
  "@miqro/test": "^0.2.9",
52
- "@miqro/test-http": "^0.1.2",
53
- "esbuild": "0.25.9 ",
54
- "jose": "6.1.0",
52
+ "@miqro/test-http": "^0.1.3",
53
+ "esbuild": "0.27.4",
54
+ "jose": "6.2.1",
55
55
  "showdown": "2.1.0"
56
56
  }
57
57
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
3
  TARGET="${PWD}/sea/deps/esbuild"
4
- VERSION="0.25.9"
4
+ VERSION="0.27.4"
5
5
 
6
6
  if [ -d "$TARGET" ]; then
7
7
  echo "$TARGET already exists exist."
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
3
  TARGET="${PWD}/sea/deps/nodejs"
4
- VERSION="24.7.0"
4
+ VERSION="25.8.1"
5
5
 
6
6
  if [ -d "$TARGET" ]; then
7
7
  echo "$TARGET already exists exist."
@@ -1 +1 @@
1
- 24.7.0
1
+ 25.8.1
package/src/bin/test.ts CHANGED
@@ -8,8 +8,9 @@ import { RuntimeOptions, RuntimeShadowRootInit, RuntimeURL } from "@miqro/jsx";
8
8
  import { EXIT_CODES } from "../common/constants.js";
9
9
  import { Miqro } from "../services/app.js";
10
10
  import { setupTests } from "../inflate/setup-test.js";
11
+ import { ImportJSXFileOptions } from "../common/jsx.js";
11
12
 
12
- export async function testMain(app: Miqro) {
13
+ export async function testMain(app: Miqro, options: ImportJSXFileOptions) {
13
14
  const startMS = Date.now();
14
15
  //resetTests();
15
16
  resetGlobals();
@@ -51,7 +52,7 @@ export async function testMain(app: Miqro) {
51
52
 
52
53
  for (const service of app.options.services) {
53
54
  const servicePath = getServicePath(service);
54
- await setupTests(app.logger, servicePath);
55
+ await setupTests(app.logger, servicePath, options);
55
56
  }
56
57
 
57
58
  console.log("");
@@ -28,6 +28,10 @@ interface MiqroJSON {
28
28
  serverOptions?: ServerOptions;
29
29
  httpsRedirect?: number;
30
30
  inflateParallel?: number;
31
+ noBuild?: boolean;
32
+ noMinify?: boolean;
33
+ inflateOnlyAssets?: boolean;
34
+ inflateFlat?: boolean;
31
35
  }
32
36
 
33
37
  const MiqroJSONSchema: Schema<MiqroJSON> = {
@@ -35,6 +39,10 @@ const MiqroJSONSchema: Schema<MiqroJSON> = {
35
39
  properties: {
36
40
  name: "string?",
37
41
  services: "string[]?",
42
+ noBuild: "boolean?",
43
+ noMinify: "boolean?",
44
+ inflateOnlyAssets: "boolean?",
45
+ inflateFlat: "boolean?",
38
46
  port: "number?|string?",
39
47
  inflateDir: "string?",
40
48
  browser: "boolean?|string?",
@@ -62,7 +70,11 @@ export function getPORT() {
62
70
  }
63
71
 
64
72
  export interface Arguments {
73
+ inflateOnlyAssets?: boolean;
74
+ inflateFlat?: boolean;
65
75
  name?: string;
76
+ noBuild?: boolean;
77
+ noMinify?: boolean;
66
78
  browser?: string | boolean;
67
79
  logFile?: string | boolean;
68
80
  // installTypes: boolean;
@@ -130,7 +142,13 @@ export function parseArguments(): Arguments {
130
142
  inflateDir?: string | null;
131
143
  hotreload?: boolean | null;
132
144
  watch?: boolean | null;
145
+ noBuild?: boolean | null;
146
+ noMinify?: boolean | null;
147
+ inflateOnlyAssets?: boolean | null;
148
+ inflateFlat?: boolean | null;
133
149
  } = {
150
+ inflateFlat: null,
151
+ inflateOnlyAssets: null,
134
152
  inflateParallel: null,
135
153
  httpsRedirect: null,
136
154
  https: null,
@@ -151,6 +169,8 @@ export function parseArguments(): Arguments {
151
169
  migrateDown: null,
152
170
  inflateSEA: null,
153
171
  compile: null,
172
+ noBuild: null,
173
+ noMinify: null,
154
174
  test: null,
155
175
  inflate: null,
156
176
  generateDoc: null,
@@ -208,6 +228,38 @@ export function parseArguments(): Arguments {
208
228
  }
209
229
  i++;
210
230
  continue;
231
+ case "--inflate-only-assets":
232
+ if (flags.inflateOnlyAssets !== null) {
233
+ console.error("bad arguments.");
234
+ console.error(usage);
235
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
236
+ }
237
+ flags.inflateOnlyAssets = true;
238
+ continue;
239
+ case "--inflate-flat":
240
+ if (flags.inflateFlat !== null) {
241
+ console.error("bad arguments.");
242
+ console.error(usage);
243
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
244
+ }
245
+ flags.inflateFlat = true;
246
+ continue;
247
+ case "--no-minify":
248
+ if (flags.noMinify !== null) {
249
+ console.error("bad arguments.");
250
+ console.error(usage);
251
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
252
+ }
253
+ flags.noMinify = true;
254
+ continue;
255
+ case "--no-build":
256
+ if (flags.noBuild !== null) {
257
+ console.error("bad arguments.");
258
+ console.error(usage);
259
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
260
+ }
261
+ flags.noBuild = true;
262
+ continue;
211
263
  case "--install-tsconfig":
212
264
  if (flags.inflate !== null || flags.installTSConfig !== null) {
213
265
  console.error("bad arguments.");
@@ -562,6 +614,26 @@ export function parseArguments(): Arguments {
562
614
  }
563
615
  }
564
616
  }
617
+ if (flags.noBuild === null) {
618
+ if (miqroRC.noBuild !== undefined) {
619
+ flags.noBuild = miqroRC.noBuild;
620
+ }
621
+ }
622
+ if (flags.inflateFlat === null) {
623
+ if (miqroRC.inflateFlat !== undefined) {
624
+ flags.inflateFlat = miqroRC.inflateFlat;
625
+ }
626
+ }
627
+ if (flags.inflateOnlyAssets === null) {
628
+ if (miqroRC.inflateOnlyAssets !== undefined) {
629
+ flags.inflateOnlyAssets = miqroRC.inflateOnlyAssets;
630
+ }
631
+ }
632
+ if (flags.noMinify === null) {
633
+ if (miqroRC.noMinify !== undefined) {
634
+ flags.noMinify = miqroRC.noMinify;
635
+ }
636
+ }
565
637
  if (flags.https === null) {
566
638
  if (miqroRC.https) {
567
639
  flags.https = miqroRC.https;
@@ -596,7 +668,7 @@ export function parseArguments(): Arguments {
596
668
  }
597
669
  if (!flags.inflateDir && flags.inflate) {
598
670
  if (miqroRC.inflateDir) {
599
- flags.inflateDir = miqroRC.inflateDir;
671
+ flags.inflateDir = join(relative(cwd(), dirname(miqroJSONPath)), miqroRC.inflateDir);
600
672
  }
601
673
  }
602
674
  if (flags.name === null) {
@@ -681,6 +753,21 @@ export function parseArguments(): Arguments {
681
753
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
682
754
  }
683
755
 
756
+ if (flags.inflateFlat && !flags.inflate) {
757
+ console.error("bad arguments. cannot use --inflate-flat without --inflate");
758
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
759
+ }
760
+
761
+ if (flags.inflateOnlyAssets && !flags.inflate) {
762
+ console.error("bad arguments. cannot use --inflate-only-assets without --inflate");
763
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
764
+ }
765
+
766
+ if (flags.inflateOnlyAssets && flags.inflateSEA) {
767
+ console.error("bad arguments. cannot use --inflate-only-assets with --inflate-sea");
768
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
769
+ }
770
+
684
771
  if (flags.editor && (/*flags.installTypes || */flags.installTSConfig || flags.installMiqroJSON)) {
685
772
  console.error("bad arguments. cannot use --editor with--install-types, --install-tsconfig or --install-miqrojson");
686
773
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
@@ -729,6 +816,10 @@ export function parseArguments(): Arguments {
729
816
  }
730
817
 
731
818
  return {
819
+ inflateFlat: flags.inflateFlat === null ? false : flags.inflateFlat,
820
+ inflateOnlyAssets: flags.inflateOnlyAssets === null ? undefined : flags.inflateOnlyAssets,
821
+ noMinify: flags.noMinify === null ? false : flags.noMinify,
822
+ noBuild: flags.noBuild === null ? false : flags.noBuild,
732
823
  inflateParallel: flags.inflateParallel ? flags.inflateParallel : undefined,
733
824
  name: flags.name ? flags.name : undefined,
734
825
  browser: flags.browser !== null ? flags.browser : undefined,
@@ -34,9 +34,9 @@ const ASSETS_ROUTER = {
34
34
  "editor-assets/font.ttf": "build/font.ttf"
35
35
  }
36
36
 
37
- export function getAsset(key: string): ArrayBuffer {
37
+ export function getAsset(key: string): Buffer {
38
38
  if (isSea()) {
39
- return seaGetAsset(key);
39
+ return Buffer.from(seaGetAsset(key));
40
40
  } else {
41
41
  if (!ASSETS_ROUTER[key]) {
42
42
  if (key === "esbuild-binary") {
@@ -12,6 +12,7 @@ export const CLEAR_JSX_CACHE = (process.env["CLEAR_JSX_CACHE"] !== undefined ? p
12
12
  export const EDITOR_CONFIG_KEY = "$$editor$$";
13
13
 
14
14
  export const HOT_RELOAD_PATH = "/hot-reload";
15
+ export const HOT_RELOAD_SCRIPT_PATH = "/hot-reload.js";
15
16
 
16
17
  //export const SERVER_IDENTIFIER = cluster.isPrimary ? "SERVER" : process.env["CLUSTER_NODE_NUMBER"] ? `WORKER_${process.env["CLUSTER_NODE_NUMBER"]}` : "WORKER";
17
18
 
@@ -73,7 +73,7 @@ export async function esBuild(options: {
73
73
  try {
74
74
  //const logger = getLogger(`${SERVER_IDENTIFIER}_ESBUILD`);
75
75
  const valid = await validateESBuild(logger);
76
- const esBuildCMD = `${getESBuildBinaryPath()} "${options.entryPoints[0]}" ${(options.external ? options.external : NODEJS_EXTERNAL).map(e => `--external:${e}`).join(" ")} --loader:.js=jsx --jsx-factory=${options.jsxFactory} --jsx-fragment=${options.jsxFragment} ${options.bundle ? " --bundle" : ""}${options.minify ? " --minify" : ""}${options.outfile ? ` --outfile="${options.outfile}"` : ""}${options.platform ? ` --platform=${options.platform}` : ""}${options.mainFields ? ` --main-fields=${options.mainFields}` : ""}${options.keepNames ? ` --keep-names` : ""}`;
76
+ const esBuildCMD = `${getESBuildBinaryPath()} "${options.entryPoints[0]}" ${(options.external ? options.external : NODEJS_EXTERNAL).map(e => `--external:"${e}"`).join(" ")} --loader:.js=jsx --jsx-factory=${options.jsxFactory} --jsx-fragment=${options.jsxFragment} ${options.bundle ? " --bundle" : ""}${options.minify ? " --minify" : ""}${options.outfile ? ` --outfile="${options.outfile}"` : ""}${options.platform ? ` --platform=${options.platform}` : ""}${options.mainFields ? ` --main-fields=${options.mainFields}` : ""}${options.keepNames ? ` --keep-names` : ""}`;
77
77
  logger?.trace(esBuildCMD);
78
78
  if (!valid) {
79
79
  const err = new Error(`esbuild installation at [${getESBuildBinaryPath()}] tampered`);
@@ -23,7 +23,7 @@ export const help = `
23
23
  --test\n\trun the tests for a service.
24
24
  --migrate-up\n\tmigrations up.
25
25
  --migrate-down\n\tmigrations down.
26
- --inflate\n\tinflates the application.
26
+ --inflate\n\tinflates the application into a directory using esbuild.
27
27
  --inflate-dir\n\tto set the output directory of the --inflate command. default value is inflated/.
28
28
  --editor\n\truns the application with a built-in editor.
29
29
  --generate-doc\n\tgenerates a documentation for the api endpoints of the service.
@@ -31,9 +31,14 @@ export const help = `
31
31
  --generate-doc-type\n\tthe format of the generated documentation. it can be JSON or MD. default value is MD.
32
32
  --generate-doc-all\n\toutputs all the server routes in the documentation output.
33
33
  --compile\n\tinflates the application and tries to create a NODE SEA binary.
34
+ --no-build\n\tdisables calling esbuild during imports in runtime. Notice that to use jsx you will need to run tsc or esbuild on your jsx files to transpile them to js.
35
+ --no-minify\n\tdisables calling minifing min.js files.
36
+ --inflate-only-assets\n\tinflates ONLY the application assets. must be used with --inflate.
37
+ --inflate-flat\n\tinflates files into the inflate-dir directly.
34
38
  --inflate-sea\n\tinflates the application with sea compilation scripts.
35
39
  --install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.
36
40
  --install-miqrojson\n\tcreates a default miqro.json file.
41
+ --install\n\tcreates a node_modules folder from binary cache (only available in sea binary).
37
42
  --disable-miqrojson\n\tdisables the load of miqro.json file.
38
43
  --log-file\n\toverrides the default log file from LOG_FILE.
39
44
  --browser\n\toverrides the default browser from BROWSER.
package/src/common/jsx.ts CHANGED
@@ -46,7 +46,7 @@ export interface InflateError {
46
46
  error: Error;
47
47
  }
48
48
 
49
- export interface InflateOptions {
49
+ interface InflateOptions {
50
50
  // embemedJSX: boolean;
51
51
  minify: boolean;
52
52
  useExport: boolean;
@@ -331,9 +331,9 @@ export const DocConfigSchema: Schema<DocConfig> = {
331
331
  }
332
332
  }
333
333
 
334
- export async function importAPIRoute(inFile: string, logger?: Logger) {
334
+ export async function importAPIRoute(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
335
335
  const isCJS = extname(inFile) === ".cjs";
336
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
336
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
337
337
  const module = typeof mod === "function" ? { handler: mod } : parser.parse(mod, APIRouteSchema, basename(inFile));
338
338
  if (module !== undefined) {
339
339
  return module as APIRoute;
@@ -342,9 +342,9 @@ export async function importAPIRoute(inFile: string, logger?: Logger) {
342
342
  }
343
343
  }
344
344
 
345
- export async function importMigrationModule(inFile: string, logger?: Logger) {
345
+ export async function importMigrationModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
346
346
  const isCJS = extname(inFile) === ".cjs";
347
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
347
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
348
348
  const module = parser.parse(mod, MigrationSchema, basename(inFile));
349
349
  if (module !== undefined) {
350
350
  return module;
@@ -353,8 +353,8 @@ export async function importMigrationModule(inFile: string, logger?: Logger) {
353
353
  }
354
354
  }
355
355
 
356
- export async function importHTMLModule(inFile: string, logger?: Logger) {
357
- const module = (await importJSXFile(inFile, logger));
356
+ export async function importHTMLModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
357
+ const module = (await importJSXFile(inFile, options, logger));
358
358
  parser.parse(module.default, HTMLModuleSchema.properties.default, `${basename(inFile)}.default`);
359
359
  parser.parse(module.apiOptions, APIOptionsSchema, `${basename(inFile)}.apiOptions`);
360
360
  if (module !== undefined) {
@@ -364,8 +364,8 @@ export async function importHTMLModule(inFile: string, logger?: Logger) {
364
364
  }
365
365
  }
366
366
 
367
- export async function importJSONModule(inFile: string, logger?: Logger) {
368
- const module = (await importJSXFile(inFile, logger));
367
+ export async function importJSONModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
368
+ const module = (await importJSXFile(inFile, options, logger));
369
369
  parser.parse(module.default, JSONModuleSchema.properties.default, `${basename(inFile)}.default`);
370
370
  parser.parse(module.apiOptions, APIOptionsSchema, `${basename(inFile)}.apiOptions`);
371
371
  if (module !== undefined) {
@@ -375,9 +375,9 @@ export async function importJSONModule(inFile: string, logger?: Logger) {
375
375
  }
376
376
  }
377
377
 
378
- export async function importAuthModule(inFile: string, logger?: Logger) {
378
+ export async function importAuthModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
379
379
  const isCJS = extname(inFile) === ".cjs";
380
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
380
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
381
381
 
382
382
  const module = parser.parse(mod, AuthConfigSchema, basename(inFile));
383
383
  if (module !== undefined) {
@@ -387,9 +387,9 @@ export async function importAuthModule(inFile: string, logger?: Logger) {
387
387
  }
388
388
  }
389
389
 
390
- export async function importMiddlewareConfigModule(inFile: string, logger?: Logger) {
390
+ export async function importMiddlewareConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
391
391
  const isCJS = extname(inFile) === ".cjs";
392
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
392
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
393
393
 
394
394
  const module = parser.parse(mod, MiddlewareConfigSchema, basename(inFile));
395
395
  if (module !== undefined) {
@@ -399,9 +399,9 @@ export async function importMiddlewareConfigModule(inFile: string, logger?: Logg
399
399
  }
400
400
  }
401
401
 
402
- export async function importErrorConfigModule(inFile: string, logger?: Logger) {
402
+ export async function importErrorConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
403
403
  const isCJS = extname(inFile) === ".cjs";
404
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
404
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
405
405
 
406
406
  const module = parser.parse(mod, ErrorConfigSchema, basename(inFile));
407
407
  if (module !== undefined) {
@@ -411,9 +411,9 @@ export async function importErrorConfigModule(inFile: string, logger?: Logger) {
411
411
  }
412
412
  }
413
413
 
414
- export async function importDocConfigModule(inFile: string, logger?: Logger) {
414
+ export async function importDocConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
415
415
  const isCJS = extname(inFile) === ".cjs";
416
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
416
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
417
417
 
418
418
  const module = parser.parse(mod, DocConfigSchema, basename(inFile));
419
419
  if (module !== undefined) {
@@ -423,9 +423,9 @@ export async function importDocConfigModule(inFile: string, logger?: Logger) {
423
423
  }
424
424
  }
425
425
 
426
- export async function importConfigConfigModule(inFile: string, logger?: Logger) {
426
+ export async function importConfigConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
427
427
  const isCJS = extname(inFile) === ".cjs";
428
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
428
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
429
429
 
430
430
  const module = parser.parse(mod, MiddlewareConfigSchema, basename(inFile));
431
431
  if (module !== undefined) {
@@ -435,9 +435,9 @@ export async function importConfigConfigModule(inFile: string, logger?: Logger)
435
435
  }
436
436
  }
437
437
 
438
- export async function importCORSModule(inFile: string, logger?: Logger) {
438
+ export async function importCORSModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
439
439
  const isCJS = extname(inFile) === ".cjs";
440
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
440
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
441
441
 
442
442
  const module = parser.parse(mod, CORSOptionsSchema, basename(inFile));
443
443
  if (module !== undefined) {
@@ -447,9 +447,9 @@ export async function importCORSModule(inFile: string, logger?: Logger) {
447
447
  }
448
448
  }
449
449
 
450
- export async function importWSConfigModule(inFile: string, logger?: Logger) {
450
+ export async function importWSConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
451
451
  const isCJS = extname(inFile) === ".cjs";
452
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
452
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
453
453
 
454
454
  const module = parser.parse(mod, WSConfigSchema, basename(inFile));
455
455
  if (module !== undefined) {
@@ -459,9 +459,9 @@ export async function importWSConfigModule(inFile: string, logger?: Logger) {
459
459
  }
460
460
  }
461
461
 
462
- export async function importDBConfigModule(inFile: string, logger?: Logger) {
462
+ export async function importDBConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
463
463
  const isCJS = extname(inFile) === ".cjs";
464
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
464
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
465
465
 
466
466
  const module = parser.parse(mod, DBConfigSchema, basename(inFile));
467
467
  if (module !== undefined) {
@@ -471,8 +471,8 @@ export async function importDBConfigModule(inFile: string, logger?: Logger) {
471
471
  }
472
472
  }
473
473
 
474
- export async function importLogConfigModule(inFile: string, logger?: Logger) {
475
- const module = parser.parse((await importJSXFile(inFile, logger)).default, LogConfigSchema, basename(inFile));
474
+ export async function importLogConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
475
+ const module = parser.parse((await importJSXFile(inFile, options, logger)).default, LogConfigSchema, basename(inFile));
476
476
  if (module !== undefined) {
477
477
  return module;
478
478
  } else {
@@ -480,9 +480,9 @@ export async function importLogConfigModule(inFile: string, logger?: Logger) {
480
480
  }
481
481
  }
482
482
 
483
- export async function importServerConfigModule(inFile: string, logger?: Logger) {
483
+ export async function importServerConfigModule(inFile: string, options: ImportJSXFileOptions, logger?: Logger) {
484
484
  const isCJS = extname(inFile) === ".cjs";
485
- const mod = isCJS ? (await importJSXFile(inFile, logger)).default.default : (await importJSXFile(inFile, logger)).default;
485
+ const mod = isCJS ? (await importJSXFile(inFile, options, logger)).default.default : (await importJSXFile(inFile, options, logger)).default;
486
486
 
487
487
  const module = parser.parse(mod, ServerConfigSchema, basename(inFile));
488
488
  if (module !== undefined) {
@@ -492,7 +492,18 @@ export async function importServerConfigModule(inFile: string, logger?: Logger)
492
492
  }
493
493
  }
494
494
 
495
- export async function importJSXFile(inFile: string, logger?: Logger | Console): Promise<any> {
495
+ export interface ImportJSXFileOptions {
496
+ noBuild: boolean;
497
+ }
498
+
499
+ export async function importJSXFile(inFile: string, options: ImportJSXFileOptions, logger?: Logger | Console): Promise<any> {
500
+
501
+ if (options.noBuild) {
502
+ const module = await import(resolve(inFile));
503
+ return module;
504
+ }
505
+
506
+
496
507
  const inflatedCode = await inflateJSX(inFile, {
497
508
  // embemedJSX: false,
498
509
  minify: false,
@@ -23,9 +23,13 @@ export interface InflateAppOptions {
23
23
  port: string;
24
24
  serverInterface: ServerInterface;
25
25
  inflateParallel?: number;
26
+ noBuild?: boolean;
27
+ noMinify?: boolean;
28
+ inflateOnlyAssets?: boolean;
29
+ inflateFlat?: boolean;
26
30
  }
27
31
 
28
- export async function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services/*, dbManager*/, inflateDir, inflateSea/*, editor, inflateTests*/, port }: InflateAppOptions): Promise<[Router, InflateError[] | null, RouteFileMap, WSConfig[]/*, ServerConfigMap*/, LogConfigMap]> {
32
+ export async function inflateApp({ inflateParallel, serverInterface, logger, hotreload, services/*, dbManager*/, inflateDir, inflateSea/*, editor, inflateTests*/, port, noBuild, noMinify, inflateOnlyAssets, inflateFlat }: InflateAppOptions): Promise<[Router, InflateError[] | null, RouteFileMap, WSConfig[]/*, ServerConfigMap*/, LogConfigMap]> {
29
33
  logger.trace("inflateApp");
30
34
  const errors: InflateError[] = [];
31
35
  //const migrations: string[] = [];
@@ -68,17 +72,17 @@ export async function inflateApp({ inflateParallel, serverInterface, logger, hot
68
72
 
69
73
  //await setupDB(logger, service, dbConfigList, inflateDir);
70
74
 
71
- await setupLogConfig(logger, servicePath, service, logConfigMap, inflateSea ? inflateDir : false, errors);
75
+ await setupLogConfig(logger, servicePath, service, logConfigMap, inflateSea ? inflateDir : false, { noBuild }, errors);
72
76
 
73
- router.use(await setupHTTPRouter(serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors, inflateParallel));
77
+ router.use(await setupHTTPRouter({ noBuild }, { noMinify, inflateOnlyAssets, inflateFlat }, serverInterface, logger, hotreload ? hotreload : false, servicePath, service, serviceRouteFileMap, serviceStaticFileMap, inflateDir, inflateSea, errors, inflateParallel));
74
78
  routeFileMap = {
75
79
  ...routeFileMap,
76
80
  ...serviceRouteFileMap
77
81
  };
78
82
 
79
- await setupDoc(logger, servicePath, service, router, routeFileMap, serviceStaticFileMap, inflateDir, errors);
83
+ await setupDoc(logger, servicePath, service, router, routeFileMap, serviceStaticFileMap, inflateDir, errors, { noBuild }, inflateFlat);
80
84
 
81
- await inflateWSConfig(logger, servicePath, service, wsConfigList, inflateSea ? inflateDir : undefined, errors);
85
+ await inflateWSConfig(logger, servicePath, service, wsConfigList, inflateSea ? inflateDir : undefined, errors, { noBuild });
82
86
 
83
87
  //await setupServerConfig(logger, servicePath, service, serverConfigMap, inflateSea ? inflateDir : undefined, errors);
84
88
 
@@ -1,16 +1,16 @@
1
1
  import { Logger, Router, SessionHandler } from "@miqro/core";
2
- import { importAuthModule, InflateError, inflateJSX } from "../common/jsx.js";
2
+ import { importAuthModule, ImportJSXFileOptions, InflateError, inflateJSX } from "../common/jsx.js";
3
3
  import { getAuthConfigPath } from "../common/paths.js";
4
4
  import { basename, dirname, join, relative, resolve } from "node:path";
5
5
  import { mkdirSync, writeFileSync } from "node:fs";
6
6
  import { cwd } from "node:process";
7
7
 
8
- export async function setupAUTH(logger: Logger, servicePath: string, service: string, mainRouter: Router, inflateDir: string | undefined | false, inflateSea: boolean, errors: InflateError[]) {
8
+ export async function setupAUTH(logger: Logger, servicePath: string, service: string, mainRouter: Router, inflateDir: string | undefined | false, inflateSea: boolean, options: ImportJSXFileOptions, errors: InflateError[]) {
9
9
  const authPath = getAuthConfigPath(servicePath); //resolve(process.cwd(), service, "auth.ts");
10
10
 
11
11
  if (authPath) {
12
12
  try {
13
- const authModule = await importAuthModule(authPath, logger);
13
+ const authModule = await importAuthModule(authPath, options, logger);
14
14
  logger.debug("setting up authentication from [%s]", join(service, basename(authPath)));
15
15
  mainRouter.use(SessionHandler(authModule));
16
16
 
@@ -1,17 +1,18 @@
1
1
  import { mkdirSync, writeFileSync } from "node:fs";
2
- import { importCORSModule, InflateError, inflateJSX } from "../common/jsx.js";
2
+ import { importCORSModule, ImportJSXFileOptions, InflateError, inflateJSX } from "../common/jsx.js";
3
3
  import { getCORSConfigPath } from "../common/paths.js";
4
4
  import { CORS, Logger, Router } from "@miqro/core";
5
5
  import { basename, dirname, join, relative, resolve } from "node:path";
6
6
  import { cwd } from "node:process";
7
7
 
8
- export async function setupCORS(logger: Logger, servicePath: string, service: string, mainRouter: Router, inflateDir: string | undefined | false, inflateSea: boolean, errors: InflateError[]) {
8
+ export async function setupCORS(logger: Logger, servicePath: string, service: string, mainRouter: Router, inflateDir: string | undefined | false, inflateSea: boolean, options: ImportJSXFileOptions, errors: InflateError[]) {
9
9
  const corsPath = getCORSConfigPath(servicePath);
10
10
 
11
11
  if (corsPath) {
12
12
  try {
13
- const corsOptions = await importCORSModule(corsPath, logger);
14
13
  logger.debug("setting up cors from [%s]", join(service, basename(corsPath)));
14
+ const corsOptions = await importCORSModule(corsPath, options, logger);
15
+
15
16
  mainRouter.use(CORS(corsOptions));
16
17
 
17
18
  if (inflateDir && inflateSea) {