@gtkx/cli 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +5 -4
  2. package/dist/builder.d.ts +0 -1
  3. package/dist/builder.d.ts.map +1 -1
  4. package/dist/builder.js +6 -6
  5. package/dist/builder.js.map +1 -1
  6. package/dist/codegen/run-codegen.d.ts +1 -2
  7. package/dist/codegen/run-codegen.d.ts.map +1 -1
  8. package/dist/codegen/run-codegen.js +11 -6
  9. package/dist/codegen/run-codegen.js.map +1 -1
  10. package/dist/commands/build.d.ts +0 -4
  11. package/dist/commands/build.d.ts.map +1 -1
  12. package/dist/commands/build.js +0 -5
  13. package/dist/commands/build.js.map +1 -1
  14. package/dist/commands/codegen.d.ts.map +1 -1
  15. package/dist/commands/codegen.js +1 -3
  16. package/dist/commands/codegen.js.map +1 -1
  17. package/dist/deploy/depends.d.ts +2 -2
  18. package/dist/deploy/depends.d.ts.map +1 -1
  19. package/dist/deploy/depends.js +30 -15
  20. package/dist/deploy/depends.js.map +1 -1
  21. package/dist/deploy/nfpm/config.js +1 -1
  22. package/dist/deploy/nfpm/config.js.map +1 -1
  23. package/dist/deploy/node-runtime/elf.d.ts +1 -1
  24. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  25. package/dist/deploy/node-runtime/elf.js +2 -2
  26. package/dist/deploy/node-runtime/elf.js.map +1 -1
  27. package/dist/deploy/node-runtime/index.js +2 -2
  28. package/dist/deploy/node-runtime/index.js.map +1 -1
  29. package/dist/deploy/notices/collect.d.ts +3 -1
  30. package/dist/deploy/notices/collect.d.ts.map +1 -1
  31. package/dist/deploy/notices/collect.js +2 -2
  32. package/dist/deploy/notices/collect.js.map +1 -1
  33. package/dist/deploy/notices/packages.d.ts +2 -1
  34. package/dist/deploy/notices/packages.d.ts.map +1 -1
  35. package/dist/deploy/notices/packages.js +4 -27
  36. package/dist/deploy/notices/packages.js.map +1 -1
  37. package/dist/deploy/payload/icons.d.ts +7 -3
  38. package/dist/deploy/payload/icons.d.ts.map +1 -1
  39. package/dist/deploy/payload/icons.js +46 -28
  40. package/dist/deploy/payload/icons.js.map +1 -1
  41. package/dist/deploy/payload/stage.d.ts.map +1 -1
  42. package/dist/deploy/payload/stage.js +3 -2
  43. package/dist/deploy/payload/stage.js.map +1 -1
  44. package/dist/deploy/run-deploy.d.ts.map +1 -1
  45. package/dist/deploy/run-deploy.js +63 -11
  46. package/dist/deploy/run-deploy.js.map +1 -1
  47. package/dist/deploy/settings/build-manifest.d.ts +9 -0
  48. package/dist/deploy/settings/build-manifest.d.ts.map +1 -0
  49. package/dist/deploy/settings/build-manifest.js +80 -0
  50. package/dist/deploy/settings/build-manifest.js.map +1 -0
  51. package/dist/deploy/settings/index.d.ts.map +1 -1
  52. package/dist/deploy/settings/index.js +9 -3
  53. package/dist/deploy/settings/index.js.map +1 -1
  54. package/dist/deploy/settings/libraries.d.ts +8 -0
  55. package/dist/deploy/settings/libraries.d.ts.map +1 -0
  56. package/dist/deploy/settings/libraries.js +39 -0
  57. package/dist/deploy/settings/libraries.js.map +1 -0
  58. package/dist/deploy/settings/paths.d.ts +3 -0
  59. package/dist/deploy/settings/paths.d.ts.map +1 -1
  60. package/dist/deploy/settings/paths.js +6 -32
  61. package/dist/deploy/settings/paths.js.map +1 -1
  62. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  63. package/dist/deploy/targets/appimage.js +19 -13
  64. package/dist/deploy/targets/appimage.js.map +1 -1
  65. package/dist/deploy/targets/flatpak-manifest.d.ts +2 -1
  66. package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
  67. package/dist/deploy/targets/flatpak-manifest.js +5 -1
  68. package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
  69. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  70. package/dist/deploy/targets/flatpak-source.js +9 -6
  71. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  72. package/dist/deploy/types.d.ts +4 -4
  73. package/dist/deploy/types.d.ts.map +1 -1
  74. package/dist/deploy/types.js.map +1 -1
  75. package/dist/dev/icon-dir.d.ts +1 -1
  76. package/dist/dev/icon-dir.d.ts.map +1 -1
  77. package/dist/dev/icon-dir.js +20 -7
  78. package/dist/dev/icon-dir.js.map +1 -1
  79. package/dist/dev/runner-deps.d.ts.map +1 -1
  80. package/dist/dev/runner-deps.js +5 -1
  81. package/dist/dev/runner-deps.js.map +1 -1
  82. package/dist/dev/runner-main.js +4 -4
  83. package/dist/dev/runner-main.js.map +1 -1
  84. package/dist/dev/runner.d.ts +1 -1
  85. package/dist/dev/runner.d.ts.map +1 -1
  86. package/dist/dev/runner.js +1 -1
  87. package/dist/dev/runner.js.map +1 -1
  88. package/dist/dev/schema-dir.d.ts +1 -1
  89. package/dist/dev/schema-dir.d.ts.map +1 -1
  90. package/dist/dev/schema-dir.js +3 -1
  91. package/dist/dev/schema-dir.js.map +1 -1
  92. package/dist/internal/build-manifest.d.ts +20 -0
  93. package/dist/internal/build-manifest.d.ts.map +1 -0
  94. package/dist/internal/build-manifest.js +6 -0
  95. package/dist/internal/build-manifest.js.map +1 -0
  96. package/dist/internal/icon-path.d.ts +13 -0
  97. package/dist/internal/icon-path.d.ts.map +1 -0
  98. package/dist/internal/icon-path.js +86 -0
  99. package/dist/internal/icon-path.js.map +1 -0
  100. package/dist/internal/source-imports.d.ts +8 -0
  101. package/dist/internal/source-imports.d.ts.map +1 -0
  102. package/dist/internal/source-imports.js +144 -0
  103. package/dist/internal/source-imports.js.map +1 -0
  104. package/dist/mcp/widget-properties.d.ts.map +1 -1
  105. package/dist/mcp/widget-properties.js +3 -12
  106. package/dist/mcp/widget-properties.js.map +1 -1
  107. package/dist/settings/render.d.ts +7 -1
  108. package/dist/settings/render.d.ts.map +1 -1
  109. package/dist/settings/render.js +69 -20
  110. package/dist/settings/render.js.map +1 -1
  111. package/dist/settings/schema.d.ts +4 -3
  112. package/dist/settings/schema.d.ts.map +1 -1
  113. package/dist/settings/schema.js +122 -15
  114. package/dist/settings/schema.js.map +1 -1
  115. package/dist/vite-plugins/asset-emitter.d.ts +1 -1
  116. package/dist/vite-plugins/asset-emitter.d.ts.map +1 -1
  117. package/dist/vite-plugins/asset-emitter.js.map +1 -1
  118. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  119. package/dist/vite-plugins/asset-extensions.js +1 -0
  120. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  121. package/dist/vite-plugins/asset-imports.d.ts +2 -1
  122. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  123. package/dist/vite-plugins/asset-imports.js +37 -16
  124. package/dist/vite-plugins/asset-imports.js.map +1 -1
  125. package/dist/vite-plugins/asset-specifier.d.ts +13 -1
  126. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  127. package/dist/vite-plugins/asset-specifier.js +39 -1
  128. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  129. package/dist/vite-plugins/build-manifest.d.ts +5 -0
  130. package/dist/vite-plugins/build-manifest.d.ts.map +1 -0
  131. package/dist/vite-plugins/{bundled-packages.js → build-manifest.js} +20 -14
  132. package/dist/vite-plugins/build-manifest.js.map +1 -0
  133. package/dist/vite-plugins/built-url.d.ts +1 -1
  134. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  135. package/dist/vite-plugins/built-url.js +37 -24
  136. package/dist/vite-plugins/built-url.js.map +1 -1
  137. package/dist/vite-plugins/icons.d.ts +2 -1
  138. package/dist/vite-plugins/icons.d.ts.map +1 -1
  139. package/dist/vite-plugins/icons.js +25 -12
  140. package/dist/vite-plugins/icons.js.map +1 -1
  141. package/dist/vite-plugins/index.d.ts +2 -1
  142. package/dist/vite-plugins/index.d.ts.map +1 -1
  143. package/dist/vite-plugins/index.js +7 -5
  144. package/dist/vite-plugins/index.js.map +1 -1
  145. package/dist/vite-plugins/native.d.ts.map +1 -1
  146. package/dist/vite-plugins/native.js +23 -4
  147. package/dist/vite-plugins/native.js.map +1 -1
  148. package/dist/vite-plugins/resource-init-module.d.ts +7 -3
  149. package/dist/vite-plugins/resource-init-module.d.ts.map +1 -1
  150. package/dist/vite-plugins/resource-init-module.js +39 -14
  151. package/dist/vite-plugins/resource-init-module.js.map +1 -1
  152. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  153. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  154. package/dist/vite-plugins/resource-shared.js +3 -1
  155. package/dist/vite-plugins/resource-shared.js.map +1 -1
  156. package/dist/vite-plugins/resources.d.ts +1 -1
  157. package/dist/vite-plugins/resources.d.ts.map +1 -1
  158. package/dist/vite-plugins/resources.js +922 -86
  159. package/dist/vite-plugins/resources.js.map +1 -1
  160. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  161. package/dist/vite-plugins/settings-worker-env.js +6 -3
  162. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  163. package/dist/vite-plugins/settings.d.ts +3 -1
  164. package/dist/vite-plugins/settings.d.ts.map +1 -1
  165. package/dist/vite-plugins/settings.js +63 -23
  166. package/dist/vite-plugins/settings.js.map +1 -1
  167. package/env.d.ts +11 -192
  168. package/package.json +10 -10
  169. package/src/builder.ts +6 -7
  170. package/src/codegen/run-codegen.ts +10 -7
  171. package/src/commands/build.ts +0 -5
  172. package/src/commands/codegen.ts +1 -3
  173. package/src/deploy/depends.ts +47 -18
  174. package/src/deploy/nfpm/config.ts +1 -1
  175. package/src/deploy/node-runtime/elf.ts +3 -3
  176. package/src/deploy/node-runtime/index.ts +2 -2
  177. package/src/deploy/notices/collect.ts +4 -2
  178. package/src/deploy/notices/packages.ts +5 -43
  179. package/src/deploy/payload/icons.ts +64 -34
  180. package/src/deploy/payload/stage.ts +5 -2
  181. package/src/deploy/run-deploy.ts +87 -12
  182. package/src/deploy/settings/build-manifest.ts +122 -0
  183. package/src/deploy/settings/index.ts +9 -4
  184. package/src/deploy/settings/libraries.ts +57 -0
  185. package/src/deploy/settings/paths.ts +10 -47
  186. package/src/deploy/targets/appimage.ts +32 -15
  187. package/src/deploy/targets/flatpak-manifest.ts +7 -1
  188. package/src/deploy/targets/flatpak-source.ts +9 -10
  189. package/src/deploy/types.ts +4 -4
  190. package/src/dev/icon-dir.ts +31 -7
  191. package/src/dev/runner-deps.ts +5 -1
  192. package/src/dev/runner-main.ts +4 -4
  193. package/src/dev/runner.ts +2 -2
  194. package/src/dev/schema-dir.ts +3 -1
  195. package/src/internal/build-manifest.ts +32 -0
  196. package/src/internal/icon-path.ts +127 -0
  197. package/src/internal/source-imports.ts +200 -0
  198. package/src/mcp/widget-properties.ts +3 -14
  199. package/src/settings/render.ts +99 -21
  200. package/src/settings/schema.ts +190 -17
  201. package/src/vite-plugins/asset-emitter.ts +1 -1
  202. package/src/vite-plugins/asset-extensions.ts +1 -0
  203. package/src/vite-plugins/asset-imports.ts +60 -19
  204. package/src/vite-plugins/asset-specifier.ts +73 -1
  205. package/src/vite-plugins/{bundled-packages.ts → build-manifest.ts} +30 -19
  206. package/src/vite-plugins/built-url.ts +49 -28
  207. package/src/vite-plugins/icons.ts +33 -14
  208. package/src/vite-plugins/index.ts +12 -5
  209. package/src/vite-plugins/native.ts +31 -4
  210. package/src/vite-plugins/resource-init-module.ts +44 -15
  211. package/src/vite-plugins/resource-shared.ts +4 -0
  212. package/src/vite-plugins/resources.ts +1459 -100
  213. package/src/vite-plugins/settings-worker-env.ts +7 -3
  214. package/src/vite-plugins/settings.ts +89 -21
  215. package/dist/vite-plugins/bundled-packages.d.ts +0 -5
  216. package/dist/vite-plugins/bundled-packages.d.ts.map +0 -1
  217. package/dist/vite-plugins/bundled-packages.js.map +0 -1
package/env.d.ts CHANGED
@@ -1,204 +1,23 @@
1
1
  /// <reference types="vite/client" />
2
2
  /// <reference types="@gtkx/react/env" />
3
3
 
4
- declare module "#data/*.aac" {
5
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
6
- const resourceUri: string;
7
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
8
- export const path: string;
9
- export default resourceUri;
4
+ declare module "*?resource" {
5
+ /** GResource path of the bundled asset. */
6
+ const path: string;
7
+ export { path };
8
+ export default path;
10
9
  }
11
10
 
12
- declare module "#data/*.avif" {
13
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
14
- const resourceUri: string;
15
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
16
- export const path: string;
17
- export default resourceUri;
18
- }
19
-
20
- declare module "#data/*.data" {
21
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
22
- const resourceUri: string;
23
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
24
- export const path: string;
25
- export default resourceUri;
26
- }
27
-
28
- declare module "#data/*.eot" {
29
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
30
- const resourceUri: string;
31
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
32
- export const path: string;
33
- export default resourceUri;
34
- }
35
-
36
- declare module "#data/*.flac" {
37
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
38
- const resourceUri: string;
39
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
40
- export const path: string;
41
- export default resourceUri;
42
- }
43
-
44
- declare module "#data/*.gif" {
45
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
46
- const resourceUri: string;
47
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
48
- export const path: string;
49
- export default resourceUri;
50
- }
51
-
52
- declare module "#data/*.gpa" {
53
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
54
- const resourceUri: string;
55
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
56
- export const path: string;
57
- export default resourceUri;
58
- }
59
-
60
- declare module "#data/*.ico" {
61
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
62
- const resourceUri: string;
63
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
64
- export const path: string;
65
- export default resourceUri;
66
- }
67
-
68
- declare module "#data/*.jpeg" {
69
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
70
- const resourceUri: string;
71
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
72
- export const path: string;
73
- export default resourceUri;
74
- }
75
-
76
- declare module "#data/*.jpg" {
77
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
78
- const resourceUri: string;
79
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
80
- export const path: string;
81
- export default resourceUri;
82
- }
83
-
84
- declare module "#data/*.mp3" {
85
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
86
- const resourceUri: string;
87
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
88
- export const path: string;
89
- export default resourceUri;
90
- }
91
-
92
- declare module "#data/*.mp4" {
93
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
94
- const resourceUri: string;
95
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
96
- export const path: string;
97
- export default resourceUri;
98
- }
99
-
100
- declare module "#data/*.ogg" {
101
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
102
- const resourceUri: string;
103
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
104
- export const path: string;
105
- export default resourceUri;
106
- }
107
-
108
- declare module "#data/*.otf" {
109
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
110
- const resourceUri: string;
111
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
112
- export const path: string;
113
- export default resourceUri;
114
- }
115
-
116
- declare module "#data/*.png" {
117
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
118
- const resourceUri: string;
119
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
120
- export const path: string;
121
- export default resourceUri;
122
- }
123
-
124
- declare module "#data/*.svg" {
125
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
126
- const resourceUri: string;
127
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
128
- export const path: string;
129
- export default resourceUri;
130
- }
131
-
132
- declare module "#data/*.ttf" {
133
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
134
- const resourceUri: string;
135
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
136
- export const path: string;
137
- export default resourceUri;
138
- }
139
-
140
- declare module "#data/*.wav" {
141
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
142
- const resourceUri: string;
143
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
144
- export const path: string;
145
- export default resourceUri;
146
- }
147
-
148
- declare module "#data/*.webm" {
149
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
150
- const resourceUri: string;
151
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
152
- export const path: string;
153
- export default resourceUri;
154
- }
155
-
156
- declare module "#data/*.webp" {
157
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
158
- const resourceUri: string;
159
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
160
- export const path: string;
161
- export default resourceUri;
162
- }
163
-
164
- declare module "#data/*.woff" {
165
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
166
- const resourceUri: string;
167
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
168
- export const path: string;
169
- export default resourceUri;
170
- }
171
-
172
- declare module "#data/*.woff2" {
173
- /** `resource://` URI of the bundled asset, accepted anywhere GTK takes a URI. */
174
- const resourceUri: string;
175
- /** GResource path of the bundled asset, for use with the `Gio.resources*` lookup functions. */
176
- export const path: string;
177
- export default resourceUri;
178
- }
179
-
180
- declare module "*.data" {
181
- /**
182
- * URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
183
- * Import it under `#data/` instead for a GResource path and a `resource://` URI.
184
- */
185
- const assetUrl: string;
186
- export default assetUrl;
187
- }
188
-
189
- declare module "*.gpa" {
190
- /**
191
- * URL of the emitted asset: a dev server URL under `gtkx dev`, an absolute filesystem path once built.
192
- * Import it under `#data/` instead for a GResource path and a `resource://` URI.
193
- */
194
- const assetUrl: string;
195
- export default assetUrl;
11
+ declare module "*?icon" {
12
+ /** Icon-theme name of the bundled asset. */
13
+ const iconName: string;
14
+ export default iconName;
196
15
  }
197
16
 
198
17
  declare module "*.css?url" {
199
18
  /**
200
- * URL of the emitted stylesheet, imported without installing it on the default display: a dev server URL
201
- * under `gtkx dev`, an absolute filesystem path once built.
19
+ * Absolute filesystem path of the source stylesheet under `gtkx dev` or the emitted stylesheet once built,
20
+ * imported without installing it on the default display.
202
21
  */
203
22
  const styleSheetUrl: string;
204
23
  export default styleSheetUrl;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gtkx/cli",
3
- "version": "1.3.0",
4
- "description": "Command-line tool and Vite plugin stack that scaffolds, develops, builds, and documents GTKX applications",
3
+ "version": "1.4.0",
4
+ "description": "GTK app toolchain for React: scaffold, dev server, build, docs.",
5
5
  "keywords": [
6
6
  "gtkx",
7
7
  "gtk",
@@ -73,19 +73,19 @@
73
73
  "react-refresh": "^0.18.0",
74
74
  "vite": "^8.2.2",
75
75
  "yaml": "^2.9.0",
76
- "@gtkx/config": "1.3.0",
77
- "@gtkx/codegen": "1.3.0",
78
- "@gtkx/runtime": "1.3.0",
79
- "@gtkx/mcp": "1.3.0",
80
- "@gtkx/utils": "1.3.0",
81
- "@gtkx/vitest": "1.3.0",
82
- "create-gtkx": "1.3.0"
76
+ "@gtkx/codegen": "1.4.0",
77
+ "@gtkx/config": "1.4.0",
78
+ "@gtkx/mcp": "1.4.0",
79
+ "@gtkx/utils": "1.4.0",
80
+ "@gtkx/runtime": "1.4.0",
81
+ "@gtkx/vitest": "1.4.0",
82
+ "create-gtkx": "1.4.0"
83
83
  },
84
84
  "devDependencies": {
85
85
  "@types/babel__core": "^7.20.5",
86
86
  "@types/react-refresh": "^0.14.7",
87
87
  "vitest": "^4.1.11",
88
- "@gtkx/testing": "1.3.0"
88
+ "@gtkx/testing": "1.4.0"
89
89
  },
90
90
  "peerDependencies": {
91
91
  "react": "^19"
package/src/builder.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { join, posix } from "node:path";
2
2
  import { type InlineConfig, mergeConfig, build as viteBuild } from "vite";
3
- import { gtkxBuiltUrl } from "./vite-plugins/built-url.js";
4
- import { gtkxBundledPackages } from "./vite-plugins/bundled-packages.js";
3
+ import { createBuildManifestCollector } from "./internal/build-manifest.js";
4
+ import { gtkxBuildManifest } from "./vite-plugins/build-manifest.js";
5
5
  import { BUNDLE_FILENAME, ESM_EXTENSION } from "./vite-plugins/esm-extension.js";
6
6
  import { gtkxVitePlugins } from "./vite-plugins/index.js";
7
7
  import { gtkxNative } from "./vite-plugins/native.js";
@@ -10,7 +10,6 @@ import { gtkxWorker } from "./vite-plugins/worker.js";
10
10
 
11
11
  type BuildOptions = {
12
12
  entry: string;
13
- assetBase?: string | undefined;
14
13
  vite?: InlineConfig | undefined;
15
14
  };
16
15
 
@@ -33,17 +32,17 @@ const buildDefaults: InlineConfig = {
33
32
  };
34
33
 
35
34
  const build = async (options: BuildOptions): Promise<string> => {
36
- const { entry, assetBase, vite: viteConfig } = options;
35
+ const { entry, vite: viteConfig } = options;
37
36
  const root = viteConfig?.root ?? process.cwd();
38
37
  const assetsDir = viteConfig?.build?.assetsDir ?? DEFAULT_ASSETS_DIR;
38
+ const buildManifest = createBuildManifestCollector();
39
39
 
40
40
  const forced: InlineConfig = {
41
41
  plugins: [
42
- ...gtkxVitePlugins(BUILD_MODE),
42
+ ...gtkxVitePlugins(BUILD_MODE, undefined, buildManifest),
43
43
  gtkxWorker(),
44
- gtkxBuiltUrl(assetBase),
45
44
  gtkxNative(root),
46
- gtkxBundledPackages(root),
45
+ gtkxBuildManifest(root, buildManifest),
47
46
  gtkxSelfContained(),
48
47
  ],
49
48
  build: {
@@ -156,6 +156,7 @@ const prepareCodegen = (options: RunCodegenOptions, cwd: string, config: Config)
156
156
  const runCodegen = async (options: RunCodegenOptions = {}): Promise<RunCodegenResult> => {
157
157
  const cwd = options.cwd ?? process.cwd();
158
158
  const { config, configFile } = await resolveLoadedConfig(options, cwd);
159
+ syncSchemaEnv(cwd, config.future?.v2ResourceImports === true);
159
160
 
160
161
  if (config.codegen === false) {
161
162
  removeShadowingStores(cwd);
@@ -208,8 +209,9 @@ const isCodegenDisabled = async (cwd: string, mode?: string): Promise<boolean> =
208
209
  }
209
210
  };
210
211
 
211
- const syncSchemaEnv = (cwd: string): void => {
212
- emitSchemaEnv(cwd, resolveDataDir(cwd));
212
+ const syncSchemaEnv = (cwd: string, isV2ResourceImports = false): void => {
213
+ const dataDir = isV2ResourceImports ? null : resolveDataDir(cwd);
214
+ emitSchemaEnv(cwd, dataDir, isV2ResourceImports);
213
215
  };
214
216
 
215
217
  const resolveInputsOrNull = (cwd: string, config: Config): CodegenInputs | null => {
@@ -243,12 +245,14 @@ const isPreflightSkipped = (options: EnsureGeneratedOptions): boolean =>
243
245
 
244
246
  /* eslint-disable-next-line unicorn/consistent-boolean-name -- the boolean reports whether codegen ran */
245
247
  const generate = async (context: CodegenContext, options: EnsureGeneratedOptions): Promise<boolean> => {
246
- syncSchemaEnv(context.root);
247
-
248
248
  if (context.config.codegen === false) {
249
- removeShadowingStores(context.root);
249
+ const result = await runCodegen({
250
+ cwd: context.root,
251
+ mode: options.mode,
252
+ resolved: { config: context.config, configFile: context.configFile },
253
+ });
250
254
 
251
- return false;
255
+ return result.isRegenerated;
252
256
  }
253
257
 
254
258
  const inputs = resolveInputsOrNull(context.root, context.config);
@@ -286,7 +290,6 @@ const resolveConfigWatch = async (
286
290
  export {
287
291
  runCodegen,
288
292
  isCodegenDisabled,
289
- syncSchemaEnv,
290
293
  ensureGenerated,
291
294
  ensureGeneratedIn,
292
295
  resolveConfigWatch,
@@ -13,10 +13,6 @@ const build = defineCommand({
13
13
  },
14
14
  args: {
15
15
  ...entryArg,
16
- "asset-base": {
17
- type: "string",
18
- description: "Asset base path relative to executable directory (e.g., ../share/my-app)",
19
- },
20
16
  },
21
17
  async run({ args }) {
22
18
  const { cwd, entry } = await prepareProject(args, BUILD_MODE);
@@ -24,7 +20,6 @@ const build = defineCommand({
24
20
 
25
21
  const bundlePath = await buildApp({
26
22
  entry,
27
- assetBase: args["asset-base"],
28
23
  vite: {
29
24
  root: cwd,
30
25
  },
@@ -1,7 +1,7 @@
1
1
  import { info } from "@gtkx/utils";
2
2
  import { defineCommand } from "citty";
3
3
  import { formatCodegenResult } from "../codegen/report.js";
4
- import { ensureGenerated, isCodegenDisabled, runCodegen, syncSchemaEnv } from "../codegen/run-codegen.js";
4
+ import { ensureGenerated, isCodegenDisabled, runCodegen } from "../codegen/run-codegen.js";
5
5
  import { cwdArg, resolveCwd } from "../internal/entry-arg.js";
6
6
 
7
7
  const FORCED_WHILE_DISABLED_MESSAGE =
@@ -29,7 +29,6 @@ const codegen = defineCommand({
29
29
 
30
30
  if (isDisabled) {
31
31
  await runCodegen({ cwd });
32
- syncSchemaEnv(cwd);
33
32
  info("codegen: disabled for this project; reusing an installed binding store");
34
33
 
35
34
  return;
@@ -44,7 +43,6 @@ const codegen = defineCommand({
44
43
 
45
44
  const startedAt = Date.now();
46
45
  const result = await runCodegen({ cwd, isForced: true });
47
- syncSchemaEnv(cwd);
48
46
  const lines = formatCodegenResult(result, Date.now() - startedAt);
49
47
 
50
48
  for (const line of lines) {
@@ -1,41 +1,70 @@
1
- import type { DeployConfig } from "./types.js";
1
+ import type { DeploySettings } from "./types.js";
2
2
 
3
3
  type Relations = {
4
4
  deb: string[];
5
5
  rpm: string[];
6
6
  };
7
7
 
8
- const GLES_SONAME = "libGLESv2.so.2()(64bit)";
8
+ type LibraryPackages = {
9
+ deb: string;
10
+ rpm: string;
11
+ extra: Relations;
12
+ };
13
+
14
+ const SONAME_SUFFIX = "()(64bit)";
15
+ const GLES_SONAME = `libGLESv2.so.2${SONAME_SUFFIX}`;
16
+ const NO_EXTRA: Relations = { deb: [], rpm: [] };
9
17
 
10
18
  const BASE_DEPENDS: Relations = {
11
19
  deb: ["hicolor-icon-theme", "adwaita-icon-theme", "gsettings-desktop-schemas"],
12
20
  rpm: ["hicolor-icon-theme", "adwaita-icon-theme", "gsettings-desktop-schemas"],
13
21
  };
14
22
 
15
- const DEPENDS_BY_LIBRARY: Record<string, Relations> = {
16
- "Adw-1": { deb: ["libadwaita-1-0"], rpm: ["libadwaita"] },
17
- "Gtk-4.0": { deb: ["libgtk-4-1"], rpm: ["gtk4", GLES_SONAME] },
18
- "GtkSource-5": { deb: ["libgtksourceview-5-0"], rpm: ["gtksourceview5"] },
19
- "WebKit-6.0": { deb: ["libwebkitgtk-6.0-4"], rpm: ["webkitgtk6.0"] },
23
+ const DEPENDS_BY_LIBRARY: Record<string, LibraryPackages> = {
24
+ "Adw-1": { deb: "libadwaita-1-0", rpm: "libadwaita", extra: NO_EXTRA },
25
+ "Gtk-4.0": { deb: "libgtk-4-1", rpm: "gtk4", extra: { deb: [], rpm: [GLES_SONAME] } },
20
26
  };
21
27
 
22
- const libraryDepends = (libraries: string[]): Relations => ({
23
- deb: libraries.flatMap((library) => DEPENDS_BY_LIBRARY[library]?.deb ?? []),
24
- rpm: libraries.flatMap((library) => DEPENDS_BY_LIBRARY[library]?.rpm ?? []),
25
- });
28
+ const debRelation = (name: string, minimum: string | undefined): string =>
29
+ minimum === undefined ? name : `${name} (>= ${minimum})`;
30
+
31
+ const rpmRelation = (name: string, minimum: string | undefined): string =>
32
+ minimum === undefined ? name : `${name} >= ${minimum}`;
33
+
34
+ const libraryDepends = (settings: DeploySettings): Relations => {
35
+ const deb: string[] = [];
36
+ const rpm: string[] = [];
37
+
38
+ for (const library of settings.libraries) {
39
+ const packages = DEPENDS_BY_LIBRARY[library];
40
+
41
+ if (packages === undefined) {
42
+ continue;
43
+ }
44
+
45
+ const minimum = settings.minimumLibraryVersions[library];
46
+ deb.push(debRelation(packages.deb, minimum), ...packages.extra.deb);
47
+ rpm.push(rpmRelation(packages.rpm, minimum), ...packages.extra.rpm);
48
+ }
49
+
50
+ return { deb, rpm };
51
+ };
26
52
 
27
- const glibcDepends = (glibcFloor: string | null): Relations =>
28
- glibcFloor === null ? { deb: [], rpm: [] } : { deb: [`libc6 (>= ${glibcFloor})`], rpm: [`glibc >= ${glibcFloor}`] };
53
+ const glibcDepends = (glibcMinimum: string | null): Relations =>
54
+ glibcMinimum === null
55
+ ? { deb: [], rpm: [] }
56
+ : { deb: [debRelation("libc6", glibcMinimum)], rpm: [rpmRelation("glibc", glibcMinimum)] };
29
57
 
30
58
  const dedupe = (entries: string[]): string[] => [...new Set(entries)];
31
59
 
32
- const resolveDepends = (deploy: DeployConfig, libraries: string[], glibcFloor: string | null): Relations => {
33
- const fromLibraries = libraryDepends(libraries);
34
- const fromGlibc = glibcDepends(glibcFloor);
60
+ const resolveDepends = (settings: DeploySettings, glibcMinimum: string | null): Relations => {
61
+ const fromLibraries = libraryDepends(settings);
62
+ const fromGlibc = glibcDepends(glibcMinimum);
63
+ const extra = settings.deploy.depends ?? {};
35
64
 
36
65
  return {
37
- deb: dedupe([...fromLibraries.deb, ...BASE_DEPENDS.deb, ...fromGlibc.deb, ...(deploy.depends?.deb ?? [])]),
38
- rpm: dedupe([...fromLibraries.rpm, ...BASE_DEPENDS.rpm, ...fromGlibc.rpm, ...(deploy.depends?.rpm ?? [])]),
66
+ deb: dedupe([...fromLibraries.deb, ...BASE_DEPENDS.deb, ...fromGlibc.deb, ...(extra.deb ?? [])]),
67
+ rpm: dedupe([...fromLibraries.rpm, ...BASE_DEPENDS.rpm, ...fromGlibc.rpm, ...(extra.rpm ?? [])]),
39
68
  };
40
69
  };
41
70
 
@@ -125,7 +125,7 @@ const descriptionFor = (settings: DeploySettings, packager: NfpmPackager): strin
125
125
  const renderNfpmConfig = (payload: DeployPayload, packager: NfpmPackager): NfpmConfig => {
126
126
  const settings = payload.settings;
127
127
  const isRpm = packager === "rpm";
128
- const depends = resolveDepends(settings.deploy, settings.libraries, payload.node?.glibcFloor ?? null);
128
+ const depends = resolveDepends(settings, payload.node?.glibcMinimum ?? null);
129
129
 
130
130
  return {
131
131
  name: packageNameFor(settings, packager),
@@ -8,7 +8,7 @@ type ElfSection = {
8
8
 
9
9
  type ElfInfo = {
10
10
  needed: string[];
11
- glibcFloor: string | null;
11
+ glibcMinimum: string | null;
12
12
  };
13
13
 
14
14
  type DynamicEntry = {
@@ -117,7 +117,7 @@ const highestVersion = (versions: number[][]): number[] | null => {
117
117
  const formatVersion = (version: number[] | null): string | null =>
118
118
  version === null ? null : `${String(version[0] ?? 0)}.${String(version[1] ?? 0)}`;
119
119
 
120
- const readGlibcFloor = (strings: Buffer): string | null => {
120
+ const readGlibcMinimum = (strings: Buffer): string | null => {
121
121
  const found = strings
122
122
  .toString("latin1")
123
123
  .matchAll(GLIBC_VERSION)
@@ -138,7 +138,7 @@ const readElfInfo = (path: string): ElfInfo => {
138
138
 
139
139
  return {
140
140
  needed: readNeeded(buffer, sectionFor(sections, ".dynamic"), strings),
141
- glibcFloor: readGlibcFloor(strings),
141
+ glibcMinimum: readGlibcMinimum(strings),
142
142
  };
143
143
  };
144
144
 
@@ -78,9 +78,9 @@ const resolveNodeRuntime = async (settings: DeploySettings): Promise<NodeRuntime
78
78
  const staged = await stageFromSource(settings, version, source);
79
79
  const isStripped = node.shouldStrip === false ? false : didStripBinary(staged.path);
80
80
  const elf = readElfInfo(staged.path);
81
- info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, glibc >= ${elf.glibcFloor ?? "unknown"})`);
81
+ info(`Bundled Node.js v${version} (${megabytes(staged.path)} MiB, glibc >= ${elf.glibcMinimum ?? "unknown"})`);
82
82
 
83
- return { ...staged, version, glibcFloor: elf.glibcFloor, isStripped };
83
+ return { ...staged, version, glibcMinimum: elf.glibcMinimum, isStripped };
84
84
  };
85
85
 
86
86
  export { resolveNodeRuntime, sourcePathFor };
@@ -1,3 +1,4 @@
1
+ import type { RecordedPackage } from "../../internal/build-manifest.js";
1
2
  import type { DeploySettings, NodeRuntime, NoticeSection } from "../types.js";
2
3
  import { dependencyNotices } from "./dependencies.js";
3
4
  import { gtkxNotices } from "./gtkx.js";
@@ -8,10 +9,11 @@ import { bundledPackages } from "./packages.js";
8
9
  type NoticeRequest = {
9
10
  settings: DeploySettings;
10
11
  node: NodeRuntime | null;
12
+ packages: RecordedPackage[];
11
13
  };
12
14
 
13
- const collectNotices = ({ settings, node }: NoticeRequest): NoticeSection[] => {
14
- const packages = bundledPackages(settings);
15
+ const collectNotices = ({ settings, node, packages: recordedPackages }: NoticeRequest): NoticeSection[] => {
16
+ const packages = bundledPackages(settings, recordedPackages);
15
17
 
16
18
  const sections = [
17
19
  nodeNotices(settings, node),
@@ -1,17 +1,11 @@
1
- import { isRecord, sortStringsBy, warn } from "@gtkx/utils";
2
- import { existsSync, readFileSync, realpathSync } from "node:fs";
1
+ import { sortStringsBy, warn } from "@gtkx/utils";
2
+ import { existsSync, realpathSync } from "node:fs";
3
3
  import { join, resolve } from "node:path";
4
+ import type { RecordedPackage } from "../../internal/build-manifest.js";
4
5
  import type { DeploySettings } from "../types.js";
5
- import { BUNDLED_PACKAGES_FILENAME } from "../../vite-plugins/bundled-packages.js";
6
6
  import { type PackageManifest, readPackageManifest } from "../settings/package-manifest.js";
7
7
  import { copyrightLines, licenseTextIn } from "./text.js";
8
8
 
9
- type RecordedPackage = {
10
- name: string;
11
- version: string | null;
12
- dir: string;
13
- };
14
-
15
9
  type BundledPackage = {
16
10
  name: string;
17
11
  version: string | null;
@@ -36,38 +30,6 @@ const realPath = (path: string): string => {
36
30
  }
37
31
  };
38
32
 
39
- const optionalString = (value: unknown): string | null => (typeof value === "string" ? value : null);
40
-
41
- const recordedPackage = (entry: unknown): RecordedPackage | null => {
42
- if (!isRecord(entry) || typeof entry.name !== "string" || typeof entry.dir !== "string") {
43
- return null;
44
- }
45
-
46
- return { name: entry.name, version: optionalString(entry.version), dir: entry.dir };
47
- };
48
-
49
- const recordedList = (value: unknown): RecordedPackage[] => {
50
- if (!Array.isArray(value)) {
51
- return [];
52
- }
53
-
54
- const entries: unknown[] = value;
55
-
56
- return entries.map((entry) => recordedPackage(entry)).filter((entry) => entry !== null);
57
- };
58
-
59
- const readRecordedPackages = (settings: DeploySettings): RecordedPackage[] => {
60
- const path = join(settings.paths.dist, BUNDLED_PACKAGES_FILENAME);
61
-
62
- if (!existsSync(path)) {
63
- throw new Error(`Cannot deploy: ${path} is missing. Run \`gtkx build\` first.`);
64
- }
65
-
66
- const parsed: unknown = JSON.parse(readFileSync(path, "utf8"));
67
-
68
- return recordedList(isRecord(parsed) ? parsed.packages : null);
69
- };
70
-
71
33
  const authorLine = (manifest: PackageManifest): string[] => {
72
34
  const { name, email } = manifest.author;
73
35
 
@@ -151,10 +113,10 @@ const warnMissing = (entries: BundledPackage[]): void => {
151
113
  );
152
114
  };
153
115
 
154
- const bundledPackages = (settings: DeploySettings): BundledPackage[] => {
116
+ const bundledPackages = (settings: DeploySettings, recorded: RecordedPackage[]): BundledPackage[] => {
155
117
  const root = realPath(settings.paths.root);
156
118
 
157
- const entries = readRecordedPackages(settings)
119
+ const entries = recorded
158
120
  .map((entry) => ({ entry, dir: resolve(settings.paths.dist, entry.dir) }))
159
121
  .filter(({ dir }) => realPath(dir) !== root)
160
122
  .map(({ entry, dir }) => packageIn(entry, dir));