@antelopejs/core 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +52 -0
  3. package/dist/cli/common.d.ts +21 -0
  4. package/dist/cli/common.js +86 -0
  5. package/dist/cli/common.js.map +1 -0
  6. package/dist/cli/config/get.d.ts +2 -0
  7. package/dist/cli/config/get.js +36 -0
  8. package/dist/cli/config/get.js.map +1 -0
  9. package/dist/cli/config/index.d.ts +2 -0
  10. package/dist/cli/config/index.js +20 -0
  11. package/dist/cli/config/index.js.map +1 -0
  12. package/dist/cli/config/reset.d.ts +2 -0
  13. package/dist/cli/config/reset.js +88 -0
  14. package/dist/cli/config/reset.js.map +1 -0
  15. package/dist/cli/config/set.d.ts +2 -0
  16. package/dist/cli/config/set.js +46 -0
  17. package/dist/cli/config/set.js.map +1 -0
  18. package/dist/cli/config/show.d.ts +2 -0
  19. package/dist/cli/config/show.js +27 -0
  20. package/dist/cli/config/show.js.map +1 -0
  21. package/dist/cli/git.d.ts +49 -0
  22. package/dist/cli/git.js +248 -0
  23. package/dist/cli/git.js.map +1 -0
  24. package/dist/cli/index.d.ts +2 -0
  25. package/dist/cli/index.js +61 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/cli/module/exports/generate.d.ts +2 -0
  28. package/dist/cli/module/exports/generate.js +178 -0
  29. package/dist/cli/module/exports/generate.js.map +1 -0
  30. package/dist/cli/module/exports/index.d.ts +2 -0
  31. package/dist/cli/module/exports/index.js +16 -0
  32. package/dist/cli/module/exports/index.js.map +1 -0
  33. package/dist/cli/module/exports/set.d.ts +2 -0
  34. package/dist/cli/module/exports/set.js +43 -0
  35. package/dist/cli/module/exports/set.js.map +1 -0
  36. package/dist/cli/module/imports/add.d.ts +9 -0
  37. package/dist/cli/module/imports/add.js +127 -0
  38. package/dist/cli/module/imports/add.js.map +1 -0
  39. package/dist/cli/module/imports/index.d.ts +2 -0
  40. package/dist/cli/module/imports/index.js +20 -0
  41. package/dist/cli/module/imports/index.js.map +1 -0
  42. package/dist/cli/module/imports/list.d.ts +2 -0
  43. package/dist/cli/module/imports/list.js +89 -0
  44. package/dist/cli/module/imports/list.js.map +1 -0
  45. package/dist/cli/module/imports/remove.d.ts +2 -0
  46. package/dist/cli/module/imports/remove.js +97 -0
  47. package/dist/cli/module/imports/remove.js.map +1 -0
  48. package/dist/cli/module/imports/update.d.ts +2 -0
  49. package/dist/cli/module/imports/update.js +157 -0
  50. package/dist/cli/module/imports/update.js.map +1 -0
  51. package/dist/cli/module/index.d.ts +2 -0
  52. package/dist/cli/module/index.js +20 -0
  53. package/dist/cli/module/index.js.map +1 -0
  54. package/dist/cli/module/init.d.ts +7 -0
  55. package/dist/cli/module/init.js +120 -0
  56. package/dist/cli/module/init.js.map +1 -0
  57. package/dist/cli/module/test.d.ts +3 -0
  58. package/dist/cli/module/test.js +33 -0
  59. package/dist/cli/module/test.js.map +1 -0
  60. package/dist/cli/project/index.d.ts +2 -0
  61. package/dist/cli/project/index.js +20 -0
  62. package/dist/cli/project/index.js.map +1 -0
  63. package/dist/cli/project/init.d.ts +2 -0
  64. package/dist/cli/project/init.js +122 -0
  65. package/dist/cli/project/init.js.map +1 -0
  66. package/dist/cli/project/logging/index.d.ts +2 -0
  67. package/dist/cli/project/logging/index.js +16 -0
  68. package/dist/cli/project/logging/index.js.map +1 -0
  69. package/dist/cli/project/logging/set.d.ts +2 -0
  70. package/dist/cli/project/logging/set.js +352 -0
  71. package/dist/cli/project/logging/set.js.map +1 -0
  72. package/dist/cli/project/logging/show.d.ts +2 -0
  73. package/dist/cli/project/logging/show.js +92 -0
  74. package/dist/cli/project/logging/show.js.map +1 -0
  75. package/dist/cli/project/modules/add.d.ts +11 -0
  76. package/dist/cli/project/modules/add.js +157 -0
  77. package/dist/cli/project/modules/add.js.map +1 -0
  78. package/dist/cli/project/modules/fix.d.ts +2 -0
  79. package/dist/cli/project/modules/fix.js +201 -0
  80. package/dist/cli/project/modules/fix.js.map +1 -0
  81. package/dist/cli/project/modules/index.d.ts +2 -0
  82. package/dist/cli/project/modules/index.js +20 -0
  83. package/dist/cli/project/modules/index.js.map +1 -0
  84. package/dist/cli/project/modules/remove.d.ts +9 -0
  85. package/dist/cli/project/modules/remove.js +102 -0
  86. package/dist/cli/project/modules/remove.js.map +1 -0
  87. package/dist/cli/project/modules/update.d.ts +2 -0
  88. package/dist/cli/project/modules/update.js +117 -0
  89. package/dist/cli/project/modules/update.js.map +1 -0
  90. package/dist/cli/project/run.d.ts +2 -0
  91. package/dist/cli/project/run.js +107 -0
  92. package/dist/cli/project/run.js.map +1 -0
  93. package/dist/common/cache.d.ts +14 -0
  94. package/dist/common/cache.js +100 -0
  95. package/dist/common/cache.js.map +1 -0
  96. package/dist/common/config.d.ts +54 -0
  97. package/dist/common/config.js +160 -0
  98. package/dist/common/config.js.map +1 -0
  99. package/dist/common/downloader/git.d.ts +8 -0
  100. package/dist/common/downloader/git.js +61 -0
  101. package/dist/common/downloader/git.js.map +1 -0
  102. package/dist/common/downloader/index.d.ts +10 -0
  103. package/dist/common/downloader/index.js +57 -0
  104. package/dist/common/downloader/index.js.map +1 -0
  105. package/dist/common/downloader/local.d.ts +11 -0
  106. package/dist/common/downloader/local.js +58 -0
  107. package/dist/common/downloader/local.js.map +1 -0
  108. package/dist/common/downloader/package.d.ts +6 -0
  109. package/dist/common/downloader/package.js +53 -0
  110. package/dist/common/downloader/package.js.map +1 -0
  111. package/dist/common/manifest.d.ts +45 -0
  112. package/dist/common/manifest.js +116 -0
  113. package/dist/common/manifest.js.map +1 -0
  114. package/dist/eslint.config.d.mts +2 -0
  115. package/dist/eslint.config.mjs +85 -0
  116. package/dist/eslint.config.mjs.map +1 -0
  117. package/dist/index.d.ts +6 -0
  118. package/dist/index.js +118 -0
  119. package/dist/index.js.map +1 -0
  120. package/dist/interfaces/core/1/decorators.d.ts +29 -0
  121. package/dist/interfaces/core/1/decorators.js +72 -0
  122. package/dist/interfaces/core/1/decorators.js.map +1 -0
  123. package/dist/interfaces/core/1/index.d.ts +54 -0
  124. package/dist/interfaces/core/1/index.js +237 -0
  125. package/dist/interfaces/core/1/index.js.map +1 -0
  126. package/dist/interfaces/core/1/modules.d.ts +26 -0
  127. package/dist/interfaces/core/1/modules.js +31 -0
  128. package/dist/interfaces/core/1/modules.js.map +1 -0
  129. package/dist/interfaces/core/beta/decorators.d.ts +29 -0
  130. package/dist/interfaces/core/beta/decorators.js +72 -0
  131. package/dist/interfaces/core/beta/decorators.js.map +1 -0
  132. package/dist/interfaces/core/beta/index.d.ts +54 -0
  133. package/dist/interfaces/core/beta/index.js +237 -0
  134. package/dist/interfaces/core/beta/index.js.map +1 -0
  135. package/dist/interfaces/core/beta/modules.d.ts +26 -0
  136. package/dist/interfaces/core/beta/modules.js +31 -0
  137. package/dist/interfaces/core/beta/modules.js.map +1 -0
  138. package/dist/interfaces/logging/1/index.d.ts +16 -0
  139. package/dist/interfaces/logging/1/index.js +49 -0
  140. package/dist/interfaces/logging/1/index.js.map +1 -0
  141. package/dist/interfaces/logging/1/listener.d.ts +9 -0
  142. package/dist/interfaces/logging/1/listener.js +5 -0
  143. package/dist/interfaces/logging/1/listener.js.map +1 -0
  144. package/dist/interfaces/logging/beta/index.d.ts +16 -0
  145. package/dist/interfaces/logging/beta/index.js +49 -0
  146. package/dist/interfaces/logging/beta/index.js.map +1 -0
  147. package/dist/interfaces/logging/beta/listener.d.ts +9 -0
  148. package/dist/interfaces/logging/beta/listener.js +5 -0
  149. package/dist/interfaces/logging/beta/listener.js.map +1 -0
  150. package/dist/loader/index.d.ts +45 -0
  151. package/dist/loader/index.js +472 -0
  152. package/dist/loader/index.js.map +1 -0
  153. package/dist/loader/module.d.ts +29 -0
  154. package/dist/loader/module.js +142 -0
  155. package/dist/loader/module.js.map +1 -0
  156. package/dist/logging/index.d.ts +5 -0
  157. package/dist/logging/index.js +124 -0
  158. package/dist/logging/index.js.map +1 -0
  159. package/dist/src/cli/common.d.ts +18 -0
  160. package/dist/src/cli/common.js +105 -0
  161. package/dist/src/cli/common.js.map +1 -0
  162. package/dist/src/cli/config/get.d.ts +2 -0
  163. package/dist/src/cli/config/get.js +36 -0
  164. package/dist/src/cli/config/get.js.map +1 -0
  165. package/dist/src/cli/config/index.d.ts +2 -0
  166. package/dist/src/cli/config/index.js +20 -0
  167. package/dist/src/cli/config/index.js.map +1 -0
  168. package/dist/src/cli/config/reset.d.ts +2 -0
  169. package/dist/src/cli/config/reset.js +88 -0
  170. package/dist/src/cli/config/reset.js.map +1 -0
  171. package/dist/src/cli/config/set.d.ts +2 -0
  172. package/dist/src/cli/config/set.js +42 -0
  173. package/dist/src/cli/config/set.js.map +1 -0
  174. package/dist/src/cli/config/show.d.ts +2 -0
  175. package/dist/src/cli/config/show.js +27 -0
  176. package/dist/src/cli/config/show.js.map +1 -0
  177. package/dist/src/cli/git.d.ts +43 -0
  178. package/dist/src/cli/git.js +227 -0
  179. package/dist/src/cli/git.js.map +1 -0
  180. package/dist/src/cli/index.d.ts +2 -0
  181. package/dist/src/cli/index.js +43 -0
  182. package/dist/src/cli/index.js.map +1 -0
  183. package/dist/src/cli/module/exports/generate.d.ts +2 -0
  184. package/dist/src/cli/module/exports/generate.js +71 -0
  185. package/dist/src/cli/module/exports/generate.js.map +1 -0
  186. package/dist/src/cli/module/exports/index.d.ts +2 -0
  187. package/dist/src/cli/module/exports/index.js +16 -0
  188. package/dist/src/cli/module/exports/index.js.map +1 -0
  189. package/dist/src/cli/module/exports/set.d.ts +2 -0
  190. package/dist/src/cli/module/exports/set.js +43 -0
  191. package/dist/src/cli/module/exports/set.js.map +1 -0
  192. package/dist/src/cli/module/imports/add.d.ts +9 -0
  193. package/dist/src/cli/module/imports/add.js +98 -0
  194. package/dist/src/cli/module/imports/add.js.map +1 -0
  195. package/dist/src/cli/module/imports/index.d.ts +2 -0
  196. package/dist/src/cli/module/imports/index.js +20 -0
  197. package/dist/src/cli/module/imports/index.js.map +1 -0
  198. package/dist/src/cli/module/imports/list.d.ts +2 -0
  199. package/dist/src/cli/module/imports/list.js +89 -0
  200. package/dist/src/cli/module/imports/list.js.map +1 -0
  201. package/dist/src/cli/module/imports/remove.d.ts +2 -0
  202. package/dist/src/cli/module/imports/remove.js +97 -0
  203. package/dist/src/cli/module/imports/remove.js.map +1 -0
  204. package/dist/src/cli/module/imports/update.d.ts +2 -0
  205. package/dist/src/cli/module/imports/update.js +129 -0
  206. package/dist/src/cli/module/imports/update.js.map +1 -0
  207. package/dist/src/cli/module/index.d.ts +2 -0
  208. package/dist/src/cli/module/index.js +20 -0
  209. package/dist/src/cli/module/index.js.map +1 -0
  210. package/dist/src/cli/module/init.d.ts +7 -0
  211. package/dist/src/cli/module/init.js +136 -0
  212. package/dist/src/cli/module/init.js.map +1 -0
  213. package/dist/src/cli/module/test.d.ts +6 -0
  214. package/dist/src/cli/module/test.js +20 -0
  215. package/dist/src/cli/module/test.js.map +1 -0
  216. package/dist/src/cli/project/index.d.ts +2 -0
  217. package/dist/src/cli/project/index.js +20 -0
  218. package/dist/src/cli/project/index.js.map +1 -0
  219. package/dist/src/cli/project/init.d.ts +2 -0
  220. package/dist/src/cli/project/init.js +116 -0
  221. package/dist/src/cli/project/init.js.map +1 -0
  222. package/dist/src/cli/project/logging/index.d.ts +2 -0
  223. package/dist/src/cli/project/logging/index.js +16 -0
  224. package/dist/src/cli/project/logging/index.js.map +1 -0
  225. package/dist/src/cli/project/logging/set.d.ts +2 -0
  226. package/dist/src/cli/project/logging/set.js +353 -0
  227. package/dist/src/cli/project/logging/set.js.map +1 -0
  228. package/dist/src/cli/project/logging/show.d.ts +2 -0
  229. package/dist/src/cli/project/logging/show.js +93 -0
  230. package/dist/src/cli/project/logging/show.js.map +1 -0
  231. package/dist/src/cli/project/modules/add.d.ts +11 -0
  232. package/dist/src/cli/project/modules/add.js +161 -0
  233. package/dist/src/cli/project/modules/add.js.map +1 -0
  234. package/dist/src/cli/project/modules/fix.d.ts +2 -0
  235. package/dist/src/cli/project/modules/fix.js +224 -0
  236. package/dist/src/cli/project/modules/fix.js.map +1 -0
  237. package/dist/src/cli/project/modules/index.d.ts +2 -0
  238. package/dist/src/cli/project/modules/index.js +20 -0
  239. package/dist/src/cli/project/modules/index.js.map +1 -0
  240. package/dist/src/cli/project/modules/remove.d.ts +9 -0
  241. package/dist/src/cli/project/modules/remove.js +102 -0
  242. package/dist/src/cli/project/modules/remove.js.map +1 -0
  243. package/dist/src/cli/project/modules/update.d.ts +2 -0
  244. package/dist/src/cli/project/modules/update.js +117 -0
  245. package/dist/src/cli/project/modules/update.js.map +1 -0
  246. package/dist/src/cli/project/run.d.ts +2 -0
  247. package/dist/src/cli/project/run.js +60 -0
  248. package/dist/src/cli/project/run.js.map +1 -0
  249. package/dist/src/common/cache.d.ts +14 -0
  250. package/dist/src/common/cache.js +99 -0
  251. package/dist/src/common/cache.js.map +1 -0
  252. package/dist/src/common/config.d.ts +58 -0
  253. package/dist/src/common/config.js +159 -0
  254. package/dist/src/common/config.js.map +1 -0
  255. package/dist/src/common/downloader/git.d.ts +8 -0
  256. package/dist/src/common/downloader/git.js +64 -0
  257. package/dist/src/common/downloader/git.js.map +1 -0
  258. package/dist/src/common/downloader/index.d.ts +10 -0
  259. package/dist/src/common/downloader/index.js +50 -0
  260. package/dist/src/common/downloader/index.js.map +1 -0
  261. package/dist/src/common/downloader/local.d.ts +11 -0
  262. package/dist/src/common/downloader/local.js +39 -0
  263. package/dist/src/common/downloader/local.js.map +1 -0
  264. package/dist/src/common/downloader/package.d.ts +6 -0
  265. package/dist/src/common/downloader/package.js +79 -0
  266. package/dist/src/common/downloader/package.js.map +1 -0
  267. package/dist/src/common/manifest.d.ts +45 -0
  268. package/dist/src/common/manifest.js +114 -0
  269. package/dist/src/common/manifest.js.map +1 -0
  270. package/dist/src/index.d.ts +5 -0
  271. package/dist/src/index.js +117 -0
  272. package/dist/src/index.js.map +1 -0
  273. package/dist/src/interfaces/core/1/decorators.d.ts +29 -0
  274. package/dist/src/interfaces/core/1/decorators.js +72 -0
  275. package/dist/src/interfaces/core/1/decorators.js.map +1 -0
  276. package/dist/src/interfaces/core/1/index.d.ts +54 -0
  277. package/dist/src/interfaces/core/1/index.js +237 -0
  278. package/dist/src/interfaces/core/1/index.js.map +1 -0
  279. package/dist/src/interfaces/core/1/modules.d.ts +26 -0
  280. package/dist/src/interfaces/core/1/modules.js +31 -0
  281. package/dist/src/interfaces/core/1/modules.js.map +1 -0
  282. package/dist/src/interfaces/logging/1/index.d.ts +16 -0
  283. package/dist/src/interfaces/logging/1/index.js +49 -0
  284. package/dist/src/interfaces/logging/1/index.js.map +1 -0
  285. package/dist/src/interfaces/logging/1/listener.d.ts +9 -0
  286. package/dist/src/interfaces/logging/1/listener.js +5 -0
  287. package/dist/src/interfaces/logging/1/listener.js.map +1 -0
  288. package/dist/src/loader/index.d.ts +42 -0
  289. package/dist/src/loader/index.js +428 -0
  290. package/dist/src/loader/index.js.map +1 -0
  291. package/dist/src/loader/module.d.ts +29 -0
  292. package/dist/src/loader/module.js +139 -0
  293. package/dist/src/loader/module.js.map +1 -0
  294. package/dist/src/logging/index.d.ts +5 -0
  295. package/dist/src/logging/index.js +118 -0
  296. package/dist/src/logging/index.js.map +1 -0
  297. package/dist/src/utils/cli-ui.d.ts +34 -0
  298. package/dist/src/utils/cli-ui.js +173 -0
  299. package/dist/src/utils/cli-ui.js.map +1 -0
  300. package/dist/src/utils/command.d.ts +3 -0
  301. package/dist/src/utils/command.js +33 -0
  302. package/dist/src/utils/command.js.map +1 -0
  303. package/dist/src/utils/object.d.ts +2 -0
  304. package/dist/src/utils/object.js +26 -0
  305. package/dist/src/utils/object.js.map +1 -0
  306. package/dist/src/utils/promise.d.ts +3 -0
  307. package/dist/src/utils/promise.js +24 -0
  308. package/dist/src/utils/promise.js.map +1 -0
  309. package/dist/utils/antelope-runner.d.ts +1 -0
  310. package/dist/utils/antelope-runner.js +29 -0
  311. package/dist/utils/antelope-runner.js.map +1 -0
  312. package/dist/utils/cli-ui.d.ts +34 -0
  313. package/dist/utils/cli-ui.js +173 -0
  314. package/dist/utils/cli-ui.js.map +1 -0
  315. package/dist/utils/command.d.ts +2 -0
  316. package/dist/utils/command.js +19 -0
  317. package/dist/utils/command.js.map +1 -0
  318. package/dist/utils/logger.d.ts +5 -0
  319. package/dist/utils/logger.js +14 -0
  320. package/dist/utils/logger.js.map +1 -0
  321. package/dist/utils/object.d.ts +2 -0
  322. package/dist/utils/object.js +26 -0
  323. package/dist/utils/object.js.map +1 -0
  324. package/dist/utils/package-manager.d.ts +3 -0
  325. package/dist/utils/package-manager.js +39 -0
  326. package/dist/utils/package-manager.js.map +1 -0
  327. package/dist/utils/promise.d.ts +3 -0
  328. package/dist/utils/promise.js +24 -0
  329. package/dist/utils/promise.js.map +1 -0
  330. package/package.json +77 -0
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RegisterLoader = RegisterLoader;
7
+ exports.default = LoadModule;
8
+ exports.GetLoaderIdentifier = GetLoaderIdentifier;
9
+ const _1_1 = __importDefault(require("../../interfaces/logging/1"));
10
+ const waiting = new Map();
11
+ const knownTypes = new Map();
12
+ function RegisterLoader(type, loaderIdentifier, loader) {
13
+ knownTypes.set(type, { loaderIdentifier, loader });
14
+ const waitingList = waiting.get(type);
15
+ if (waitingList) {
16
+ for (const waiter of waitingList) {
17
+ loader(waiter.cache, waiter.source).then(waiter.resolve);
18
+ }
19
+ waiting.delete(type);
20
+ }
21
+ }
22
+ function LoadModule(cache, source) {
23
+ _1_1.default.Info(`LoadModule called for type ${source.type}`);
24
+ const type = knownTypes.get(source.type);
25
+ if (type) {
26
+ _1_1.default.Info(`Found loader for type ${source.type}`);
27
+ return type.loader(cache, source);
28
+ }
29
+ _1_1.default.Info(`No loader found for type ${source.type}`);
30
+ return new Promise((resolve) => {
31
+ let waitingList = waiting.get(source.type);
32
+ if (!waitingList) {
33
+ waitingList = [];
34
+ waiting.set(source.type, waitingList);
35
+ }
36
+ waitingList.push({
37
+ cache,
38
+ source,
39
+ resolve,
40
+ });
41
+ });
42
+ }
43
+ function GetLoaderIdentifier(source) {
44
+ const type = knownTypes.get(source.type);
45
+ if (type) {
46
+ return source[type.loaderIdentifier];
47
+ }
48
+ return undefined;
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/downloader/index.ts"],"names":[],"mappings":";;;;;AA4BA,wCAaC;AAED,6BAoBC;AAED,kDAMC;AArED,oEAAiD;AAuBjD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;AACjD,MAAM,UAAU,GAAG,IAAI,GAAG,EAAgE,CAAC;AAE3F,SAAgB,cAAc,CAC5B,IAAY,EACZ,gBAAyB,EACzB,MAAuB;IAEvB,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,WAAW,EAAE,CAAC;QAChB,KAAK,MAAM,MAAM,IAAI,WAAW,EAAE,CAAC;YACjC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChE,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAED,SAAwB,UAAU,CAAC,KAAkB,EAAE,MAAoB;IACzE,YAAO,CAAC,IAAI,CAAC,8BAA8B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,IAAI,EAAE,CAAC;QACT,YAAO,CAAC,IAAI,CAAC,yBAAyB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IACD,YAAO,CAAC,IAAI,CAAC,4BAA4B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACxD,OAAO,IAAI,OAAO,CAAmB,CAAC,OAAO,EAAE,EAAE;QAC/C,IAAI,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,WAAW,GAAG,EAAE,CAAC;YACjB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QACxC,CAAC;QACD,WAAW,CAAC,IAAI,CAAC;YACf,KAAK;YACL,MAAM;YACN,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAoB;IACtD,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,IAAI,EAAE,CAAC;QACT,OAAQ,MAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { ModuleSource } from '.';
2
+ export interface ModuleSourceLocal extends ModuleSource {
3
+ type: 'local';
4
+ path: string;
5
+ watchDir?: string | string[];
6
+ installCommand?: string | string[];
7
+ }
8
+ export interface ModuleSourceLocalFolder extends ModuleSource {
9
+ type: 'local-folder';
10
+ path: string;
11
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const _1 = require(".");
8
+ const promises_1 = require("fs/promises");
9
+ const command_1 = require("../../utils/command");
10
+ const manifest_1 = require("../manifest");
11
+ const node_os_1 = __importDefault(require("node:os"));
12
+ function ReplaceUnixRelativeHome(path) {
13
+ if (path.startsWith('~')) {
14
+ return node_os_1.default.homedir() + path.slice(1);
15
+ }
16
+ return path;
17
+ }
18
+ (0, _1.RegisterLoader)('local', 'path', async (_, source) => {
19
+ const formattedPath = ReplaceUnixRelativeHome(source.path);
20
+ if (source.installCommand) {
21
+ if (Array.isArray(source.installCommand)) {
22
+ for (const command of source.installCommand) {
23
+ await (0, command_1.ExecuteCMDWithLogging)(command, { cwd: formattedPath });
24
+ }
25
+ }
26
+ else {
27
+ await (0, command_1.ExecuteCMDWithLogging)(source.installCommand, { cwd: formattedPath });
28
+ }
29
+ }
30
+ return [new manifest_1.ModuleManifest(formattedPath, source)];
31
+ });
32
+ (0, _1.RegisterLoader)('local-folder', 'path', (_, source) => {
33
+ const searchPath = ReplaceUnixRelativeHome(source.path);
34
+ return (0, promises_1.readdir)(searchPath).then((names) => names.map((name) => {
35
+ const folder = path_1.default.join(searchPath, name);
36
+ return new manifest_1.ModuleManifest(folder, { type: 'local', path: folder });
37
+ }));
38
+ });
39
+ //# sourceMappingURL=local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../../../../src/common/downloader/local.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,wBAAiD;AACjD,0CAAsC;AACtC,iDAA4D;AAC5D,0CAA6C;AAE7C,sDAAyB;AASzB,SAAS,uBAAuB,CAAC,IAAY;IAC3C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,iBAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAC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CAAC,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ModuleSource } from '.';
2
+ export interface ModuleSourcePackage extends ModuleSource {
3
+ type: 'package';
4
+ package: string;
5
+ version: string;
6
+ }
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const _1 = require(".");
40
+ const cache_1 = require("../cache");
41
+ const path_1 = __importDefault(require("path"));
42
+ const inly = __importStar(require("inly"));
43
+ const command_1 = require("../../utils/command");
44
+ const manifest_1 = require("../manifest");
45
+ function Extract(from, to) {
46
+ return new Promise((resolve, reject) => {
47
+ const i = inly(from, to);
48
+ i.on('error', reject);
49
+ i.on('end', resolve);
50
+ });
51
+ }
52
+ (0, _1.RegisterLoader)('package', 'package', async (cache, source) => {
53
+ let folder;
54
+ let manifest;
55
+ if (!source.ignoreCache && cache.hasVersion(source.package, source.version)) {
56
+ folder = await cache.getFolder(source.package, true, true);
57
+ manifest = require(path_1.default.join(folder, 'package.json'));
58
+ }
59
+ else {
60
+ const tmp = await cache_1.ModuleCache.getTemp();
61
+ const [output] = await (0, command_1.ExecuteCMDWithLogging)(`npm pack ${source.package}@${source.version}`, { cwd: tmp });
62
+ const filename_match = output.match(/filename: +([^ ]+.tgz)/);
63
+ if (!filename_match) {
64
+ return [];
65
+ }
66
+ try {
67
+ await Extract(`${tmp}/${filename_match[1]}`, '.');
68
+ }
69
+ catch (e) {
70
+ return [];
71
+ }
72
+ const tmpPackage = path_1.default.join(tmp, 'package');
73
+ manifest = require(path_1.default.join(tmpPackage, 'package.json'));
74
+ await (0, command_1.ExecuteCMDWithLogging)('npm install', { cwd: tmpPackage });
75
+ folder = await cache.transfer(tmpPackage, source.package, manifest.version);
76
+ }
77
+ return [new manifest_1.ModuleManifest(folder, source)];
78
+ });
79
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","sourceRoot":"","sources":["../../../../src/common/downloader/package.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAAiD;AACjD,oCAAuC;AACvC,gDAAwB;AAGxB,2CAA6B;AAC7B,iDAA4D;AAC5D,0CAAgE;AAChE,SAAS,OAAO,CAAC,IAAY,EAAE,EAAU;IACvC,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,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,GAAG,EAAE,SAAS,CAAC,CAAC;QAC7C,QAAQ,GAAG,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAE1D,MAAM,IAAA,+BAAqB,EAAC,aAAa,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,CAAC;QAEhE,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9E,CAAC;IACD,OAAO,CAAC,IAAI,yBAAc,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { ModuleSource } from './downloader';
2
+ export type ModuleImport = string | {
3
+ name: string;
4
+ git?: string;
5
+ };
6
+ export declare function mapModuleImport(moduleImport: ModuleImport): string;
7
+ export interface ModulePackageJson {
8
+ name: string;
9
+ version: string;
10
+ description?: string;
11
+ author?: string | Array<string>;
12
+ antelopeJs?: {
13
+ imports: ModuleImport[];
14
+ importsOptional: ModuleImport[];
15
+ exports?: string[];
16
+ exportsPath?: string;
17
+ baseUrl?: string;
18
+ paths?: Record<string, string[]>;
19
+ moduleAliases?: Record<string, string>;
20
+ };
21
+ _moduleAliases?: Record<string, string>;
22
+ }
23
+ export declare class ModuleManifest {
24
+ readonly source: ModuleSource;
25
+ readonly name: string;
26
+ version: string;
27
+ readonly folder: string;
28
+ readonly baseUrl: string;
29
+ readonly paths: {
30
+ key: string;
31
+ values: string[];
32
+ }[];
33
+ private manifest;
34
+ exportsPath: string;
35
+ exports: Record<string, string>;
36
+ imports: string[];
37
+ srcAliases?: Array<{
38
+ alias: string;
39
+ replace: string;
40
+ }>;
41
+ private static readManifest;
42
+ constructor(folder: string, source: ModuleSource);
43
+ loadExports(): Promise<void>;
44
+ reload(): Promise<void>;
45
+ }
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ModuleManifest = void 0;
7
+ exports.mapModuleImport = mapModuleImport;
8
+ const path_1 = __importDefault(require("path"));
9
+ const promises_1 = require("fs/promises");
10
+ const _1_1 = __importDefault(require("../interfaces/logging/1"));
11
+ function mapModuleImport(moduleImport) {
12
+ return typeof moduleImport === 'object' ? moduleImport.name : moduleImport;
13
+ }
14
+ class ModuleManifest {
15
+ source;
16
+ name;
17
+ version;
18
+ folder;
19
+ baseUrl;
20
+ paths = [];
21
+ manifest;
22
+ exportsPath;
23
+ exports = {};
24
+ imports = [];
25
+ srcAliases;
26
+ static readManifest(folder) {
27
+ try {
28
+ return require(path_1.default.join(folder, 'package.json'));
29
+ }
30
+ catch (err) {
31
+ _1_1.default.Error(`Missing package.json in '${folder}'`);
32
+ return {
33
+ name: folder,
34
+ version: '0.0.0',
35
+ };
36
+ }
37
+ }
38
+ constructor(folder, source) {
39
+ this.source = source;
40
+ this.folder = path_1.default.resolve(folder);
41
+ this.manifest = ModuleManifest.readManifest(this.folder);
42
+ this.name = this.manifest.name;
43
+ this.version = this.manifest.version;
44
+ this.exportsPath = path_1.default.join(this.folder, this.manifest.antelopeJs?.exportsPath || 'interfaces');
45
+ this.imports = this.manifest.antelopeJs?.imports?.map(mapModuleImport) ?? [];
46
+ this.baseUrl = path_1.default.join(this.folder, this.manifest.antelopeJs?.baseUrl ?? '');
47
+ if (this.manifest.antelopeJs?.paths) {
48
+ for (const [key, values] of Object.entries(this.manifest.antelopeJs?.paths)) {
49
+ this.paths.push({
50
+ key: key.replace(/\*$/, ''),
51
+ values: values.map((value) => path_1.default.join(this.baseUrl, value.replace(/\*$/, ''))),
52
+ });
53
+ }
54
+ }
55
+ if (this.manifest._moduleAliases) {
56
+ this.srcAliases = Object.entries(this.manifest._moduleAliases).map(([alias, replace]) => ({
57
+ alias,
58
+ replace: path_1.default.join(this.folder, replace),
59
+ }));
60
+ }
61
+ if (this.manifest.antelopeJs?.moduleAliases) {
62
+ this.srcAliases = [
63
+ ...(this.srcAliases || []),
64
+ ...Object.entries(this.manifest.antelopeJs.moduleAliases).map(([alias, replace]) => ({
65
+ alias,
66
+ replace: path_1.default.join(this.folder, replace),
67
+ })),
68
+ ];
69
+ }
70
+ }
71
+ async loadExports() {
72
+ this.exports = {};
73
+ const addIfFolder = async (name, ifFolder) => {
74
+ for (const version of await (0, promises_1.readdir)(ifFolder)) {
75
+ const versionName = version.match(/^([^.]+)(?:\.js)?$/);
76
+ if (versionName) {
77
+ this.exports[`${name}@${versionName[1]}`] = path_1.default.join(ifFolder, versionName[1]);
78
+ }
79
+ }
80
+ };
81
+ if (this.manifest.antelopeJs?.exports) {
82
+ for (const nameVersion of this.manifest.antelopeJs.exports) {
83
+ const match = nameVersion.match(/^([^@]*)(?:@(.*))?$/);
84
+ if (match) {
85
+ if (match[2]) {
86
+ this.exports[nameVersion] = path_1.default.join(this.exportsPath, match[1], match[2]);
87
+ }
88
+ else {
89
+ await addIfFolder(match[1], path_1.default.join(this.exportsPath, match[1]));
90
+ }
91
+ }
92
+ }
93
+ }
94
+ else if (await (0, promises_1.lstat)(this.exportsPath)
95
+ .then((s) => s.isDirectory())
96
+ .catch(() => false)) {
97
+ for (const name of await (0, promises_1.readdir)(this.exportsPath)) {
98
+ const ifFolder = path_1.default.join(this.exportsPath, name);
99
+ if ((await (0, promises_1.lstat)(ifFolder)).isDirectory()) {
100
+ await addIfFolder(name, ifFolder);
101
+ }
102
+ }
103
+ }
104
+ }
105
+ async reload() {
106
+ this.manifest = ModuleManifest.readManifest(this.folder);
107
+ this.version = this.manifest.version;
108
+ this.exportsPath = path_1.default.join(this.folder, this.manifest.antelopeJs?.exportsPath || 'interfaces');
109
+ this.imports = this.manifest.antelopeJs?.imports.map(mapModuleImport) ?? [];
110
+ await this.loadExports();
111
+ }
112
+ }
113
+ exports.ModuleManifest = ModuleManifest;
114
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/common/manifest.ts"],"names":[],"mappings":";;;;;;AAOA,0CAEC;AATD,gDAAwB;AAExB,0CAA6C;AAC7C,iEAA8C;AAI9C,SAAgB,eAAe,CAAC,YAA0B;IACxD,OAAO,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC;AAC7E,CAAC;AA2BD,MAAa,cAAc;IAiCP;IAhCF,IAAI,CAAS;IACtB,OAAO,CAAS;IACP,MAAM,CAAS;IAEf,OAAO,CAAS;IAChB,KAAK,GAGf,EAAE,CAAC;IAED,QAAQ,CAAoB;IAC7B,WAAW,CAAS;IAEpB,OAAO,GAA2B,EAAE,CAAC;IACrC,OAAO,GAAa,EAAE,CAAC;IAEvB,UAAU,CAA6C;IAEtD,MAAM,CAAC,YAAY,CAAC,MAAc;QACxC,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;QACpD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAO,CAAC,KAAK,CAAC,4BAA4B,MAAM,GAAG,CAAC,CAAC;YACrD,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,OAAO;aACjB,CAAC;QACJ,CAAC;IACH,CAAC;IAED,YACE,MAAc,EACE,MAAoB;QAApB,WAAM,GAAN,MAAM,CAAc;QAEpC,IAAI,CAAC,MAAM,GAAG,cAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC/B,IAAI,CAAC,O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C,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,WAAW,IAAI,YAAY,CAAC,CAAC;QACjG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;QAC5E,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IAC3B,CAAC;CACF;AA/GD,wCA+GC"}
@@ -0,0 +1,5 @@
1
+ export interface LaunchOptions {
2
+ watch?: boolean;
3
+ }
4
+ export declare function TestModule(moduleFolder?: string): Promise<void>;
5
+ export default function (projectFolder?: string, env?: string, options?: LaunchOptions): Promise<void>;
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TestModule = TestModule;
7
+ exports.default = default_1;
8
+ const config_1 = require("./common/config");
9
+ const loader_1 = require("./loader");
10
+ const async_exit_hook_1 = __importDefault(require("async-exit-hook"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const logging_1 = __importDefault(require("./logging"));
13
+ const _1_1 = __importDefault(require("./interfaces/logging/1"));
14
+ const assert_1 = __importDefault(require("assert"));
15
+ const jest_1 = require("jest");
16
+ const promises_1 = require("fs/promises");
17
+ async function ConvertConfig(config) {
18
+ if (config.cluster?.mode === 'secondary') {
19
+ }
20
+ return {
21
+ sources: Object.entries(config.modules)
22
+ .filter(([, module]) => 'source' in module)
23
+ .map(([id, module]) => ({ id, ...module.source })),
24
+ configs: Object.entries(config.modules).reduce((configs, [name, module]) => {
25
+ configs[name] = {
26
+ config: module.config,
27
+ importOverrides: (module.importOverrides ?? []).reduce((prev, override) => {
28
+ if (!prev.has(override.interface)) {
29
+ prev.set(override.interface, []);
30
+ }
31
+ prev.get(override.interface).push({
32
+ module: override.source,
33
+ id: override.id,
34
+ });
35
+ return prev;
36
+ }, new Map()),
37
+ disabledExports: new Set(module.disabledExports),
38
+ };
39
+ return configs;
40
+ }, {}),
41
+ };
42
+ }
43
+ async function TestModule(moduleFolder = '.') {
44
+ const moduleRoot = path_1.default.resolve(moduleFolder);
45
+ const pack = require(path_1.default.join(moduleRoot, 'package.json'));
46
+ (0, assert_1.default)(pack, 'Missing package.json');
47
+ const testConfig = pack.antelopeJs?.test;
48
+ if (!testConfig) {
49
+ console.error('Missing AntelopeJS test config');
50
+ return;
51
+ }
52
+ const testProject = path_1.default.join(moduleRoot, testConfig.project);
53
+ const config = require(testProject);
54
+ console.log(config);
55
+ (0, logging_1.default)(config);
56
+ const moduleManager = new loader_1.ModuleManager(path_1.default.resolve(path_1.default.join(__dirname, '..')), config.cacheFolder);
57
+ const legacyModuleList = await ConvertConfig(config);
58
+ try {
59
+ await moduleManager.init(legacyModuleList);
60
+ }
61
+ catch (err) {
62
+ _1_1.default.Error('Error during module manager initialization', err);
63
+ console.error(err);
64
+ return;
65
+ }
66
+ const testConfigFile = path_1.default.resolve(config.cacheFolder, '.jest.tmp.js');
67
+ const interfaceSources = Array.from(moduleManager.loadedModules.values()).map((module) => module.ref.manifest.exportsPath + '/$1');
68
+ interfaceSources.push(path_1.default.resolve(__dirname, '../dist/interfaces/$1'));
69
+ await (0, promises_1.writeFile)(testConfigFile, `module.exports = ${JSON.stringify({
70
+ moduleNameMapper: {
71
+ '^@ajs.local/(.*)': '<rootDir>/dist/interfaces/$1',
72
+ '^@ajs/(.*)': interfaceSources,
73
+ },
74
+ })}`);
75
+ const testFolder = path_1.default.join(moduleRoot, testConfig.folder);
76
+ await (0, jest_1.runCLI)({
77
+ roots: [testFolder],
78
+ testRegex: testConfig.regex ?? '\\.js',
79
+ rootDir: moduleRoot,
80
+ config: testConfigFile,
81
+ }, [testConfig.projectRoot ? path_1.default.join(moduleRoot, testConfig.projectRoot) : moduleRoot]);
82
+ try {
83
+ await moduleManager.shutdown();
84
+ }
85
+ catch (err) {
86
+ _1_1.default.Error('Error during shutdown', err);
87
+ }
88
+ }
89
+ async function default_1(projectFolder = '.', env = 'default', options = {}) {
90
+ const config = await (0, config_1.LoadConfig)(projectFolder, env);
91
+ (0, logging_1.default)(config);
92
+ const moduleManager = new loader_1.ModuleManager(path_1.default.resolve(path_1.default.join(__dirname, '..')), config.cacheFolder);
93
+ const legacyModuleList = await ConvertConfig(config);
94
+ try {
95
+ await moduleManager.init(legacyModuleList);
96
+ }
97
+ catch (err) {
98
+ _1_1.default.Error('Error during module manager initialization', err);
99
+ return;
100
+ }
101
+ if (options.watch) {
102
+ await moduleManager.startWatcher().catch(_1_1.default.Error);
103
+ }
104
+ moduleManager.startModules();
105
+ (0, async_exit_hook_1.default)(async (callback) => {
106
+ try {
107
+ await moduleManager.shutdown();
108
+ }
109
+ catch (err) {
110
+ _1_1.default.Error('Error during shutdown', err);
111
+ }
112
+ finally {
113
+ callback();
114
+ }
115
+ });
116
+ }
117
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;AAiDA,gCA2DC;AAED,4BA8BC;AA5ID,4CAA6E;AAC7E,qCAA2D;AAC3D,sEAAuC;AACvC,gDAAwB;AACxB,wDAAoD;AACpD,gEAA6C;AAC7C,oDAA4B;AAC5B,+BAA8B;AAC9B,0CAAwC;AAMxC,KAAK,UAAU,aAAa,CAAC,MAAsC;IACjE,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,KAAK,WAAW,EAAE,CAAC;IAM3C,CAAC;IACD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;aACpC,MAAM,CAAC,CA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AC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAEtG,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,CAAC;QACH,MAAM,aAAa,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,YAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAC;QACjE,OAAO;IACT,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC,KAAK,CAAC,YAAO,CAAC,KAAK,CAAC,CAAC;IAC1D,CAAC;IAED,aAAa,CAAC,YAAY,EAAE,CAAC;IAE7B,IAAA,yBAAQ,EAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,aAAa,CAAC,QAAQ,EAAE,CAAC;QACjC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;gBAAS,CAAC;YACT,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,29 @@
1
+ export type Func<A extends any[] = any[], R = any> = (...args: A) => R;
2
+ export type Class<T = any, A extends any[] = any[]> = {
3
+ new (...args: A): T;
4
+ };
5
+ export type ClassDecorator<C = Class> = (t: C) => any;
6
+ export type PropertyDecorator = (t: any, key: PropertyKey) => void;
7
+ export type MethodDecorator = (t: any, key: PropertyKey, descriptor: PropertyDescriptor) => void;
8
+ export type ParameterDecorator = (t: any, key: PropertyKey, index: number) => void;
9
+ type MergeArray<A extends any[], B extends any[]> = A extends [infer P, ...infer PR] ? B extends [infer Q, ...infer QR] ? [P | Q, ...MergeArray<PR, QR>] : [P | undefined, ...MergeArray<PR, []>] : B extends [infer Q, ...infer QR] ? [Q | undefined, ...MergeArray<[], QR>] : [];
10
+ type UnwrapFunctions<T extends Func[]> = T extends [infer F] ? Parameters<F extends Func ? F : never> : T extends [infer F1, ...infer F2] ? MergeArray<Parameters<F1 extends Func ? F1 : never>, UnwrapFunctions<F2 extends Func[] ? F2 : never>> : [];
11
+ type Function1<T extends Func[], A extends any[], R = void, AR extends any[] = UnwrapFunctions<T>> = (a1: AR[0], ...args: A) => R;
12
+ type Function2<T extends Func[], A extends any[], R = void, AR extends any[] = UnwrapFunctions<T>> = (a1: AR[0], a2: AR[1], ...args: A) => R;
13
+ type Function3<T extends Func[], A extends any[], R = void, AR extends any[] = UnwrapFunctions<T>> = (a1: AR[0], a2: AR[1], a3: AR[2], ...args: A) => R;
14
+ export declare function MakeClassDecorator<T extends any[]>(handler: Function1<[ClassDecorator], T, any>): (...args: T) => ClassDecorator<Class<any, any[]>>;
15
+ export declare function MakePropertyDecorator<T extends any[]>(handler: Function2<[PropertyDecorator], T, void>): (...args: T) => PropertyDecorator;
16
+ export declare function MakePropertyAndClassDecorator<T extends any[]>(handler: Function2<[PropertyDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & PropertyDecorator;
17
+ export declare function MakeMethodDecorator<T extends any[]>(handler: Function3<[MethodDecorator], T, void>): (...args: T) => MethodDecorator;
18
+ export declare function MakeMethodAndClassDecorator<T extends any[]>(handler: Function3<[MethodDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & MethodDecorator;
19
+ export declare function MakeMethodAndPropertyDecorator<T extends any[]>(handler: Function3<[MethodDecorator, PropertyDecorator], T, void>): (...args: T) => PropertyDecorator & MethodDecorator;
20
+ export declare function MakeMethodAndPropertyAndClassDecorator<T extends any[]>(handler: Function3<[MethodDecorator, PropertyDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & PropertyDecorator & MethodDecorator;
21
+ export declare function MakeParameterDecorator<T extends any[]>(handler: Function3<[ParameterDecorator], T, void>): (...args: T) => ParameterDecorator;
22
+ export declare function MakeParameterAndClassDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & ParameterDecorator;
23
+ export declare function MakeParameterAndPropertyDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, PropertyDecorator], T, void>): (...args: T) => PropertyDecorator & ParameterDecorator;
24
+ export declare function MakeParameterAndPropertyAndClassDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, PropertyDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & PropertyDecorator & ParameterDecorator;
25
+ export declare function MakeParameterAndMethodDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, MethodDecorator], T, void>): (...args: T) => MethodDecorator & ParameterDecorator;
26
+ export declare function MakeParameterAndMethodAndClassDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, MethodDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & MethodDecorator & ParameterDecorator;
27
+ export declare function MakeParameterAndMethodAndPropertyDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, MethodDecorator, PropertyDecorator], T, void>): (...args: T) => PropertyDecorator & MethodDecorator & ParameterDecorator;
28
+ export declare function MakeParameterAndMethodAndPropertyAndClassDecorator<T extends any[]>(handler: Function3<[ParameterDecorator, MethodDecorator, PropertyDecorator, ClassDecorator], T, any | undefined>): (...args: T) => ClassDecorator<Class<any, any[]>> & PropertyDecorator & MethodDecorator & ParameterDecorator;
29
+ export {};
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MakeClassDecorator = MakeClassDecorator;
4
+ exports.MakePropertyDecorator = MakePropertyDecorator;
5
+ exports.MakePropertyAndClassDecorator = MakePropertyAndClassDecorator;
6
+ exports.MakeMethodDecorator = MakeMethodDecorator;
7
+ exports.MakeMethodAndClassDecorator = MakeMethodAndClassDecorator;
8
+ exports.MakeMethodAndPropertyDecorator = MakeMethodAndPropertyDecorator;
9
+ exports.MakeMethodAndPropertyAndClassDecorator = MakeMethodAndPropertyAndClassDecorator;
10
+ exports.MakeParameterDecorator = MakeParameterDecorator;
11
+ exports.MakeParameterAndClassDecorator = MakeParameterAndClassDecorator;
12
+ exports.MakeParameterAndPropertyDecorator = MakeParameterAndPropertyDecorator;
13
+ exports.MakeParameterAndPropertyAndClassDecorator = MakeParameterAndPropertyAndClassDecorator;
14
+ exports.MakeParameterAndMethodDecorator = MakeParameterAndMethodDecorator;
15
+ exports.MakeParameterAndMethodAndClassDecorator = MakeParameterAndMethodAndClassDecorator;
16
+ exports.MakeParameterAndMethodAndPropertyDecorator = MakeParameterAndMethodAndPropertyDecorator;
17
+ exports.MakeParameterAndMethodAndPropertyAndClassDecorator = MakeParameterAndMethodAndPropertyAndClassDecorator;
18
+ function Decorator1(handler) {
19
+ return (...args) => (a) => handler(a, ...args);
20
+ }
21
+ function Decorator2(handler) {
22
+ return (...args) => (a, b) => handler(a, b, ...args);
23
+ }
24
+ function Decorator3(handler) {
25
+ return (...args) => (a, b, c) => handler(a, b, c, ...args);
26
+ }
27
+ function MakeClassDecorator(handler) {
28
+ return Decorator1(handler);
29
+ }
30
+ function MakePropertyDecorator(handler) {
31
+ return Decorator2(handler);
32
+ }
33
+ function MakePropertyAndClassDecorator(handler) {
34
+ return Decorator2(handler);
35
+ }
36
+ function MakeMethodDecorator(handler) {
37
+ return Decorator3(handler);
38
+ }
39
+ function MakeMethodAndClassDecorator(handler) {
40
+ return Decorator3(handler);
41
+ }
42
+ function MakeMethodAndPropertyDecorator(handler) {
43
+ return Decorator3(handler);
44
+ }
45
+ function MakeMethodAndPropertyAndClassDecorator(handler) {
46
+ return Decorator3(handler);
47
+ }
48
+ function MakeParameterDecorator(handler) {
49
+ return Decorator3(handler);
50
+ }
51
+ function MakeParameterAndClassDecorator(handler) {
52
+ return Decorator3(handler);
53
+ }
54
+ function MakeParameterAndPropertyDecorator(handler) {
55
+ return Decorator3(handler);
56
+ }
57
+ function MakeParameterAndPropertyAndClassDecorator(handler) {
58
+ return Decorator3(handler);
59
+ }
60
+ function MakeParameterAndMethodDecorator(handler) {
61
+ return Decorator3(handler);
62
+ }
63
+ function MakeParameterAndMethodAndClassDecorator(handler) {
64
+ return Decorator3(handler);
65
+ }
66
+ function MakeParameterAndMethodAndPropertyDecorator(handler) {
67
+ return Decorator3(handler);
68
+ }
69
+ function MakeParameterAndMethodAndPropertyAndClassDecorator(handler) {
70
+ return Decorator3(handler);
71
+ }
72
+ //# sourceMappingURL=decorators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../src/interfaces/core/1/decorators.ts"],"names":[],"mappings":";;AAyGA,gDAEC;AAYD,sDAEC;AAaD,sEAIC;AAUD,kDAEC;AAUD,kEAIC;AAUD,wEAIC;AAUD,wFAIC;AAUD,wDAEC;AAUD,wEAIC;AAUD,8EAIC;AAUD,8FAIC;AAUD,0EAIC;AAUD,0FAIC;AAUD,gGAIC;AAUD,gHAMC;AApPD,SAAS,UAAU,CACjB,OAA2B;IAE3B,OAAO,CAAC,GAAG,IAAO,EAAO,EAAE,CACzB,CAAC,CAAM,EAAE,EAAE,CACT,OAAO,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAC1B,CAAC;AAOD,SAAS,UAAU,CACjB,OAA2B;IAE3B,OAAO,CAAC,GAAG,IAAO,EAAO,EAAE,CACzB,CAAC,CAAM,EAAE,CAAM,EAAE,EAAE,CACjB,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;AAC7B,CAAC;AAQD,SAAS,UAAU,CACjB,OAA2B;IAE3B,OAAO,CAAC,GAAG,IAAO,EAAO,EAAE,CACzB,CAAC,CAAM,EAAE,CAAM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