miqro 6.3.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/README.md +9 -17
  2. package/build/editor.bundle.js +11601 -10129
  3. package/build/esm/src/bin/types.js +10 -5
  4. package/build/esm/src/cluster.js +1 -1
  5. package/build/esm/src/common/arguments.d.ts +1 -1
  6. package/build/esm/src/common/arguments.js +28 -14
  7. package/build/esm/src/common/assets.d.ts +1 -1
  8. package/build/esm/src/common/assets.js +34 -13
  9. package/build/esm/src/common/esbuild.d.ts +4 -1
  10. package/build/esm/src/common/esbuild.js +31 -26
  11. package/build/esm/src/common/exit.js +4 -4
  12. package/build/esm/src/common/help.d.ts +1 -1
  13. package/build/esm/src/common/help.js +0 -1
  14. package/build/esm/src/common/jsx.d.ts +2 -3
  15. package/build/esm/src/common/jsx.js +70 -75
  16. package/build/esm/src/common/paths.d.ts +0 -1
  17. package/build/esm/src/common/paths.js +3 -3
  18. package/build/esm/src/common/watch.d.ts +0 -1
  19. package/build/esm/src/common/watch.js +1 -1
  20. package/build/esm/src/inflate/inflate-sea.js +35 -24
  21. package/build/esm/src/inflate/inflate.js +4 -4
  22. package/build/esm/src/inflate/setup-auth.js +1 -1
  23. package/build/esm/src/inflate/setup-cors.js +1 -1
  24. package/build/esm/src/inflate/setup-db.js +2 -2
  25. package/build/esm/src/inflate/setup-error.js +1 -1
  26. package/build/esm/src/inflate/setup-http.js +16 -16
  27. package/build/esm/src/inflate/setup-log.js +1 -1
  28. package/build/esm/src/inflate/setup-middleware.js +1 -1
  29. package/build/esm/src/inflate/setup-server-config.js +1 -1
  30. package/build/esm/src/inflate/setup-ws.js +1 -1
  31. package/build/esm/src/inflate/setup.doc.d.ts +2 -2
  32. package/build/esm/src/inflate/setup.doc.js +23 -2
  33. package/build/esm/src/inflate/utils/sea-utils.js +2 -2
  34. package/build/esm/src/lib.d.ts +10 -1
  35. package/build/esm/src/lib.js +16 -1
  36. package/build/esm/src/main.js +1 -1
  37. package/build/esm/src/services/app.js +3 -4
  38. package/build/esm/src/services/migrations.js +2 -2
  39. package/build/esm/src/services/utils/jwt.d.ts +2 -0
  40. package/build/esm/src/services/utils/jwt.js +23 -0
  41. package/build/esm/src/services/utils/middleware.d.ts +9 -0
  42. package/build/esm/src/services/utils/middleware.js +9 -0
  43. package/build/esm/src/services/utils/server-interface.js +33 -4
  44. package/build/esm/src/types.d.ts +50 -83
  45. package/build/lib.cjs +15684 -15612
  46. package/package.json +6 -8
  47. package/sea/basic-compile.base64.sh +1 -1
  48. package/sea/basic-compile.sh +1 -1
  49. package/sea/install-nodejs.sh +1 -1
  50. package/sea/node.version.tag +1 -1
  51. package/.eslintrc +0 -15
  52. package/build/esm/editor/auth.d.ts +0 -6
  53. package/build/esm/editor/auth.js +0 -41
  54. package/build/esm/editor/common/admin-interface.d.ts +0 -36
  55. package/build/esm/editor/common/admin-interface.js +0 -44
  56. package/build/esm/editor/common/constants.d.ts +0 -4
  57. package/build/esm/editor/common/constants.js +0 -20
  58. package/build/esm/editor/common/constants.server.d.ts +0 -2
  59. package/build/esm/editor/common/constants.server.js +0 -4
  60. package/build/esm/editor/common/editor-index.d.ts +0 -2
  61. package/build/esm/editor/common/editor-index.js +0 -14
  62. package/build/esm/editor/common/html-encode.d.ts +0 -1
  63. package/build/esm/editor/common/html-encode.js +0 -14
  64. package/build/esm/editor/common/log-socket.d.ts +0 -15
  65. package/build/esm/editor/common/log-socket.js +0 -70
  66. package/build/esm/editor/common/templates.d.ts +0 -11
  67. package/build/esm/editor/common/templates.js +0 -477
  68. package/build/esm/editor/components/api-preview.d.ts +0 -11
  69. package/build/esm/editor/components/api-preview.js +0 -90
  70. package/build/esm/editor/components/editor.d.ts +0 -16
  71. package/build/esm/editor/components/editor.js +0 -365
  72. package/build/esm/editor/components/file-browser.d.ts +0 -37
  73. package/build/esm/editor/components/file-browser.js +0 -126
  74. package/build/esm/editor/components/file-editor-toolbar.d.ts +0 -22
  75. package/build/esm/editor/components/file-editor-toolbar.js +0 -93
  76. package/build/esm/editor/components/file-editor.d.ts +0 -32
  77. package/build/esm/editor/components/file-editor.js +0 -59
  78. package/build/esm/editor/components/filter-query.d.ts +0 -1
  79. package/build/esm/editor/components/filter-query.js +0 -22
  80. package/build/esm/editor/components/highlight-text-area.d.ts +0 -11
  81. package/build/esm/editor/components/highlight-text-area.js +0 -125
  82. package/build/esm/editor/components/log-viewer.d.ts +0 -6
  83. package/build/esm/editor/components/log-viewer.js +0 -69
  84. package/build/esm/editor/components/new-file.d.ts +0 -10
  85. package/build/esm/editor/components/new-file.js +0 -117
  86. package/build/esm/editor/components/scroll-query.d.ts +0 -7
  87. package/build/esm/editor/components/scroll-query.js +0 -21
  88. package/build/esm/editor/components/start-page.d.ts +0 -13
  89. package/build/esm/editor/components/start-page.js +0 -30
  90. package/build/esm/editor/http/admin/editor/api/fs/delete.api.d.ts +0 -3
  91. package/build/esm/editor/http/admin/editor/api/fs/delete.api.js +0 -29
  92. package/build/esm/editor/http/admin/editor/api/fs/read.api.d.ts +0 -5
  93. package/build/esm/editor/http/admin/editor/api/fs/read.api.js +0 -49
  94. package/build/esm/editor/http/admin/editor/api/fs/rename.api.d.ts +0 -4
  95. package/build/esm/editor/http/admin/editor/api/fs/rename.api.js +0 -39
  96. package/build/esm/editor/http/admin/editor/api/fs/scan.api.d.ts +0 -26
  97. package/build/esm/editor/http/admin/editor/api/fs/scan.api.js +0 -149
  98. package/build/esm/editor/http/admin/editor/api/fs/write.api.d.ts +0 -3
  99. package/build/esm/editor/http/admin/editor/api/fs/write.api.js +0 -38
  100. package/build/esm/editor/http/admin/editor/api/server/reload.api.d.ts +0 -10
  101. package/build/esm/editor/http/admin/editor/api/server/reload.api.js +0 -46
  102. package/build/esm/editor/http/admin/editor/api/server/restart.api.d.ts +0 -10
  103. package/build/esm/editor/http/admin/editor/api/server/restart.api.js +0 -45
  104. package/build/esm/editor/http/admin/editor/editor.d.ts +0 -1
  105. package/build/esm/editor/http/admin/editor/editor.js +0 -7
  106. package/build/esm/editor/http/admin/editor/index.api.d.ts +0 -3
  107. package/build/esm/editor/http/admin/editor/index.api.js +0 -21
  108. package/build/esm/editor/server.d.ts +0 -3
  109. package/build/esm/editor/server.js +0 -49
  110. package/build/esm/editor/ws.d.ts +0 -3
  111. package/build/esm/editor/ws.js +0 -11
  112. package/build/esm/src/services/globals.d.ts +0 -3
  113. package/build/esm/src/services/globals.js +0 -182
  114. package/build/jsx.dom.js +0 -1587
  115. package/build/postject.base64.cjs +0 -1
  116. package/editor/auth.ts +0 -51
  117. package/editor/common/admin-interface.ts +0 -84
  118. package/editor/common/constants.server.ts +0 -5
  119. package/editor/common/constants.ts +0 -21
  120. package/editor/common/editor-index.tsx +0 -17
  121. package/editor/common/html-encode.ts +0 -14
  122. package/editor/common/log-socket.tsx +0 -85
  123. package/editor/common/templates.ts +0 -481
  124. package/editor/components/api-preview.tsx +0 -116
  125. package/editor/components/editor.tsx +0 -494
  126. package/editor/components/file-browser.tsx +0 -308
  127. package/editor/components/file-editor-toolbar.tsx +0 -191
  128. package/editor/components/file-editor.tsx +0 -122
  129. package/editor/components/filter-query.tsx +0 -22
  130. package/editor/components/highlight-text-area.tsx +0 -145
  131. package/editor/components/log-viewer.tsx +0 -110
  132. package/editor/components/new-file.tsx +0 -169
  133. package/editor/components/scroll-query.tsx +0 -22
  134. package/editor/components/start-page.tsx +0 -49
  135. package/editor/http/admin/editor/api/fs/delete.api.tsx +0 -32
  136. package/editor/http/admin/editor/api/fs/read.api.tsx +0 -55
  137. package/editor/http/admin/editor/api/fs/rename.api.tsx +0 -41
  138. package/editor/http/admin/editor/api/fs/scan.api.tsx +0 -181
  139. package/editor/http/admin/editor/api/fs/write.api.tsx +0 -41
  140. package/editor/http/admin/editor/api/server/reload.api.ts +0 -53
  141. package/editor/http/admin/editor/api/server/restart.api.tsx +0 -52
  142. package/editor/http/admin/editor/editor.tsx +0 -8
  143. package/editor/http/admin/editor/index.api.tsx +0 -39
  144. package/editor/server.ts +0 -57
  145. package/editor/ws.ts +0 -15
  146. package/sea/types.json +0 -1
  147. package/src/bin/compile.ts +0 -35
  148. package/src/bin/doc-md.ts +0 -210
  149. package/src/bin/generate-doc.ts +0 -64
  150. package/src/bin/test.ts +0 -92
  151. package/src/bin/types.ts +0 -29
  152. package/src/cluster.ts +0 -27
  153. package/src/common/arguments.ts +0 -745
  154. package/src/common/assets.ts +0 -128
  155. package/src/common/checksum.ts +0 -58
  156. package/src/common/constants.ts +0 -18
  157. package/src/common/content-type.ts +0 -84
  158. package/src/common/esbuild.ts +0 -94
  159. package/src/common/exit.ts +0 -91
  160. package/src/common/fs.ts +0 -82
  161. package/src/common/help.ts +0 -61
  162. package/src/common/jsx.ts +0 -547
  163. package/src/common/jwt.ts +0 -85
  164. package/src/common/paths.ts +0 -107
  165. package/src/common/watch.ts +0 -88
  166. package/src/inflate/inflate-sea.ts +0 -226
  167. package/src/inflate/inflate.ts +0 -101
  168. package/src/inflate/md.ts +0 -25
  169. package/src/inflate/setup-auth.ts +0 -41
  170. package/src/inflate/setup-cors.ts +0 -41
  171. package/src/inflate/setup-db.ts +0 -117
  172. package/src/inflate/setup-error.ts +0 -44
  173. package/src/inflate/setup-http.ts +0 -704
  174. package/src/inflate/setup-log.ts +0 -45
  175. package/src/inflate/setup-middleware.ts +0 -47
  176. package/src/inflate/setup-server-config.ts +0 -48
  177. package/src/inflate/setup-test.ts +0 -23
  178. package/src/inflate/setup-ws.ts +0 -50
  179. package/src/inflate/setup.doc.ts +0 -68
  180. package/src/inflate/utils/sea-utils.ts +0 -14
  181. package/src/lib.ts +0 -19
  182. package/src/main.ts +0 -101
  183. package/src/services/app.ts +0 -699
  184. package/src/services/editor.tsx +0 -101
  185. package/src/services/globals.ts +0 -186
  186. package/src/services/hot-reload.ts +0 -51
  187. package/src/services/migrations.ts +0 -68
  188. package/src/services/utils/admin-interface.ts +0 -37
  189. package/src/services/utils/cache.ts +0 -88
  190. package/src/services/utils/cluster-cache.ts +0 -230
  191. package/src/services/utils/cluster-ws.ts +0 -202
  192. package/src/services/utils/db-manager.ts +0 -92
  193. package/src/services/utils/get-route.ts +0 -70
  194. package/src/services/utils/log-transport.ts +0 -81
  195. package/src/services/utils/log.ts +0 -92
  196. package/src/services/utils/server-interface.ts +0 -92
  197. package/src/services/utils/websocketmanager.ts +0 -157
  198. package/src/types/@esbuild.d.ts +0 -1
  199. package/src/types/@miqro/core.d.ts +0 -2
  200. package/src/types/@miqro/jsx.d.ts +0 -2
  201. package/src/types/@miqro/parser.d.ts +0 -2
  202. package/src/types/@miqro/query.d.ts +0 -2
  203. package/src/types/@miqro/request.d.ts +0 -2
  204. package/src/types/@miqro/test.d.ts +0 -2
  205. package/src/types/@miqro.d.ts +0 -1
  206. package/src/types/@types.d.ts +0 -1
  207. package/src/types/browser.globals.d.ts +0 -1
  208. package/src/types/cookie.d.ts +0 -2
  209. package/src/types/globals.d.ts +0 -2
  210. package/src/types/jose.d.ts +0 -2
  211. package/src/types/jsx.globals.d.ts +0 -38
  212. package/src/types/miqro.d.ts +0 -228
  213. package/src/types/postject.d.ts +0 -1
  214. package/src/types/server.globals.d.ts +0 -47
  215. package/src/types.ts +0 -304
  216. package/tsconfig.json +0 -35
@@ -1,12 +1,17 @@
1
- import { initTypes } from "../common/assets.js";
1
+ // import { initTypes } from "../common/assets.js";
2
2
  import { existsSync, writeFileSync } from "node:fs";
3
3
  import { TEMPLATES } from "../../editor/common/templates.js";
4
4
  import { EXIT_CODES } from "../common/constants.js";
5
+ import { installAsset } from "../common/assets.js";
5
6
  export async function installTypings(args, logger) {
6
- if (args.installTypes) {
7
- logger.debug("writing types");
8
- // install typing for typescript only if argument --install-types is set
9
- await initTypes(logger);
7
+ /*if (args.installTypes) {
8
+ logger.debug("writing types");
9
+ // install typing for typescript only if argument --install-types is set
10
+ await initTypes(logger);
11
+ }*/
12
+ if (args.install) {
13
+ logger.debug("writing node_modules");
14
+ await installAsset(logger, ["node_modules/"]);
10
15
  }
11
16
  if (args.installTSConfig && !existsSync("tsconfig.json")) {
12
17
  logger.info("writing tsconfig.json");
@@ -10,7 +10,7 @@ const __package_dirname = import.meta.url ? resolve(dirname(fileURLToPath(import
10
10
  //const usage = "CLUSTER_COUNT=os.cpus().length [CLUSTER_AUTO_BROADCAST=true|false] [CLUSTER_DISABLE_RESTART=true|false]";
11
11
  const CLUSTER_COUNT = checkEnvVariable("CLUSTER_COUNT", String(cpus().length));
12
12
  const args = parseArguments();
13
- if (args.inflate || args.test || args.compile || args.installTSConfig || args.installTypes || args.migrateDown || args.migrateUp) {
13
+ if (args.inflate || args.test || args.compile || args.installTSConfig /* || args.installTypes */ || args.migrateDown || args.migrateUp) {
14
14
  await import("./main.js");
15
15
  }
16
16
  else {
@@ -18,9 +18,9 @@ export interface Arguments {
18
18
  name?: string;
19
19
  browser?: string | boolean;
20
20
  logFile?: string | boolean;
21
- installTypes: boolean;
22
21
  installMiqroJSON: boolean;
23
22
  installTSConfig: boolean;
23
+ install: boolean;
24
24
  test: boolean;
25
25
  port: string;
26
26
  inflate: boolean;
@@ -59,8 +59,9 @@ export function parseArguments() {
59
59
  watch: null,
60
60
  miqroJSONPath: null,
61
61
  installMiqroJSON: null,
62
+ install: null,
62
63
  disableMiqroJSON: null,
63
- installTypes: null,
64
+ // installTypes: null,
64
65
  port: null,
65
66
  installTSConfig: null,
66
67
  migrateUp: null,
@@ -133,6 +134,14 @@ export function parseArguments() {
133
134
  }
134
135
  flags.installTSConfig = true;
135
136
  continue;
137
+ case "--install":
138
+ if (flags.inflate !== null || flags.installTSConfig !== null) {
139
+ console.error("bad arguments.");
140
+ console.error(usage);
141
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
142
+ }
143
+ flags.install = true;
144
+ continue;
136
145
  case "--watch":
137
146
  if (flags.watch !== null) {
138
147
  console.error("bad arguments.");
@@ -328,14 +337,14 @@ export function parseArguments() {
328
337
  flags.inflateSEA = true;
329
338
  flags.inflate = true;
330
339
  continue;
331
- case "--install-types":
332
- if (flags.inflate !== null || flags.installTypes !== null) {
333
- console.error("bad arguments.");
334
- console.error(usage);
335
- process.exit(EXIT_CODES.BAD_ARGUMENTS);
336
- }
337
- flags.installTypes = true;
338
- continue;
340
+ /*case "--install-types":
341
+ if (flags.inflate !== null || flags.installTypes !== null) {
342
+ console.error("bad arguments.");
343
+ console.error(usage);
344
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
345
+ }
346
+ flags.installTypes = true;
347
+ continue;*/
339
348
  case "--editor":
340
349
  if (flags.editor !== null) {
341
350
  console.error("bad arguments.");
@@ -531,7 +540,7 @@ export function parseArguments() {
531
540
  }
532
541
  }
533
542
  flags.editor = flags.editor ? flags.editor : false;
534
- if (services.length === 0 && (!flags.installTSConfig && !flags.installTypes && !flags.installMiqroJSON)) {
543
+ if (services.length === 0 && (!flags.installTSConfig /* && !flags.installTypes*/ && !flags.installMiqroJSON)) {
535
544
  flags.inflateDir = flags.inflateDir ? flags.inflateDir : undefined;
536
545
  console.error(`bad arguments. missing --service argument`);
537
546
  console.error(usage);
@@ -557,19 +566,23 @@ export function parseArguments() {
557
566
  console.error("for ts");
558
567
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
559
568
  }
569
+ if (flags.install && flags.inflate) {
570
+ console.error("bad arguments. cannot use --install with --inflate");
571
+ process.exit(EXIT_CODES.BAD_ARGUMENTS);
572
+ }
560
573
  if (flags.inflate && flags.editor) {
561
574
  console.error("bad arguments. cannot use --inflate with --editor");
562
575
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
563
576
  }
564
- if (flags.inflate && (flags.installTypes || flags.installTSConfig || flags.installMiqroJSON)) {
565
- console.error("bad arguments. cannot use --inflate with --install-types, --install-tsconfig or --install-miqrojson");
577
+ if (flags.inflate && ( /*flags.installTypes || */flags.installTSConfig || flags.installMiqroJSON || flags.install)) {
578
+ console.error("bad arguments. cannot use --inflate with --install, --install-tsconfig or --install-miqrojson");
566
579
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
567
580
  }
568
581
  if (flags.inflateSEA && !flags.inflate) {
569
582
  console.error("bad arguments. cannot use --inflate-sea without --inflate");
570
583
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
571
584
  }
572
- if (flags.editor && (flags.installTypes || flags.installTSConfig || flags.installMiqroJSON)) {
585
+ if (flags.editor && ( /*flags.installTypes || */flags.installTSConfig || flags.installMiqroJSON)) {
573
586
  console.error("bad arguments. cannot use --editor with--install-types, --install-tsconfig or --install-miqrojson");
574
587
  process.exit(EXIT_CODES.BAD_ARGUMENTS);
575
588
  }
@@ -616,9 +629,10 @@ export function parseArguments() {
616
629
  watch: flags.watch ? true : false,
617
630
  disableMiqroJSON: flags.disableMiqroJSON !== null ? flags.disableMiqroJSON : false,
618
631
  miqroJSONPath: miqroJSONPath ? miqroJSONPath : false,
619
- installTypes: flags.installTypes ? true : false,
632
+ // installTypes: flags.installTypes ? true : false,
620
633
  installMiqroJSON: flags.installMiqroJSON ? true : false,
621
634
  installTSConfig: flags.installTSConfig ? true : false,
635
+ install: flags.install,
622
636
  inflate: flags.inflate,
623
637
  port: flags.port ? flags.port : getPORT(),
624
638
  migrateUp: flags.migrateUp ? true : false,
@@ -7,6 +7,6 @@ export declare function getVersion(): {
7
7
  ESBUILD_VERSION: string;
8
8
  };
9
9
  export declare function initAssets(logger: Logger): Promise<void>;
10
- export declare function initTypes(logger: MinimalLogger): Promise<void>;
10
+ export declare function installAsset(logger: MinimalLogger, include: string[]): Promise<void>;
11
11
  export declare function validateAsset(logger: MinimalLogger | undefined, path: string, internalChecksum: string): Promise<boolean>;
12
12
  export declare function initAsset(logger: MinimalLogger, path: string, buffer: Buffer, executable?: boolean, checksum?: Promise<string>, logInstallasInfo?: boolean): Promise<void>;
@@ -1,11 +1,12 @@
1
- import { chmodSync, constants, existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
1
+ import { chmodSync, constants, existsSync, mkdirSync, readFileSync, statSync } from "node:fs";
2
2
  import { getAsset as seaGetAsset, isSea } from "node:sea";
3
- import { dirname, resolve } from "node:path";
3
+ import { dirname, join, resolve } from "node:path";
4
4
  import { calculateChecksum, calculateChecksumFromBuffer } from "./checksum.js";
5
5
  import { arch, cwd, platform } from "node:process";
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { initESBuild } from "./esbuild.js";
8
- import { initJSXJS } from "./jsx.js";
8
+ import { mkdirASync, unlinkASync, writeFileASync } from "./fs.js";
9
+ // import { initJSXJS } from "./jsx.js";
9
10
  //const require = createRequire(import.meta.url);
10
11
  export const __package_dirname = import.meta.url ? resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..", "..") : null;
11
12
  const ASSETS_ROUTER = {
@@ -13,7 +14,7 @@ const ASSETS_ROUTER = {
13
14
  "version.tag": "sea/version.tag",
14
15
  "node.version.tag": "sea/node.version.tag",
15
16
  "esbuild.version.tag": "sea/esbuild.version.tag",
16
- "postject.base64.cjs": "build/postject.base64.cjs",
17
+ // "postject.base64.cjs": "build/postject.base64.cjs",
17
18
  "sea.basic.config.json": "sea/basic-config.json",
18
19
  "node.sh": "sea/node.sh",
19
20
  "install-nodejs.sh": "sea/install-nodejs.sh",
@@ -21,8 +22,9 @@ const ASSETS_ROUTER = {
21
22
  "sign-remove.sh": "sea/sign-remove.sh",
22
23
  "sign-add.sh": "sea/sign-add.sh",
23
24
  "app.sh": "sea/app.sh",
24
- "jsx.dom.js": "build/jsx.dom.js",
25
- "types.json": "sea/types.json",
25
+ // "jsx.dom.js": "build/jsx.dom.js",
26
+ // "types.json": "sea/types.json",
27
+ "assets.base64.json": "sea/assets.base64.json",
26
28
  "editor-assets/editor.bundle.js": "build/editor.bundle.js",
27
29
  "editor-assets/style.css": "build/style.css",
28
30
  "editor-assets/font.ttf": "build/font.ttf"
@@ -68,11 +70,25 @@ export async function initAssets(logger) {
68
70
  logger.debug("esbuild version [%s]", ESBUILD_VERSION);
69
71
  }
70
72
  logger.debug("platform [%s-%s]", platform, arch);
71
- await Promise.all([initJSXJS(logger), initESBuild(logger)]);
73
+ // await Promise.all([initJSXJS(logger), initESBuild(logger)]);
74
+ await Promise.all([initESBuild(logger)]);
72
75
  }
73
- export async function initTypes(logger) {
74
- const typesJSON = JSON.parse(Buffer.from(getAsset("types.json")).toString("utf-8"));
75
- await Promise.all(Object.keys(typesJSON).map(typeFile => initAsset(logger, resolve(cwd(), "." + typeFile), Buffer.from(typesJSON[typeFile], "base64"))));
76
+ /*export async function initTypes(logger: MinimalLogger) {
77
+ const typesJSON = JSON.parse(Buffer.from(getAsset("types.json")).toString("utf-8"));
78
+ await Promise.all(Object.keys(typesJSON).map(typeFile =>
79
+ initAsset(logger, resolve(cwd(), "." + typeFile), Buffer.from(typesJSON[typeFile], "base64"))
80
+ ));
81
+ }*/
82
+ export async function installAsset(logger, include) {
83
+ const assetsJSON = JSON.parse(Buffer.from(getAsset("assets.base64.json")).toString("utf-8"));
84
+ await Promise.all(assetsJSON.map(asset => {
85
+ for (const i of include) {
86
+ if (asset.path.indexOf(i) === 0) {
87
+ return initAsset(logger, join(cwd(), asset.path), Buffer.from(asset.content, "base64"));
88
+ }
89
+ }
90
+ return Promise.resolve();
91
+ }));
76
92
  }
77
93
  export async function validateAsset(logger, path, internalChecksum) {
78
94
  mkdirSync(dirname(path), {
@@ -101,8 +117,13 @@ export async function initAsset(logger, path, buffer, executable, checksum, logI
101
117
  if (existsSync(path)) {
102
118
  if (!valid) {
103
119
  logger.info("updating [%s]", path);
104
- unlinkSync(path);
105
- writeFileSync(path, buffer);
120
+ await unlinkASync(path);
121
+ if (!statSync(dirname(path)).isDirectory()) {
122
+ await mkdirASync(dirname(path), {
123
+ recursive: true
124
+ });
125
+ }
126
+ await writeFileASync(path, buffer);
106
127
  if (executable) {
107
128
  chmodSync(path, constants.S_IXUSR | constants.S_IRUSR | constants.S_IWUSR);
108
129
  }
@@ -115,7 +136,7 @@ export async function initAsset(logger, path, buffer, executable, checksum, logI
115
136
  else {
116
137
  logger.info("installing [%s]", path);
117
138
  }
118
- writeFileSync(path, buffer);
139
+ await writeFileASync(path, buffer);
119
140
  if (executable) {
120
141
  chmodSync(path, constants.S_IXUSR | constants.S_IRUSR | constants.S_IWUSR);
121
142
  }
@@ -1,14 +1,17 @@
1
1
  import { Logger } from "@miqro/core";
2
2
  export declare function validateESBuild(logger?: Logger): Promise<boolean>;
3
3
  export declare function initESBuild(logger: Logger): Promise<void>;
4
+ export declare const NODEJS_EXTERNAL: string[];
4
5
  export declare function esBuild(options: {
5
- platform?: string;
6
+ platform?: string | false;
6
7
  entryPoints: [string];
8
+ mainFields?: string;
7
9
  bundle?: boolean;
8
10
  jsxFactory?: string;
9
11
  jsxFragment?: string;
10
12
  minify?: boolean;
11
13
  outfile?: string;
14
+ external?: string[];
12
15
  }, logger?: Logger): Promise<{
13
16
  outputFiles: {
14
17
  path: string;
@@ -13,39 +13,44 @@ export async function initESBuild(logger) {
13
13
  esbuildBinaryChecksumPromise = esbuildBinaryChecksumPromise ? esbuildBinaryChecksumPromise : calculateChecksumFromBuffer(esbuildBinaryBuffer);
14
14
  return initAsset(logger, getESBuildBinaryPath(), esbuildBinaryBuffer, true, esbuildBinaryChecksumPromise, false);
15
15
  }
16
- const NODEJS_EXTERNAL = [
17
- "node:cluster",
18
- "node:assert",
19
- "node:util",
20
- "node:path",
21
- "node:fs",
22
- "node:crypto",
23
- "node:http",
24
- "node:https",
25
- "node:os",
26
- "node:dns",
27
- "node:string_decoder",
28
- "node:stream",
29
- "node:http2",
30
- "node:net",
31
- "node:worker_threads",
32
- "node:process",
33
- "child_process",
34
- "node:child_process",
35
- "core",
36
- "globals",
37
- "jsx.globals",
38
- "server.globals",
39
- "browser.globals",
16
+ /*const NODEJS_EXTERNAL = [
17
+ "node:cluster",
18
+ "node:assert",
19
+ "node:util",
20
+ "node:path",
21
+ "node:fs",
22
+ "node:crypto",
23
+ "node:http",
24
+ "node:https",
25
+ "node:os",
26
+ "node:dns",
27
+ "node:string_decoder",
28
+ "node:stream",
29
+ "node:http2",
30
+ "node:net",
31
+ "node:worker_threads",
32
+ "node:process",
33
+ "child_process",
34
+ "node:child_process",
35
+ "core",
36
+ "globals",
37
+ "jsx.globals",
38
+ "server.globals",
39
+ "browser.globals",
40
+ "sqlite3",
41
+ "pg"
42
+ ];*/
43
+ export const NODEJS_EXTERNAL = [
40
44
  "sqlite3",
41
- "pg"
45
+ "pg",
46
+ "node:*"
42
47
  ];
43
48
  export async function esBuild(options, logger) {
44
49
  return new Promise(async (resolve, reject) => {
45
50
  try {
46
51
  //const logger = getLogger(`${SERVER_IDENTIFIER}_ESBUILD`);
47
52
  const valid = await validateESBuild(logger);
48
- const esBuildCMD = `${getESBuildBinaryPath()} "${options.entryPoints[0]}" ${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}` : ""}`;
53
+ 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}` : ""}`;
49
54
  logger?.trace(esBuildCMD);
50
55
  if (!valid) {
51
56
  const err = new Error(`esbuild installation at [${getESBuildBinaryPath()}] tampered`);
@@ -1,6 +1,6 @@
1
1
  import { existsSync, rmdirSync, unlinkSync } from "node:fs";
2
2
  //import { notifiyServerStop, notifiyServerUnLoad } from "../services/server.js";
3
- import { getESBuildBinaryPath, getJSXJSPath, JSX_TMP_DIR } from "./paths.js";
3
+ import { getESBuildBinaryPath /*, getJSXJSPath*/, JSX_TMP_DIR } from "./paths.js";
4
4
  import { CLEAR_JSX_CACHE } from "./constants.js";
5
5
  import { resolve } from "node:path";
6
6
  import { EXIT_CODES } from "./constants.js";
@@ -10,10 +10,10 @@ function cleanJSX(app) {
10
10
  unlinkSync(getESBuildBinaryPath());
11
11
  }
12
12
  if (CLEAR_JSX_CACHE) {
13
- app.logger?.trace("trying to clean up jsx.js installation at [%s]", getJSXJSPath());
13
+ /*app.logger?.trace("trying to clean up jsx.js installation at [%s]", getJSXJSPath());
14
14
  if (existsSync(getJSXJSPath())) {
15
- unlinkSync(getJSXJSPath());
16
- }
15
+ unlinkSync(getJSXJSPath());
16
+ }*/
17
17
  const buildParendDir = resolve(JSX_TMP_DIR, String(process.pid));
18
18
  app.logger?.trace("trying to clean up jsx build/import folders at [%s]", buildParendDir);
19
19
  const buildDir = resolve(buildParendDir, "build");
@@ -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\n\toutputs the version number\n-h, --help\n\toutputs this page.\n--watch\n\tuse to auto reload the server when files change.\n--hot-reload\n\tenables the hot-reload functionality use with --watch.\n--test\n\trun the tests for a service.\n--migrate-up\n\tmigrations up.\n--migrate-down\n\tmigrations down.\n--inflate\n\tinflates the application.\n--inflate-dir\n\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\n\truns the application with a built-in editor.\n--generate-doc\n\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\n\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\n\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\n\toutputs all the server routes in the documentation output.\n--compile\n\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\n\tinflates the application with sea compilation scripts.\n--install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.\n--install-types\n\tcreates and updates the .types/ folder use together with --install-tsconfig.\n--install-miqrojson\n\tcreates a default miqro.json file.\n--disable-miqrojson\n\tdisables the load of miqro.json file.\n--log-file\n\toverrides the default log file from LOG_FILE.\n--browser\n\toverrides the default browser from BROWSER.\n--config\n\toverrides the default miqro.json path.\n--port\n\toverrides the default port from PORT.\n--name\n\toverrides the default name of the server.\n--https\n\tserves the server in https instead of http\n--https-key\n\tpoint to a server.key file for https.\n--https-cert\n\tpoint to a server.cert file for https.\n--https-redirect\n\tserves an aditional http server that redirects to https. it needs a port number.\n--inflate-parallel\n\tsets the max parallel esbuild instances. defaults to 1.\n\n==environment variables==\n\nPORT\n\toverride the default 8080 port.\nBROWSER\n\toverride the default browser. change to none to disable.\".\nLOG_FILE\n\toverride the default ./server.log file\nDB\n\tenable the server.db features\nDB_STORAGE\n\toverride the default local db location ./db.sqlite3\nDB_DIALECT\n\toverride the default node:sqlite\nDB_CONNECTION\n\toverride the default connection url\nCLEAR_JSX_CACHE\n\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\n\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
3
+ export declare const help = "\n==flags==\n\n-v, --version\n\toutputs the version number\n-h, --help\n\toutputs this page.\n--watch\n\tuse to auto reload the server when files change.\n--hot-reload\n\tenables the hot-reload functionality use with --watch.\n--test\n\trun the tests for a service.\n--migrate-up\n\tmigrations up.\n--migrate-down\n\tmigrations down.\n--inflate\n\tinflates the application.\n--inflate-dir\n\tto set the output directory of the --inflate command. default value is inflated/.\n--editor\n\truns the application with a built-in editor.\n--generate-doc\n\tgenerates a documentation for the api endpoints of the service.\n--generate-doc-out\n\tthe output file for the generated documentation. default value is API.md.\n--generate-doc-type\n\tthe format of the generated documentation. it can be JSON or MD. default value is MD.\n--generate-doc-all\n\toutputs all the server routes in the documentation output.\n--compile\n\tinflates the application and tries to create a NODE SEA binary.\n--inflate-sea\n\tinflates the application with sea compilation scripts.\n--install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.\n--install-miqrojson\n\tcreates a default miqro.json file.\n--disable-miqrojson\n\tdisables the load of miqro.json file.\n--log-file\n\toverrides the default log file from LOG_FILE.\n--browser\n\toverrides the default browser from BROWSER.\n--config\n\toverrides the default miqro.json path.\n--port\n\toverrides the default port from PORT.\n--name\n\toverrides the default name of the server.\n--https\n\tserves the server in https instead of http\n--https-key\n\tpoint to a server.key file for https.\n--https-cert\n\tpoint to a server.cert file for https.\n--https-redirect\n\tserves an aditional http server that redirects to https. it needs a port number.\n--inflate-parallel\n\tsets the max parallel esbuild instances. defaults to 1.\n\n==environment variables==\n\nPORT\n\toverride the default 8080 port.\nBROWSER\n\toverride the default browser. change to none to disable.\".\nLOG_FILE\n\toverride the default ./server.log file\nDB\n\tenable the server.db features\nDB_STORAGE\n\toverride the default local db location ./db.sqlite3\nDB_DIALECT\n\toverride the default node:sqlite\nDB_CONNECTION\n\toverride the default connection url\nCLEAR_JSX_CACHE\n\tset to 1 or 0 to enable or disable the clearing of the esbuild cache defaults to 1.\nJSX_TMP\n\tset custom location of esbuild builds defaults to /tmp/jsx_tmp.\n";
@@ -30,7 +30,6 @@ export const help = `
30
30
  --compile\n\tinflates the application and tries to create a NODE SEA binary.
31
31
  --inflate-sea\n\tinflates the application with sea compilation scripts.
32
32
  --install-tsconfig\n\tcreates a tsconfig.json configured to use with --install-types.
33
- --install-types\n\tcreates and updates the .types/ folder use together with --install-tsconfig.
34
33
  --install-miqrojson\n\tcreates a default miqro.json file.
35
34
  --disable-miqrojson\n\tdisables the load of miqro.json file.
36
35
  --log-file\n\toverrides the default log file from LOG_FILE.
@@ -3,8 +3,6 @@ import { Request, Response, CORSOptions, Logger, APIRoute } from "@miqro/core";
3
3
  import { Schema } from "@miqro/parser";
4
4
  import { APIOptions, ServerConfig, WSConfig, AuthConfig, DBConfig, LogConfig, MiddlewareConfig, ErrorConfig, DocConfig } from "../types.js";
5
5
  import { Migration } from "@miqro/query";
6
- export declare function initJSXJS(logger: Logger): Promise<void>;
7
- export declare function validateJSXJS(logger: Logger): Promise<boolean>;
8
6
  export interface Dict<T> {
9
7
  [key: string]: T | Dict<T>;
10
8
  }
@@ -13,10 +11,11 @@ export interface InflateError {
13
11
  error: Error;
14
12
  }
15
13
  export interface InflateOptions {
16
- embemedJSX: boolean;
17
14
  minify: boolean;
18
15
  useExport: boolean;
19
16
  platform?: string;
17
+ mainFields?: string;
18
+ external?: string[];
20
19
  logger?: Logger | Console;
21
20
  }
22
21
  export declare function inflateJSX(inFile: string, options: InflateOptions): Promise<string>;
@@ -5,99 +5,93 @@ import { Parser } from "@miqro/parser";
5
5
  import { APIRouteSchema, SessionHandlerOptionsSchema } from "@miqro/core";
6
6
  import { cwd } from "node:process";
7
7
  import { esBuild } from "./esbuild.js";
8
- import { assertGlobalTampered, browserJSXGlobals } from "../services/globals.js";
9
- import { getJSXJSPath, JSX_TMP_DIR } from "./paths.js";
8
+ import { JSX_TMP_DIR } from "./paths.js";
10
9
  import { CLEAR_JSX_CACHE } from "./constants.js";
11
- import { getAsset, initAsset, validateAsset } from "./assets.js";
12
- import { calculateChecksumFromBuffer } from "./checksum.js";
13
10
  import { HandlerWithOptionsSchema, RouteOptionsSchema } from "@miqro/core/build/types.js";
14
11
  import { mkdirASync, rmdirASync, unlinkASync, writeFileASync } from "./fs.js";
15
12
  let jsxJSBuffer = null; // Buffer.from(getAsset("jsx.dom.js"));
16
13
  let jsxJSBufferChecksumPromise = null; // calculateChecksumFromBuffer(jsxJSBuffer);
17
- export async function initJSXJS(logger) {
18
- jsxJSBuffer = jsxJSBuffer ? jsxJSBuffer : Buffer.from(getAsset("jsx.dom.js"));
19
- jsxJSBufferChecksumPromise = jsxJSBufferChecksumPromise ? jsxJSBufferChecksumPromise : calculateChecksumFromBuffer(jsxJSBuffer);
20
- return initAsset(logger, getJSXJSPath(), jsxJSBuffer, true, jsxJSBufferChecksumPromise, false);
21
- }
22
- export async function validateJSXJS(logger) {
23
- const checksum = await jsxJSBufferChecksumPromise;
24
- if (!checksum) {
25
- throw new Error("error calculating checksum");
26
- }
27
- return validateAsset(logger, getJSXJSPath(), checksum);
28
- }
29
14
  const parser = new Parser();
30
15
  const DEFAULT_ESOPTION = {
31
16
  platform: "neutral",
17
+ mainFields: "module,main",
18
+ // platform: "node",
32
19
  bundle: true,
33
20
  jsxFactory: "JSX.createElement",
34
21
  jsxFragment: "JSX.Fragment"
35
22
  };
23
+ function JSXTemplate(inFile /*, jsxPath: string | false = false*/, useExport = true) {
24
+ // const PRE = ``;
25
+ // return `${jsxPath ? PRE : ""}\n${useExport ? `export * from "${inFile}";import * as lib from "${inFile}";export default lib.default;` : `import * as lib from "${inFile}"`}`;
26
+ return `${useExport ? `export * from "${inFile}";import * as lib from "${inFile}";export default lib.default;` : `import * as lib from "${inFile}"`}`;
27
+ }
36
28
  export async function inflateJSX(inFile, options) {
37
29
  const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "build", Date.now() + "-" + randomUUID());
38
30
  const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
39
- const jsxJSPath = getJSXJSPath(); //resolve(tmpBuildDir, "jsx.js");
31
+ //const jsxJSPath = getJSXJSPath();//resolve(tmpBuildDir, "jsx.js");
40
32
  const logger = options.logger; //getLogger(`${SERVER_IDENTIFIER}_JSX`);
41
33
  try {
42
- if (!options.embemedJSX) {
43
- await mkdirASync(tmpBuildDir, {
44
- recursive: true
45
- });
46
- await writeFileASync(inFileTmp, browserJSXGlobals(inFile, false, options.useExport));
47
- //await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), false));
48
- logger?.trace("inflating [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
49
- const { outputFiles: [{ contents }] } = await esBuild({
50
- ...DEFAULT_ESOPTION,
51
- entryPoints: [inFileTmp],
52
- minify: options.minify,
53
- platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
54
- });
55
- if (CLEAR_JSX_CACHE) {
56
- logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
57
- await unlinkASync(inFileTmp);
58
- await rmdirASync(tmpBuildDir);
59
- }
60
- return contents;
61
- }
62
- else {
63
- await mkdirASync(tmpBuildDir, {
64
- recursive: true
65
- });
66
- //await writeFileASync(jsxJSPath, Buffer.from(getAsset("jsx-dom-bundle")));
67
- await writeFileASync(inFileTmp, browserJSXGlobals(inFile, jsxJSPath));
68
- //await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), relative(tmpBuildDir, jsxJSPath)));
69
- logger?.trace("inflating [%s] from [%s] with jsx.js embedded. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
70
- const { outputFiles: [{ contents }] } = await esBuild({
71
- ...DEFAULT_ESOPTION,
72
- entryPoints: [inFileTmp],
73
- minify: options.minify,
74
- platform: options.platform ? options.platform : DEFAULT_ESOPTION.platform
75
- });
76
- if (CLEAR_JSX_CACHE) {
77
- logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
78
- await unlinkASync(inFileTmp);
79
- //await unlinkASync(jsxJSPath);
80
- await rmdirASync(tmpBuildDir);
81
- }
82
- return contents;
34
+ // if (!options.embemedJSX) {
35
+ await mkdirASync(tmpBuildDir, {
36
+ recursive: true
37
+ });
38
+ await writeFileASync(inFileTmp, JSXTemplate(inFile /*, false*/, options.useExport));
39
+ //await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), false));
40
+ logger?.trace("inflating [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
41
+ const { outputFiles: [{ contents }] } = await esBuild({
42
+ ...DEFAULT_ESOPTION,
43
+ entryPoints: [inFileTmp],
44
+ minify: options.minify,
45
+ platform: options.platform !== undefined ? options.platform : DEFAULT_ESOPTION.platform,
46
+ mainFields: options.mainFields !== undefined ? options.mainFields : DEFAULT_ESOPTION.mainFields,
47
+ external: options.external ? options.external : undefined,
48
+ });
49
+ if (CLEAR_JSX_CACHE) {
50
+ logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
51
+ await unlinkASync(inFileTmp);
52
+ await rmdirASync(tmpBuildDir);
83
53
  }
54
+ return contents;
55
+ /*} else {
56
+ await mkdirASync(tmpBuildDir, {
57
+ recursive: true
58
+ });
59
+ //await writeFileASync(jsxJSPath, Buffer.from(getAsset("jsx-dom-bundle")));
60
+ await writeFileASync(inFileTmp, browserJSXGlobals(inFile, false));
61
+ //await writeFileASync(inFileTmp, browserJSXGlobals(relative(tmpBuildDir, inFile), relative(tmpBuildDir, jsxJSPath)));
62
+ logger?.trace("inflating [%s] from [%s] with jsx.js embedded. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
63
+ const { outputFiles: [{ contents }] } = await esBuild({
64
+ ...DEFAULT_ESOPTION,
65
+ entryPoints: [inFileTmp],
66
+ minify: options.minify,
67
+ platform: options.platform !== undefined ? options.platform : DEFAULT_ESOPTION.platform,
68
+ mainFields: options.mainFields !== undefined ? options.mainFields : DEFAULT_ESOPTION.mainFields,
69
+ external: options.external ? options.external : undefined
70
+ });
71
+ if (CLEAR_JSX_CACHE) {
72
+ logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
73
+ await unlinkASync(inFileTmp);
74
+ //await unlinkASync(jsxJSPath);
75
+ await rmdirASync(tmpBuildDir);
76
+ }
77
+ return contents;
78
+ }*/
84
79
  }
85
80
  catch (e) {
86
81
  logger?.error("error with: " + inFile);
87
82
  logger?.error(e);
88
- if (options.embemedJSX) {
89
- if (CLEAR_JSX_CACHE) {
90
- logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
91
- await unlinkASync(inFileTmp);
92
- //await unlinkASync(jsxJSPath);
93
- await rmdirASync(tmpBuildDir);
94
- }
95
- else {
96
- //console.error("errors on: " + tmpBuildDir);
97
- logger?.error("error with: %s", inFileTmp);
98
- logger?.trace("NOT clearing cache. to change this behaivor set CLEAR_JSX_CACHE to 1", tmpBuildDir);
99
- }
100
- }
83
+ /*if (options.embemedJSX) {
84
+ if (CLEAR_JSX_CACHE) {
85
+ logger?.trace("clearing cache at [%s] to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
86
+ await unlinkASync(inFileTmp);
87
+ //await unlinkASync(jsxJSPath);
88
+ await rmdirASync(tmpBuildDir);
89
+ } else {
90
+ //console.error("errors on: " + tmpBuildDir);
91
+ logger?.error("error with: %s", inFileTmp);
92
+ logger?.trace("NOT clearing cache. to change this behaivor set CLEAR_JSX_CACHE to 1", tmpBuildDir);
93
+ }
94
+ }*/
101
95
  throw e;
102
96
  }
103
97
  }
@@ -417,14 +411,14 @@ export async function importServerConfigModule(inFile, logger) {
417
411
  }
418
412
  export async function importJSXFile(inFile, logger) {
419
413
  const inflatedCode = await inflateJSX(inFile, {
420
- embemedJSX: false,
414
+ // embemedJSX: false,
421
415
  minify: false,
422
416
  useExport: true,
423
417
  platform: "node",
424
418
  logger
425
419
  });
426
420
  const tmpBuildDir = resolve(JSX_TMP_DIR, String(process.pid), "import", Date.now() + "-" + randomUUID());
427
- //const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
421
+ // const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".mjs");
428
422
  const inFileTmp = resolve(tmpBuildDir, basename(inFile) + ".cjs");
429
423
  //const logger = getLogger(`${SERVER_IDENTIFIER}_JSX`);
430
424
  await mkdirASync(tmpBuildDir, {
@@ -432,11 +426,12 @@ export async function importJSXFile(inFile, logger) {
432
426
  });
433
427
  try {
434
428
  await writeFileASync(inFileTmp, inflatedCode);
435
- assertGlobalTampered();
429
+ // assertGlobalTampered();
436
430
  logger?.trace("importing [%s] from [%s]. to change the import folder set JSX_TMP", relative(cwd(), inFile), dirname(relative(JSX_TMP_DIR, inFileTmp)));
437
431
  logger?.debug("importing [%s]", relative(cwd(), inFile));
438
432
  const module = await import(resolve(inFileTmp));
439
- assertGlobalTampered();
433
+ // console.dir(module);
434
+ // assertGlobalTampered();
440
435
  if (CLEAR_JSX_CACHE) {
441
436
  logger?.trace("clearing cache at [%s]. to change this behaivor set CLEAR_JSX_CACHE to 0", tmpBuildDir);
442
437
  await unlinkASync(inFileTmp);
@@ -15,4 +15,3 @@ export declare function getAuthConfigPath(servicePath: string): string | false;
15
15
  export declare function getHTTPRouterPath(servicePath: string): string | false;
16
16
  export declare function getMigrationsPath(servicePath: string): string | false;
17
17
  export declare function getESBuildBinaryPath(): string;
18
- export declare function getJSXJSPath(): string;
@@ -82,6 +82,6 @@ export function getESBuildBinaryPath() {
82
82
  return resolve(JSX_TMP_DIR, String(process.pid), "esbuild");
83
83
  }
84
84
  }
85
- export function getJSXJSPath() {
86
- return resolve(JSX_TMP_DIR, String(process.pid), "jsx.js");
87
- }
85
+ /*export function getJSXJSPath() {
86
+ return resolve(JSX_TMP_DIR, String(process.pid), "jsx.js");
87
+ }*/
@@ -1,4 +1,3 @@
1
- import "../services/globals.js";
2
1
  import { Miqro } from "../services/app.js";
3
2
  export declare function watchAndServer(app: Miqro): Promise<{
4
3
  stopWatch: () => void;
@@ -1,4 +1,4 @@
1
- import "../services/globals.js";
1
+ //import "../services/globals.js";
2
2
  import { existsSync, readdirSync, statSync, watch } from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  export async function watchAndServer(app) {