@antelopejs/core 0.2.0 → 0.3.0

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 (278) hide show
  1. package/dist/cli/common.js +1 -1
  2. package/dist/cli/common.js.map +1 -1
  3. package/dist/cli/config/get.js +3 -1
  4. package/dist/cli/config/get.js.map +1 -1
  5. package/dist/cli/config/reset.js +1 -1
  6. package/dist/cli/config/reset.js.map +1 -1
  7. package/dist/cli/config/set.js +1 -0
  8. package/dist/cli/config/set.js.map +1 -1
  9. package/dist/cli/git.d.ts +1 -0
  10. package/dist/cli/git.js +52 -1
  11. package/dist/cli/git.js.map +1 -1
  12. package/dist/cli/index.js +9 -0
  13. package/dist/cli/index.js.map +1 -1
  14. package/dist/cli/module/exports/generate.js +33 -58
  15. package/dist/cli/module/exports/generate.js.map +1 -1
  16. package/dist/cli/module/exports/set.js +1 -0
  17. package/dist/cli/module/exports/set.js.map +1 -1
  18. package/dist/cli/module/imports/add.js +2 -0
  19. package/dist/cli/module/imports/add.js.map +1 -1
  20. package/dist/cli/module/imports/install.js +4 -1
  21. package/dist/cli/module/imports/install.js.map +1 -1
  22. package/dist/cli/module/imports/list.js +2 -0
  23. package/dist/cli/module/imports/list.js.map +1 -1
  24. package/dist/cli/module/imports/remove.js +3 -0
  25. package/dist/cli/module/imports/remove.js.map +1 -1
  26. package/dist/cli/module/imports/update.js +5 -0
  27. package/dist/cli/module/imports/update.js.map +1 -1
  28. package/dist/cli/module/init.js +4 -1
  29. package/dist/cli/module/init.js.map +1 -1
  30. package/dist/cli/module/test.d.ts +5 -1
  31. package/dist/cli/module/test.js +8 -2
  32. package/dist/cli/module/test.js.map +1 -1
  33. package/dist/cli/project/init.js +3 -1
  34. package/dist/cli/project/init.js.map +1 -1
  35. package/dist/cli/project/logging/set.js +2 -0
  36. package/dist/cli/project/logging/set.js.map +1 -1
  37. package/dist/cli/project/logging/show.js +2 -1
  38. package/dist/cli/project/logging/show.js.map +1 -1
  39. package/dist/cli/project/modules/add.js +8 -3
  40. package/dist/cli/project/modules/add.js.map +1 -1
  41. package/dist/cli/project/modules/install.js +26 -13
  42. package/dist/cli/project/modules/install.js.map +1 -1
  43. package/dist/cli/project/modules/list.js +2 -1
  44. package/dist/cli/project/modules/list.js.map +1 -1
  45. package/dist/cli/project/modules/remove.js +3 -0
  46. package/dist/cli/project/modules/remove.js.map +1 -1
  47. package/dist/cli/project/modules/update.js +2 -0
  48. package/dist/cli/project/modules/update.js.map +1 -1
  49. package/dist/cli/project/run.js +3 -1
  50. package/dist/cli/project/run.js.map +1 -1
  51. package/dist/common/config.d.ts +5 -1
  52. package/dist/common/config.js.map +1 -1
  53. package/dist/common/downloader/git.js +58 -33
  54. package/dist/common/downloader/git.js.map +1 -1
  55. package/dist/common/downloader/index.d.ts +4 -1
  56. package/dist/common/downloader/index.js +4 -3
  57. package/dist/common/downloader/index.js.map +1 -1
  58. package/dist/common/downloader/local.js +20 -8
  59. package/dist/common/downloader/local.js.map +1 -1
  60. package/dist/common/downloader/package.js +12 -11
  61. package/dist/common/downloader/package.js.map +1 -1
  62. package/dist/common/manifest.d.ts +1 -1
  63. package/dist/common/manifest.js +2 -2
  64. package/dist/common/manifest.js.map +1 -1
  65. package/dist/index.d.ts +2 -1
  66. package/dist/index.js +39 -7
  67. package/dist/index.js.map +1 -1
  68. package/dist/interfaces/core/beta/index.d.ts +6 -2
  69. package/dist/interfaces/core/beta/index.js +33 -7
  70. package/dist/interfaces/core/beta/index.js.map +1 -1
  71. package/dist/interfaces/logging/beta/index.d.ts +16 -12
  72. package/dist/interfaces/logging/beta/index.js +26 -37
  73. package/dist/interfaces/logging/beta/index.js.map +1 -1
  74. package/dist/loader/index.js +47 -31
  75. package/dist/loader/index.js.map +1 -1
  76. package/dist/loader/module.js +6 -5
  77. package/dist/loader/module.js.map +1 -1
  78. package/dist/logging/index.d.ts +3 -5
  79. package/dist/logging/index.js +10 -200
  80. package/dist/logging/index.js.map +1 -1
  81. package/dist/logging/logger.d.ts +6 -0
  82. package/dist/logging/logger.js +132 -0
  83. package/dist/logging/logger.js.map +1 -0
  84. package/dist/logging/terminal-display.d.ts +16 -0
  85. package/dist/logging/terminal-display.js +100 -0
  86. package/dist/logging/terminal-display.js.map +1 -0
  87. package/dist/logging/utils.d.ts +21 -0
  88. package/dist/logging/utils.js +182 -0
  89. package/dist/logging/utils.js.map +1 -0
  90. package/dist/utils/cli-ui.d.ts +7 -3
  91. package/dist/utils/cli-ui.js +128 -56
  92. package/dist/utils/cli-ui.js.map +1 -1
  93. package/dist/utils/command.d.ts +1 -1
  94. package/dist/utils/command.js +4 -7
  95. package/dist/utils/command.js.map +1 -1
  96. package/dist/utils/package-manager.js +1 -1
  97. package/dist/utils/package-manager.js.map +1 -1
  98. package/package.json +6 -3
  99. package/dist/cli/package-manager.d.ts +0 -6
  100. package/dist/cli/package-manager.js +0 -99
  101. package/dist/cli/package-manager.js.map +0 -1
  102. package/dist/cli/project/modules/fix.d.ts +0 -2
  103. package/dist/cli/project/modules/fix.js +0 -201
  104. package/dist/cli/project/modules/fix.js.map +0 -1
  105. package/dist/eslint.config.d.mts +0 -2
  106. package/dist/eslint.config.mjs +0 -85
  107. package/dist/eslint.config.mjs.map +0 -1
  108. package/dist/interfaces/core/1/decorators.d.ts +0 -29
  109. package/dist/interfaces/core/1/decorators.js +0 -72
  110. package/dist/interfaces/core/1/decorators.js.map +0 -1
  111. package/dist/interfaces/core/1/index.d.ts +0 -54
  112. package/dist/interfaces/core/1/index.js +0 -237
  113. package/dist/interfaces/core/1/index.js.map +0 -1
  114. package/dist/interfaces/core/1/modules.d.ts +0 -26
  115. package/dist/interfaces/core/1/modules.js +0 -31
  116. package/dist/interfaces/core/1/modules.js.map +0 -1
  117. package/dist/interfaces/logging/1/index.d.ts +0 -16
  118. package/dist/interfaces/logging/1/index.js +0 -49
  119. package/dist/interfaces/logging/1/index.js.map +0 -1
  120. package/dist/interfaces/logging/1/listener.d.ts +0 -9
  121. package/dist/interfaces/logging/1/listener.js +0 -5
  122. package/dist/interfaces/logging/1/listener.js.map +0 -1
  123. package/dist/src/cli/common.d.ts +0 -18
  124. package/dist/src/cli/common.js +0 -105
  125. package/dist/src/cli/common.js.map +0 -1
  126. package/dist/src/cli/config/get.d.ts +0 -2
  127. package/dist/src/cli/config/get.js +0 -36
  128. package/dist/src/cli/config/get.js.map +0 -1
  129. package/dist/src/cli/config/index.d.ts +0 -2
  130. package/dist/src/cli/config/index.js +0 -20
  131. package/dist/src/cli/config/index.js.map +0 -1
  132. package/dist/src/cli/config/reset.d.ts +0 -2
  133. package/dist/src/cli/config/reset.js +0 -88
  134. package/dist/src/cli/config/reset.js.map +0 -1
  135. package/dist/src/cli/config/set.d.ts +0 -2
  136. package/dist/src/cli/config/set.js +0 -42
  137. package/dist/src/cli/config/set.js.map +0 -1
  138. package/dist/src/cli/config/show.d.ts +0 -2
  139. package/dist/src/cli/config/show.js +0 -27
  140. package/dist/src/cli/config/show.js.map +0 -1
  141. package/dist/src/cli/git.d.ts +0 -43
  142. package/dist/src/cli/git.js +0 -227
  143. package/dist/src/cli/git.js.map +0 -1
  144. package/dist/src/cli/index.d.ts +0 -2
  145. package/dist/src/cli/index.js +0 -43
  146. package/dist/src/cli/index.js.map +0 -1
  147. package/dist/src/cli/module/exports/generate.d.ts +0 -2
  148. package/dist/src/cli/module/exports/generate.js +0 -71
  149. package/dist/src/cli/module/exports/generate.js.map +0 -1
  150. package/dist/src/cli/module/exports/index.d.ts +0 -2
  151. package/dist/src/cli/module/exports/index.js +0 -16
  152. package/dist/src/cli/module/exports/index.js.map +0 -1
  153. package/dist/src/cli/module/exports/set.d.ts +0 -2
  154. package/dist/src/cli/module/exports/set.js +0 -43
  155. package/dist/src/cli/module/exports/set.js.map +0 -1
  156. package/dist/src/cli/module/imports/add.d.ts +0 -9
  157. package/dist/src/cli/module/imports/add.js +0 -98
  158. package/dist/src/cli/module/imports/add.js.map +0 -1
  159. package/dist/src/cli/module/imports/index.d.ts +0 -2
  160. package/dist/src/cli/module/imports/index.js +0 -20
  161. package/dist/src/cli/module/imports/index.js.map +0 -1
  162. package/dist/src/cli/module/imports/list.d.ts +0 -2
  163. package/dist/src/cli/module/imports/list.js +0 -89
  164. package/dist/src/cli/module/imports/list.js.map +0 -1
  165. package/dist/src/cli/module/imports/remove.d.ts +0 -2
  166. package/dist/src/cli/module/imports/remove.js +0 -97
  167. package/dist/src/cli/module/imports/remove.js.map +0 -1
  168. package/dist/src/cli/module/imports/update.d.ts +0 -2
  169. package/dist/src/cli/module/imports/update.js +0 -129
  170. package/dist/src/cli/module/imports/update.js.map +0 -1
  171. package/dist/src/cli/module/index.d.ts +0 -2
  172. package/dist/src/cli/module/index.js +0 -20
  173. package/dist/src/cli/module/index.js.map +0 -1
  174. package/dist/src/cli/module/init.d.ts +0 -7
  175. package/dist/src/cli/module/init.js +0 -136
  176. package/dist/src/cli/module/init.js.map +0 -1
  177. package/dist/src/cli/module/test.d.ts +0 -6
  178. package/dist/src/cli/module/test.js +0 -20
  179. package/dist/src/cli/module/test.js.map +0 -1
  180. package/dist/src/cli/project/index.d.ts +0 -2
  181. package/dist/src/cli/project/index.js +0 -20
  182. package/dist/src/cli/project/index.js.map +0 -1
  183. package/dist/src/cli/project/init.d.ts +0 -2
  184. package/dist/src/cli/project/init.js +0 -116
  185. package/dist/src/cli/project/init.js.map +0 -1
  186. package/dist/src/cli/project/logging/index.d.ts +0 -2
  187. package/dist/src/cli/project/logging/index.js +0 -16
  188. package/dist/src/cli/project/logging/index.js.map +0 -1
  189. package/dist/src/cli/project/logging/set.d.ts +0 -2
  190. package/dist/src/cli/project/logging/set.js +0 -353
  191. package/dist/src/cli/project/logging/set.js.map +0 -1
  192. package/dist/src/cli/project/logging/show.d.ts +0 -2
  193. package/dist/src/cli/project/logging/show.js +0 -93
  194. package/dist/src/cli/project/logging/show.js.map +0 -1
  195. package/dist/src/cli/project/modules/add.d.ts +0 -11
  196. package/dist/src/cli/project/modules/add.js +0 -161
  197. package/dist/src/cli/project/modules/add.js.map +0 -1
  198. package/dist/src/cli/project/modules/fix.d.ts +0 -2
  199. package/dist/src/cli/project/modules/fix.js +0 -224
  200. package/dist/src/cli/project/modules/fix.js.map +0 -1
  201. package/dist/src/cli/project/modules/index.d.ts +0 -2
  202. package/dist/src/cli/project/modules/index.js +0 -20
  203. package/dist/src/cli/project/modules/index.js.map +0 -1
  204. package/dist/src/cli/project/modules/remove.d.ts +0 -9
  205. package/dist/src/cli/project/modules/remove.js +0 -102
  206. package/dist/src/cli/project/modules/remove.js.map +0 -1
  207. package/dist/src/cli/project/modules/update.d.ts +0 -2
  208. package/dist/src/cli/project/modules/update.js +0 -117
  209. package/dist/src/cli/project/modules/update.js.map +0 -1
  210. package/dist/src/cli/project/run.d.ts +0 -2
  211. package/dist/src/cli/project/run.js +0 -60
  212. package/dist/src/cli/project/run.js.map +0 -1
  213. package/dist/src/common/cache.d.ts +0 -14
  214. package/dist/src/common/cache.js +0 -99
  215. package/dist/src/common/cache.js.map +0 -1
  216. package/dist/src/common/config.d.ts +0 -58
  217. package/dist/src/common/config.js +0 -159
  218. package/dist/src/common/config.js.map +0 -1
  219. package/dist/src/common/downloader/git.d.ts +0 -8
  220. package/dist/src/common/downloader/git.js +0 -64
  221. package/dist/src/common/downloader/git.js.map +0 -1
  222. package/dist/src/common/downloader/index.d.ts +0 -10
  223. package/dist/src/common/downloader/index.js +0 -50
  224. package/dist/src/common/downloader/index.js.map +0 -1
  225. package/dist/src/common/downloader/local.d.ts +0 -11
  226. package/dist/src/common/downloader/local.js +0 -39
  227. package/dist/src/common/downloader/local.js.map +0 -1
  228. package/dist/src/common/downloader/package.d.ts +0 -6
  229. package/dist/src/common/downloader/package.js +0 -79
  230. package/dist/src/common/downloader/package.js.map +0 -1
  231. package/dist/src/common/manifest.d.ts +0 -45
  232. package/dist/src/common/manifest.js +0 -114
  233. package/dist/src/common/manifest.js.map +0 -1
  234. package/dist/src/index.d.ts +0 -5
  235. package/dist/src/index.js +0 -117
  236. package/dist/src/index.js.map +0 -1
  237. package/dist/src/interfaces/core/1/decorators.d.ts +0 -29
  238. package/dist/src/interfaces/core/1/decorators.js +0 -72
  239. package/dist/src/interfaces/core/1/decorators.js.map +0 -1
  240. package/dist/src/interfaces/core/1/index.d.ts +0 -54
  241. package/dist/src/interfaces/core/1/index.js +0 -237
  242. package/dist/src/interfaces/core/1/index.js.map +0 -1
  243. package/dist/src/interfaces/core/1/modules.d.ts +0 -26
  244. package/dist/src/interfaces/core/1/modules.js +0 -31
  245. package/dist/src/interfaces/core/1/modules.js.map +0 -1
  246. package/dist/src/interfaces/logging/1/index.d.ts +0 -16
  247. package/dist/src/interfaces/logging/1/index.js +0 -49
  248. package/dist/src/interfaces/logging/1/index.js.map +0 -1
  249. package/dist/src/interfaces/logging/1/listener.d.ts +0 -9
  250. package/dist/src/interfaces/logging/1/listener.js +0 -5
  251. package/dist/src/interfaces/logging/1/listener.js.map +0 -1
  252. package/dist/src/loader/index.d.ts +0 -42
  253. package/dist/src/loader/index.js +0 -428
  254. package/dist/src/loader/index.js.map +0 -1
  255. package/dist/src/loader/module.d.ts +0 -29
  256. package/dist/src/loader/module.js +0 -139
  257. package/dist/src/loader/module.js.map +0 -1
  258. package/dist/src/logging/index.d.ts +0 -5
  259. package/dist/src/logging/index.js +0 -118
  260. package/dist/src/logging/index.js.map +0 -1
  261. package/dist/src/utils/cli-ui.d.ts +0 -34
  262. package/dist/src/utils/cli-ui.js +0 -173
  263. package/dist/src/utils/cli-ui.js.map +0 -1
  264. package/dist/src/utils/command.d.ts +0 -3
  265. package/dist/src/utils/command.js +0 -33
  266. package/dist/src/utils/command.js.map +0 -1
  267. package/dist/src/utils/object.d.ts +0 -2
  268. package/dist/src/utils/object.js +0 -26
  269. package/dist/src/utils/object.js.map +0 -1
  270. package/dist/src/utils/promise.d.ts +0 -3
  271. package/dist/src/utils/promise.js +0 -24
  272. package/dist/src/utils/promise.js.map +0 -1
  273. package/dist/utils/antelope-runner.d.ts +0 -1
  274. package/dist/utils/antelope-runner.js +0 -29
  275. package/dist/utils/antelope-runner.js.map +0 -1
  276. package/dist/utils/logger.d.ts +0 -5
  277. package/dist/utils/logger.js +0 -14
  278. package/dist/utils/logger.js.map +0 -1
@@ -1,45 +0,0 @@
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
- }
@@ -1,114 +0,0 @@
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
@@ -1 +0,0 @@
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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3
- }
4
- export declare function TestModule(moduleFolder?: string): Promise<void>;
5
- export default function (projectFolder?: string, env?: string, options?: LaunchOptions): Promise<void>;
package/dist/src/index.js DELETED
@@ -1,117 +0,0 @@
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
@@ -1 +0,0 @@
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,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACpD,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAC5C,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;YAC1B,OAAO,CAAC,IAAI,CAAC,GAAG;gBACd,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,eAAe,EAAE,CAAC,MAAM,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE;oBACxE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,E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AAM,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"}
@@ -1,29 +0,0 @@
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 {};
@@ -1,72 +0,0 @@
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
@@ -1 +0,0 @@
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;AAU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AAC,CAAC;AACvG,CAAC;AAUD,SAAgB,sBAAsB,CAAkB,OAAiD;IACvG,OAAO,UAAU,CAAgC,OAAO,CAAC,CAAC;AAC5D,CAAC;AAUD,SAAgB,8BAA8B,CAC5C,OAA4E;IAE5E,OAAO,UAAU,CAA2D,OAAO,CAAC,CAAC;AACvF,CAAC;AAUD,SAAgB,iCAAiC,CAC/C,OAAoE;IAEpE,OAAO,UAAU,CAAmD,OAAO,CAAC,CAAC;AAC/E,CAAC;AAUD,SAAgB,yCAAyC,CACvD,OAA+F;IAE/F,OAAO,UAAU,CAA8E,OAAO,CAAC,CAAC;AAC1G,CAAC;AAUD,SAAgB,+BAA+B,CAC7C,OAAkE;IAElE,OAAO,UAAU,CAAiD,OAAO,CAAC,CAAC;AAC7E,CAAC;AAUD,SAAgB,uCAAuC,CACrD,OAA6F;IAE7F,OAAO,UAAU,CAA4E,OAAO,CAAC,CAAC;AACxG,CAAC;AAUD,SAAgB,0CAA0C,CACxD,OAAqF;IAErF,OAAO,UAAU,CAAoE,OAAO,CAAC,CAAC;AAChG,CAAC;AAUD,SAAgB,kDAAkD,CAChE,OAAgH;IAEhH,OAAO,UAAU,CACf,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -1,54 +0,0 @@
1
- import 'reflect-metadata';
2
- import { Class } from './decorators';
3
- interface InterfaceConnection {
4
- id?: string;
5
- path: string;
6
- }
7
- type Func<A extends any[] = any[], R = any> = (...args: A) => R;
8
- export declare class AsyncProxy<T extends Func = Func, R = Awaited<ReturnType<T>>> {
9
- private callback?;
10
- private queue;
11
- onCall(callback: T, manualDetach?: boolean): void;
12
- detach(): void;
13
- call(...args: Parameters<T>): Promise<R>;
14
- }
15
- type RegisterFunction = (id: any, ...args: any[]) => void;
16
- type RID<T> = T extends (id: infer P, ...args: any[]) => void ? P : never;
17
- type RArgs<T> = T extends (id: any, ...args: infer P) => void ? P : never;
18
- export declare class RegisteringProxy<T extends RegisterFunction = RegisterFunction> {
19
- private registerCallback?;
20
- private unregisterCallback?;
21
- private registered;
22
- onRegister(callback: T, manualDetach?: boolean): void;
23
- onUnregister(callback: (id: RID<T>) => void): void;
24
- detach(): void;
25
- register(id: RID<T>, ...args: RArgs<T>): void;
26
- unregister(id: RID<T>): void;
27
- }
28
- type EventFunction = (...args: any[]) => void;
29
- export declare class EventProxy<T extends EventFunction = EventFunction> {
30
- private registered;
31
- constructor();
32
- emit(...args: Parameters<T>): void;
33
- register(func: T): void;
34
- unregister(fn: T): void;
35
- }
36
- export declare function GetResponsibleModule(ignoreInterfaces?: boolean, startFrame?: number): string | undefined;
37
- export declare function GetMetadata<T extends Record<string, any>, U extends Record<string, any>>(target: U, meta: Class<T, [U]> & {
38
- key: symbol;
39
- }, inherit?: boolean): T;
40
- export declare function InterfaceFunction<T extends Func = Func, R = Awaited<ReturnType<T>>>(): (...args: Parameters<T>) => Promise<R>;
41
- type InterfaceImplType<T> = T extends RegisteringProxy<infer P> ? {
42
- register: P;
43
- unregister: (id: RID<P>) => void;
44
- } : T extends EventProxy ? never : T extends (...args: any[]) => any ? T : T extends Record<string, any> ? InterfaceToImpl<T> : never;
45
- type InterfaceToImpl<T> = T extends infer P ? {
46
- [K in keyof P]?: InterfaceImplType<P[K]>;
47
- } : never;
48
- export declare function ImplementInterface<T, T2 = InterfaceToImpl<Awaited<T>>>(declaration: T, implementation: T2 | Promise<T2>): Promise<{
49
- declaration: Awaited<T>;
50
- implementation: T2;
51
- }>;
52
- export declare function GetInterfaceInstances(interfaceID: string): InterfaceConnection[];
53
- export declare function GetInterfaceInstance(interfaceID: string, connectionID: string): InterfaceConnection | undefined;
54
- export {};