@ts-for-gir/lib 3.0.0-beta.11 → 3.0.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 (248) hide show
  1. package/lib/conflict-resolver.d.ts +1 -0
  2. package/lib/conflict-resolver.js +20 -6
  3. package/lib/conflict-resolver.js.map +1 -1
  4. package/lib/constants.d.ts +7 -3
  5. package/lib/constants.js +14 -2
  6. package/lib/constants.js.map +1 -1
  7. package/lib/dependency-manager.d.ts +52 -3
  8. package/lib/dependency-manager.js +138 -18
  9. package/lib/dependency-manager.js.map +1 -1
  10. package/lib/gir-module.d.ts +12 -5
  11. package/lib/gir-module.js +52 -25
  12. package/lib/gir-module.js.map +1 -1
  13. package/lib/index.d.ts +3 -1
  14. package/lib/index.js +3 -1
  15. package/lib/index.js.map +1 -1
  16. package/lib/injection/classes/gjs/gio-2.0.d.ts +5 -0
  17. package/lib/injection/classes/gjs/gio-2.0.js +218 -0
  18. package/lib/injection/classes/gjs/gio-2.0.js.map +1 -0
  19. package/lib/injection/classes/gjs/glib-2.0.d.ts +2 -0
  20. package/lib/injection/classes/gjs/glib-2.0.js +205 -0
  21. package/lib/injection/classes/gjs/glib-2.0.js.map +1 -0
  22. package/lib/injection/classes/gjs/gobject-2.0.d.ts +2 -0
  23. package/lib/injection/classes/gjs/gobject-2.0.js +634 -0
  24. package/lib/injection/classes/gjs/gobject-2.0.js.map +1 -0
  25. package/lib/injection/classes/gjs/index.js +3 -3
  26. package/lib/injection/classes/glib-2.0.d.ts +2 -0
  27. package/lib/injection/classes/glib-2.0.js +35 -0
  28. package/lib/injection/classes/glib-2.0.js.map +1 -0
  29. package/lib/injection/classes/index.js +1 -1
  30. package/lib/injection/classes/node-gtk/gdk-4.0.d.ts +2 -0
  31. package/lib/injection/classes/node-gtk/gdk-4.0.js +32 -0
  32. package/lib/injection/classes/node-gtk/gdk-4.0.js.map +1 -0
  33. package/lib/injection/classes/node-gtk/gio-2.0.d.ts +2 -0
  34. package/lib/injection/classes/node-gtk/gio-2.0.js +14 -0
  35. package/lib/injection/classes/node-gtk/gio-2.0.js.map +1 -0
  36. package/lib/injection/classes/node-gtk/glib-2.0.d.ts +2 -0
  37. package/lib/injection/classes/node-gtk/glib-2.0.js +19 -0
  38. package/lib/injection/classes/node-gtk/glib-2.0.js.map +1 -0
  39. package/lib/injection/classes/node-gtk/gobject-2.0.d.ts +2 -0
  40. package/lib/injection/classes/node-gtk/gobject-2.0.js +66 -0
  41. package/lib/injection/classes/node-gtk/gobject-2.0.js.map +1 -0
  42. package/lib/injection/classes/node-gtk/graphene-1.0.d.ts +2 -0
  43. package/lib/injection/classes/node-gtk/graphene-1.0.js +133 -0
  44. package/lib/injection/classes/node-gtk/graphene-1.0.js.map +1 -0
  45. package/lib/injection/classes/node-gtk/gtk-3.0.d.ts +2 -0
  46. package/lib/injection/classes/node-gtk/gtk-3.0.js +31 -0
  47. package/lib/injection/classes/node-gtk/gtk-3.0.js.map +1 -0
  48. package/lib/injection/classes/node-gtk/gtk-4.0.d.ts +2 -0
  49. package/lib/injection/classes/node-gtk/gtk-4.0.js +52 -0
  50. package/lib/injection/classes/node-gtk/gtk-4.0.js.map +1 -0
  51. package/lib/injection/classes/node-gtk/index.js +8 -8
  52. package/lib/injection/classes/node-gtk/pango-1.0.d.ts +2 -0
  53. package/lib/injection/classes/node-gtk/pango-1.0.js +31 -0
  54. package/lib/injection/classes/node-gtk/pango-1.0.js.map +1 -0
  55. package/lib/library-version.d.ts +8 -0
  56. package/lib/library-version.js +32 -0
  57. package/lib/library-version.js.map +1 -0
  58. package/lib/messages.d.ts +0 -2
  59. package/lib/messages.js +1 -3
  60. package/lib/messages.js.map +1 -1
  61. package/lib/package-data-parser.d.ts +13 -0
  62. package/lib/package-data-parser.js +67 -0
  63. package/lib/package-data-parser.js.map +1 -0
  64. package/lib/package-data.d.ts +9 -0
  65. package/lib/package-data.js +41 -0
  66. package/lib/package-data.js.map +1 -0
  67. package/lib/symtable.js +2 -1
  68. package/lib/symtable.js.map +1 -1
  69. package/lib/template-processor.d.ts +59 -19
  70. package/lib/template-processor.js +128 -41
  71. package/lib/template-processor.js.map +1 -1
  72. package/lib/transformation.d.ts +52 -29
  73. package/lib/transformation.js +101 -73
  74. package/lib/transformation.js.map +1 -1
  75. package/lib/types/construct-name.d.ts +1 -1
  76. package/lib/types/dependency.d.ts +17 -2
  77. package/lib/types/generate-config.d.ts +9 -2
  78. package/lib/types/gir-callable-param-element.d.ts +7 -5
  79. package/lib/types/gir-direction.d.ts +3 -1
  80. package/lib/types/gir-direction.js +2 -0
  81. package/lib/types/gir-direction.js.map +1 -1
  82. package/lib/types/gir-instance-parameter.d.ts +2 -0
  83. package/lib/types/gir-property-element.d.ts +2 -0
  84. package/lib/types/gir-transfer-ownership.d.ts +5 -1
  85. package/lib/types/index.d.ts +5 -0
  86. package/lib/types/index.js +5 -0
  87. package/lib/types/index.js.map +1 -1
  88. package/lib/types/module-type.d.ts +1 -1
  89. package/lib/types/package-data-parsed.d.ts +28 -0
  90. package/lib/types/package-data-parsed.js +2 -0
  91. package/lib/types/package-data-parsed.js.map +1 -0
  92. package/lib/types/package-data.d.ts +23 -0
  93. package/lib/types/package-data.js +2 -0
  94. package/lib/types/package-data.js.map +1 -0
  95. package/lib/types/package-section-parsed.d.ts +8 -0
  96. package/lib/types/package-section-parsed.js +2 -0
  97. package/lib/types/package-section-parsed.js.map +1 -0
  98. package/lib/types/package-section.d.ts +8 -0
  99. package/lib/types/package-section.js +2 -0
  100. package/lib/types/package-section.js.map +1 -0
  101. package/lib/types/parsed-package-data.d.ts +6 -0
  102. package/lib/types/parsed-package-data.js +2 -0
  103. package/lib/types/parsed-package-data.js.map +1 -0
  104. package/lib/types/template-data.d.ts +7 -0
  105. package/lib/types/template-data.js +2 -0
  106. package/lib/types/template-data.js.map +1 -0
  107. package/lib/types/transformation-case.d.ts +1 -1
  108. package/lib/types/transformations.d.ts +1 -1
  109. package/lib/types/user-config.d.ts +6 -2
  110. package/lib/utils.d.ts +38 -17
  111. package/lib/utils.js +85 -33
  112. package/lib/utils.js.map +1 -1
  113. package/package.json +20 -19
  114. package/templates/README.md +102 -0
  115. package/templates/gjs/README-GJS.md +109 -0
  116. package/templates/gjs/ambient.d.ts +59 -0
  117. package/templates/gjs/cairo-1.0.d.ts +9 -0
  118. package/templates/gjs/cairo.d.ts +8 -0
  119. package/templates/gjs/cairo.js +11 -0
  120. package/templates/gjs/gettext.d.ts +41 -0
  121. package/templates/gjs/gettext.js +11 -0
  122. package/templates/{Gjs/Gio-2.0.d.ts → gjs/gio-2.0.d.ts} +1 -1
  123. package/templates/{Gjs/index.d.ts → gjs/gjs.d.ts} +221 -58
  124. package/templates/gjs/gjs.js +10 -0
  125. package/templates/{Gjs/GObject-2.0.d.ts → gjs/gobject-2.0.d.ts} +1 -1
  126. package/templates/gjs/module-ambient.d.ts +31 -0
  127. package/templates/gjs/module-import.d.ts +33 -0
  128. package/templates/gjs/module.append.d.ts +1 -0
  129. package/templates/gjs/module.d.ts +12 -0
  130. package/templates/gjs/module.js +17 -0
  131. package/templates/gjs/system.d.ts +32 -0
  132. package/templates/gjs/system.js +11 -0
  133. package/templates/gjs/tsconfig.alias.json +12 -0
  134. package/templates/node-gtk/README-NODE-GTK.md +71 -0
  135. package/templates/node-gtk/ambient.d.ts +19 -0
  136. package/templates/node-gtk/module-import.d.ts +29 -0
  137. package/templates/node-gtk/module.append.d.ts +1 -0
  138. package/templates/node-gtk/module.d.ts +4 -0
  139. package/templates/node-gtk/module.js +2 -1
  140. package/templates/node-gtk/node-gtk.d.ts +25 -0
  141. package/templates/node-gtk/{index.js → node-gtk.js} +0 -2
  142. package/templates/package.json +173 -0
  143. package/templates/tsconfig.doc.json +30 -0
  144. package/templates/Gjs/Gjs.d.ts +0 -204
  145. package/templates/Gjs/Gjs.js +0 -21
  146. package/templates/Gjs/GnomeShell.d.ts +0 -154
  147. package/templates/Gjs/GnomeShell.js +0 -10
  148. package/templates/Gjs/index.js +0 -4
  149. package/templates/Gjs/misc/dbusUtils.d.ts +0 -15
  150. package/templates/Gjs/misc/dbusUtils.js +0 -6
  151. package/templates/Gjs/misc/extensionUtils.d.ts +0 -99
  152. package/templates/Gjs/misc/extensionUtils.js +0 -6
  153. package/templates/Gjs/misc/fileUtils.d.ts +0 -51
  154. package/templates/Gjs/misc/fileUtils.js +0 -6
  155. package/templates/Gjs/misc/gnomeSession.d.ts +0 -74
  156. package/templates/Gjs/misc/gnomeSession.js +0 -6
  157. package/templates/Gjs/misc/parentalControlsManager.d.ts +0 -42
  158. package/templates/Gjs/misc/parentalControlsManager.js +0 -6
  159. package/templates/Gjs/misc/signals.d.ts +0 -15
  160. package/templates/Gjs/misc/signals.js +0 -6
  161. package/templates/Gjs/module.d.ts +0 -6
  162. package/templates/Gjs/module.js +0 -16
  163. package/templates/Gjs/tsconfig.alias.json +0 -10
  164. package/templates/Gjs/ui/accessDialog.d.ts +0 -19
  165. package/templates/Gjs/ui/accessDialog.js +0 -6
  166. package/templates/Gjs/ui/altTab.d.ts +0 -124
  167. package/templates/Gjs/ui/altTab.js +0 -6
  168. package/templates/Gjs/ui/animation.d.ts +0 -58
  169. package/templates/Gjs/ui/animation.js +0 -6
  170. package/templates/Gjs/ui/appDisplay.d.ts +0 -204
  171. package/templates/Gjs/ui/appDisplay.js +0 -6
  172. package/templates/Gjs/ui/appFavorites.d.ts +0 -34
  173. package/templates/Gjs/ui/appFavorites.js +0 -6
  174. package/templates/Gjs/ui/appMenu.d.ts +0 -74
  175. package/templates/Gjs/ui/appMenu.js +0 -6
  176. package/templates/Gjs/ui/audioDeviceSelection.d.ts +0 -51
  177. package/templates/Gjs/ui/audioDeviceSelection.js +0 -6
  178. package/templates/Gjs/ui/background.d.ts +0 -255
  179. package/templates/Gjs/ui/background.js +0 -5
  180. package/templates/Gjs/ui/backgroundMenu.d.ts +0 -19
  181. package/templates/Gjs/ui/backgroundMenu.js +0 -5
  182. package/templates/Gjs/ui/barLevel.d.ts +0 -42
  183. package/templates/Gjs/ui/barLevel.js +0 -5
  184. package/templates/Gjs/ui/boxpointer.d.ts +0 -103
  185. package/templates/Gjs/ui/boxpointer.js +0 -5
  186. package/templates/Gjs/ui/calendar.d.ts +0 -261
  187. package/templates/Gjs/ui/calendar.js +0 -5
  188. package/templates/Gjs/ui/checkBox.d.ts +0 -22
  189. package/templates/Gjs/ui/checkBox.js +0 -5
  190. package/templates/Gjs/ui/closeDialog.d.ts +0 -40
  191. package/templates/Gjs/ui/closeDialog.js +0 -5
  192. package/templates/Gjs/ui/components/__init__.d.ts +0 -9
  193. package/templates/Gjs/ui/components/__init__.js +0 -6
  194. package/templates/Gjs/ui/components/automountManager.d.ts +0 -8
  195. package/templates/Gjs/ui/components/automountManager.js +0 -6
  196. package/templates/Gjs/ui/components/autorunManager.d.ts +0 -8
  197. package/templates/Gjs/ui/components/autorunManager.js +0 -6
  198. package/templates/Gjs/ui/components/index.d.ts +0 -6
  199. package/templates/Gjs/ui/components/index.js +0 -6
  200. package/templates/Gjs/ui/components/keyring.d.ts +0 -19
  201. package/templates/Gjs/ui/components/keyring.js +0 -6
  202. package/templates/Gjs/ui/components/networkAgent.d.ts +0 -10
  203. package/templates/Gjs/ui/components/networkAgent.js +0 -6
  204. package/templates/Gjs/ui/components/polkitAgent.d.ts +0 -19
  205. package/templates/Gjs/ui/components/polkitAgent.js +0 -6
  206. package/templates/Gjs/ui/components/telepathyClient.d.ts +0 -10
  207. package/templates/Gjs/ui/components/telepathyClient.js +0 -6
  208. package/templates/Gjs/ui/dialog.d.ts +0 -78
  209. package/templates/Gjs/ui/dialog.js +0 -6
  210. package/templates/Gjs/ui/dnd.d.ts +0 -127
  211. package/templates/Gjs/ui/dnd.js +0 -6
  212. package/templates/Gjs/ui/iconGrid.d.ts +0 -172
  213. package/templates/Gjs/ui/iconGrid.js +0 -6
  214. package/templates/Gjs/ui/layout.d.ts +0 -311
  215. package/templates/Gjs/ui/layout.js +0 -6
  216. package/templates/Gjs/ui/main.d.ts +0 -215
  217. package/templates/Gjs/ui/main.js +0 -6
  218. package/templates/Gjs/ui/messageList.d.ts +0 -113
  219. package/templates/Gjs/ui/messageList.js +0 -6
  220. package/templates/Gjs/ui/messageTray.d.ts +0 -423
  221. package/templates/Gjs/ui/messageTray.js +0 -6
  222. package/templates/Gjs/ui/modalDialog.d.ts +0 -96
  223. package/templates/Gjs/ui/modalDialog.js +0 -6
  224. package/templates/Gjs/ui/mpris.d.ts +0 -78
  225. package/templates/Gjs/ui/mpris.js +0 -6
  226. package/templates/Gjs/ui/notificationDaemon.d.ts +0 -5
  227. package/templates/Gjs/ui/notificationDaemon.js +0 -6
  228. package/templates/Gjs/ui/panel.d.ts +0 -65
  229. package/templates/Gjs/ui/panel.js +0 -6
  230. package/templates/Gjs/ui/panelMenu.d.ts +0 -51
  231. package/templates/Gjs/ui/panelMenu.js +0 -6
  232. package/templates/Gjs/ui/popupMenu.d.ts +0 -228
  233. package/templates/Gjs/ui/popupMenu.js +0 -6
  234. package/templates/Gjs/ui/ripples.d.ts +0 -44
  235. package/templates/Gjs/ui/ripples.js +0 -6
  236. package/templates/Gjs/ui/search.d.ts +0 -158
  237. package/templates/Gjs/ui/search.js +0 -6
  238. package/templates/Gjs/ui/switcherPopup.d.ts +0 -107
  239. package/templates/Gjs/ui/switcherPopup.js +0 -6
  240. package/templates/Gjs/ui/userWidget.d.ts +0 -13
  241. package/templates/Gjs/ui/userWidget.js +0 -6
  242. package/templates/node-gtk/index.d.ts +0 -40
  243. /package/templates/{Cogl-2.0.d.ts → cogl-2-0.d.ts} +0 -0
  244. /package/templates/{Granite-1.0.d.ts → granite-1.0.d.ts} +0 -0
  245. /package/templates/{Granite-7.0.d.ts → granite-7.0.d.ts} +0 -0
  246. /package/templates/{GstBase-0.10.d.ts → gstbase-0.10.d.ts} +0 -0
  247. /package/templates/node-gtk/{GObject-2.0.d.ts → gobject-2.0.d.ts} +0 -0
  248. /package/templates/{RygelServer-2.6.d.ts → rygelserver-2.6.d.ts} +0 -0
@@ -0,0 +1,67 @@
1
+ import { parseStringPromise } from 'xml2js';
2
+ import { readFile } from 'fs/promises';
3
+ import { resolve } from 'path';
4
+ import { Logger } from './logger.js';
5
+ import { __dirname, splitModuleName, cleanString } from './utils.js';
6
+ export class PackageDataParser {
7
+ config;
8
+ log;
9
+ packages = [];
10
+ constructor(config) {
11
+ this.config = config;
12
+ this.log = new Logger('', config.verbose, 'ModuleLoader');
13
+ }
14
+ get(name) {
15
+ return this.packages.find((pkg) => pkg.gir === name);
16
+ }
17
+ parseSections(sections) {
18
+ for (const section of sections) {
19
+ this.log.log(`Found section`, section.$.name);
20
+ if (section.package) {
21
+ this.parsePackages(section.package);
22
+ }
23
+ if (section.section) {
24
+ this.parseSections(section.section);
25
+ }
26
+ }
27
+ }
28
+ transformPackageData(pkg, parentSection) {
29
+ const { gir, home, gallery, 'c-docs': cDocs, deprecated, maintainers, maintainer } = pkg.$;
30
+ const description = cleanString(pkg._);
31
+ if (!gir) {
32
+ throw new Error(`No gir name specified for package "${pkg.$.name}"`);
33
+ }
34
+ const { namespace, version } = splitModuleName(gir);
35
+ const trans = {
36
+ description,
37
+ namespace,
38
+ version,
39
+ gir,
40
+ home,
41
+ gallery,
42
+ cDocs,
43
+ deprecated: deprecated === 'true',
44
+ maintainers: maintainers || maintainer,
45
+ section: parentSection,
46
+ };
47
+ return trans;
48
+ }
49
+ parsePackages(packages, parentSection) {
50
+ for (const pkg of packages) {
51
+ this.log.log(`Found package "${pkg.$.name}"`);
52
+ if (pkg.$.ignore === 'true' || !pkg.$.gir) {
53
+ this.log.warn(`Ignoring package "${pkg.$.name}"`);
54
+ continue;
55
+ }
56
+ const transPgk = this.transformPackageData(pkg, parentSection);
57
+ this.packages.push(transPgk);
58
+ }
59
+ }
60
+ async start() {
61
+ this.log.log(`Parsing package.xml...`);
62
+ const fileContents = await readFile(resolve(__dirname, '../packages.xml'), 'utf8');
63
+ const result = (await parseStringPromise(fileContents));
64
+ this.parseSections(result.packages.section);
65
+ }
66
+ }
67
+ //# sourceMappingURL=package-data-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-data-parser.js","sourceRoot":"","sources":["../src/package-data-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAUpE,MAAM,OAAO,iBAAiB;IAIK;IAHrB,GAAG,CAAQ;IACX,QAAQ,GAAkB,EAAE,CAAA;IAEtC,YAA+B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QACjD,IAAI,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;IAC7D,CAAC;IAEM,GAAG,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,IAAI,CAAC,CAAA;IACxD,CAAC;IAES,aAAa,CAAC,QAAgC;QACpD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YAC7C,IAAI,OAAO,CAAC,OAAO,EAAE;gBACjB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;aACtC;YAED,IAAI,OAAO,CAAC,OAAO,EAAE;gBACjB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;aACtC;SACJ;IACL,CAAC;IAES,oBAAoB,CAAC,GAAsB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AC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACtC,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAA;QAClF,MAAM,MAAM,GAAG,CAAC,MAAM,kBAAkB,CAAC,YAAY,CAAC,CAAsB,CAAA;QAC5E,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACJ"}
@@ -0,0 +1,9 @@
1
+ import { Logger } from './logger.js';
2
+ import type { GenerateConfig, PackageSection } from './types/index.js';
3
+ export declare class PackageData {
4
+ protected readonly config: GenerateConfig;
5
+ log: Logger;
6
+ constructor(config: GenerateConfig);
7
+ start(): Promise<void>;
8
+ parseSections(sections: PackageSection[]): Promise<void>;
9
+ }
@@ -0,0 +1,41 @@
1
+ import { parseStringPromise } from 'xml2js';
2
+ import { readFile } from 'fs/promises';
3
+ import { resolve } from 'path';
4
+ import { Logger } from './logger.js';
5
+ import { __dirname } from './utils.js';
6
+ export class PackageDataParser {
7
+ config;
8
+ log;
9
+ constructor(config) {
10
+ this.config = config;
11
+ this.log = new Logger('', config.verbose || true, 'ModuleLoader');
12
+ }
13
+ async start() {
14
+ this.log.log(`Parsing package.xml...`);
15
+ const fileContents = await readFile(resolve(__dirname, '../packages.xml'), 'utf8');
16
+ const result = (await parseStringPromise(fileContents));
17
+ this.log.log(`Parsed package.xml`, result.packages.section);
18
+ this.parseSections(result.packages.section);
19
+ }
20
+ async parseSections(sections) {
21
+ for (const section of sections) {
22
+ this.log.log(`Found package section`, section.$.name);
23
+ if (section.package) {
24
+ for (const pkg of section.package) {
25
+ this.log.log(`Found package`, pkg.$.name);
26
+ }
27
+ }
28
+ if (section.section) {
29
+ this.parseSections(section.section);
30
+ }
31
+ }
32
+ }
33
+ async parsePackages(packages) {
34
+ for (const key in data) {
35
+ if (Object.prototype.hasOwnProperty.call(data, key)) {
36
+ const element = data[key];
37
+ }
38
+ }
39
+ }
40
+ }
41
+ //# sourceMappingURL=package-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-data.js","sourceRoot":"","sources":["../src/package-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAItC,MAAM,OAAO,iBAAiB;IAEK;IAD/B,GAAG,CAAQ;IACX,YAA+B,MAAsB;QAAtB,WAAM,GAAN,MAAM,CAAgB;QACjD,IAAI,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE,cAAc,CAAC,CAAA;IACrE,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;QACtC,MAAM,YAAY,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAA;QAClF,MAAM,MAAM,GAAG,CAAC,MAAM,kBAAkB,CAAC,YAAY,CAAC,CAAsB,CAAA;QAC5E,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAoB,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3D,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAE/C,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAA0B;QAC1C,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;YACrD,IAAG,OAAO,CAAC,OAAO,EAAE;gBAChB,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE;oBAC/B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;iBAC5C;aACJ;YAED,IAAG,OAAO,CAAC,OAAO,EAAE;gBAChB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;aACtC;SAEJ;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,QAAuB;QACvC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACpB,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE;gBACjD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;aAE7B;SACJ;IACL,CAAC;CACJ"}
package/lib/symtable.js CHANGED
@@ -3,7 +3,7 @@ import { WARN_NOT_FOUND_PACKAGE_NAME } from './messages.js';
3
3
  /**
4
4
  * The SymTable is used to get any Type from any dependency to compare or to get information from
5
5
  */
6
- export class SymTable {
6
+ class SymTable {
7
7
  config;
8
8
  modPackageName;
9
9
  modNamespace;
@@ -60,4 +60,5 @@ export class SymTable {
60
60
  }
61
61
  }
62
62
  }
63
+ export { SymTable };
63
64
  //# sourceMappingURL=symtable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"symtable.js","sourceRoot":"","sources":["../src/symtable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAA;AAE3D;;GAEG;AACH,MAAM,OAAO,QAAQ;IAQI;IACA;IACA;IATrB;;OAEG;IACK,MAAM,CAAC,KAAK,GAAkB,E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AAK,CAAC,GAAG,CAAC,EAAE;YAC9B,OAAO,IAAI,CAAA;SACd;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAA;QAC1C,OAAO,MAAkB,CAAA;IAC7B,CAAC;IAEM,SAAS,CAAoB,GAAW;QAC3C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAwB,CAAA;IAC/D,CAAC;IAEM,GAAG,CAAC,YAA0B,EAAE,YAAoB,EAAE,UAAyB;QAClF,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;QACnD,IAAI,GAAG,EAAE;YACL,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,CAAA;SACnC;IACL,CAAC;;SA/DQ,QAAQ"}
@@ -4,49 +4,89 @@
4
4
  */
5
5
  import ejs from 'ejs';
6
6
  import { Logger } from './logger.js';
7
- import type { GenerateConfig } from './types/index.js';
7
+ import { Transformation } from './transformation.js';
8
+ import type { GenerateConfig, Dependency, TemplateData, Environment } from './types/index.js';
8
9
  export declare class TemplateProcessor {
9
- protected readonly data: ejs.Data | undefined;
10
+ protected readonly data: TemplateData | undefined;
10
11
  protected readonly packageName: string;
12
+ protected readonly deps: Dependency[];
11
13
  protected readonly config: GenerateConfig;
12
14
  protected environmentTemplateDir: string;
13
15
  protected log: Logger;
14
- constructor(data: ejs.Data | undefined, packageName: string, config: GenerateConfig);
16
+ protected transformation: Transformation;
17
+ constructor(data: TemplateData | undefined, packageName: string, deps: Dependency[], config: GenerateConfig);
18
+ /**
19
+ * Get the output or input directory of the environment
20
+ * @param environment The environment to get the directory for
21
+ * @param baseDir The base directory
22
+ * @returns The path to the directory
23
+ */
24
+ protected getEnvironmentDir: (environment: Environment, baseDir: string) => string;
25
+ protected getAppendTemplateName(templateFilename: string): string;
15
26
  /**
16
27
  * Loads and renders a template and gets the rendered templates back
17
28
  * @param templateFilename
18
29
  */
19
- load(templateFilename: string): Promise<string>;
30
+ load(templateFilename: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
31
+ prepend: string;
32
+ append: string;
33
+ }>;
20
34
  /**
21
35
  * Loads and renders all templates in a directory and gets the rendered templates back
22
36
  * @param templateDirname
37
+ * @param fileExtension
38
+ * @param options EJS options
39
+ * @param overrideTemplateData Override template data if you want
40
+ * @returns The rendered templates
23
41
  */
24
- loadAll(templateDirname: string, fileExtension: string): Promise<{
42
+ loadAll(templateDirname: string, fileExtension: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
25
43
  [path: string]: string;
26
44
  }>;
27
45
  /**
28
46
  * Loads an template, render the template and write the template to the filesystem
29
- * @param templateFilename
30
- * @param outputDir
31
- * @param outputFilename
32
- * @param append
33
- * @param prependEnv
34
- * @return The rendered (and if possible prettified) template string
47
+ * @param templateFilename The filename of the template
48
+ * @param baseOutputPath The base output directory path where the templates should be written to
49
+ * @param outputFilename The filename of the output file
50
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
51
+ * @param content A (optional) string that should be appended to the rendered template
52
+ * @param options EJS options
53
+ * @param overrideTemplateData Override template data if you want
54
+ * @return The rendered template string
35
55
  */
36
- create(templateFilename: string, outputDir: string, outputFilename: string, append?: string, prependEnv?: boolean): Promise<string>;
56
+ create(templateFilename: string, baseOutputPath: string, outputFilename: string, prependEnv?: boolean, content?: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<string>;
37
57
  /**
38
58
  * Loads all templates with file extension in dir, render the templates and write the template to the filesystem
39
- * @param fileExtension
40
- * @param templateDirname
41
- * @param outputDir
42
- * @param outputDirname
59
+ * @param fileExtension The file extension of the templates
60
+ * @param templateDirname The directory where the templates are located
61
+ * @param baseOutputPath The base output directory path where the templates should be written to
62
+ * @param outputDirname The child output directory of the base output directory where the templates should be written to
63
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
64
+ * @param append A (optional) string that should be appended to the rendered template
65
+ * @param options EJS options
66
+ * @param overrideTemplateData Override template data if you want
43
67
  * @return The rendered (and if possible prettified) templates
44
68
  */
45
- createAll(fileExtension: string, templateDirname: string, outputDir: string, outputDirname: string, append?: string): Promise<{
69
+ createAll(fileExtension: string, templateDirname: string, baseOutputPath: string, outputDirname: string, prependEnv?: boolean, append?: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<{
46
70
  [path: string]: string;
47
71
  }>;
48
- protected write(content: string, outputDir: string, outputFilename: string, prependEnv?: boolean): Promise<string>;
49
- protected render(templateString: string, options?: Partial<ejs.Options>): Promise<string>;
72
+ getOutputPath(baseOutputPath: string, outputFilename: string, prependEnv?: boolean): string;
73
+ /**
74
+ * Writes the `content` to the filesystem
75
+ * @param content The content (normally the content of a rendered template file) that should be written to the filesystem
76
+ * @param baseOutputPath The base output directory path where the templates should be written to
77
+ * @param outputFilename The filename of the output file
78
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
79
+ * @returns
80
+ */
81
+ protected write(content: string, baseOutputPath: string, outputFilename: string, prependEnv?: boolean): Promise<string>;
82
+ /**
83
+ *
84
+ * @param templateString The template content string that should be rendered
85
+ * @param options EJS options
86
+ * @param overrideTemplateData Override template data if you want
87
+ * @returns
88
+ */
89
+ protected render(templateString: string, options?: Partial<ejs.Options>, overrideTemplateData?: TemplateData): Promise<string>;
50
90
  /**
51
91
  * Checks if the template file or directory exists and returns the path if found
52
92
  * Tries first to load the file / directory from the environment-specific template folder and otherwise looks for it in the general template folder
@@ -4,100 +4,186 @@
4
4
  */
5
5
  import { existsSync } from 'fs';
6
6
  import { readFile, writeFile, mkdir, readdir } from 'fs/promises';
7
- import Path from 'path';
7
+ import { join, dirname, relative, extname } from 'path';
8
8
  import ejs from 'ejs';
9
9
  import { Logger } from './logger.js';
10
- import { APP_NAME, APP_USAGE, APP_SOURCE } from './constants.js';
11
- import { __dirname, getEnvironmentDir, getDestPath } from './utils.js';
10
+ import { APP_NAME, APP_USAGE, APP_SOURCE, APP_VERSION, PACKAGE_DESC, PACKAGE_KEYWORDS } from './constants.js';
11
+ import { __dirname, getDestPath } from './utils.js';
12
12
  import { DependencyManager } from './dependency-manager.js';
13
- const TEMPLATE_DIR = Path.join(__dirname, '../templates');
13
+ import { Transformation } from './transformation.js';
14
+ const TEMPLATE_DIR = join(__dirname, '../templates');
14
15
  export class TemplateProcessor {
15
16
  data;
16
17
  packageName;
18
+ deps;
17
19
  config;
18
20
  environmentTemplateDir;
19
21
  log;
20
- constructor(data, packageName, config) {
22
+ transformation;
23
+ constructor(data, packageName, deps, config) {
21
24
  this.data = data;
22
25
  this.packageName = packageName;
26
+ this.deps = deps;
23
27
  this.config = config;
28
+ this.transformation = new Transformation(config);
24
29
  const dep = DependencyManager.getInstance(config);
30
+ let outdir = config.outdir || './';
31
+ // Make outdir relative to the root directory
32
+ outdir = relative(config.root, outdir);
33
+ const typeDir = getDestPath(outdir);
25
34
  this.data = {
26
35
  ...this.data,
27
36
  APP_NAME,
28
37
  APP_USAGE,
29
38
  APP_SOURCE,
39
+ APP_VERSION,
40
+ PACKAGE_DESC: PACKAGE_DESC(packageName, this.config.environment, this.data?.girModule?.libraryVersion),
41
+ PACKAGE_KEYWORDS: PACKAGE_KEYWORDS(packageName, this.config.environment),
42
+ importName: this.transformation.transformImportName(packageName),
30
43
  dep,
44
+ deps,
45
+ typeDir,
46
+ join,
47
+ dirname,
31
48
  };
32
- this.environmentTemplateDir = getEnvironmentDir(config.environment, TEMPLATE_DIR);
49
+ this.environmentTemplateDir = this.getEnvironmentDir(config.environment, TEMPLATE_DIR);
33
50
  this.log = new Logger(config.environment, config.verbose, this.packageName);
34
51
  }
52
+ /**
53
+ * Get the output or input directory of the environment
54
+ * @param environment The environment to get the directory for
55
+ * @param baseDir The base directory
56
+ * @returns The path to the directory
57
+ */
58
+ getEnvironmentDir = (environment, baseDir) => {
59
+ if (!baseDir.endsWith(environment))
60
+ if (environment === 'gjs' && !baseDir.endsWith('/gjs')) {
61
+ return join(baseDir, 'gjs');
62
+ }
63
+ if (environment === 'node' && !baseDir.endsWith('/node-gtk')) {
64
+ return join(baseDir, 'node-gtk');
65
+ }
66
+ return baseDir;
67
+ };
68
+ getAppendTemplateName(templateFilename) {
69
+ let appendTemplateFilename = templateFilename;
70
+ if (appendTemplateFilename.endsWith('.d.ts')) {
71
+ appendTemplateFilename = appendTemplateFilename.replace('.d.ts', '.append.d.ts');
72
+ }
73
+ else if (extname(appendTemplateFilename)) {
74
+ const ext = extname(appendTemplateFilename);
75
+ appendTemplateFilename = appendTemplateFilename.replace(ext, '.append' + ext);
76
+ }
77
+ else {
78
+ appendTemplateFilename += '.append';
79
+ }
80
+ return appendTemplateFilename;
81
+ }
35
82
  /**
36
83
  * Loads and renders a template and gets the rendered templates back
37
84
  * @param templateFilename
38
85
  */
39
- async load(templateFilename) {
86
+ async load(templateFilename, options = {}, overrideTemplateData = {}) {
40
87
  const fileContent = await this.read(templateFilename);
41
- return await this.render(fileContent);
88
+ const prepend = await this.render(fileContent, options, overrideTemplateData);
89
+ let append = '';
90
+ const appendTemplateFilename = this.getAppendTemplateName(templateFilename);
91
+ if (this.exists(appendTemplateFilename)) {
92
+ const appendFileContent = await this.read(appendTemplateFilename);
93
+ append = await this.render(appendFileContent, options, overrideTemplateData);
94
+ }
95
+ return { prepend, append };
42
96
  }
43
97
  /**
44
98
  * Loads and renders all templates in a directory and gets the rendered templates back
45
99
  * @param templateDirname
100
+ * @param fileExtension
101
+ * @param options EJS options
102
+ * @param overrideTemplateData Override template data if you want
103
+ * @returns The rendered templates
46
104
  */
47
- async loadAll(templateDirname, fileExtension) {
105
+ async loadAll(templateDirname, fileExtension, options = {}, overrideTemplateData = {}) {
48
106
  const fileContents = await this.readAll(templateDirname, fileExtension);
49
107
  for (const file of Object.keys(fileContents)) {
50
- fileContents[file] = await this.render(fileContents[file]);
108
+ fileContents[file] = await this.render(fileContents[file], options, overrideTemplateData);
51
109
  }
52
110
  return fileContents;
53
111
  }
54
112
  /**
55
113
  * Loads an template, render the template and write the template to the filesystem
56
- * @param templateFilename
57
- * @param outputDir
58
- * @param outputFilename
59
- * @param append
60
- * @param prependEnv
61
- * @return The rendered (and if possible prettified) template string
114
+ * @param templateFilename The filename of the template
115
+ * @param baseOutputPath The base output directory path where the templates should be written to
116
+ * @param outputFilename The filename of the output file
117
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
118
+ * @param content A (optional) string that should be appended to the rendered template
119
+ * @param options EJS options
120
+ * @param overrideTemplateData Override template data if you want
121
+ * @return The rendered template string
62
122
  */
63
- async create(templateFilename, outputDir, outputFilename, append = '', prependEnv = true) {
64
- const renderedTpl = await this.load(templateFilename);
65
- const code = renderedTpl + append;
66
- await this.write(code, outputDir, outputFilename, prependEnv);
123
+ async create(templateFilename, baseOutputPath, outputFilename, prependEnv = true, content = '', options = {}, overrideTemplateData = {}) {
124
+ const { prepend, append } = await this.load(templateFilename, options, overrideTemplateData);
125
+ const code = prepend + '\n' + content + '\n' + append;
126
+ await this.write(code, baseOutputPath, outputFilename, prependEnv);
67
127
  return code;
68
128
  }
69
129
  /**
70
130
  * Loads all templates with file extension in dir, render the templates and write the template to the filesystem
71
- * @param fileExtension
72
- * @param templateDirname
73
- * @param outputDir
74
- * @param outputDirname
131
+ * @param fileExtension The file extension of the templates
132
+ * @param templateDirname The directory where the templates are located
133
+ * @param baseOutputPath The base output directory path where the templates should be written to
134
+ * @param outputDirname The child output directory of the base output directory where the templates should be written to
135
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
136
+ * @param append A (optional) string that should be appended to the rendered template
137
+ * @param options EJS options
138
+ * @param overrideTemplateData Override template data if you want
75
139
  * @return The rendered (and if possible prettified) templates
76
140
  */
77
- async createAll(fileExtension, templateDirname, outputDir, outputDirname, append = '') {
78
- const renderedTpls = await this.loadAll(templateDirname, fileExtension);
141
+ async createAll(fileExtension, templateDirname, baseOutputPath, outputDirname, prependEnv = true, append = '', options = {}, overrideTemplateData = {}) {
142
+ const rendered = await this.loadAll(templateDirname, fileExtension, options, overrideTemplateData);
79
143
  const result = {};
80
- for (const filename of Object.keys(renderedTpls)) {
81
- const destPath = getDestPath(this.config.environment, outputDir, outputDirname, filename);
82
- result[destPath] = renderedTpls[filename] + append;
83
- await this.write(result[destPath], outputDir, Path.join(outputDirname, filename));
144
+ for (const filename of Object.keys(rendered)) {
145
+ const destPath = getDestPath(baseOutputPath, outputDirname, filename);
146
+ result[destPath] = rendered[filename] + '\n' + append;
147
+ await this.write(result[destPath], baseOutputPath, join(outputDirname, filename), prependEnv);
84
148
  }
85
149
  return result;
86
150
  }
87
- async write(content, outputDir, outputFilename, prependEnv = true) {
88
- const destPath = prependEnv
89
- ? getDestPath(this.config.environment, outputDir, outputFilename)
90
- : Path.join(outputDir, outputFilename);
151
+ getOutputPath(baseOutputPath, outputFilename, prependEnv = true) {
152
+ const filePath = this.config.package
153
+ ? join(this.data?.importName || this.packageName, outputFilename)
154
+ : outputFilename;
155
+ const outputPath = prependEnv ? getDestPath(baseOutputPath, filePath) : join(baseOutputPath, filePath);
156
+ return outputPath;
157
+ }
158
+ /**
159
+ * Writes the `content` to the filesystem
160
+ * @param content The content (normally the content of a rendered template file) that should be written to the filesystem
161
+ * @param baseOutputPath The base output directory path where the templates should be written to
162
+ * @param outputFilename The filename of the output file
163
+ * @param prependEnv A (optional) boolean that indicates if the environment should be prepended to the output path
164
+ * @returns
165
+ */
166
+ async write(content, baseOutputPath, outputFilename, prependEnv = true) {
167
+ const outputPath = this.getOutputPath(baseOutputPath, outputFilename, prependEnv);
91
168
  // write template result file
92
- await mkdir(Path.dirname(destPath), { recursive: true });
93
- await writeFile(destPath, content, { encoding: 'utf8', flag: 'w' });
94
- return Promise.resolve(destPath);
169
+ await mkdir(dirname(outputPath), { recursive: true });
170
+ await writeFile(outputPath, content, { encoding: 'utf8', flag: 'w' });
171
+ return Promise.resolve(outputPath);
95
172
  }
96
- async render(templateString, options = {}) {
173
+ /**
174
+ *
175
+ * @param templateString The template content string that should be rendered
176
+ * @param options EJS options
177
+ * @param overrideTemplateData Override template data if you want
178
+ * @returns
179
+ */
180
+ async render(templateString, options = {}, overrideTemplateData = {}) {
97
181
  try {
98
182
  const renderedTpl = await ejs.render(templateString, {
99
183
  ...this.config,
100
184
  ...this.data,
185
+ packageName: this.packageName,
186
+ ...overrideTemplateData,
101
187
  }, {
102
188
  async: true,
103
189
  ...options,
@@ -105,6 +191,7 @@ export class TemplateProcessor {
105
191
  return renderedTpl;
106
192
  }
107
193
  catch (error) {
194
+ console.error(error);
108
195
  this.log.error('Error on render', error);
109
196
  return '';
110
197
  }
@@ -115,8 +202,8 @@ export class TemplateProcessor {
115
202
  * @param templateFilename
116
203
  */
117
204
  exists(templateFilename) {
118
- const fullEnvironmentTemplatePath = Path.join(this.environmentTemplateDir, templateFilename);
119
- const fullGeneralTemplatePath = Path.join(TEMPLATE_DIR, templateFilename);
205
+ const fullEnvironmentTemplatePath = join(this.environmentTemplateDir, templateFilename);
206
+ const fullGeneralTemplatePath = join(TEMPLATE_DIR, templateFilename);
120
207
  if (existsSync(fullEnvironmentTemplatePath)) {
121
208
  return fullEnvironmentTemplatePath;
122
209
  }
@@ -154,7 +241,7 @@ export class TemplateProcessor {
154
241
  }
155
242
  const results = {};
156
243
  for (const file of files) {
157
- results[file] = await readFile(Path.join(path, file), 'utf8');
244
+ results[file] = await readFile(join(path, file), 'utf8');
158
245
  }
159
246
  return results;
160
247
  }
@@ -1 +1 @@
1
- {"version":3,"file":"template-processor.js","sourceRoot":"","sources":["../src/template-processor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACjE,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,GAAG,MA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