@gtkx/codegen 1.0.0-rc.2 → 1.0.0-rc.4

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 (254) hide show
  1. package/README.md +4 -5
  2. package/dist/analysis/descriptor-render.d.ts +2 -2
  3. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  4. package/dist/analysis/descriptor-render.js +30 -32
  5. package/dist/analysis/descriptor-render.js.map +1 -1
  6. package/dist/analysis/descriptor.d.ts +6 -6
  7. package/dist/analysis/descriptor.d.ts.map +1 -1
  8. package/dist/analysis/descriptor.js +7 -7
  9. package/dist/analysis/descriptor.js.map +1 -1
  10. package/dist/analysis/param-structure.d.ts +2 -2
  11. package/dist/analysis/param-structure.d.ts.map +1 -1
  12. package/dist/analysis/param-structure.js +5 -7
  13. package/dist/analysis/param-structure.js.map +1 -1
  14. package/dist/analysis/ts-type.d.ts +1 -1
  15. package/dist/analysis/ts-type.d.ts.map +1 -1
  16. package/dist/analysis/ts-type.js +7 -13
  17. package/dist/analysis/ts-type.js.map +1 -1
  18. package/dist/compile.d.ts.map +1 -1
  19. package/dist/compile.js +2 -1
  20. package/dist/compile.js.map +1 -1
  21. package/dist/docs/api-reference.d.ts +77 -1
  22. package/dist/docs/api-reference.d.ts.map +1 -1
  23. package/dist/docs/api-reference.js +66 -8
  24. package/dist/docs/api-reference.js.map +1 -1
  25. package/dist/docs/element-page.d.ts.map +1 -1
  26. package/dist/docs/element-page.js +5 -4
  27. package/dist/docs/element-page.js.map +1 -1
  28. package/dist/docs/pipeline.d.ts +5 -3
  29. package/dist/docs/pipeline.d.ts.map +1 -1
  30. package/dist/docs/pipeline.js +5 -3
  31. package/dist/docs/pipeline.js.map +1 -1
  32. package/dist/docs/render.js +6 -6
  33. package/dist/docs/render.js.map +1 -1
  34. package/dist/docs/symbol-page.d.ts +5 -0
  35. package/dist/docs/symbol-page.d.ts.map +1 -1
  36. package/dist/docs/symbol-page.js +2 -2
  37. package/dist/docs/symbol-page.js.map +1 -1
  38. package/dist/fingerprint.d.ts +2 -4
  39. package/dist/fingerprint.d.ts.map +1 -1
  40. package/dist/fingerprint.js +7 -6
  41. package/dist/fingerprint.js.map +1 -1
  42. package/dist/gi.d.ts +7 -10
  43. package/dist/gi.d.ts.map +1 -1
  44. package/dist/gi.js +4 -9
  45. package/dist/gi.js.map +1 -1
  46. package/dist/gir/field.d.ts +0 -1
  47. package/dist/gir/field.d.ts.map +1 -1
  48. package/dist/gir/field.js +0 -3
  49. package/dist/gir/field.js.map +1 -1
  50. package/dist/gir/gir-path.d.ts +7 -0
  51. package/dist/gir/gir-path.d.ts.map +1 -1
  52. package/dist/gir/gir-path.js +7 -0
  53. package/dist/gir/gir-path.js.map +1 -1
  54. package/dist/gir/libraries.d.ts +17 -3
  55. package/dist/gir/libraries.d.ts.map +1 -1
  56. package/dist/gir/libraries.js +14 -1
  57. package/dist/gir/libraries.js.map +1 -1
  58. package/dist/gir/parameter.d.ts.map +1 -1
  59. package/dist/gir/parameter.js +0 -4
  60. package/dist/gir/parameter.js.map +1 -1
  61. package/dist/gir/size.d.ts.map +1 -1
  62. package/dist/gir/size.js +0 -3
  63. package/dist/gir/size.js.map +1 -1
  64. package/dist/gir/type-id.d.ts +1 -1
  65. package/dist/gir/type-id.d.ts.map +1 -1
  66. package/dist/gir/type-id.js +1 -3
  67. package/dist/gir/type-id.js.map +1 -1
  68. package/dist/gir/type-ref.js +1 -1
  69. package/dist/gir/type-ref.js.map +1 -1
  70. package/dist/index.d.ts +18 -5
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +12 -2
  73. package/dist/index.js.map +1 -1
  74. package/dist/internal.d.ts +3 -0
  75. package/dist/internal.d.ts.map +1 -0
  76. package/dist/internal.js +3 -0
  77. package/dist/internal.js.map +1 -0
  78. package/dist/jsx.d.ts +8 -11
  79. package/dist/jsx.d.ts.map +1 -1
  80. package/dist/jsx.js +18 -15
  81. package/dist/jsx.js.map +1 -1
  82. package/dist/khronos/args.d.ts.map +1 -1
  83. package/dist/khronos/args.js +1 -1
  84. package/dist/khronos/args.js.map +1 -1
  85. package/dist/khronos/pipeline.js +1 -1
  86. package/dist/khronos/pipeline.js.map +1 -1
  87. package/dist/khronos/plan.d.ts +2 -2
  88. package/dist/khronos/plan.d.ts.map +1 -1
  89. package/dist/khronos/plan.js +6 -6
  90. package/dist/khronos/plan.js.map +1 -1
  91. package/dist/react/element-config.d.ts +18 -9
  92. package/dist/react/element-config.d.ts.map +1 -1
  93. package/dist/react/element-config.js +23 -13
  94. package/dist/react/element-config.js.map +1 -1
  95. package/dist/runner.d.ts +36 -16
  96. package/dist/runner.d.ts.map +1 -1
  97. package/dist/runner.js +22 -20
  98. package/dist/runner.js.map +1 -1
  99. package/dist/store/compile-store.d.ts +1 -2
  100. package/dist/store/compile-store.d.ts.map +1 -1
  101. package/dist/store/compile-store.js +2 -2
  102. package/dist/store/compile-store.js.map +1 -1
  103. package/dist/store/gi/callables.d.ts.map +1 -1
  104. package/dist/store/gi/callables.js +4 -9
  105. package/dist/store/gi/callables.js.map +1 -1
  106. package/dist/store/gi/constant.d.ts.map +1 -1
  107. package/dist/store/gi/constant.js +0 -2
  108. package/dist/store/gi/constant.js.map +1 -1
  109. package/dist/store/gi/function.d.ts.map +1 -1
  110. package/dist/store/gi/function.js +1 -7
  111. package/dist/store/gi/function.js.map +1 -1
  112. package/dist/store/gi/method.d.ts.map +1 -1
  113. package/dist/store/gi/method.js +26 -23
  114. package/dist/store/gi/method.js.map +1 -1
  115. package/dist/store/gi/property-accessor.d.ts +1 -1
  116. package/dist/store/gi/property-accessor.d.ts.map +1 -1
  117. package/dist/store/gi/property-accessor.js +5 -7
  118. package/dist/store/gi/property-accessor.js.map +1 -1
  119. package/dist/store/gi/record-constructor.d.ts.map +1 -1
  120. package/dist/store/gi/record-constructor.js +5 -4
  121. package/dist/store/gi/record-constructor.js.map +1 -1
  122. package/dist/store/gi/record-field-accessor.d.ts +3 -2
  123. package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
  124. package/dist/store/gi/record-field-accessor.js +21 -11
  125. package/dist/store/gi/record-field-accessor.js.map +1 -1
  126. package/dist/store/gi/record-layout.d.ts.map +1 -1
  127. package/dist/store/gi/record-layout.js +0 -4
  128. package/dist/store/gi/record-layout.js.map +1 -1
  129. package/dist/store/gi/record.d.ts.map +1 -1
  130. package/dist/store/gi/record.js +0 -7
  131. package/dist/store/gi/record.js.map +1 -1
  132. package/dist/store/gi/return-wrap.d.ts +1 -1
  133. package/dist/store/gi/return-wrap.d.ts.map +1 -1
  134. package/dist/store/gi/return-wrap.js +4 -4
  135. package/dist/store/gi/return-wrap.js.map +1 -1
  136. package/dist/store/gi/signal.d.ts.map +1 -1
  137. package/dist/store/gi/signal.js +13 -16
  138. package/dist/store/gi/signal.js.map +1 -1
  139. package/dist/store/gi/value-marshalable.d.ts +7 -0
  140. package/dist/store/gi/value-marshalable.d.ts.map +1 -0
  141. package/dist/store/gi/value-marshalable.js +57 -0
  142. package/dist/store/gi/value-marshalable.js.map +1 -0
  143. package/dist/store/gi-store.d.ts +2 -3
  144. package/dist/store/gi-store.d.ts.map +1 -1
  145. package/dist/store/gi-store.js.map +1 -1
  146. package/dist/store/jsx/element-components.d.ts +0 -2
  147. package/dist/store/jsx/element-components.d.ts.map +1 -1
  148. package/dist/store/jsx/element-components.js +0 -4
  149. package/dist/store/jsx/element-components.js.map +1 -1
  150. package/dist/store/jsx/element-prop-imports.d.ts +2 -3
  151. package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
  152. package/dist/store/jsx/element-prop-imports.js +0 -2
  153. package/dist/store/jsx/element-prop-imports.js.map +1 -1
  154. package/dist/store/jsx/element-prop-types.d.ts +0 -1
  155. package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
  156. package/dist/store/jsx/element-prop-types.js +0 -1
  157. package/dist/store/jsx/element-prop-types.js.map +1 -1
  158. package/dist/store/jsx/generated-elements.d.ts +29 -0
  159. package/dist/store/jsx/generated-elements.d.ts.map +1 -0
  160. package/dist/store/jsx/generated-elements.js +30 -0
  161. package/dist/store/jsx/generated-elements.js.map +1 -0
  162. package/dist/store/jsx/intrinsic-elements.d.ts +1 -2
  163. package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
  164. package/dist/store/jsx/intrinsic-elements.js +1 -2
  165. package/dist/store/jsx/intrinsic-elements.js.map +1 -1
  166. package/dist/store/jsx/jsx.js +6 -6
  167. package/dist/store/jsx/jsx.js.map +1 -1
  168. package/dist/store/jsx/metadata.js +7 -7
  169. package/dist/store/jsx/metadata.js.map +1 -1
  170. package/dist/store/jsx/omitted-props.d.ts +8 -0
  171. package/dist/store/jsx/omitted-props.d.ts.map +1 -0
  172. package/dist/store/jsx/omitted-props.js +20 -0
  173. package/dist/store/jsx/omitted-props.js.map +1 -0
  174. package/dist/store/jsx/pipeline.d.ts +4 -0
  175. package/dist/store/jsx/pipeline.d.ts.map +1 -1
  176. package/dist/store/jsx/pipeline.js +4 -1
  177. package/dist/store/jsx/pipeline.js.map +1 -1
  178. package/dist/store/jsx/props.d.ts +1 -1
  179. package/dist/store/jsx/props.d.ts.map +1 -1
  180. package/dist/store/jsx/props.js +8 -13
  181. package/dist/store/jsx/props.js.map +1 -1
  182. package/dist/store/jsx-store.d.ts +2 -3
  183. package/dist/store/jsx-store.d.ts.map +1 -1
  184. package/dist/store/jsx-store.js +3 -3
  185. package/dist/store/jsx-store.js.map +1 -1
  186. package/dist/store/resolve-store.d.ts +28 -0
  187. package/dist/store/resolve-store.d.ts.map +1 -0
  188. package/dist/store/resolve-store.js +65 -0
  189. package/dist/store/resolve-store.js.map +1 -0
  190. package/dist/store/store-fs.d.ts +5 -1
  191. package/dist/store/store-fs.d.ts.map +1 -1
  192. package/dist/store/store-fs.js +6 -4
  193. package/dist/store/store-fs.js.map +1 -1
  194. package/overrides/gobject/object.ts.ejs +8 -8
  195. package/package.json +6 -11
  196. package/src/analysis/descriptor-render.ts +45 -38
  197. package/src/analysis/descriptor.ts +13 -13
  198. package/src/analysis/param-structure.ts +8 -10
  199. package/src/analysis/ts-type.ts +8 -17
  200. package/src/compile.ts +2 -1
  201. package/src/docs/api-reference.ts +131 -13
  202. package/src/docs/element-page.ts +5 -9
  203. package/src/docs/pipeline.ts +9 -6
  204. package/src/docs/render.ts +7 -7
  205. package/src/docs/symbol-page.ts +7 -2
  206. package/src/fingerprint.ts +21 -12
  207. package/src/gi.ts +13 -11
  208. package/src/gir/field.ts +0 -4
  209. package/src/gir/gir-path.ts +7 -0
  210. package/src/gir/libraries.ts +18 -4
  211. package/src/gir/parameter.ts +0 -4
  212. package/src/gir/size.ts +0 -3
  213. package/src/gir/type-id.ts +2 -4
  214. package/src/gir/type-ref.ts +1 -1
  215. package/src/index.ts +18 -15
  216. package/src/internal.ts +2 -0
  217. package/src/jsx.ts +26 -21
  218. package/src/khronos/args.ts +1 -1
  219. package/src/khronos/pipeline.ts +1 -1
  220. package/src/khronos/plan.ts +8 -8
  221. package/src/react/element-config.ts +25 -16
  222. package/src/runner.ts +62 -37
  223. package/src/store/compile-store.ts +3 -4
  224. package/src/store/gi/callables.ts +5 -11
  225. package/src/store/gi/constant.ts +0 -2
  226. package/src/store/gi/function.ts +1 -7
  227. package/src/store/gi/method.ts +31 -28
  228. package/src/store/gi/property-accessor.ts +6 -8
  229. package/src/store/gi/record-constructor.ts +9 -4
  230. package/src/store/gi/record-field-accessor.ts +41 -12
  231. package/src/store/gi/record-layout.ts +0 -4
  232. package/src/store/gi/record.ts +0 -9
  233. package/src/store/gi/return-wrap.ts +5 -5
  234. package/src/store/gi/signal.ts +17 -17
  235. package/src/store/gi/value-marshalable.ts +87 -0
  236. package/src/store/gi-store.ts +2 -4
  237. package/src/store/jsx/element-components.ts +0 -6
  238. package/src/store/jsx/element-prop-imports.ts +7 -4
  239. package/src/store/jsx/element-prop-types.ts +0 -1
  240. package/src/store/jsx/generated-elements.ts +60 -0
  241. package/src/store/jsx/intrinsic-elements.ts +0 -9
  242. package/src/store/jsx/jsx.ts +7 -7
  243. package/src/store/jsx/metadata.ts +8 -8
  244. package/src/store/jsx/omitted-props.ts +30 -0
  245. package/src/store/jsx/pipeline.ts +6 -1
  246. package/src/store/jsx/props.ts +8 -20
  247. package/src/store/jsx-store.ts +5 -7
  248. package/src/store/resolve-store.ts +100 -0
  249. package/src/store/store-fs.ts +12 -5
  250. package/dist/store/gi/class-struct-record.d.ts +0 -10
  251. package/dist/store/gi/class-struct-record.d.ts.map +0 -1
  252. package/dist/store/gi/class-struct-record.js +0 -52
  253. package/dist/store/gi/class-struct-record.js.map +0 -1
  254. package/src/store/gi/class-struct-record.ts +0 -72
@@ -1,3 +1,11 @@
1
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
2
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
3
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
4
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
5
+ });
6
+ }
7
+ return path;
8
+ };
1
9
  import { readdirSync } from "node:fs";
2
10
  const CONFIG_ENTRYPOINT = "config";
3
11
  const CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;
@@ -11,10 +19,6 @@ const presentNamespaceDirs = (giStoreDir) => {
11
19
  }
12
20
  return dirs;
13
21
  };
14
- /**
15
- * The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus
16
- * each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.
17
- */
18
22
  const configEntrypoints = (reactSubexports, present) => reactSubexports.filter((sub) => {
19
23
  if (sub === CONFIG_ENTRYPOINT) {
20
24
  return true;
@@ -23,7 +27,7 @@ const configEntrypoints = (reactSubexports, present) => reactSubexports.filter((
23
27
  });
24
28
  const importBuiltinElements = async (entrypoint) => {
25
29
  const specifier = `@gtkx/react/${entrypoint}`;
26
- const imported = (await import(/* @vite-ignore */ specifier));
30
+ const imported = (await import(__rewriteRelativeImportExtension(/* @vite-ignore */ specifier)));
27
31
  return imported.BUILTIN_ELEMENTS ?? {};
28
32
  };
29
33
  const applyBuiltinElement = (target, type, config) => {
@@ -33,29 +37,35 @@ const applyBuiltinElement = (target, type, config) => {
33
37
  if (config.props !== undefined) {
34
38
  target.props[type] = config.props;
35
39
  }
36
- if (config.lazy === true) {
40
+ if (config.omittedProps !== undefined) {
41
+ target.omittedProps[type] = [...(target.omittedProps[type] ?? []), ...config.omittedProps];
42
+ }
43
+ if (config.isLazy === true) {
37
44
  target.lazyElements.push(type);
38
45
  }
39
46
  };
40
- /**
41
- * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config
42
- * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;
43
- * it must run only after the gi store has been linked.
44
- */
45
47
  const collectBuiltinElements = (target, elements) => {
46
48
  for (const [type, config] of Object.entries(elements)) {
47
49
  applyBuiltinElement(target, type, config);
48
50
  }
49
51
  };
52
+ /**
53
+ * Reads the framework's built-in element config by importing the `config` entrypoints of the installed
54
+ * `@gtkx/react`, skipping the per-namespace ones whose namespace the gi store does not carry. Those
55
+ * entrypoints are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`,
56
+ * which means this must run only after the gi store has been written and linked.
57
+ *
58
+ * @param reactSubexports Subexport names of the installed `@gtkx/react`, as `resolveStore` reports them.
59
+ * @param giStoreDir The gi store directory, whose subdirectories name the generated namespaces.
60
+ */
50
61
  const readBuiltinElements = async (reactSubexports, giStoreDir) => {
51
62
  const present = presentNamespaceDirs(giStoreDir);
52
63
  const entrypoints = configEntrypoints(reactSubexports, present);
53
- const result = { components: {}, lazyElements: [], props: {} };
64
+ const result = { components: {}, lazyElements: [], props: {}, omittedProps: {} };
54
65
  for (const entrypoint of entrypoints) {
55
66
  collectBuiltinElements(result, await importBuiltinElements(entrypoint));
56
67
  }
57
68
  return result;
58
69
  };
59
- export {} from "@gtkx/react/config";
60
70
  export { readBuiltinElements };
61
71
  //# sourceMappingURL=element-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/react/element-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAYtC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACnC,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE;IAC7D,MAAM,IAAI,GAAgB,IAAI,GAAG,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,eAAyB,EAAE,OAAoB,EAAY,EAAE,CACpF,eAAe,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE;IAC3B,IAAI,GAAG,KAAK,iBAAiB,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACvG,CAAC,CAAC,CAAC;AAEP,MAAM,qBAAqB,GAAG,KAAK,EAAE,UAAkB,EAA2C,EAAE;IAChG,MAAM,SAAS,GAAG,e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AAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAEhF,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACnC,sBAAsB,CAAC,MAAM,EAAE,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAA6C,CAAC","sourcesContent":["import type { ModuleExport } from \"@gtkx/react/config\";\nimport { readdirSync } from \"node:fs\";\n\n/** The codegen-relevant subset of a React element config; behaviors are ignored at codegen time. */\ntype BuiltinElement = { component?: ModuleExport; lazy?: boolean; props?: ModuleExport };\n\n/** The framework's built-in element config, split into the maps codegen consumes. */\ntype BuiltinElements = {\n components: Record<string, ModuleExport>;\n lazyElements: string[];\n props: Record<string, ModuleExport>;\n};\n\nconst CONFIG_ENTRYPOINT = \"config\";\nconst CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;\n\nconst presentNamespaceDirs = (giStoreDir: string): Set<string> => {\n const dirs: Set<string> = new Set();\n const entries = readdirSync(giStoreDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n dirs.add(entry.name);\n }\n }\n\n return dirs;\n};\n\n/**\n * The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus\n * each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.\n */\nconst configEntrypoints = (reactSubexports: string[], present: Set<string>): string[] =>\n reactSubexports.filter((sub) => {\n if (sub === CONFIG_ENTRYPOINT) {\n return true;\n }\n\n return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));\n });\n\nconst importBuiltinElements = async (entrypoint: string): Promise<Record<string, BuiltinElement>> => {\n const specifier = `@gtkx/react/${entrypoint}`;\n\n const imported = (await import(/* @vite-ignore */ specifier)) as {\n BUILTIN_ELEMENTS?: Record<string, BuiltinElement>;\n };\n\n return imported.BUILTIN_ELEMENTS ?? {};\n};\n\nconst applyBuiltinElement = (target: BuiltinElements, type: string, config: BuiltinElement): void => {\n if (config.component !== undefined) {\n target.components[type] = config.component;\n }\n\n if (config.props !== undefined) {\n target.props[type] = config.props;\n }\n\n if (config.lazy === true) {\n target.lazyElements.push(type);\n }\n};\n\n/**\n * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config\n * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;\n * it must run only after the gi store has been linked.\n */\nconst collectBuiltinElements = (target: BuiltinElements, elements: Record<string, BuiltinElement>): void => {\n for (const [type, config] of Object.entries(elements)) {\n applyBuiltinElement(target, type, config);\n }\n};\n\nconst readBuiltinElements = async (reactSubexports: string[], giStoreDir: string): Promise<BuiltinElements> => {\n const present = presentNamespaceDirs(giStoreDir);\n const entrypoints = configEntrypoints(reactSubexports, present);\n const result: BuiltinElements = { components: {}, lazyElements: [], props: {} };\n\n for (const entrypoint of entrypoints) {\n collectBuiltinElements(result, await importBuiltinElements(entrypoint));\n }\n\n return result;\n};\n\nexport { type ModuleExport } from \"@gtkx/react/config\";\nexport { readBuiltinElements, type BuiltinElement, type BuiltinElements };\n"]}
1
+ {"version":3,"file":"element-config.js","sourceRoot":"","sources":["../../src/react/element-config.ts"],"names":[],"mappings":";;;;;;;;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAiBtC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AACnC,MAAM,aAAa,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAE9C,MAAM,oBAAoB,GAAG,CAAC,UAAkB,EAAe,EAAE;IAC7D,MAAM,IAAI,GAAgB,IAAI,GAAG,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjE,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,C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node:fs\";\nimport type { OmittedProps } from \"../store/jsx/omitted-props.js\";\n\ntype BuiltinElement = { component?: ModuleExport; isLazy?: boolean; props?: ModuleExport; omittedProps?: string[] };\n\n/** The framework's built-in element config, split into the maps codegen consumes. */\ntype BuiltinElements = {\n /** Component wrappers keyed by GLib type name; an element without one inherits its nearest ancestor's. */\n components: Record<string, ModuleExport>;\n /** GLib type names with no GObject of their own, exported as elements that drop their construct-only props. */\n lazyElements: string[];\n /** Base props interfaces the generated element props extend, keyed by GLib type name. */\n props: Record<string, ModuleExport>;\n /** Props left out of the generated element props, keyed by GLib type name. */\n omittedProps: OmittedProps;\n};\n\nconst CONFIG_ENTRYPOINT = \"config\";\nconst CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;\n\nconst presentNamespaceDirs = (giStoreDir: string): Set<string> => {\n const dirs: Set<string> = new Set();\n const entries = readdirSync(giStoreDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n dirs.add(entry.name);\n }\n }\n\n return dirs;\n};\n\nconst configEntrypoints = (reactSubexports: string[], present: Set<string>): string[] =>\n reactSubexports.filter((sub) => {\n if (sub === CONFIG_ENTRYPOINT) {\n return true;\n }\n\n return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));\n });\n\nconst importBuiltinElements = async (entrypoint: string): Promise<Record<string, BuiltinElement>> => {\n const specifier = `@gtkx/react/${entrypoint}`;\n\n const imported = (await import(/* @vite-ignore */ specifier)) as {\n BUILTIN_ELEMENTS?: Record<string, BuiltinElement>;\n };\n\n return imported.BUILTIN_ELEMENTS ?? {};\n};\n\nconst applyBuiltinElement = (target: BuiltinElements, type: string, config: BuiltinElement): void => {\n if (config.component !== undefined) {\n target.components[type] = config.component;\n }\n\n if (config.props !== undefined) {\n target.props[type] = config.props;\n }\n\n if (config.omittedProps !== undefined) {\n target.omittedProps[type] = [...(target.omittedProps[type] ?? []), ...config.omittedProps];\n }\n\n if (config.isLazy === true) {\n target.lazyElements.push(type);\n }\n};\n\nconst collectBuiltinElements = (target: BuiltinElements, elements: Record<string, BuiltinElement>): void => {\n for (const [type, config] of Object.entries(elements)) {\n applyBuiltinElement(target, type, config);\n }\n};\n\n/**\n * Reads the framework's built-in element config by importing the `config` entrypoints of the installed\n * `@gtkx/react`, skipping the per-namespace ones whose namespace the gi store does not carry. Those\n * entrypoints are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`,\n * which means this must run only after the gi store has been written and linked.\n *\n * @param reactSubexports Subexport names of the installed `@gtkx/react`, as `resolveStore` reports them.\n * @param giStoreDir The gi store directory, whose subdirectories name the generated namespaces.\n */\nconst readBuiltinElements = async (reactSubexports: string[], giStoreDir: string): Promise<BuiltinElements> => {\n const present = presentNamespaceDirs(giStoreDir);\n const entrypoints = configEntrypoints(reactSubexports, present);\n const result: BuiltinElements = { components: {}, lazyElements: [], props: {}, omittedProps: {} };\n\n for (const entrypoint of entrypoints) {\n collectBuiltinElements(result, await importBuiltinElements(entrypoint));\n }\n\n return result;\n};\n\nexport type { ModuleExport } from \"@gtkx/react/internal\";\nexport { readBuiltinElements, type BuiltinElements };\n"]}
package/dist/runner.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- import type { GiStoreOptions } from "./store/gi-store.js";
2
- import type { JsxStoreOptions } from "./store/jsx-store.js";
1
+ import type { OmittedProps } from "./store/jsx/omitted-props.js";
2
+ import type { StoreOptions } from "./store/store-fs.js";
3
3
  import { type GlGenerationReport } from "./khronos/pipeline.js";
4
+ /** A named export in a module, referenced as plain data (the module is never imported at runtime). */
4
5
  type ModuleExport = {
6
+ /** Specifier the export is imported from. */
5
7
  module: string;
8
+ /** Identifier the module exports it under. */
6
9
  export: string;
7
10
  };
8
11
  type GlCodegenOptions = {
@@ -11,34 +14,51 @@ type GlCodegenOptions = {
11
14
  outputDir: string;
12
15
  resolveFrom: string;
13
16
  };
17
+ /** What to generate and where to write it. */
14
18
  type CodegenRunnerOptions = {
15
- libraries?: string[];
16
- girPath?: string[];
17
- gi?: GiStoreOptions;
18
- jsx?: JsxStoreOptions | undefined;
19
+ /** GIR library identifiers such as `"Gtk-4.0"`; a `"*"` selection must be expanded before it gets here. */
20
+ libraries: string[];
21
+ /** Directories to search for `.gir` files. */
22
+ girPath: string[];
23
+ /** Where to write and link the `@gtkx/gi` store. */
24
+ gi: StoreOptions;
25
+ /** Where to write and link the `@gtkx/jsx` store; omit to generate the gi store alone. */
26
+ jsx?: StoreOptions | undefined;
27
+ /** Subexport names of the installed `@gtkx/react`, whose element config shapes the jsx store. */
19
28
  reactSubexports?: string[];
29
+ /** Component wrappers the project layers over the built-ins, keyed by GLib type name. */
20
30
  userComponents?: Record<string, ModuleExport>;
31
+ /** GLib type names whose GObject their parent container creates, added to the framework's own. */
21
32
  userLazyElements?: string[];
33
+ /** Base props interfaces the project's elements extend, keyed by GLib type name. */
22
34
  userProps?: Record<string, ModuleExport>;
23
- gl?: GlCodegenOptions;
24
- force?: boolean;
35
+ /** Props the project drops from the generated element props, keyed by GLib type name. */
36
+ userOmittedProps?: OmittedProps;
37
+ /** Regenerates both stores even when their fingerprints are fresh. */
38
+ isForced?: boolean;
25
39
  };
40
+ /** What a `runCodegen` run produced. */
26
41
  type CodegenRunnerResult = {
27
- regenerated: boolean;
42
+ /** Whether either store was rewritten; false means both were already fresh. */
43
+ isRegenerated: boolean;
44
+ /** How many namespaces the gi store was written with, zero when it was already fresh. */
28
45
  namespaces: number;
46
+ /** How many JSX elements the jsx store binds, zero when no jsx store was requested. */
29
47
  intrinsicElements: number;
48
+ /** Wall-clock duration of the run, in milliseconds. */
30
49
  duration: number;
31
- gl?: GlGenerationReport | undefined;
32
50
  };
33
51
  /**
34
- * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
35
- * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
36
- * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
37
- * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
52
+ * Writes and links a project's `@gtkx/gi` and `@gtkx/jsx` stores from the given GObject-Introspection
53
+ * libraries. The gi store is rewritten only when its GIR inputs changed, and the jsx store only when the gi
54
+ * store or the React element config changed, unless `options.isForced` is set. Pass the spread of
55
+ * `resolveStore(projectRoot)` for everything but `libraries` and `girPath`.
38
56
  *
39
- * @param options - What to generate and where to write it.
57
+ * @param options What to generate and where to write it.
40
58
  * @returns A summary of what was regenerated and how long the run took.
59
+ * @throws If `girPath` is empty, which would otherwise generate nothing and report success.
41
60
  */
42
61
  declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
43
- export { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };
62
+ declare const runGlCodegen: (options: GlCodegenOptions) => GlGenerationReport;
63
+ export { runCodegen, runGlCodegen, type CodegenRunnerOptions, type CodegenRunnerResult };
44
64
  //# sourceMappingURL=runner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAK5D,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEnF,KAAK,YAAY,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,KAAK,gBAAgB,GAAG;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB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CAAC;AA8EF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
package/dist/runner.js CHANGED
@@ -6,27 +6,26 @@ import { runGiCodegen } from "./gi.js";
6
6
  import { Library } from "./gir/library.js";
7
7
  import { generateGlModules } from "./khronos/pipeline.js";
8
8
  /**
9
- * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
10
- * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
11
- * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
12
- * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
9
+ * Writes and links a project's `@gtkx/gi` and `@gtkx/jsx` stores from the given GObject-Introspection
10
+ * libraries. The gi store is rewritten only when its GIR inputs changed, and the jsx store only when the gi
11
+ * store or the React element config changed, unless `options.isForced` is set. Pass the spread of
12
+ * `resolveStore(projectRoot)` for everything but `libraries` and `girPath`.
13
13
  *
14
- * @param options - What to generate and where to write it.
14
+ * @param options What to generate and where to write it.
15
15
  * @returns A summary of what was regenerated and how long the run took.
16
+ * @throws If `girPath` is empty, which would otherwise generate nothing and report success.
16
17
  */
17
18
  const runCodegen = async (options) => {
18
19
  const start = Date.now();
19
- const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);
20
20
  const store = await emitStores(options);
21
21
  return {
22
- regenerated: store.regenerated,
22
+ isRegenerated: store.isRegenerated,
23
23
  namespaces: store.namespaces,
24
24
  intrinsicElements: store.intrinsicElements,
25
25
  duration: Date.now() - start,
26
- gl,
27
26
  };
28
27
  };
29
- const emitGlModules = (options) => {
28
+ const runGlCodegen = (options) => {
30
29
  const { files, report } = generateGlModules({
31
30
  registryPath: options.registryPath,
32
31
  overrideExports: options.overrideExports,
@@ -47,20 +46,21 @@ const jsxUserOptions = (options) => ({
47
46
  userComponents: options.userComponents ?? {},
48
47
  userLazyElements: options.userLazyElements ?? [],
49
48
  userProps: options.userProps ?? {},
49
+ userOmittedProps: options.userOmittedProps ?? {},
50
50
  });
51
51
  const emitJsxStore = async (input) => {
52
- const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;
52
+ const { options, jsx, gi, loadLibrary, isGiRegenerated, namespaces } = input;
53
53
  const { runJsxCodegen } = await import("./jsx.js");
54
54
  const jsxResult = await runJsxCodegen({
55
55
  getLibrary: loadLibrary,
56
56
  jsx,
57
57
  giStoreDir: gi.storeDir,
58
58
  ...jsxUserOptions(options),
59
- giRegenerated,
60
- force: options.force === true,
59
+ isGiRegenerated,
60
+ isForced: options.isForced === true,
61
61
  });
62
62
  return {
63
- regenerated: giRegenerated || jsxResult.regenerated,
63
+ isRegenerated: isGiRegenerated || jsxResult.isRegenerated,
64
64
  namespaces,
65
65
  intrinsicElements: jsxResult.intrinsicElementCount,
66
66
  };
@@ -69,19 +69,21 @@ const emitStoresWithConfig = async (config) => {
69
69
  const { options, gi, jsx, libraries, girPath } = config;
70
70
  let library;
71
71
  const loadLibrary = () => (library ??= Library.load(libraries, girPath));
72
- const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);
73
- const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;
72
+ const isGiRegenerated = options.isForced === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);
73
+ const namespaces = isGiRegenerated
74
+ ? runGiCodegen(loadLibrary(), { gi, libraries, girPath })
75
+ : 0;
74
76
  if (jsx === undefined) {
75
- return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };
77
+ return { isRegenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };
76
78
  }
77
- return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });
79
+ return emitJsxStore({ options, jsx, gi, loadLibrary, isGiRegenerated, namespaces });
78
80
  };
79
81
  const emitStores = async (options) => {
80
82
  const { gi, jsx, libraries, girPath } = options;
81
- if (gi === undefined || libraries === undefined || girPath === undefined) {
82
- return { regenerated: false, namespaces: 0, intrinsicElements: 0 };
83
+ if (girPath.length === 0) {
84
+ throw new Error("codegen needs at least one GIR search path; pass the result of resolveGirPath");
83
85
  }
84
86
  return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });
85
87
  };
86
- export { runCodegen };
88
+ export { runCodegen, runGlCodegen };
87
89
  //# sourceMappingURL=runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAA2B,MAAM,uBAAuB,CAAC;AAsCnF;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAG,KAAK,EAAE,OAA6B,EAAgC,EAAE;IACrF,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACzB,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC5E,MAAM,KAAK,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;IAExC,OAAO;QACH,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;QAC5B,EAAE;KAC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AAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC;AACvG,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,KAAK,EAAE,OAA6B,EAAwB,EAAE;IAC7E,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEhD,IAAI,EAAE,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACvE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;IAED,OAAO,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAA8E,CAAC","sourcesContent":["import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GiStoreOptions } from \"./store/gi-store.js\";\nimport type { JsxStoreOptions } from \"./store/jsx-store.js\";\nimport { checkModules } from \"./compile.js\";\nimport { isGiStoreFresh } from \"./fingerprint.js\";\nimport { runGiCodegen } from \"./gi.js\";\nimport { Library } from \"./gir/library.js\";\nimport { generateGlModules, type GlGenerationReport } from \"./khronos/pipeline.js\";\n\ntype ModuleExport = { module: string; export: string };\n\ntype GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\ntype CodegenRunnerOptions = {\n libraries?: string[];\n girPath?: string[];\n gi?: GiStoreOptions;\n jsx?: JsxStoreOptions | undefined;\n reactSubexports?: string[];\n userComponents?: Record<string, ModuleExport>;\n userLazyElements?: string[];\n userProps?: Record<string, ModuleExport>;\n gl?: GlCodegenOptions;\n force?: boolean;\n};\n\ntype CodegenRunnerResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n duration: number;\n gl?: GlGenerationReport | undefined;\n};\n\ntype StoreResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n};\n\n/**\n * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the\n * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its\n * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or\n * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.\n *\n * @param options - What to generate and where to write it.\n * @returns A summary of what was regenerated and how long the run took.\n */\nconst runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);\n const store = await emitStores(options);\n\n return {\n regenerated: store.regenerated,\n namespaces: store.namespaces,\n intrinsicElements: store.intrinsicElements,\n duration: Date.now() - start,\n gl,\n };\n};\n\nconst emitGlModules = (options: GlCodegenOptions): GlGenerationReport => {\n const { files, report } = generateGlModules({\n registryPath: options.registryPath,\n overrideExports: options.overrideExports,\n });\n\n checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n\n mkdirSync(options.outputDir, { recursive: true });\n\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n\n return report;\n};\n\nconst jsxUserOptions = (\n options: CodegenRunnerOptions,\n): {\n reactSubexports: string[];\n userComponents: Record<string, ModuleExport>;\n userLazyElements: string[];\n userProps: Record<string, ModuleExport>;\n} => ({\n reactSubexports: options.reactSubexports ?? [],\n userComponents: options.userComponents ?? {},\n userLazyElements: options.userLazyElements ?? [],\n userProps: options.userProps ?? {},\n});\n\nconst emitJsxStore = async (input: {\n options: CodegenRunnerOptions;\n jsx: JsxStoreOptions;\n gi: GiStoreOptions;\n loadLibrary: () => Library;\n giRegenerated: boolean;\n namespaces: number;\n}): Promise<StoreResult> => {\n const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;\n const { runJsxCodegen } = await import(\"./jsx.js\");\n\n const jsxResult = await runJsxCodegen({\n getLibrary: loadLibrary,\n jsx,\n giStoreDir: gi.storeDir,\n ...jsxUserOptions(options),\n giRegenerated,\n force: options.force === true,\n });\n\n return {\n regenerated: giRegenerated || jsxResult.regenerated,\n namespaces,\n intrinsicElements: jsxResult.intrinsicElementCount,\n };\n};\n\nconst emitStoresWithConfig = async (config: {\n options: CodegenRunnerOptions;\n gi: GiStoreOptions;\n jsx: JsxStoreOptions | undefined;\n libraries: string[];\n girPath: string[];\n}): Promise<StoreResult> => {\n const { options, gi, jsx, libraries, girPath } = config;\n let library: Library | undefined;\n const loadLibrary = (): Library => (library ??= Library.load(libraries, girPath));\n const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);\n const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;\n\n if (jsx === undefined) {\n return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };\n }\n\n return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });\n};\n\nconst emitStores = async (options: CodegenRunnerOptions): Promise<StoreResult> => {\n const { gi, jsx, libraries, girPath } = options;\n\n if (gi === undefined || libraries === undefined || girPath === undefined) {\n return { regenerated: false, namespaces: 0, intrinsicElements: 0 };\n }\n\n return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });\n};\n\nexport { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };\n"]}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,cAA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I,OAA4B,CAAC;IACjC,MAAM,WAAW,GAAG,GAAY,EAAE,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;IAClF,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtG,MAAM,UAAU,GAAG,eAAe;QAC9B,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;QACzD,CAAC,CAAC,CAAC,CAAC;IAER,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpB,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IAChF,CAAC;IAED,OAAO,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,EAAE,CAAC,CAAC;AACxF,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,KAAK,EAAE,OAA6B,EAAwB,EAAE;IAC7E,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEhD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+EAA+E,CAAC,CAAC;IACrG,CAAC;IAED,OAAO,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAuD,CAAC","sourcesContent":["import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { OmittedProps } from \"./store/jsx/omitted-props.js\";\nimport type { StoreOptions } from \"./store/store-fs.js\";\nimport { checkModules } from \"./compile.js\";\nimport { isGiStoreFresh } from \"./fingerprint.js\";\nimport { runGiCodegen } from \"./gi.js\";\nimport { Library } from \"./gir/library.js\";\nimport { generateGlModules, type GlGenerationReport } from \"./khronos/pipeline.js\";\n\n/** A named export in a module, referenced as plain data (the module is never imported at runtime). */\ntype ModuleExport = {\n /** Specifier the export is imported from. */\n module: string;\n /** Identifier the module exports it under. */\n export: string;\n};\n\ntype GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\n/** What to generate and where to write it. */\ntype CodegenRunnerOptions = {\n /** GIR library identifiers such as `\"Gtk-4.0\"`; a `\"*\"` selection must be expanded before it gets here. */\n libraries: string[];\n /** Directories to search for `.gir` files. */\n girPath: string[];\n /** Where to write and link the `@gtkx/gi` store. */\n gi: StoreOptions;\n /** Where to write and link the `@gtkx/jsx` store; omit to generate the gi store alone. */\n jsx?: StoreOptions | undefined;\n /** Subexport names of the installed `@gtkx/react`, whose element config shapes the jsx store. */\n reactSubexports?: string[];\n /** Component wrappers the project layers over the built-ins, keyed by GLib type name. */\n userComponents?: Record<string, ModuleExport>;\n /** GLib type names whose GObject their parent container creates, added to the framework's own. */\n userLazyElements?: string[];\n /** Base props interfaces the project's elements extend, keyed by GLib type name. */\n userProps?: Record<string, ModuleExport>;\n /** Props the project drops from the generated element props, keyed by GLib type name. */\n userOmittedProps?: OmittedProps;\n /** Regenerates both stores even when their fingerprints are fresh. */\n isForced?: boolean;\n};\n\n/** What a `runCodegen` run produced. */\ntype CodegenRunnerResult = {\n /** Whether either store was rewritten; false means both were already fresh. */\n isRegenerated: boolean;\n /** How many namespaces the gi store was written with, zero when it was already fresh. */\n namespaces: number;\n /** How many JSX elements the jsx store binds, zero when no jsx store was requested. */\n intrinsicElements: number;\n /** Wall-clock duration of the run, in milliseconds. */\n duration: number;\n};\n\ntype StoreResult = {\n isRegenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n};\n\n/**\n * Writes and links a project's `@gtkx/gi` and `@gtkx/jsx` stores from the given GObject-Introspection\n * libraries. The gi store is rewritten only when its GIR inputs changed, and the jsx store only when the gi\n * store or the React element config changed, unless `options.isForced` is set. Pass the spread of\n * `resolveStore(projectRoot)` for everything but `libraries` and `girPath`.\n *\n * @param options What to generate and where to write it.\n * @returns A summary of what was regenerated and how long the run took.\n * @throws If `girPath` is empty, which would otherwise generate nothing and report success.\n */\nconst runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const store = await emitStores(options);\n\n return {\n isRegenerated: store.isRegenerated,\n namespaces: store.namespaces,\n intrinsicElements: store.intrinsicElements,\n duration: Date.now() - start,\n };\n};\n\nconst runGlCodegen = (options: GlCodegenOptions): GlGenerationReport => {\n const { files, report } = generateGlModules({\n registryPath: options.registryPath,\n overrideExports: options.overrideExports,\n });\n\n checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n\n mkdirSync(options.outputDir, { recursive: true });\n\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n\n return report;\n};\n\nconst jsxUserOptions = (\n options: CodegenRunnerOptions,\n): {\n reactSubexports: string[];\n userComponents: Record<string, ModuleExport>;\n userLazyElements: string[];\n userProps: Record<string, ModuleExport>;\n userOmittedProps: OmittedProps;\n} => ({\n reactSubexports: options.reactSubexports ?? [],\n userComponents: options.userComponents ?? {},\n userLazyElements: options.userLazyElements ?? [],\n userProps: options.userProps ?? {},\n userOmittedProps: options.userOmittedProps ?? {},\n});\n\nconst emitJsxStore = async (input: {\n options: CodegenRunnerOptions;\n jsx: StoreOptions;\n gi: StoreOptions;\n loadLibrary: () => Library;\n isGiRegenerated: boolean;\n namespaces: number;\n}): Promise<StoreResult> => {\n const { options, jsx, gi, loadLibrary, isGiRegenerated, namespaces } = input;\n const { runJsxCodegen } = await import(\"./jsx.js\");\n\n const jsxResult = await runJsxCodegen({\n getLibrary: loadLibrary,\n jsx,\n giStoreDir: gi.storeDir,\n ...jsxUserOptions(options),\n isGiRegenerated,\n isForced: options.isForced === true,\n });\n\n return {\n isRegenerated: isGiRegenerated || jsxResult.isRegenerated,\n namespaces,\n intrinsicElements: jsxResult.intrinsicElementCount,\n };\n};\n\nconst emitStoresWithConfig = async (config: {\n options: CodegenRunnerOptions;\n gi: StoreOptions;\n jsx: StoreOptions | undefined;\n libraries: string[];\n girPath: string[];\n}): Promise<StoreResult> => {\n const { options, gi, jsx, libraries, girPath } = config;\n let library: Library | undefined;\n const loadLibrary = (): Library => (library ??= Library.load(libraries, girPath));\n const isGiRegenerated = options.isForced === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);\n\n const namespaces = isGiRegenerated\n ? runGiCodegen(loadLibrary(), { gi, libraries, girPath })\n : 0;\n\n if (jsx === undefined) {\n return { isRegenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };\n }\n\n return emitJsxStore({ options, jsx, gi, loadLibrary, isGiRegenerated, namespaces });\n};\n\nconst emitStores = async (options: CodegenRunnerOptions): Promise<StoreResult> => {\n const { gi, jsx, libraries, girPath } = options;\n\n if (girPath.length === 0) {\n throw new Error(\"codegen needs at least one GIR search path; pass the result of resolveGirPath\");\n }\n\n return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });\n};\n\nexport { runCodegen, runGlCodegen, type CodegenRunnerOptions, type CodegenRunnerResult };\n"]}
@@ -3,8 +3,7 @@ type CompileStoreParams = {
3
3
  storeDir: string;
4
4
  files: SourceModule[];
5
5
  packageName: string;
6
- /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */
7
- configEnv?: boolean;
6
+ requiresEnvReference?: boolean;
8
7
  };
9
8
  declare const compileStore: (params: CompileStoreParams) => void;
10
9
  export { compileStore, type CompileStoreParams };
@@ -1 +1 @@
1
- {"version":3,"file":"compile-store.d.ts","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,kBAAkB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqBF,QAAA,MAAM,YAAY,GAAI,QAAQ,kBAAkB,KAAG,IAqBlD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
1
+ {"version":3,"file":"compile-store.d.ts","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,kBAAkB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAqBF,QAAA,MAAM,YAAY,GAAI,QAAQ,kBAAkB,KAAG,IAqBlD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
@@ -18,13 +18,13 @@ const writeEnvReference = (storeDir) => {
18
18
  };
19
19
  const compileStore = (params) => {
20
20
  const fileNames = params.files.map((file) => file.fileName);
21
- const removeEnvReference = params.configEnv === true
21
+ const removeEnvReference = params.requiresEnvReference === true
22
22
  ? writeEnvReference(params.storeDir)
23
23
  : () => undefined;
24
24
  try {
25
25
  compileProject({
26
26
  projectDir: params.storeDir,
27
- fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,
27
+ fileNames: params.requiresEnvReference === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,
28
28
  compilerOptions: EMIT_OPTIONS,
29
29
  label: `the generated ${params.packageName} store`,
30
30
  });
@@ -1 +1 @@
1
- {"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAUlE,MAAM,YAAY,GAAG;IACjB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;CACd,CAAC;AAEF,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAgB,EAAE;IACzD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,+CAA+C,CAAC,CAAC;IAEnG,OAAO,GAAG,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAQ,EAAE;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,KAAK,IAAI;QAChD,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC;QACpC,CAAC,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;IAE5B,IAAI,CAAC;QACD,cAAc,CAAC;YACX,UAAU,EAAE,MAAM,CAAC,QAAQ;YAC3B,SAAS,EAAE,MAAM,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YACrF,eAAe,EAAE,YAAY;YAC7B,KAAK,EAAE,iBAAiB,MAAM,CAAC,WAAW,QAAQ;SACrD,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,kBAAkB,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\ntype CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */\n configEnv?: boolean;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst ENV_REFERENCE_FILE = \"__gtkx-env__.d.ts\";\n\nconst writeEnvReference = (storeDir: string): (() => void) => {\n writeFileSync(join(storeDir, ENV_REFERENCE_FILE), \"/// <reference types=\\\"@gtkx/react/env\\\" />\\n\");\n\n return () => {\n rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });\n };\n};\n\nconst compileStore = (params: CompileStoreParams): void => {\n const fileNames = params.files.map((file) => file.fileName);\n\n const removeEnvReference = params.configEnv === true\n ? writeEnvReference(params.storeDir)\n : (): void => undefined;\n\n try {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,\n compilerOptions: EMIT_OPTIONS,\n label: `the generated ${params.packageName} store`,\n });\n } finally {\n removeEnvReference();\n }\n\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n\nexport { compileStore, type CompileStoreParams };\n"]}
1
+ {"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AASlE,MAAM,YAAY,GAAG;IACjB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,KAAK;IACrB,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;CACd,CAAC;AAEF,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAE/C,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAgB,EAAE;IACzD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,+CAA+C,CAAC,CAAC;IAEnG,OAAO,GAAG,EAAE;QACR,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,kBAAkB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAChE,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAQ,EAAE;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAE5D,MAAM,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,KAAK,IAAI;QAC3D,CAAC,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC;QACpC,CAAC,CAAC,GAAS,EAAE,CAAC,SAAS,CAAC;IAE5B,IAAI,CAAC;QACD,cAAc,CAAC;YACX,UAAU,EAAE,MAAM,CAAC,QAAQ;YAC3B,SAAS,EAAE,MAAM,CAAC,oBAAoB,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS;YAChG,eAAe,EAAE,YAAY;YAC7B,KAAK,EAAE,iBAAiB,MAAM,CAAC,WAAW,QAAQ;SACrD,CAAC,CAAC;IACP,CAAC;YAAS,CAAC;QACP,kBAAkB,EAAE,CAAC;IACzB,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\ntype CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n requiresEnvReference?: boolean;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst ENV_REFERENCE_FILE = \"__gtkx-env__.d.ts\";\n\nconst writeEnvReference = (storeDir: string): (() => void) => {\n writeFileSync(join(storeDir, ENV_REFERENCE_FILE), \"/// <reference types=\\\"@gtkx/react/env\\\" />\\n\");\n\n return () => {\n rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });\n };\n};\n\nconst compileStore = (params: CompileStoreParams): void => {\n const fileNames = params.files.map((file) => file.fileName);\n\n const removeEnvReference = params.requiresEnvReference === true\n ? writeEnvReference(params.storeDir)\n : (): void => undefined;\n\n try {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.requiresEnvReference === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,\n compilerOptions: EMIT_OPTIONS,\n label: `the generated ${params.packageName} store`,\n });\n } finally {\n removeEnvReference();\n }\n\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n\nexport { compileStore, type CompileStoreParams };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"callables.d.ts","sourceRoot":"","sources":["../../../src/store/gi/callables.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAmB7D,KAAK,SAAS,GAAG;IACb,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvC,OAAO,EAAE,WAAW,EAAE,CAAC;CAC1B,CAAC;AAoBF,KAAK,sBAAsB,GAAG,CAC1B,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,aAAa,EACpB,YAAY,CAAC,EAAE,MAAM,KACpB,MAAM,GAAG,SAAS,CAAC;AAExB,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,aAAa,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,6BAA6B,EAAE,sBAGpC,CAAC;AAEF,QAAA,MAAM,yBAAyB,EAAE,sBAShC,CAAC;AAEF,QAAA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C"}
@@ -3,7 +3,6 @@ import { hasCallerAllocatedArrayLength } from "../../analysis/param-structure.js
3
3
  import { renderJsDoc } from "../../writer/doc.js";
4
4
  import { renderBlock } from "../../writer/emit.js";
5
5
  import { matchAsyncFinish } from "./async.js";
6
- import { hasClassStructReference } from "./class-struct-record.js";
7
6
  import { renderFnExpression } from "./function.js";
8
7
  import { gtypeMemberDeclaration } from "./gtype-binding.js";
9
8
  import { finishCallExpression, methodExportName, renderMethodBody, renderMethodReturnType, renderMethodSignature, renderPromisifiedBody, renderPromisifiedSignature, } from "./method.js";
@@ -33,9 +32,6 @@ const renderBinding = (context, callable) => {
33
32
  if (cIdentifier === undefined) {
34
33
  return undefined;
35
34
  }
36
- if (hasClassStructReference(context, callable)) {
37
- return undefined;
38
- }
39
35
  const expression = renderFnExpression(context, callable);
40
36
  if (expression === undefined) {
41
37
  return undefined;
@@ -65,8 +61,8 @@ const resolveCallableMember = (context, callable, resolveName) => {
65
61
  }
66
62
  return { cIdentifier, name };
67
63
  };
68
- const runtimeOverrideMember = (callable, name, doc, allow) => {
69
- if (allow !== true) {
64
+ const runtimeOverrideMember = (callable, name, doc, canUseRuntimeOverride) => {
65
+ if (canUseRuntimeOverride !== true) {
70
66
  return undefined;
71
67
  }
72
68
  const override = renderRuntimeOverride(callable, name);
@@ -79,7 +75,7 @@ const renderCallableMember = (context, callable, options) => {
79
75
  }
80
76
  const { cIdentifier, name } = resolved;
81
77
  const doc = renderJsDoc(callable.doc);
82
- const override = runtimeOverrideMember(callable, name, doc, options.allowRuntimeOverride);
78
+ const override = runtimeOverrideMember(callable, name, doc, options.canUseRuntimeOverride);
83
79
  if (override !== undefined) {
84
80
  return override;
85
81
  }
@@ -115,7 +111,7 @@ const renderStaticEntry = (context, callable, siblings, options) => {
115
111
  const renderInstanceMethod = (context, callable, nameOverride) => renderCallableMember(context, callable, {
116
112
  resolveName: (member) => nameOverride ?? methodExportName(member),
117
113
  isStatic: false,
118
- allowRuntimeOverride: true,
114
+ canUseRuntimeOverride: true,
119
115
  });
120
116
  const resolveInstanceMember = (context, callable, scope, nameOverride) => {
121
117
  if (!isEmittableCallable(context, callable)) {
@@ -175,7 +171,6 @@ const indexMethodsByName = (methods) => {
175
171
  const isEmittableCallable = (context, callable) => callable.introspectable &&
176
172
  callable.shadowedBy === undefined &&
177
173
  callable.cIdentifier !== undefined &&
178
- !hasClassStructReference(context, callable) &&
179
174
  !hasCallerAllocatedArrayLength(context.library, callable);
180
175
  const constructorMemberName = (girName) => {
181
176
  const camel = camelCase(girName);
@@ -1 +1 @@
1
- {"version":3,"file":"callables.js","sourceRoot":"","sources":["../../../src/store/gi/callables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA8C9D,MAAM,6BAA6B,GAA2B,sBAAsB,CAChF,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CACtC,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,mBAAmB,C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OAAO,EAAE,YAAY,CAAC;KAC1E,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,GAGzB,CAAC","sourcesContent":["import { camelCase, toCamelIdentifier, uniqBy } from \"@gtkx/utils\";\nimport type { GirFunction } from \"../../gir/function.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport { hasCallerAllocatedArrayLength } from \"../../analysis/param-structure.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { renderBlock } from \"../../writer/emit.js\";\nimport { matchAsyncFinish } from \"./async.js\";\nimport { hasClassStructReference } from \"./class-struct-record.js\";\nimport { renderFnExpression } from \"./function.js\";\nimport { gtypeMemberDeclaration } from \"./gtype-binding.js\";\nimport {\n finishCallExpression,\n methodExportName,\n renderMethodBody,\n renderMethodReturnType,\n renderMethodSignature,\n renderPromisifiedBody,\n renderPromisifiedSignature,\n} from \"./method.js\";\nimport { renderRuntimeOverride } from \"./runtime-override.js\";\n\ntype Callables = {\n constructors: GirFunction[];\n functions: GirFunction[];\n methods: GirFunction[];\n};\n\ntype InstanceScope = {\n ownerName: string;\n methodByName: Map<string, GirFunction>;\n statics: GirFunction[];\n};\n\ntype CallableMemberOptions = {\n resolveName: (callable: GirFunction) => string | undefined;\n isStatic: boolean;\n returnTypeOverride?: string | undefined;\n allowRuntimeOverride?: boolean;\n};\n\ntype StaticEntryOptions = {\n resolveName: (callable: GirFunction) => string | undefined;\n ownerName: string;\n returnTypeOverride?: string | undefined;\n};\n\ntype ResolvedInstanceMember = {\n name: string;\n finishFn: GirFunction | undefined;\n};\n\ntype InstanceMemberRenderer = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n nameOverride?: string,\n) => string | undefined;\n\ntype PlainTypeMembersOptions = {\n context: ModuleContext;\n className: string;\n callables: Callables;\n hasGtype: boolean;\n};\n\nconst renderInstanceMethodSignature: InstanceMemberRenderer = instanceMemberRenderer(\n (context, callable, { name, finishFn }) =>\n `${renderJsDoc(callable.doc)}${memberSignatureText(context, callable, name, { finishFn })};`,\n);\n\nconst renderClassInstanceMember: InstanceMemberRenderer = instanceMemberRenderer(\n (context, callable, { name, finishFn }, scope) =>\n finishFn === undefined\n ? renderInstanceMethod(context, callable, name)\n : renderPromisifiedCallable(context, callable, finishFn, {\n name,\n isStatic: false,\n ownerName: scope.ownerName,\n }),\n);\n\nconst instanceScope = (ownerName: string, callables: Callables): InstanceScope => ({\n ownerName,\n methodByName: indexMethodsByName(callables.methods),\n statics: [...callables.constructors, ...callables.functions],\n});\n\nconst dedupeCallables = (callables: GirFunction[]): GirFunction[] =>\n uniqBy(\n callables.filter(\n (callable): callable is GirFunction & { cIdentifier: string } => callable.cIdentifier !== undefined,\n ),\n (callable) => callable.cIdentifier,\n );\n\nconst renderBinding = (\n context: ModuleContext,\n callable: GirFunction,\n): { text: string; cIdentifier: string } | undefined => {\n if (!callable.introspectable) {\n return undefined;\n }\n\n if (callable.shadowedBy !== undefined) {\n return undefined;\n }\n\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n if (hasClassStructReference(context, callable)) {\n return undefined;\n }\n\n const expression = renderFnExpression(context, callable);\n\n if (expression === undefined) {\n return undefined;\n }\n\n return { text: `const ${toCamelIdentifier(cIdentifier)} = ${expression};`, cIdentifier };\n};\n\nconst generateBindings = (context: ModuleContext, callables: Callables): void => {\n const all = [...callables.constructors, ...callables.functions, ...callables.methods];\n\n for (const callable of all) {\n const binding = renderBinding(context, callable);\n\n if (binding !== undefined) {\n context.module.appendBinding(binding.text, binding.cIdentifier);\n }\n }\n};\n\nconst resolveCallableMember = (\n context: ModuleContext,\n callable: GirFunction,\n resolveName: (callable: GirFunction) => string | undefined,\n): { cIdentifier: string; name: string } | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n const name = resolveName(callable);\n\n if (name === undefined || name === \"constructor\") {\n return undefined;\n }\n\n return { cIdentifier, name };\n};\n\nconst runtimeOverrideMember = (\n callable: GirFunction,\n name: string,\n doc: string,\n allow: boolean | undefined,\n): string | undefined => {\n if (allow !== true) {\n return undefined;\n }\n\n const override = renderRuntimeOverride(callable, name);\n\n return override === undefined ? undefined : `${doc}${override}`;\n};\n\nconst renderCallableMember = (\n context: ModuleContext,\n callable: GirFunction,\n options: CallableMemberOptions,\n): string | undefined => {\n const resolved = resolveCallableMember(context, callable, options.resolveName);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const { cIdentifier, name } = resolved;\n const doc = renderJsDoc(callable.doc);\n const override = runtimeOverrideMember(callable, name, doc, options.allowRuntimeOverride);\n\n if (override !== undefined) {\n return override;\n }\n\n const signature = renderMethodSignature(context, callable);\n const returnType = options.returnTypeOverride ?? renderMethodReturnType(context, callable);\n\n const body = renderMethodBody(context, callable, {\n bindingExpression: toCamelIdentifier(cIdentifier),\n returnTypeOverride: options.returnTypeOverride,\n });\n\n const prefix = options.isStatic ? \"static \" : \"\";\n const header = `${prefix}${name}(${signature}): ${returnType}`;\n\n return `${doc}${renderBlock(header, body)}`;\n};\n\nconst renderStaticEntry = (\n context: ModuleContext,\n callable: GirFunction,\n siblings: GirFunction[],\n options: StaticEntryOptions,\n): string | undefined => {\n const finishFn = matchStaticFinishFunction(context, callable, siblings);\n\n if (finishFn !== undefined) {\n const name = options.resolveName(callable);\n\n if (name === undefined || name === \"constructor\") {\n return undefined;\n }\n\n return renderPromisifiedCallable(context, callable, finishFn, {\n name,\n isStatic: true,\n ownerName: options.ownerName,\n });\n }\n\n return renderCallableMember(context, callable, {\n resolveName: options.resolveName,\n isStatic: true,\n returnTypeOverride: options.returnTypeOverride,\n });\n};\n\nconst renderInstanceMethod = (\n context: ModuleContext,\n callable: GirFunction,\n nameOverride?: string,\n): string | undefined =>\n renderCallableMember(context, callable, {\n resolveName: (member) => nameOverride ?? methodExportName(member),\n isStatic: false,\n allowRuntimeOverride: true,\n });\n\nconst resolveInstanceMember = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n nameOverride?: string,\n): ResolvedInstanceMember | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const name = nameOverride ?? methodExportName(callable);\n\n if (name === \"constructor\") {\n return undefined;\n }\n\n const finishFn = matchFinishFunction(context, callable, scope);\n\n if (finishFn !== undefined && !isEmittableCallable(context, finishFn)) {\n return undefined;\n }\n\n return { name, finishFn };\n};\n\nfunction instanceMemberRenderer(\n render: (\n context: ModuleContext,\n callable: GirFunction,\n member: ResolvedInstanceMember,\n scope: InstanceScope,\n ) => string | undefined,\n): InstanceMemberRenderer {\n return (context, callable, scope, nameOverride) => {\n const member = resolveInstanceMember(context, callable, scope, nameOverride);\n\n return member === undefined ? undefined : render(context, callable, member, scope);\n };\n}\n\nconst memberSignatureText = (\n context: ModuleContext,\n callable: GirFunction,\n name: string,\n options: { finishFn: GirFunction | undefined; returnTypeOverride?: string | undefined },\n): string => {\n const promisified =\n options.finishFn === undefined ? undefined : renderPromisifiedSignature(context, callable, options.finishFn);\n\n const signature = promisified?.signature ?? renderMethodSignature(context, callable);\n\n const returnType =\n promisified?.returnType ?? options.returnTypeOverride ?? renderMethodReturnType(context, callable);\n\n return `${name}(${signature}): ${returnType}`;\n};\n\nconst matchFinishFunction = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n): GirFunction | undefined =>\n matchAsyncFinish(context.library, callable, [...scope.methodByName.values(), ...scope.statics]);\n\nconst matchStaticFinishFunction = (\n context: ModuleContext,\n callable: GirFunction,\n siblings: GirFunction[],\n): GirFunction | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const finishFn = matchAsyncFinish(context.library, callable, siblings);\n\n if (finishFn === undefined || !isEmittableCallable(context, finishFn)) {\n return undefined;\n }\n\n return finishFn;\n};\n\nconst renderPromisifiedCallable = (\n context: ModuleContext,\n callable: GirFunction,\n finishFn: GirFunction,\n member: { name: string; isStatic: boolean; ownerName: string },\n): string | undefined => {\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n const { signature, returnType } = renderPromisifiedSignature(context, callable, finishFn);\n\n const body = renderPromisifiedBody(\n context,\n callable,\n finishCallExpression(callable, finishFn, member.ownerName),\n toCamelIdentifier(cIdentifier),\n );\n\n const prefix = member.isStatic ? \"static \" : \"\";\n const header = `${prefix}${member.name}(${signature}): ${returnType}`;\n\n return `${renderJsDoc(callable.doc)}${renderBlock(header, body)}`;\n};\n\nconst indexMethodsByName = (methods: GirFunction[]): Map<string, GirFunction> => {\n const map: Map<string, GirFunction> = new Map();\n\n for (const callable of methods) {\n map.set(callable.name, callable);\n }\n\n return map;\n};\n\nconst isEmittableCallable = (context: ModuleContext, callable: GirFunction): boolean =>\n callable.introspectable &&\n callable.shadowedBy === undefined &&\n callable.cIdentifier !== undefined &&\n !hasClassStructReference(context, callable) &&\n !hasCallerAllocatedArrayLength(context.library, callable);\n\nconst constructorMemberName = (girName: string): string | undefined => {\n const camel = camelCase(girName);\n\n if (camel === \"constructor\") {\n return undefined;\n }\n\n return camel;\n};\n\nconst renderStaticSignature = (\n context: ModuleContext,\n callable: GirFunction,\n options?: { returnTypeOverride?: string | undefined; siblings?: GirFunction[] | undefined },\n): { name: string; signature: string } | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const name = constructorMemberName(callable.name);\n\n if (name === undefined) {\n return undefined;\n }\n\n const finishFn =\n options?.siblings === undefined ? undefined : matchStaticFinishFunction(context, callable, options.siblings);\n\n return {\n name,\n signature: memberSignatureText(context, callable, name, {\n finishFn,\n returnTypeOverride: options?.returnTypeOverride,\n }),\n };\n};\n\nconst classConstructorMemberNames = (context: ModuleContext, callables: Callables): string[] => {\n const names: string[] = [];\n\n for (const callable of callables.constructors) {\n if (!isEmittableCallable(context, callable)) {\n continue;\n }\n\n const member = constructorMemberName(callable.name);\n\n if (member !== undefined) {\n names.push(member);\n }\n }\n\n return names;\n};\n\nconst collectStaticEntries = (\n context: ModuleContext,\n group: GirFunction[],\n siblings: GirFunction[],\n options: StaticEntryOptions,\n): string[] => {\n const blocks: string[] = [];\n\n for (const callable of group) {\n const block = renderStaticEntry(context, callable, siblings, options);\n\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n\n return blocks;\n};\n\nconst renderStaticHead = (context: ModuleContext, callables: Callables, ownerClassName: string): string[] => {\n const siblings = [...callables.constructors, ...callables.functions];\n\n return [\n ...collectStaticEntries(context, callables.constructors, siblings, {\n resolveName: (member) => constructorMemberName(member.name),\n ownerName: ownerClassName,\n returnTypeOverride: ownerClassName,\n }),\n ...collectStaticEntries(context, callables.functions, siblings, {\n resolveName: (member) => camelCase(member.name),\n ownerName: ownerClassName,\n }),\n ];\n};\n\nconst renderPlainInstanceMethods = (\n context: ModuleContext,\n methods: GirFunction[],\n claimedNames: Set<string>,\n): string[] => {\n const blocks: string[] = [];\n\n for (const callable of methods) {\n const block = renderInstanceMethod(context, callable);\n\n if (block === undefined) {\n continue;\n }\n\n blocks.push(block);\n claimedNames.add(methodExportName(callable));\n }\n\n return blocks;\n};\n\nconst renderPlainTypeMembers = (\n options: PlainTypeMembersOptions,\n): { members: string[]; claimedNames: Set<string> } => {\n const { context, className, callables, hasGtype } = options;\n const claimedNames: Set<string> = new Set();\n\n const members: string[] = [\n ...(hasGtype ? [gtypeMemberDeclaration(context)] : []),\n ...renderStaticHead(context, callables, className),\n ...renderPlainInstanceMethods(context, callables.methods, claimedNames),\n ];\n\n return { members, claimedNames };\n};\n\nexport {\n renderInstanceMethodSignature,\n renderClassInstanceMember,\n instanceScope,\n dedupeCallables,\n generateBindings,\n matchStaticFinishFunction,\n indexMethodsByName,\n isEmittableCallable,\n renderStaticSignature,\n classConstructorMemberNames,\n renderStaticHead,\n renderPlainTypeMembers,\n type Callables,\n type InstanceScope,\n};\n"]}
1
+ {"version":3,"file":"callables.js","sourceRoot":"","sources":["../../../src/store/gi/callables.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AA8C9D,MAAM,6BAA6B,GAA2B,sBAAsB,CAChF,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CACtC,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,CACnG,CAAC;AAEF,MAAM,yBAAyB,GAA2B,sBAAsB,CAC5E,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,CAC7C,QAAQ,KAAK,SAAS;IAClB,CAAC,CA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,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACtB,SAAS;QACb,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAC3B,OAAgC,EACgB,EAAE;IAClD,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAC5D,MAAM,YAAY,GAAgB,IAAI,GAAG,EAAE,CAAC;IAE5C,MAAM,OAAO,GAAa;QACtB,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;QAClD,GAAG,0BAA0B,CAAC,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;KAC1E,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACrC,CAAC,CAAC;AAEF,OAAO,EACH,6BAA6B,EAC7B,yBAAyB,EACzB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,yBAAyB,EACzB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,2BAA2B,EAC3B,gBAAgB,EAChB,sBAAsB,GAGzB,CAAC","sourcesContent":["import { camelCase, toCamelIdentifier, uniqBy } from \"@gtkx/utils\";\nimport type { GirFunction } from \"../../gir/function.js\";\nimport type { ModuleContext } from \"../../writer/context.js\";\nimport { hasCallerAllocatedArrayLength } from \"../../analysis/param-structure.js\";\nimport { renderJsDoc } from \"../../writer/doc.js\";\nimport { renderBlock } from \"../../writer/emit.js\";\nimport { matchAsyncFinish } from \"./async.js\";\nimport { renderFnExpression } from \"./function.js\";\nimport { gtypeMemberDeclaration } from \"./gtype-binding.js\";\nimport {\n finishCallExpression,\n methodExportName,\n renderMethodBody,\n renderMethodReturnType,\n renderMethodSignature,\n renderPromisifiedBody,\n renderPromisifiedSignature,\n} from \"./method.js\";\nimport { renderRuntimeOverride } from \"./runtime-override.js\";\n\ntype Callables = {\n constructors: GirFunction[];\n functions: GirFunction[];\n methods: GirFunction[];\n};\n\ntype InstanceScope = {\n ownerName: string;\n methodByName: Map<string, GirFunction>;\n statics: GirFunction[];\n};\n\ntype CallableMemberOptions = {\n resolveName: (callable: GirFunction) => string | undefined;\n isStatic: boolean;\n returnTypeOverride?: string | undefined;\n canUseRuntimeOverride?: boolean;\n};\n\ntype StaticEntryOptions = {\n resolveName: (callable: GirFunction) => string | undefined;\n ownerName: string;\n returnTypeOverride?: string | undefined;\n};\n\ntype ResolvedInstanceMember = {\n name: string;\n finishFn: GirFunction | undefined;\n};\n\ntype InstanceMemberRenderer = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n nameOverride?: string,\n) => string | undefined;\n\ntype PlainTypeMembersOptions = {\n context: ModuleContext;\n className: string;\n callables: Callables;\n hasGtype: boolean;\n};\n\nconst renderInstanceMethodSignature: InstanceMemberRenderer = instanceMemberRenderer(\n (context, callable, { name, finishFn }) =>\n `${renderJsDoc(callable.doc)}${memberSignatureText(context, callable, name, { finishFn })};`,\n);\n\nconst renderClassInstanceMember: InstanceMemberRenderer = instanceMemberRenderer(\n (context, callable, { name, finishFn }, scope) =>\n finishFn === undefined\n ? renderInstanceMethod(context, callable, name)\n : renderPromisifiedCallable(context, callable, finishFn, {\n name,\n isStatic: false,\n ownerName: scope.ownerName,\n }),\n);\n\nconst instanceScope = (ownerName: string, callables: Callables): InstanceScope => ({\n ownerName,\n methodByName: indexMethodsByName(callables.methods),\n statics: [...callables.constructors, ...callables.functions],\n});\n\nconst dedupeCallables = (callables: GirFunction[]): GirFunction[] =>\n uniqBy(\n callables.filter(\n (callable): callable is GirFunction & { cIdentifier: string } => callable.cIdentifier !== undefined,\n ),\n (callable) => callable.cIdentifier,\n );\n\nconst renderBinding = (\n context: ModuleContext,\n callable: GirFunction,\n): { text: string; cIdentifier: string } | undefined => {\n if (!callable.introspectable) {\n return undefined;\n }\n\n if (callable.shadowedBy !== undefined) {\n return undefined;\n }\n\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n const expression = renderFnExpression(context, callable);\n\n if (expression === undefined) {\n return undefined;\n }\n\n return { text: `const ${toCamelIdentifier(cIdentifier)} = ${expression};`, cIdentifier };\n};\n\nconst generateBindings = (context: ModuleContext, callables: Callables): void => {\n const all = [...callables.constructors, ...callables.functions, ...callables.methods];\n\n for (const callable of all) {\n const binding = renderBinding(context, callable);\n\n if (binding !== undefined) {\n context.module.appendBinding(binding.text, binding.cIdentifier);\n }\n }\n};\n\nconst resolveCallableMember = (\n context: ModuleContext,\n callable: GirFunction,\n resolveName: (callable: GirFunction) => string | undefined,\n): { cIdentifier: string; name: string } | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n const name = resolveName(callable);\n\n if (name === undefined || name === \"constructor\") {\n return undefined;\n }\n\n return { cIdentifier, name };\n};\n\nconst runtimeOverrideMember = (\n callable: GirFunction,\n name: string,\n doc: string,\n canUseRuntimeOverride: boolean | undefined,\n): string | undefined => {\n if (canUseRuntimeOverride !== true) {\n return undefined;\n }\n\n const override = renderRuntimeOverride(callable, name);\n\n return override === undefined ? undefined : `${doc}${override}`;\n};\n\nconst renderCallableMember = (\n context: ModuleContext,\n callable: GirFunction,\n options: CallableMemberOptions,\n): string | undefined => {\n const resolved = resolveCallableMember(context, callable, options.resolveName);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const { cIdentifier, name } = resolved;\n const doc = renderJsDoc(callable.doc);\n const override = runtimeOverrideMember(callable, name, doc, options.canUseRuntimeOverride);\n\n if (override !== undefined) {\n return override;\n }\n\n const signature = renderMethodSignature(context, callable);\n const returnType = options.returnTypeOverride ?? renderMethodReturnType(context, callable);\n\n const body = renderMethodBody(context, callable, {\n bindingExpression: toCamelIdentifier(cIdentifier),\n returnTypeOverride: options.returnTypeOverride,\n });\n\n const prefix = options.isStatic ? \"static \" : \"\";\n const header = `${prefix}${name}(${signature}): ${returnType}`;\n\n return `${doc}${renderBlock(header, body)}`;\n};\n\nconst renderStaticEntry = (\n context: ModuleContext,\n callable: GirFunction,\n siblings: GirFunction[],\n options: StaticEntryOptions,\n): string | undefined => {\n const finishFn = matchStaticFinishFunction(context, callable, siblings);\n\n if (finishFn !== undefined) {\n const name = options.resolveName(callable);\n\n if (name === undefined || name === \"constructor\") {\n return undefined;\n }\n\n return renderPromisifiedCallable(context, callable, finishFn, {\n name,\n isStatic: true,\n ownerName: options.ownerName,\n });\n }\n\n return renderCallableMember(context, callable, {\n resolveName: options.resolveName,\n isStatic: true,\n returnTypeOverride: options.returnTypeOverride,\n });\n};\n\nconst renderInstanceMethod = (\n context: ModuleContext,\n callable: GirFunction,\n nameOverride?: string,\n): string | undefined =>\n renderCallableMember(context, callable, {\n resolveName: (member) => nameOverride ?? methodExportName(member),\n isStatic: false,\n canUseRuntimeOverride: true,\n });\n\nconst resolveInstanceMember = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n nameOverride?: string,\n): ResolvedInstanceMember | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const name = nameOverride ?? methodExportName(callable);\n\n if (name === \"constructor\") {\n return undefined;\n }\n\n const finishFn = matchFinishFunction(context, callable, scope);\n\n if (finishFn !== undefined && !isEmittableCallable(context, finishFn)) {\n return undefined;\n }\n\n return { name, finishFn };\n};\n\nfunction instanceMemberRenderer(\n render: (\n context: ModuleContext,\n callable: GirFunction,\n member: ResolvedInstanceMember,\n scope: InstanceScope,\n ) => string | undefined,\n): InstanceMemberRenderer {\n return (context, callable, scope, nameOverride) => {\n const member = resolveInstanceMember(context, callable, scope, nameOverride);\n\n return member === undefined ? undefined : render(context, callable, member, scope);\n };\n}\n\nconst memberSignatureText = (\n context: ModuleContext,\n callable: GirFunction,\n name: string,\n options: { finishFn: GirFunction | undefined; returnTypeOverride?: string | undefined },\n): string => {\n const promisified =\n options.finishFn === undefined ? undefined : renderPromisifiedSignature(context, callable, options.finishFn);\n\n const signature = promisified?.signature ?? renderMethodSignature(context, callable);\n\n const returnType =\n promisified?.returnType ?? options.returnTypeOverride ?? renderMethodReturnType(context, callable);\n\n return `${name}(${signature}): ${returnType}`;\n};\n\nconst matchFinishFunction = (\n context: ModuleContext,\n callable: GirFunction,\n scope: InstanceScope,\n): GirFunction | undefined =>\n matchAsyncFinish(context.library, callable, [...scope.methodByName.values(), ...scope.statics]);\n\nconst matchStaticFinishFunction = (\n context: ModuleContext,\n callable: GirFunction,\n siblings: GirFunction[],\n): GirFunction | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const finishFn = matchAsyncFinish(context.library, callable, siblings);\n\n if (finishFn === undefined || !isEmittableCallable(context, finishFn)) {\n return undefined;\n }\n\n return finishFn;\n};\n\nconst renderPromisifiedCallable = (\n context: ModuleContext,\n callable: GirFunction,\n finishFn: GirFunction,\n member: { name: string; isStatic: boolean; ownerName: string },\n): string | undefined => {\n const cIdentifier = callable.cIdentifier;\n\n if (cIdentifier === undefined) {\n return undefined;\n }\n\n const { signature, returnType } = renderPromisifiedSignature(context, callable, finishFn);\n\n const body = renderPromisifiedBody(\n context,\n callable,\n finishCallExpression(callable, finishFn, member.ownerName),\n toCamelIdentifier(cIdentifier),\n );\n\n const prefix = member.isStatic ? \"static \" : \"\";\n const header = `${prefix}${member.name}(${signature}): ${returnType}`;\n\n return `${renderJsDoc(callable.doc)}${renderBlock(header, body)}`;\n};\n\nconst indexMethodsByName = (methods: GirFunction[]): Map<string, GirFunction> => {\n const map: Map<string, GirFunction> = new Map();\n\n for (const callable of methods) {\n map.set(callable.name, callable);\n }\n\n return map;\n};\n\nconst isEmittableCallable = (context: ModuleContext, callable: GirFunction): boolean =>\n callable.introspectable &&\n callable.shadowedBy === undefined &&\n callable.cIdentifier !== undefined &&\n !hasCallerAllocatedArrayLength(context.library, callable);\n\nconst constructorMemberName = (girName: string): string | undefined => {\n const camel = camelCase(girName);\n\n if (camel === \"constructor\") {\n return undefined;\n }\n\n return camel;\n};\n\nconst renderStaticSignature = (\n context: ModuleContext,\n callable: GirFunction,\n options?: { returnTypeOverride?: string | undefined; siblings?: GirFunction[] | undefined },\n): { name: string; signature: string } | undefined => {\n if (!isEmittableCallable(context, callable)) {\n return undefined;\n }\n\n const name = constructorMemberName(callable.name);\n\n if (name === undefined) {\n return undefined;\n }\n\n const finishFn =\n options?.siblings === undefined ? undefined : matchStaticFinishFunction(context, callable, options.siblings);\n\n return {\n name,\n signature: memberSignatureText(context, callable, name, {\n finishFn,\n returnTypeOverride: options?.returnTypeOverride,\n }),\n };\n};\n\nconst classConstructorMemberNames = (context: ModuleContext, callables: Callables): string[] => {\n const names: string[] = [];\n\n for (const callable of callables.constructors) {\n if (!isEmittableCallable(context, callable)) {\n continue;\n }\n\n const member = constructorMemberName(callable.name);\n\n if (member !== undefined) {\n names.push(member);\n }\n }\n\n return names;\n};\n\nconst collectStaticEntries = (\n context: ModuleContext,\n group: GirFunction[],\n siblings: GirFunction[],\n options: StaticEntryOptions,\n): string[] => {\n const blocks: string[] = [];\n\n for (const callable of group) {\n const block = renderStaticEntry(context, callable, siblings, options);\n\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n\n return blocks;\n};\n\nconst renderStaticHead = (context: ModuleContext, callables: Callables, ownerClassName: string): string[] => {\n const siblings = [...callables.constructors, ...callables.functions];\n\n return [\n ...collectStaticEntries(context, callables.constructors, siblings, {\n resolveName: (member) => constructorMemberName(member.name),\n ownerName: ownerClassName,\n returnTypeOverride: ownerClassName,\n }),\n ...collectStaticEntries(context, callables.functions, siblings, {\n resolveName: (member) => camelCase(member.name),\n ownerName: ownerClassName,\n }),\n ];\n};\n\nconst renderPlainInstanceMethods = (\n context: ModuleContext,\n methods: GirFunction[],\n claimedNames: Set<string>,\n): string[] => {\n const blocks: string[] = [];\n\n for (const callable of methods) {\n const block = renderInstanceMethod(context, callable);\n\n if (block === undefined) {\n continue;\n }\n\n blocks.push(block);\n claimedNames.add(methodExportName(callable));\n }\n\n return blocks;\n};\n\nconst renderPlainTypeMembers = (\n options: PlainTypeMembersOptions,\n): { members: string[]; claimedNames: Set<string> } => {\n const { context, className, callables, hasGtype } = options;\n const claimedNames: Set<string> = new Set();\n\n const members: string[] = [\n ...(hasGtype ? [gtypeMemberDeclaration(context)] : []),\n ...renderStaticHead(context, callables, className),\n ...renderPlainInstanceMethods(context, callables.methods, claimedNames),\n ];\n\n return { members, claimedNames };\n};\n\nexport {\n renderInstanceMethodSignature,\n renderClassInstanceMember,\n instanceScope,\n dedupeCallables,\n generateBindings,\n matchStaticFinishFunction,\n indexMethodsByName,\n isEmittableCallable,\n renderStaticSignature,\n classConstructorMemberNames,\n renderStaticHead,\n renderPlainTypeMembers,\n type Callables,\n type InstanceScope,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/store/gi/constant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQ7D,QAAA,MAAM,gBAAgB,GAAI,SAAS,aAAa,EAAE,UAAU,WAAW,KAAG,IAIzE,CAAC;AAEF,QAAA,MAAM,eAAe,GAAI,SAAS,aAAa,EAAE,UAAU,WAAW,KAAG,MAUxE,CAAC;AA6BF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/store/gi/constant.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAM7D,QAAA,MAAM,gBAAgB,GAAI,SAAS,aAAa,EAAE,UAAU,WAAW,KAAG,IAIzE,CAAC;AAEF,QAAA,MAAM,eAAe,GAAI,SAAS,aAAa,EAAE,UAAU,WAAW,KAAG,MAUxE,CAAC;AA6BF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
@@ -1,8 +1,6 @@
1
1
  import { sourceStringLiteral } from "@gtkx/utils";
2
2
  import { renderJsDoc } from "../../writer/doc.js";
3
3
  const TRUE_VALUES = new Set(["true", "1"]);
4
- // A `gint64`/`guint64` constant is typed `bigint`, and its decimal text does not survive a double:
5
- // G_MAXINT64 rounds to 2^63. The literal has to carry the BigInt suffix the type promises.
6
4
  const BIGINT_CATEGORIES = new Set(["bigint64", "biguint64", "gtype"]);
7
5
  const generateConstant = (context, constant) => {
8
6
  context.module.appendDeclaration(`${renderJsDoc(constant.doc)}export const ${constant.name} = ${constantLiteral(context, constant)};`);