@gtkx/cli 1.3.0 → 1.5.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 (299) hide show
  1. package/README.md +5 -4
  2. package/dist/builder.d.ts +1 -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 +3 -2
  7. package/dist/codegen/run-codegen.d.ts.map +1 -1
  8. package/dist/codegen/run-codegen.js +41 -12
  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 +2 -4
  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/freedesktop/localize.d.ts +6 -0
  22. package/dist/deploy/freedesktop/localize.d.ts.map +1 -0
  23. package/dist/deploy/freedesktop/localize.js +107 -0
  24. package/dist/deploy/freedesktop/localize.js.map +1 -0
  25. package/dist/deploy/install-hints.d.ts.map +1 -1
  26. package/dist/deploy/install-hints.js +5 -0
  27. package/dist/deploy/install-hints.js.map +1 -1
  28. package/dist/deploy/nfpm/config.js +1 -1
  29. package/dist/deploy/nfpm/config.js.map +1 -1
  30. package/dist/deploy/node-runtime/elf.d.ts +1 -1
  31. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  32. package/dist/deploy/node-runtime/elf.js +2 -2
  33. package/dist/deploy/node-runtime/elf.js.map +1 -1
  34. package/dist/deploy/node-runtime/index.js +2 -2
  35. package/dist/deploy/node-runtime/index.js.map +1 -1
  36. package/dist/deploy/notices/collect.d.ts +3 -1
  37. package/dist/deploy/notices/collect.d.ts.map +1 -1
  38. package/dist/deploy/notices/collect.js +2 -2
  39. package/dist/deploy/notices/collect.js.map +1 -1
  40. package/dist/deploy/notices/packages.d.ts +2 -1
  41. package/dist/deploy/notices/packages.d.ts.map +1 -1
  42. package/dist/deploy/notices/packages.js +4 -27
  43. package/dist/deploy/notices/packages.js.map +1 -1
  44. package/dist/deploy/payload/icons.d.ts +7 -3
  45. package/dist/deploy/payload/icons.d.ts.map +1 -1
  46. package/dist/deploy/payload/icons.js +46 -28
  47. package/dist/deploy/payload/icons.js.map +1 -1
  48. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  49. package/dist/deploy/payload/launcher.js +2 -0
  50. package/dist/deploy/payload/launcher.js.map +1 -1
  51. package/dist/deploy/payload/stage.d.ts +1 -1
  52. package/dist/deploy/payload/stage.d.ts.map +1 -1
  53. package/dist/deploy/payload/stage.js +23 -13
  54. package/dist/deploy/payload/stage.js.map +1 -1
  55. package/dist/deploy/run-deploy.d.ts.map +1 -1
  56. package/dist/deploy/run-deploy.js +149 -25
  57. package/dist/deploy/run-deploy.js.map +1 -1
  58. package/dist/deploy/settings/build-manifest.d.ts +9 -0
  59. package/dist/deploy/settings/build-manifest.d.ts.map +1 -0
  60. package/dist/deploy/settings/build-manifest.js +80 -0
  61. package/dist/deploy/settings/build-manifest.js.map +1 -0
  62. package/dist/deploy/settings/index.d.ts.map +1 -1
  63. package/dist/deploy/settings/index.js +9 -3
  64. package/dist/deploy/settings/index.js.map +1 -1
  65. package/dist/deploy/settings/libraries.d.ts +8 -0
  66. package/dist/deploy/settings/libraries.d.ts.map +1 -0
  67. package/dist/deploy/settings/libraries.js +39 -0
  68. package/dist/deploy/settings/libraries.js.map +1 -0
  69. package/dist/deploy/settings/paths.d.ts +3 -0
  70. package/dist/deploy/settings/paths.d.ts.map +1 -1
  71. package/dist/deploy/settings/paths.js +6 -32
  72. package/dist/deploy/settings/paths.js.map +1 -1
  73. package/dist/deploy/targets/appimage.d.ts.map +1 -1
  74. package/dist/deploy/targets/appimage.js +19 -13
  75. package/dist/deploy/targets/appimage.js.map +1 -1
  76. package/dist/deploy/targets/flatpak-manifest.d.ts +2 -1
  77. package/dist/deploy/targets/flatpak-manifest.d.ts.map +1 -1
  78. package/dist/deploy/targets/flatpak-manifest.js +5 -1
  79. package/dist/deploy/targets/flatpak-manifest.js.map +1 -1
  80. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  81. package/dist/deploy/targets/flatpak-source.js +30 -16
  82. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  83. package/dist/deploy/tools.d.ts +6 -1
  84. package/dist/deploy/tools.d.ts.map +1 -1
  85. package/dist/deploy/tools.js +26 -1
  86. package/dist/deploy/tools.js.map +1 -1
  87. package/dist/deploy/types.d.ts +4 -4
  88. package/dist/deploy/types.d.ts.map +1 -1
  89. package/dist/deploy/types.js.map +1 -1
  90. package/dist/dev/icon-dir.d.ts +1 -1
  91. package/dist/dev/icon-dir.d.ts.map +1 -1
  92. package/dist/dev/icon-dir.js +20 -7
  93. package/dist/dev/icon-dir.js.map +1 -1
  94. package/dist/dev/locale-dir.d.ts +3 -0
  95. package/dist/dev/locale-dir.d.ts.map +1 -0
  96. package/dist/dev/locale-dir.js +17 -0
  97. package/dist/dev/locale-dir.js.map +1 -0
  98. package/dist/dev/runner-deps.d.ts.map +1 -1
  99. package/dist/dev/runner-deps.js +5 -1
  100. package/dist/dev/runner-deps.js.map +1 -1
  101. package/dist/dev/runner-main.d.ts.map +1 -1
  102. package/dist/dev/runner-main.js +6 -4
  103. package/dist/dev/runner-main.js.map +1 -1
  104. package/dist/dev/runner.d.ts +1 -1
  105. package/dist/dev/runner.d.ts.map +1 -1
  106. package/dist/dev/runner.js +7 -1
  107. package/dist/dev/runner.js.map +1 -1
  108. package/dist/dev/schema-dir.d.ts +1 -1
  109. package/dist/dev/schema-dir.d.ts.map +1 -1
  110. package/dist/dev/schema-dir.js +3 -1
  111. package/dist/dev/schema-dir.js.map +1 -1
  112. package/dist/dev/vite-dev-server.d.ts +1 -0
  113. package/dist/dev/vite-dev-server.d.ts.map +1 -1
  114. package/dist/dev/vite-dev-server.js.map +1 -1
  115. package/dist/i18n/binding-extractor.d.ts +30 -0
  116. package/dist/i18n/binding-extractor.d.ts.map +1 -0
  117. package/dist/i18n/binding-extractor.js +1324 -0
  118. package/dist/i18n/binding-extractor.js.map +1 -0
  119. package/dist/i18n/catalog-template.d.ts +3 -0
  120. package/dist/i18n/catalog-template.d.ts.map +1 -0
  121. package/dist/i18n/catalog-template.js +18 -0
  122. package/dist/i18n/catalog-template.js.map +1 -0
  123. package/dist/i18n/catalogs.d.ts +21 -0
  124. package/dist/i18n/catalogs.d.ts.map +1 -0
  125. package/dist/i18n/catalogs.js +139 -0
  126. package/dist/i18n/catalogs.js.map +1 -0
  127. package/dist/i18n/extractor-plugin.d.ts +8 -0
  128. package/dist/i18n/extractor-plugin.d.ts.map +1 -0
  129. package/dist/i18n/extractor-plugin.js +247 -0
  130. package/dist/i18n/extractor-plugin.js.map +1 -0
  131. package/dist/i18n/metadata-templates.d.ts +11 -0
  132. package/dist/i18n/metadata-templates.d.ts.map +1 -0
  133. package/dist/i18n/metadata-templates.js +11 -0
  134. package/dist/i18n/metadata-templates.js.map +1 -0
  135. package/dist/i18n/source-messages.d.ts +23 -0
  136. package/dist/i18n/source-messages.d.ts.map +1 -0
  137. package/dist/i18n/source-messages.js +403 -0
  138. package/dist/i18n/source-messages.js.map +1 -0
  139. package/dist/i18n/types.d.ts +10 -0
  140. package/dist/i18n/types.d.ts.map +1 -0
  141. package/dist/i18n/types.js +108 -0
  142. package/dist/i18n/types.js.map +1 -0
  143. package/dist/internal/build-manifest.d.ts +20 -0
  144. package/dist/internal/build-manifest.d.ts.map +1 -0
  145. package/dist/internal/build-manifest.js +6 -0
  146. package/dist/internal/build-manifest.js.map +1 -0
  147. package/dist/internal/icon-path.d.ts +13 -0
  148. package/dist/internal/icon-path.d.ts.map +1 -0
  149. package/dist/internal/icon-path.js +86 -0
  150. package/dist/internal/icon-path.js.map +1 -0
  151. package/dist/internal/source-imports.d.ts +12 -0
  152. package/dist/internal/source-imports.d.ts.map +1 -0
  153. package/dist/internal/source-imports.js +123 -0
  154. package/dist/internal/source-imports.js.map +1 -0
  155. package/dist/mcp/client.d.ts +0 -1
  156. package/dist/mcp/client.d.ts.map +1 -1
  157. package/dist/mcp/client.js +11 -39
  158. package/dist/mcp/client.js.map +1 -1
  159. package/dist/mcp/handlers.d.ts +2 -1
  160. package/dist/mcp/handlers.d.ts.map +1 -1
  161. package/dist/mcp/handlers.js.map +1 -1
  162. package/dist/mcp/widget-properties.d.ts.map +1 -1
  163. package/dist/mcp/widget-properties.js +3 -12
  164. package/dist/mcp/widget-properties.js.map +1 -1
  165. package/dist/settings/render.d.ts +10 -1
  166. package/dist/settings/render.d.ts.map +1 -1
  167. package/dist/settings/render.js +78 -20
  168. package/dist/settings/render.js.map +1 -1
  169. package/dist/settings/schema.d.ts +4 -3
  170. package/dist/settings/schema.d.ts.map +1 -1
  171. package/dist/settings/schema.js +124 -15
  172. package/dist/settings/schema.js.map +1 -1
  173. package/dist/vite-plugins/asset-emitter.d.ts +1 -1
  174. package/dist/vite-plugins/asset-emitter.d.ts.map +1 -1
  175. package/dist/vite-plugins/asset-emitter.js.map +1 -1
  176. package/dist/vite-plugins/asset-extensions.d.ts.map +1 -1
  177. package/dist/vite-plugins/asset-extensions.js +1 -0
  178. package/dist/vite-plugins/asset-extensions.js.map +1 -1
  179. package/dist/vite-plugins/asset-imports.d.ts +2 -1
  180. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  181. package/dist/vite-plugins/asset-imports.js +39 -28
  182. package/dist/vite-plugins/asset-imports.js.map +1 -1
  183. package/dist/vite-plugins/asset-specifier.d.ts +13 -1
  184. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  185. package/dist/vite-plugins/asset-specifier.js +39 -1
  186. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  187. package/dist/vite-plugins/build-manifest.d.ts +5 -0
  188. package/dist/vite-plugins/build-manifest.d.ts.map +1 -0
  189. package/dist/vite-plugins/{bundled-packages.js → build-manifest.js} +20 -14
  190. package/dist/vite-plugins/build-manifest.js.map +1 -0
  191. package/dist/vite-plugins/built-url.d.ts +1 -1
  192. package/dist/vite-plugins/built-url.d.ts.map +1 -1
  193. package/dist/vite-plugins/built-url.js +37 -24
  194. package/dist/vite-plugins/built-url.js.map +1 -1
  195. package/dist/vite-plugins/i18n.d.ts +5 -0
  196. package/dist/vite-plugins/i18n.d.ts.map +1 -0
  197. package/dist/vite-plugins/i18n.js +88 -0
  198. package/dist/vite-plugins/i18n.js.map +1 -0
  199. package/dist/vite-plugins/icons.d.ts +2 -1
  200. package/dist/vite-plugins/icons.d.ts.map +1 -1
  201. package/dist/vite-plugins/icons.js +25 -12
  202. package/dist/vite-plugins/icons.js.map +1 -1
  203. package/dist/vite-plugins/index.d.ts +2 -1
  204. package/dist/vite-plugins/index.d.ts.map +1 -1
  205. package/dist/vite-plugins/index.js +9 -5
  206. package/dist/vite-plugins/index.js.map +1 -1
  207. package/dist/vite-plugins/native.d.ts.map +1 -1
  208. package/dist/vite-plugins/native.js +23 -4
  209. package/dist/vite-plugins/native.js.map +1 -1
  210. package/dist/vite-plugins/resource-init-module.d.ts +7 -3
  211. package/dist/vite-plugins/resource-init-module.d.ts.map +1 -1
  212. package/dist/vite-plugins/resource-init-module.js +39 -14
  213. package/dist/vite-plugins/resource-init-module.js.map +1 -1
  214. package/dist/vite-plugins/resource-shared.d.ts +3 -1
  215. package/dist/vite-plugins/resource-shared.d.ts.map +1 -1
  216. package/dist/vite-plugins/resource-shared.js +3 -1
  217. package/dist/vite-plugins/resource-shared.js.map +1 -1
  218. package/dist/vite-plugins/resources.d.ts +1 -1
  219. package/dist/vite-plugins/resources.d.ts.map +1 -1
  220. package/dist/vite-plugins/resources.js +877 -86
  221. package/dist/vite-plugins/resources.js.map +1 -1
  222. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  223. package/dist/vite-plugins/self-contained.js +128 -135
  224. package/dist/vite-plugins/self-contained.js.map +1 -1
  225. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  226. package/dist/vite-plugins/settings-worker-env.js +6 -3
  227. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  228. package/dist/vite-plugins/settings.d.ts +3 -1
  229. package/dist/vite-plugins/settings.d.ts.map +1 -1
  230. package/dist/vite-plugins/settings.js +63 -23
  231. package/dist/vite-plugins/settings.js.map +1 -1
  232. package/env.d.ts +11 -192
  233. package/package.json +11 -10
  234. package/src/builder.ts +7 -7
  235. package/src/codegen/run-codegen.ts +64 -15
  236. package/src/commands/build.ts +0 -5
  237. package/src/commands/codegen.ts +2 -4
  238. package/src/deploy/depends.ts +47 -18
  239. package/src/deploy/freedesktop/localize.ts +144 -0
  240. package/src/deploy/install-hints.ts +5 -0
  241. package/src/deploy/nfpm/config.ts +1 -1
  242. package/src/deploy/node-runtime/elf.ts +3 -3
  243. package/src/deploy/node-runtime/index.ts +2 -2
  244. package/src/deploy/notices/collect.ts +4 -2
  245. package/src/deploy/notices/packages.ts +5 -43
  246. package/src/deploy/payload/icons.ts +64 -34
  247. package/src/deploy/payload/launcher.ts +2 -0
  248. package/src/deploy/payload/stage.ts +40 -12
  249. package/src/deploy/run-deploy.ts +214 -24
  250. package/src/deploy/settings/build-manifest.ts +122 -0
  251. package/src/deploy/settings/index.ts +9 -4
  252. package/src/deploy/settings/libraries.ts +57 -0
  253. package/src/deploy/settings/paths.ts +10 -47
  254. package/src/deploy/targets/appimage.ts +32 -15
  255. package/src/deploy/targets/flatpak-manifest.ts +7 -1
  256. package/src/deploy/targets/flatpak-source.ts +42 -20
  257. package/src/deploy/tools.ts +35 -0
  258. package/src/deploy/types.ts +4 -4
  259. package/src/dev/icon-dir.ts +31 -7
  260. package/src/dev/locale-dir.ts +22 -0
  261. package/src/dev/runner-deps.ts +5 -1
  262. package/src/dev/runner-main.ts +6 -4
  263. package/src/dev/runner.ts +10 -2
  264. package/src/dev/schema-dir.ts +3 -1
  265. package/src/dev/vite-dev-server.ts +1 -0
  266. package/src/i18n/binding-extractor.ts +1969 -0
  267. package/src/i18n/catalog-template.ts +24 -0
  268. package/src/i18n/catalogs.ts +216 -0
  269. package/src/i18n/extractor-plugin.ts +413 -0
  270. package/src/i18n/metadata-templates.ts +29 -0
  271. package/src/i18n/source-messages.ts +608 -0
  272. package/src/i18n/types.ts +154 -0
  273. package/src/internal/build-manifest.ts +32 -0
  274. package/src/internal/icon-path.ts +127 -0
  275. package/src/internal/source-imports.ts +171 -0
  276. package/src/mcp/client.ts +17 -44
  277. package/src/mcp/handlers.ts +7 -6
  278. package/src/mcp/widget-properties.ts +3 -14
  279. package/src/settings/render.ts +113 -21
  280. package/src/settings/schema.ts +192 -17
  281. package/src/vite-plugins/asset-emitter.ts +1 -1
  282. package/src/vite-plugins/asset-extensions.ts +1 -0
  283. package/src/vite-plugins/asset-imports.ts +62 -33
  284. package/src/vite-plugins/asset-specifier.ts +73 -1
  285. package/src/vite-plugins/{bundled-packages.ts → build-manifest.ts} +30 -19
  286. package/src/vite-plugins/built-url.ts +49 -28
  287. package/src/vite-plugins/i18n.ts +146 -0
  288. package/src/vite-plugins/icons.ts +33 -14
  289. package/src/vite-plugins/index.ts +15 -5
  290. package/src/vite-plugins/native.ts +31 -4
  291. package/src/vite-plugins/resource-init-module.ts +44 -15
  292. package/src/vite-plugins/resource-shared.ts +4 -0
  293. package/src/vite-plugins/resources.ts +1397 -100
  294. package/src/vite-plugins/self-contained.ts +150 -169
  295. package/src/vite-plugins/settings-worker-env.ts +7 -3
  296. package/src/vite-plugins/settings.ts +89 -21
  297. package/dist/vite-plugins/bundled-packages.d.ts +0 -5
  298. package/dist/vite-plugins/bundled-packages.d.ts.map +0 -1
  299. package/dist/vite-plugins/bundled-packages.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"self-contained.js","sourceRoot":"","s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M;YAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC1B,mBAAmB,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;gBACnF,CAAC;YACL,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { Plugin } from \"vite\";\nimport { isRecord } from \"@gtkx/utils\";\nimport { isBuiltin } from \"node:module\";\nimport { posix } from \"node:path\";\nimport { parseSync } from \"vite\";\n\ntype AstNode = Record<string, unknown>;\n\ntype Bindings = {\n declarations: Map<string, number>;\n factories: Set<string>;\n requires: Set<string>;\n urls: Set<string>;\n};\n\ntype Scan = {\n bindings: Bindings;\n calls: AstNode[];\n sources: string[];\n};\n\ntype Chunk = {\n fileName: string;\n code: string;\n};\n\nconst REQUIRE_FACTORY = \"createRequire\";\nconst REQUIRE_BINDING = \"require\";\nconst RESOLVE_PROPERTY = \"resolve\";\nconst MODULE_BUILTIN = \"node:module\";\nconst OUTPUT_DIRECTORY = \".\";\nconst RELATIVE_SPECIFIER = /^\\.\\.?(?:\\/|$)/;\nconst DECLARATION_KEYS = [\"id\", \"local\", \"param\", \"params\"];\n\nconst SOURCE_STATEMENTS = new Set([\n \"ExportAllDeclaration\",\n \"ExportNamedDeclaration\",\n \"ImportDeclaration\",\n \"ImportExpression\",\n]);\n\nconst isAstNode = (value: unknown): value is AstNode => isRecord(value) && typeof value.type === \"string\";\nconst nodeType = (node: AstNode): string => (typeof node.type === \"string\" ? node.type : \"\");\n\nconst nodeName = (node: AstNode | null): string | null =>\n node !== null && typeof node.name === \"string\" ? node.name : null;\n\nconst childNode = (node: AstNode, key: string): AstNode | null => {\n const value = node[key];\n\n return isAstNode(value) ? value : null;\n};\n\nconst childNodes = (node: AstNode, key: string): AstNode[] => {\n const value = node[key];\n\n if (!Array.isArray(value)) {\n return [];\n }\n\n const entries: unknown[] = value;\n\n return entries.filter(isAstNode);\n};\n\nconst childValues = (value: unknown): unknown[] => {\n if (Array.isArray(value)) {\n const entries: unknown[] = value;\n\n return entries;\n }\n\n if (!isAstNode(value)) {\n return [];\n }\n\n return Object.values(value).filter((child) => typeof child === \"object\" && child !== null);\n};\n\nconst visitNode = (value: unknown, visit: (node: AstNode) => void): void => {\n if (isAstNode(value)) {\n visit(value);\n }\n};\n\nconst walk = (root: unknown, visit: (node: AstNode) => void): void => {\n const stack: unknown[] = [root];\n\n while (stack.length > 0) {\n const current = stack.pop();\n visitNode(current, visit);\n\n for (const value of childValues(current)) {\n stack.push(value);\n }\n }\n};\n\nconst countName = (declarations: Map<string, number>, node: AstNode): void => {\n const name = nodeName(node);\n\n if (name !== null) {\n declarations.set(name, (declarations.get(name) ?? 0) + 1);\n }\n};\n\nconst countDeclarations = (node: AstNode, declarations: Map<string, number>): void => {\n for (const key of DECLARATION_KEYS) {\n walk(node[key], (declared) => {\n countName(declarations, declared);\n });\n }\n};\n\nconst isUnshadowed = (name: string, bindings: Bindings): boolean => (bindings.declarations.get(name) ?? 0) <= 1;\n\nconst templateString = (node: AstNode): string | null => {\n if (childNodes(node, \"expressions\").length > 0) {\n return null;\n }\n\n const [quasi] = childNodes(node, \"quasis\");\n const value = quasi === undefined ? null : quasi.value;\n\n return isRecord(value) && typeof value.cooked === \"string\" ? value.cooked : null;\n};\n\nconst literalString = (node: AstNode | null): string | null => {\n if (node === null) {\n return null;\n }\n\n if (nodeType(node) === \"Literal\") {\n return typeof node.value === \"string\" ? node.value : null;\n }\n\n return nodeType(node) === \"TemplateLiteral\" ? templateString(node) : null;\n};\n\nconst isMetaUrl = (node: AstNode, bindings: Bindings): boolean => {\n if (nodeType(node) === \"MemberExpression\") {\n const object = childNode(node, \"object\");\n\n return object !== null && nodeType(object) === \"MetaProperty\";\n }\n\n const name = nodeName(node);\n\n return name !== null && bindings.urls.has(name) && isUnshadowed(name, bindings);\n};\n\nconst hasMetaUrl = (node: AstNode, bindings: Bindings): boolean =>\n childNodes(node, \"arguments\").some((argument) => isMetaUrl(argument, bindings));\n\nconst isRequireName = (name: string | null, bindings: Bindings): boolean =>\n name !== null && (name === REQUIRE_BINDING || bindings.requires.has(name)) && isUnshadowed(name, bindings);\n\nconst isFactoryName = (name: string | null, bindings: Bindings): boolean =>\n name !== null && (name === REQUIRE_FACTORY || bindings.factories.has(name)) && isUnshadowed(name, bindings);\n\nconst isRequireFactory = (node: AstNode, bindings: Bindings): boolean => {\n if (nodeType(node) !== \"CallExpression\") {\n return false;\n }\n\n return isFactoryName(nodeName(childNode(node, \"callee\")), bindings) || hasMetaUrl(node, bindings);\n};\n\nconst isResolveTarget = (object: AstNode, bindings: Bindings): boolean =>\n nodeType(object) === \"MetaProperty\" ||\n isRequireName(nodeName(object), bindings) ||\n isRequireFactory(object, bindings);\n\nconst isResolveMember = (callee: AstNode, bindings: Bindings): boolean => {\n if (nodeType(callee) !== \"MemberExpression\" || callee.computed === true) {\n return false;\n }\n\n if (nodeName(childNode(callee, \"property\")) !== RESOLVE_PROPERTY) {\n return false;\n }\n\n const object = childNode(callee, \"object\");\n\n return object !== null && isResolveTarget(object, bindings);\n};\n\nconst isResolvingCall = (call: AstNode, bindings: Bindings): boolean => {\n if (hasMetaUrl(call, bindings)) {\n return true;\n }\n\n const callee = childNode(call, \"callee\");\n\n if (callee === null) {\n return false;\n }\n\n return (\n isRequireName(nodeName(callee), bindings) ||\n isRequireFactory(callee, bindings) ||\n isResolveMember(callee, bindings)\n );\n};\n\nconst collectFactories = (node: AstNode, bindings: Bindings): void => {\n if (literalString(childNode(node, \"source\")) !== MODULE_BUILTIN) {\n return;\n }\n\n for (const specifier of childNodes(node, \"specifiers\")) {\n const local = nodeName(childNode(specifier, \"local\"));\n\n if (local !== null && nodeName(childNode(specifier, \"imported\")) === REQUIRE_FACTORY) {\n bindings.factories.add(local);\n }\n }\n};\n\nconst collectBinding = (node: AstNode, bindings: Bindings): void => {\n const name = nodeName(childNode(node, \"id\"));\n const init = childNode(node, \"init\");\n\n if (name === null || init === null) {\n return;\n }\n\n if (isMetaUrl(init, bindings)) {\n bindings.urls.add(name);\n }\n\n if (isRequireFactory(init, bindings)) {\n bindings.requires.add(name);\n }\n};\n\nconst hasStringArgument = (call: AstNode): boolean =>\n childNodes(call, \"arguments\").some((argument) => literalString(argument) !== null);\n\nconst collectSource = (scan: Scan, node: AstNode, type: string): void => {\n if (!SOURCE_STATEMENTS.has(type)) {\n return;\n }\n\n const source = literalString(childNode(node, \"source\"));\n\n if (source !== null) {\n scan.sources.push(source);\n }\n};\n\nconst collectCall = (scan: Scan, node: AstNode, type: string): void => {\n if (type === \"CallExpression\" && hasStringArgument(node)) {\n scan.calls.push(node);\n }\n};\n\nconst scanNode = (scan: Scan, node: AstNode): void => {\n const type = nodeType(node);\n countDeclarations(node, scan.bindings.declarations);\n\n if (type === \"ImportDeclaration\") {\n collectFactories(node, scan.bindings);\n } else if (type === \"VariableDeclarator\") {\n collectBinding(node, scan.bindings);\n }\n\n collectSource(scan, node, type);\n collectCall(scan, node, type);\n};\n\nconst scanChunk = (chunk: Chunk): Scan => {\n const scan: Scan = {\n bindings: { declarations: new Map(), factories: new Set(), requires: new Set(), urls: new Set() },\n calls: [],\n sources: [],\n };\n\n walk(parseSync(chunk.fileName, chunk.code).program, (node) => {\n scanNode(scan, node);\n });\n\n return scan;\n};\n\nconst callSpecifiers = (scan: Scan): string[] =>\n scan.calls\n .filter((call) => isResolvingCall(call, scan.bindings))\n .flatMap((call) => childNodes(call, \"arguments\"))\n .map((argument) => literalString(argument))\n .filter((specifier) => specifier !== null);\n\nconst isReachable = (specifier: string, directory: string, emitted: Set<string>): boolean => {\n if (isBuiltin(specifier)) {\n return true;\n }\n\n if (!RELATIVE_SPECIFIER.test(specifier)) {\n return false;\n }\n\n const target = posix.normalize(posix.join(directory, specifier));\n\n return target === OUTPUT_DIRECTORY || emitted.has(target);\n};\n\nconst unreachableSpecifiers = (chunk: Chunk, emitted: Set<string>): string[] => {\n const scan = scanChunk(chunk);\n const directory = posix.dirname(chunk.fileName);\n\n return new Set([...scan.sources, ...callSpecifiers(scan)])\n .values()\n .filter((specifier) => !isReachable(specifier, directory, emitted))\n .toArray()\n .toSorted((left, right) => left.localeCompare(right));\n};\n\nconst assertSelfContained = (chunk: Chunk, emitted: Set<string>): void => {\n const specifiers = unreachableSpecifiers(chunk, emitted);\n\n if (specifiers.length === 0) {\n return;\n }\n\n throw new Error(\n [\n `${chunk.fileName} resolves ${specifiers.join(\", \")} at runtime,`,\n \"so the built app only starts where that resolution succeeds from wherever it was installed.\",\n \"The artifact may resolve node: builtins and the files the build emits beside it, nothing else:\",\n \"bundle the module, emit the file, or read the data at build time.\",\n ].join(\" \"),\n );\n};\n\nfunction gtkxSelfContained(): Plugin {\n return {\n name: \"gtkx:self-contained\",\n apply: \"build\",\n\n generateBundle(_options, bundle) {\n const emitted = new Set(Object.keys(bundle));\n\n for (const output of Object.values(bundle)) {\n if (output.type === \"chunk\") {\n assertSelfContained({ fileName: output.fileName, code: output.code }, emitted);\n }\n }\n },\n };\n}\n\nexport { gtkxSelfContained };\n"]}
1
+ {"version":3,"file":"self-contained.js","sourceRoot":"","sources":["../../src/vite-plugins/self-contained.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AA4B1C,MAAM,eAAe,GAAG,eAAe,CAAC;AACxC,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,gBAAgB,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AC;IAED,MAAM,IAAI,KAAK,CACX;QACI,GAAG,KAAK,CAAC,QAAQ,aAAa,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc;QACjE,6FAA6F;QAC7F,gGAAgG;QAChG,mEAAmE;KACtE,CAAC,IAAI,CAAC,GAAG,CAAC,CACd,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,iBAAiB;IACtB,OAAO;QACH,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,OAAO;QAEd,cAAc,CAAC,QAAQ,EAAE,MAAM;YAC3B,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAE7C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzC,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;oBAC1B,mBAAmB,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;gBACnF,CAAC;YACL,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["import type { ESTree, Plugin, VisitorObject } from \"vite\";\nimport { isBuiltin } from \"node:module\";\nimport { posix } from \"node:path\";\nimport { parseSync, Visitor } from \"vite\";\n\ntype Bindings = {\n declarations: Map<string, number>;\n factories: Set<string>;\n requires: Set<string>;\n urls: Set<string>;\n};\n\ntype Scan = {\n bindings: Bindings;\n calls: ESTree.CallExpression[];\n sources: string[];\n};\n\ntype Chunk = {\n fileName: string;\n code: string;\n};\n\ntype PatternItem =\n | ESTree.BindingPattern |\n ESTree.BindingProperty |\n ESTree.BindingRestElement |\n ESTree.FormalParameterRest |\n ESTree.TSParameterProperty |\n null;\n\nconst REQUIRE_FACTORY = \"createRequire\";\nconst REQUIRE_BINDING = \"require\";\nconst RESOLVE_PROPERTY = \"resolve\";\nconst MODULE_BUILTIN = \"node:module\";\nconst OUTPUT_DIRECTORY = \".\";\nconst RELATIVE_SPECIFIER = /^\\.\\.?(?:\\/|$)/;\n\nconst exportName = (name: ESTree.ModuleExportName): string | null => (name.type === \"Identifier\" ? name.name : null);\nconst referenceName = (node: ESTree.Argument): string | null => (node.type === \"Identifier\" ? node.name : null);\n\nconst countName = (declarations: Map<string, number>, name: string | null): void => {\n if (name !== null) {\n declarations.set(name, (declarations.get(name) ?? 0) + 1);\n }\n};\n\nconst boundPattern = (item: PatternItem): ESTree.BindingPattern | null => {\n if (item === null) {\n return null;\n }\n\n if (item.type === \"Property\") {\n return item.value;\n }\n\n if (item.type === \"RestElement\") {\n return item.argument;\n }\n\n return item.type === \"TSParameterProperty\" ? item.parameter : item;\n};\n\nconst countPatterns = (declarations: Map<string, number>, items: PatternItem[]): void => {\n for (const item of items) {\n countPattern(declarations, boundPattern(item));\n }\n};\n\nconst countPattern = (declarations: Map<string, number>, pattern: ESTree.BindingPattern | null): void => {\n if (pattern === null) {\n return;\n }\n\n if (pattern.type === \"Identifier\") {\n countName(declarations, pattern.name);\n\n return;\n }\n\n if (pattern.type === \"AssignmentPattern\") {\n countPattern(declarations, pattern.left);\n\n return;\n }\n\n countPatterns(declarations, pattern.type === \"ObjectPattern\" ? pattern.properties : pattern.elements);\n};\n\nconst countFunction = (\n declarations: Map<string, number>,\n node: ESTree.ArrowFunctionExpression | ESTree.Function,\n): void => {\n countPattern(declarations, node.id);\n countPatterns(declarations, node.params);\n};\n\nconst declarationVisitor = (declarations: Map<string, number>): VisitorObject => ({\n ArrowFunctionExpression: (node) => {\n countFunction(declarations, node);\n },\n CatchClause: (node) => {\n countPattern(declarations, node.param);\n },\n ClassDeclaration: (node) => {\n countPattern(declarations, node.id);\n },\n ClassExpression: (node) => {\n countPattern(declarations, node.id);\n },\n ExportSpecifier: (node) => {\n countName(declarations, exportName(node.local));\n },\n FunctionDeclaration: (node) => {\n countFunction(declarations, node);\n },\n FunctionExpression: (node) => {\n countFunction(declarations, node);\n },\n ImportDefaultSpecifier: (node) => {\n countPattern(declarations, node.local);\n },\n ImportNamespaceSpecifier: (node) => {\n countPattern(declarations, node.local);\n },\n ImportSpecifier: (node) => {\n countPattern(declarations, node.local);\n },\n VariableDeclarator: (node) => {\n countPattern(declarations, node.id);\n },\n});\n\nconst isUnshadowed = (name: string, bindings: Bindings): boolean => (bindings.declarations.get(name) ?? 0) <= 1;\n\nconst templateString = (node: ESTree.TemplateLiteral): string | null => {\n const [quasi] = node.quasis;\n\n return quasi === undefined || node.expressions.length > 0 ? null : quasi.value.cooked;\n};\n\nconst literalString = (node: ESTree.Argument | null): string | null => {\n if (node?.type === \"TemplateLiteral\") {\n return templateString(node);\n }\n\n return node?.type === \"Literal\" && typeof node.value === \"string\" ? node.value : null;\n};\n\nconst isMetaUrl = (node: ESTree.Argument, bindings: Bindings): boolean => {\n if (node.type === \"MemberExpression\") {\n return node.object.type === \"MetaProperty\";\n }\n\n const name = referenceName(node);\n\n return name !== null && bindings.urls.has(name) && isUnshadowed(name, bindings);\n};\n\nconst hasMetaUrl = (node: ESTree.CallExpression, bindings: Bindings): boolean =>\n node.arguments.some((argument) => isMetaUrl(argument, bindings));\n\nconst isRequireName = (name: string | null, bindings: Bindings): boolean =>\n name !== null && (name === REQUIRE_BINDING || bindings.requires.has(name)) && isUnshadowed(name, bindings);\n\nconst isFactoryName = (name: string | null, bindings: Bindings): boolean =>\n name !== null && (name === REQUIRE_FACTORY || bindings.factories.has(name)) && isUnshadowed(name, bindings);\n\nconst isRequireFactory = (node: ESTree.Argument, bindings: Bindings): boolean =>\n node.type === \"CallExpression\" &&\n (isFactoryName(referenceName(node.callee), bindings) || hasMetaUrl(node, bindings));\n\nconst isResolveTarget = (object: ESTree.Expression, bindings: Bindings): boolean =>\n object.type === \"MetaProperty\" ||\n isRequireName(referenceName(object), bindings) ||\n isRequireFactory(object, bindings);\n\nconst isResolveMember = (callee: ESTree.Expression, bindings: Bindings): boolean =>\n callee.type === \"MemberExpression\" &&\n !callee.computed &&\n callee.property.type === \"Identifier\" &&\n callee.property.name === RESOLVE_PROPERTY &&\n isResolveTarget(callee.object, bindings);\n\nconst isResolvingCall = (call: ESTree.CallExpression, bindings: Bindings): boolean =>\n hasMetaUrl(call, bindings) ||\n isRequireName(referenceName(call.callee), bindings) ||\n isRequireFactory(call.callee, bindings) ||\n isResolveMember(call.callee, bindings);\n\nconst collectFactories = (node: ESTree.ImportDeclaration, bindings: Bindings): void => {\n if (node.source.value !== MODULE_BUILTIN) {\n return;\n }\n\n for (const specifier of node.specifiers) {\n if (specifier.type === \"ImportSpecifier\" && exportName(specifier.imported) === REQUIRE_FACTORY) {\n bindings.factories.add(specifier.local.name);\n }\n }\n};\n\nconst collectBinding = (node: ESTree.VariableDeclarator, bindings: Bindings): void => {\n const { id, init } = node;\n\n if (init === null || id.type !== \"Identifier\") {\n return;\n }\n\n if (isMetaUrl(init, bindings)) {\n bindings.urls.add(id.name);\n }\n\n if (isRequireFactory(init, bindings)) {\n bindings.requires.add(id.name);\n }\n};\n\nconst collectSource = (scan: Scan, source: string | null): void => {\n if (source !== null) {\n scan.sources.push(source);\n }\n};\n\nconst collectCall = (scan: Scan, node: ESTree.CallExpression): void => {\n if (node.arguments.some((argument) => literalString(argument) !== null)) {\n scan.calls.push(node);\n }\n};\n\nconst scanVisitor = (scan: Scan): VisitorObject => ({\n CallExpression: (node) => {\n collectCall(scan, node);\n },\n ExportAllDeclaration: (node) => {\n collectSource(scan, node.source.value);\n },\n ExportNamedDeclaration: (node) => {\n collectSource(scan, node.source?.value ?? null);\n },\n ImportDeclaration: (node) => {\n collectFactories(node, scan.bindings);\n collectSource(scan, node.source.value);\n },\n ImportExpression: (node) => {\n collectSource(scan, literalString(node.source));\n },\n VariableDeclarator: (node) => {\n collectBinding(node, scan.bindings);\n },\n});\n\nconst scanChunk = (chunk: Chunk): Scan => {\n const scan: Scan = {\n bindings: { declarations: new Map(), factories: new Set(), requires: new Set(), urls: new Set() },\n calls: [],\n sources: [],\n };\n\n const { program } = parseSync(chunk.fileName, chunk.code);\n new Visitor(declarationVisitor(scan.bindings.declarations)).visit(program);\n new Visitor(scanVisitor(scan)).visit(program);\n\n return scan;\n};\n\nconst callSpecifiers = (scan: Scan): string[] =>\n scan.calls\n .filter((call) => isResolvingCall(call, scan.bindings))\n .flatMap((call) => call.arguments)\n .map((argument) => literalString(argument))\n .filter((specifier) => specifier !== null);\n\nconst isReachable = (specifier: string, directory: string, emitted: Set<string>): boolean => {\n if (isBuiltin(specifier)) {\n return true;\n }\n\n if (!RELATIVE_SPECIFIER.test(specifier)) {\n return false;\n }\n\n const target = posix.normalize(posix.join(directory, specifier));\n\n return target === OUTPUT_DIRECTORY || emitted.has(target);\n};\n\nconst unreachableSpecifiers = (chunk: Chunk, emitted: Set<string>): string[] => {\n const scan = scanChunk(chunk);\n const directory = posix.dirname(chunk.fileName);\n\n return new Set([...scan.sources, ...callSpecifiers(scan)])\n .values()\n .filter((specifier) => !isReachable(specifier, directory, emitted))\n .toArray()\n .toSorted((left, right) => left.localeCompare(right));\n};\n\nconst assertSelfContained = (chunk: Chunk, emitted: Set<string>): void => {\n const specifiers = unreachableSpecifiers(chunk, emitted);\n\n if (specifiers.length === 0) {\n return;\n }\n\n throw new Error(\n [\n `${chunk.fileName} resolves ${specifiers.join(\", \")} at runtime,`,\n \"so the built app only starts where that resolution succeeds from wherever it was installed.\",\n \"The artifact may resolve node: builtins and the files the build emits beside it, nothing else:\",\n \"bundle the module, emit the file, or read the data at build time.\",\n ].join(\" \"),\n );\n};\n\nfunction gtkxSelfContained(): Plugin {\n return {\n name: \"gtkx:self-contained\",\n apply: \"build\",\n\n generateBundle(_options, bundle) {\n const emitted = new Set(Object.keys(bundle));\n\n for (const output of Object.values(bundle)) {\n if (output.type === \"chunk\") {\n assertSelfContained({ fileName: output.fileName, code: output.code }, emitted);\n }\n }\n },\n };\n}\n\nexport { gtkxSelfContained };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"settings-worker-env.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/settings-worker-env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAI5C,iBAAS,qBAAqB,IAAI,MAAM,CAsBvC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"settings-worker-env.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/settings-worker-env.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,iBAAS,qBAAqB,IAAI,MAAM,CAyBvC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,12 +1,15 @@
1
+ import { createConfigLoader } from "@gtkx/config/internal";
1
2
  import { resolveDataDir } from "../internal/data-dir.js";
2
3
  import { prependSchemaDir, stageAndCompileProjectSchemas } from "../settings/schema.js";
3
4
  function gtkxSettingsWorkerEnv() {
5
+ const loadConfig = createConfigLoader();
4
6
  return {
5
7
  name: "gtkx:settings-worker-env",
6
8
  enforce: "pre",
7
- config(config) {
8
- const root = config.root ?? process.cwd();
9
- const dir = stageAndCompileProjectSchemas(root, resolveDataDir(root));
9
+ async config(config) {
10
+ const loaded = await loadConfig.load(config.root ?? process.cwd());
11
+ const dataDir = loaded.config.future?.v2ResourceImports === true ? null : resolveDataDir(loaded.root);
12
+ const dir = stageAndCompileProjectSchemas(loaded.root, dataDir);
10
13
  if (dir === null) {
11
14
  return;
12
15
  }
@@ -1 +1 @@
1
- {"version":3,"file":"settings-worker-env.js","sourceRoot":"","sources":["../../src/vite-plugins/settings-worker-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAExF,SAAS,qBAAqB;IAC1B,OAAO;QACH,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,KAAK;QAEd,MAAM,CAAC,MAAkB;YACrB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YAC1C,MAAM,GAAG,GAAG,6BAA6B,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;YAEtE,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;gBACf,OAAO;YACX,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC;YAEtC,OAAO;gBACH,IAAI,EAAE;oBACF,GAAG,EAAE,EAAE,oBAAoB,EAAE,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;iBACzF;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { UserConfig } from \"vite\";\nimport type { Plugin } from \"vitest/config\";\nimport { resolveDataDir } from \"../internal/data-dir.js\";\nimport { prependSchemaDir, stageAndCompileProjectSchemas } from \"../settings/schema.js\";\n\nfunction gtkxSettingsWorkerEnv(): Plugin {\n return {\n name: \"gtkx:settings-worker-env\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n const root = config.root ?? process.cwd();\n const dir = stageAndCompileProjectSchemas(root, resolveDataDir(root));\n\n if (dir === null) {\n return;\n }\n\n process.env.GTKX_DEV_SCHEMA_DIR = dir;\n\n return {\n test: {\n env: { GSETTINGS_SCHEMA_DIR: prependSchemaDir(dir, process.env.GSETTINGS_SCHEMA_DIR) },\n },\n };\n },\n };\n}\n\nexport { gtkxSettingsWorkerEnv };\n"]}
1
+ {"version":3,"file":"settings-worker-env.js","sourceRoot":"","sources":["../../src/vite-plugins/settings-worker-env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAExF,SAAS,qBAAqB;IAC1B,MAAM,UAAU,GAAG,kBAAkB,EAAE,CAAC;IAExC,OAAO;QACH,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,KAAK;QAEd,KAAK,CAAC,MAAM,CAAC,MAAkB;YAC3B,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACnE,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACtG,MAAM,GAAG,GAAG,6BAA6B,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YAEhE,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;gBACf,OAAO;YACX,CAAC;YAED,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,GAAG,CAAC;YAEtC,OAAO;gBACH,IAAI,EAAE;oBACF,GAAG,EAAE,EAAE,oBAAoB,EAAE,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE;iBACzF;aACJ,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC","sourcesContent":["import type { UserConfig } from \"vite\";\nimport type { Plugin } from \"vitest/config\";\nimport { createConfigLoader } from \"@gtkx/config/internal\";\nimport { resolveDataDir } from \"../internal/data-dir.js\";\nimport { prependSchemaDir, stageAndCompileProjectSchemas } from \"../settings/schema.js\";\n\nfunction gtkxSettingsWorkerEnv(): Plugin {\n const loadConfig = createConfigLoader();\n\n return {\n name: \"gtkx:settings-worker-env\",\n enforce: \"pre\",\n\n async config(config: UserConfig) {\n const loaded = await loadConfig.load(config.root ?? process.cwd());\n const dataDir = loaded.config.future?.v2ResourceImports === true ? null : resolveDataDir(loaded.root);\n const dir = stageAndCompileProjectSchemas(loaded.root, dataDir);\n\n if (dir === null) {\n return;\n }\n\n process.env.GTKX_DEV_SCHEMA_DIR = dir;\n\n return {\n test: {\n env: { GSETTINGS_SCHEMA_DIR: prependSchemaDir(dir, process.env.GSETTINGS_SCHEMA_DIR) },\n },\n };\n },\n };\n}\n\nexport { gtkxSettingsWorkerEnv };\n"]}
@@ -1,4 +1,6 @@
1
+ import type { ConfigLoader } from "@gtkx/config";
1
2
  import type { Plugin } from "vite";
2
- declare function gtkxSettings(): Plugin;
3
+ import type { BuildManifestCollector } from "../internal/build-manifest.js";
4
+ declare function gtkxSettings(loadConfig: ConfigLoader, buildManifest?: BuildManifestCollector): Plugin;
3
5
  export { gtkxSettings };
4
6
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAA6C,MAAM,MAAM,CAAC;AAsM1F,iBAAS,YAAY,IAAI,MAAM,CA0D9B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/vite-plugins/settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAc,MAAM,EAA6C,MAAM,MAAM,CAAC;AAI1F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAkQ5E,iBAAS,YAAY,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,sBAAsB,GAAG,MAAM,CA6D9F;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { error, errorMessage, info } from "@gtkx/utils";
1
+ import { error, errorMessage, info, sortStrings } from "@gtkx/utils";
2
2
  import { readFileSync } from "node:fs";
3
3
  import { basename, join } from "node:path";
4
4
  import { prependBanner } from "../internal/banner.js";
@@ -7,10 +7,12 @@ import { createRetainedStagingDir, withStagingDir } from "../internal/staging-di
7
7
  import { compileSchemas } from "../settings/compile.js";
8
8
  import { parseSchemaXml, SchemaParseError } from "../settings/parser.js";
9
9
  import { renderRuntimeModule } from "../settings/render.js";
10
- import { emitSchemaEnv, prependSchemaDir, SCHEMA_SUFFIX, stageSchema } from "../settings/schema.js";
10
+ import { assertUniqueSchemaBasenames, emitSchemaEnv, prependSchemaDir, projectRelativeSchemaPath, SCHEMA_SUFFIX, stageSchema, } from "../settings/schema.js";
11
11
  import { createVirtualNamespace } from "./virtual-module.js";
12
12
  const VIRTUAL_PREFIX = "\0gtkx-settings:";
13
13
  const SCHEMA_STAGING_PREFIX = "schemas";
14
+ const SOURCE_MODULE_RE = /\.[cm]?[jt]sx?$/;
15
+ const SCHEMA_ENV_DEBOUNCE_MS = 50;
14
16
  const { isVirtual, fromVirtualId, resolveToVirtual } = createVirtualNamespace(VIRTUAL_PREFIX);
15
17
  const SCHEMA_ENV_BANNER = [
16
18
  "process.env.GSETTINGS_SCHEMA_DIR = [",
@@ -41,14 +43,30 @@ const syncSchemaEnv = (state) => {
41
43
  return;
42
44
  }
43
45
  try {
44
- emitSchemaEnv(state.rootDir, state.dataDir);
46
+ emitSchemaEnv(state.rootDir, state.dataDir, state.isV2ResourceImports);
45
47
  }
46
48
  catch (error_) {
47
49
  error(`Failed to generate GSettings schema types: ${errorMessage(error_)}`);
48
50
  }
49
51
  };
50
- const applyUserConfig = (state, config) => {
51
- state.dataDir = resolveDataDir(config.root ?? process.cwd());
52
+ const cancelSchemaEnvSync = (state) => {
53
+ if (state.schemaEnvTimer === null) {
54
+ return;
55
+ }
56
+ clearTimeout(state.schemaEnvTimer);
57
+ state.schemaEnvTimer = null;
58
+ };
59
+ const scheduleSchemaEnvSync = (state) => {
60
+ cancelSchemaEnvSync(state);
61
+ state.schemaEnvTimer = setTimeout(() => {
62
+ state.schemaEnvTimer = null;
63
+ syncSchemaEnv(state);
64
+ }, SCHEMA_ENV_DEBOUNCE_MS);
65
+ };
66
+ const applyUserConfig = async (state, config, loadConfig) => {
67
+ const loaded = await loadConfig.load(config.root ?? process.cwd());
68
+ state.isV2ResourceImports = loaded.config.future?.v2ResourceImports === true;
69
+ state.dataDir = state.isV2ResourceImports ? null : resolveDataDir(loaded.root);
52
70
  };
53
71
  const applyResolvedConfig = (state, config) => {
54
72
  state.isBuild = config.command === "build";
@@ -91,27 +109,45 @@ const loadSchemaModule = (ctx, state, id) => {
91
109
  }
92
110
  return renderRuntimeModule(parsed);
93
111
  };
94
- const emitCompiledSchemas = (ctx, state) => {
95
- if (!state.isBuild || state.buildSchemas.size === 0) {
112
+ const compileBuildSchemas = (schemaFiles) => withStagingDir("schemas-build", (dir) => {
113
+ for (const filePath of schemaFiles) {
114
+ stageSchema(dir, filePath);
115
+ }
116
+ compileSchemas(dir);
117
+ return readFileSync(join(dir, "gschemas.compiled"));
118
+ });
119
+ const buildSchemaPaths = (rootDir, schemaFiles) => schemaFiles.map((filePath) => {
120
+ const rel = projectRelativeSchemaPath(rootDir, filePath);
121
+ if (rel === null) {
122
+ throw new Error(`Cannot package the GSettings schema ${filePath}: it is outside ${rootDir}`);
123
+ }
124
+ return rel;
125
+ });
126
+ const emitBuildSchemas = (ctx, state, buildManifest) => {
127
+ if (!state.isBuild || state.rootDir === null) {
96
128
  return;
97
129
  }
98
- const compiled = withStagingDir("schemas-build", (dir) => {
99
- for (const filePath of state.buildSchemas) {
100
- stageSchema(dir, filePath);
101
- }
102
- compileSchemas(dir);
103
- return readFileSync(join(dir, "gschemas.compiled"));
104
- });
130
+ const rootDir = state.rootDir;
131
+ const schemaFiles = sortStrings(state.buildSchemas);
132
+ assertUniqueSchemaBasenames(schemaFiles);
133
+ const schemas = buildSchemaPaths(rootDir, schemaFiles);
134
+ if (buildManifest !== undefined) {
135
+ buildManifest.schemas = schemas;
136
+ }
137
+ if (schemaFiles.length === 0) {
138
+ return;
139
+ }
140
+ const compiled = compileBuildSchemas(schemaFiles);
105
141
  ctx.emitFile({
106
142
  type: "asset",
107
143
  fileName: "gschemas.compiled",
108
144
  source: compiled,
109
145
  });
110
- info(`Compiled ${String(state.buildSchemas.size)} GSettings schema(s)`);
146
+ info(`Compiled ${String(schemaFiles.length)} GSettings schema(s)`);
111
147
  };
112
148
  const handleSchemaHotUpdate = (state, file, server) => {
113
- if (file.endsWith(SCHEMA_SUFFIX)) {
114
- syncSchemaEnv(state);
149
+ if (file.endsWith(SCHEMA_SUFFIX) || SOURCE_MODULE_RE.test(file)) {
150
+ scheduleSchemaEnvSync(state);
115
151
  }
116
152
  const virtualId = state.trackedSchemas.get(file);
117
153
  if (!virtualId) {
@@ -130,32 +166,35 @@ const handleSchemaHotUpdate = (state, file, server) => {
130
166
  };
131
167
  const watchSchemaFiles = (state, server) => {
132
168
  const onClose = () => {
169
+ cancelSchemaEnvSync(state);
133
170
  state.schemaDir.release();
134
171
  };
135
172
  server.httpServer?.once("close", onClose);
136
173
  server.watcher.once("close", onClose);
137
174
  const refreshSchemaTypes = (file) => {
138
- if (file.endsWith(SCHEMA_SUFFIX)) {
139
- syncSchemaEnv(state);
175
+ if (file.endsWith(SCHEMA_SUFFIX) || SOURCE_MODULE_RE.test(file)) {
176
+ scheduleSchemaEnvSync(state);
140
177
  }
141
178
  };
142
179
  server.watcher.on("add", refreshSchemaTypes);
143
180
  server.watcher.on("unlink", refreshSchemaTypes);
144
181
  };
145
- function gtkxSettings() {
182
+ function gtkxSettings(loadConfig, buildManifest) {
146
183
  const state = {
147
184
  schemaDir: createRetainedStagingDir(SCHEMA_STAGING_PREFIX),
148
185
  rootDir: null,
149
186
  dataDir: null,
187
+ isV2ResourceImports: false,
150
188
  isBuild: false,
189
+ schemaEnvTimer: null,
151
190
  trackedSchemas: new Map(),
152
191
  buildSchemas: new Set(),
153
192
  };
154
193
  return {
155
194
  name: "gtkx:settings",
156
195
  enforce: "pre",
157
- config(config) {
158
- applyUserConfig(state, config);
196
+ async config(config) {
197
+ await applyUserConfig(state, config, loadConfig);
159
198
  },
160
199
  configResolved(config) {
161
200
  applyResolvedConfig(state, config);
@@ -179,9 +218,10 @@ function gtkxSettings() {
179
218
  return loadSchemaModule(this, state, id);
180
219
  },
181
220
  buildEnd() {
182
- emitCompiledSchemas(this, state);
221
+ emitBuildSchemas(this, state, buildManifest);
183
222
  },
184
223
  closeBundle() {
224
+ cancelSchemaEnvSync(state);
185
225
  state.schemaDir.release();
186
226
  },
187
227
  handleHotUpdate({ file, server }) {
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/vite-plugins/settings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAA2B,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AA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AAM,CAAC,CAAC;QACvC,CAAC;QAED,eAAe,CAAC,MAAM;YAClB,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;QAED,aAAa,CAAC,OAAO;YACjB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO;YACX,CAAC;YAED,OAAO,aAAa,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;QACrD,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;YACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;gBAClC,OAAO;YACX,CAAC;YAED,OAAO,gBAAgB,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,IAAI,CAAC,EAAE;YACH,OAAO,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,CAAC;QAED,QAAQ;YACJ,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrC,CAAC;QAED,WAAW;YACP,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QAC9B,CAAC;QAED,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;YAC5B,OAAO,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { ModuleNode, Plugin, ResolvedConfig, UserConfig, ViteDevServer } from \"vite\";\nimport { error, errorMessage, info } from \"@gtkx/utils\";\nimport { readFileSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport type { AssetEmitter } from \"./asset-emitter.js\";\nimport { prependBanner } from \"../internal/banner.js\";\nimport { resolveDataDir } from \"../internal/data-dir.js\";\nimport { createRetainedStagingDir, type RetainedStagingDir, withStagingDir } from \"../internal/staging-dir.js\";\nimport { compileSchemas } from \"../settings/compile.js\";\nimport { parseSchemaXml, SchemaParseError } from \"../settings/parser.js\";\nimport { renderRuntimeModule } from \"../settings/render.js\";\nimport { emitSchemaEnv, prependSchemaDir, SCHEMA_SUFFIX, stageSchema } from \"../settings/schema.js\";\nimport { createVirtualNamespace } from \"./virtual-module.js\";\n\ntype PluginState = {\n schemaDir: RetainedStagingDir;\n rootDir: string | null;\n dataDir: string | null;\n isBuild: boolean;\n trackedSchemas: Map<string, string>;\n buildSchemas: Set<string>;\n};\n\ntype PluginContext = AssetEmitter & {\n error: (message: string) => never;\n};\n\nconst VIRTUAL_PREFIX = \"\\0gtkx-settings:\";\nconst SCHEMA_STAGING_PREFIX = \"schemas\";\nconst { isVirtual, fromVirtualId, resolveToVirtual } = createVirtualNamespace(VIRTUAL_PREFIX);\n\nconst SCHEMA_ENV_BANNER = [\n \"process.env.GSETTINGS_SCHEMA_DIR = [\",\n \" decodeURIComponent(new URL(\\\".\\\", import.meta.url).pathname),\",\n \" process.env.GSETTINGS_SCHEMA_DIR,\",\n \"]\",\n \" .filter(Boolean)\",\n \" .join(\\\":\\\");\",\n].join(\"\\n\");\n\nconst ensureSchemaDir = (state: PluginState): string => {\n const existing = state.schemaDir.getPath();\n\n if (existing !== null) {\n return existing;\n }\n\n const runnerDir = process.env.GTKX_DEV_SCHEMA_DIR;\n\n return runnerDir ? state.schemaDir.adopt(runnerDir) : state.schemaDir.retain();\n};\n\nconst compileSchemaDir = (state: PluginState): void => {\n const dir = state.schemaDir.getPath();\n\n if (dir === null) {\n return;\n }\n\n compileSchemas(dir);\n process.env.GSETTINGS_SCHEMA_DIR = prependSchemaDir(dir, process.env.GSETTINGS_SCHEMA_DIR);\n};\n\nconst syncSchemaEnv = (state: PluginState): void => {\n if (state.rootDir === null) {\n return;\n }\n\n try {\n emitSchemaEnv(state.rootDir, state.dataDir);\n } catch (error_) {\n error(`Failed to generate GSettings schema types: ${errorMessage(error_)}`);\n }\n};\n\nconst applyUserConfig = (state: PluginState, config: UserConfig): void => {\n state.dataDir = resolveDataDir(config.root ?? process.cwd());\n};\n\nconst applyResolvedConfig = (state: PluginState, config: ResolvedConfig): void => {\n state.isBuild = config.command === \"build\";\n state.rootDir = typeof config.root === \"string\" ? config.root : null;\n syncSchemaEnv(state);\n};\n\nconst registerSchemaForMode = (state: PluginState, filePath: string, id: string): void => {\n const fileName = basename(filePath);\n\n if (state.isBuild) {\n state.buildSchemas.add(filePath);\n info(`Queued GSettings schema: ${fileName}`);\n\n return;\n }\n\n state.trackedSchemas.set(filePath, id);\n const dir = ensureSchemaDir(state);\n stageSchema(dir, filePath);\n compileSchemaDir(state);\n info(`Compiled GSettings schema: ${fileName}`);\n};\n\nconst loadSchemaModule = (ctx: PluginContext, state: PluginState, id: string): string | undefined => {\n if (!isVirtual(id)) {\n return undefined;\n }\n\n const filePath = fromVirtualId(id);\n const xml = readFileSync(filePath, \"utf8\");\n const fileName = basename(filePath);\n registerSchemaForMode(state, filePath, id);\n let parsed: ReturnType<typeof parseSchemaXml>;\n\n try {\n parsed = parseSchemaXml(xml, fileName);\n } catch (error) {\n if (!(error instanceof SchemaParseError)) {\n throw error;\n }\n\n ctx.error(error.message);\n }\n\n if (parsed.schemas.length === 0) {\n ctx.error(`No <schema id=\"...\"> found in ${fileName}`);\n }\n\n return renderRuntimeModule(parsed);\n};\n\nconst emitCompiledSchemas = (ctx: PluginContext, state: PluginState): void => {\n if (!state.isBuild || state.buildSchemas.size === 0) {\n return;\n }\n\n const compiled = withStagingDir(\"schemas-build\", (dir) => {\n for (const filePath of state.buildSchemas) {\n stageSchema(dir, filePath);\n }\n\n compileSchemas(dir);\n\n return readFileSync(join(dir, \"gschemas.compiled\"));\n });\n\n ctx.emitFile({\n type: \"asset\",\n fileName: \"gschemas.compiled\",\n source: compiled,\n });\n\n info(`Compiled ${String(state.buildSchemas.size)} GSettings schema(s)`);\n};\n\nconst handleSchemaHotUpdate = (state: PluginState, file: string, server: ViteDevServer): ModuleNode[] | undefined => {\n if (file.endsWith(SCHEMA_SUFFIX)) {\n syncSchemaEnv(state);\n }\n\n const virtualId = state.trackedSchemas.get(file);\n\n if (!virtualId) {\n return;\n }\n\n const dir = ensureSchemaDir(state);\n stageSchema(dir, file);\n compileSchemaDir(state);\n info(`Recompiled GSettings schema: ${basename(file)}`);\n const mod = server.moduleGraph.getModuleById(virtualId);\n\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n\n return [mod];\n }\n\n return undefined;\n};\n\nconst watchSchemaFiles = (state: PluginState, server: ViteDevServer): void => {\n const onClose = (): void => {\n state.schemaDir.release();\n };\n\n server.httpServer?.once(\"close\", onClose);\n server.watcher.once(\"close\", onClose);\n\n const refreshSchemaTypes = (file: string): void => {\n if (file.endsWith(SCHEMA_SUFFIX)) {\n syncSchemaEnv(state);\n }\n };\n\n server.watcher.on(\"add\", refreshSchemaTypes);\n server.watcher.on(\"unlink\", refreshSchemaTypes);\n};\n\nfunction gtkxSettings(): Plugin {\n const state: PluginState = {\n schemaDir: createRetainedStagingDir(SCHEMA_STAGING_PREFIX),\n rootDir: null,\n dataDir: null,\n isBuild: false,\n trackedSchemas: new Map(),\n buildSchemas: new Set(),\n };\n\n return {\n name: \"gtkx:settings\",\n enforce: \"pre\",\n\n config(config: UserConfig) {\n applyUserConfig(state, config);\n },\n\n configResolved(config) {\n applyResolvedConfig(state, config);\n },\n\n configureServer(server) {\n watchSchemaFiles(state, server);\n },\n\n outputOptions(options) {\n if (!state.isBuild) {\n return;\n }\n\n return prependBanner(options, SCHEMA_ENV_BANNER);\n },\n\n async resolveId(source, importer, options) {\n if (!source.endsWith(SCHEMA_SUFFIX)) {\n return;\n }\n\n return resolveToVirtual(this, { source, importer, options });\n },\n\n load(id) {\n return loadSchemaModule(this, state, id);\n },\n\n buildEnd() {\n emitCompiledSchemas(this, state);\n },\n\n closeBundle() {\n state.schemaDir.release();\n },\n\n handleHotUpdate({ file, server }) {\n return handleSchemaHotUpdate(state, file, server);\n },\n };\n}\n\nexport { gtkxSettings };\n"]}
1
+ {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/vite-plugins/settings.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAA2B,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC/G,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EACH,2BAA2B,EAC3B,aAAa,EACb,gBAAgB,EAChB,yBAAyB,EACzB,aAAa,EACb,WAAW,GACd,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAiB7D,MAAM,cAAc,GAAG,kBAAkB,CAAC;AAC1C,MAAM,qBAAqB,GAAG,SAAS,CAAC;AACxC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAC3C,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAC;AAE9F,MAAM,iBAAiB,GAAG;IACtB,sCAAsC;IACtC,mEAAmE;IACnE,uCAAuC;IACvC,GAAG;IACH,sBAAsB;IACtB,mBAAmB;CACtB,CAAC,IAAI,CAAC,IAAI,CAA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,qBAAqB,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACtD,CAAC;KACJ,CAAC;AACN,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { ConfigLoader } from \"@gtkx/config\";\nimport type { ModuleNode, Plugin, ResolvedConfig, UserConfig, ViteDevServer } from \"vite\";\nimport { error, errorMessage, info, sortStrings } from \"@gtkx/utils\";\nimport { readFileSync } from \"node:fs\";\nimport { basename, join } from \"node:path\";\nimport type { BuildManifestCollector } from \"../internal/build-manifest.js\";\nimport type { AssetEmitter } from \"./asset-emitter.js\";\nimport { prependBanner } from \"../internal/banner.js\";\nimport { resolveDataDir } from \"../internal/data-dir.js\";\nimport { createRetainedStagingDir, type RetainedStagingDir, withStagingDir } from \"../internal/staging-dir.js\";\nimport { compileSchemas } from \"../settings/compile.js\";\nimport { parseSchemaXml, SchemaParseError } from \"../settings/parser.js\";\nimport { renderRuntimeModule } from \"../settings/render.js\";\nimport {\n assertUniqueSchemaBasenames,\n emitSchemaEnv,\n prependSchemaDir,\n projectRelativeSchemaPath,\n SCHEMA_SUFFIX,\n stageSchema,\n} from \"../settings/schema.js\";\nimport { createVirtualNamespace } from \"./virtual-module.js\";\n\ntype PluginState = {\n schemaDir: RetainedStagingDir;\n rootDir: string | null;\n dataDir: string | null;\n isV2ResourceImports: boolean;\n isBuild: boolean;\n schemaEnvTimer: ReturnType<typeof setTimeout> | null;\n trackedSchemas: Map<string, string>;\n buildSchemas: Set<string>;\n};\n\ntype PluginContext = AssetEmitter & {\n error: (message: string) => never;\n};\n\nconst VIRTUAL_PREFIX = \"\\0gtkx-settings:\";\nconst SCHEMA_STAGING_PREFIX = \"schemas\";\nconst SOURCE_MODULE_RE = /\\.[cm]?[jt]sx?$/;\nconst SCHEMA_ENV_DEBOUNCE_MS = 50;\nconst { isVirtual, fromVirtualId, resolveToVirtual } = createVirtualNamespace(VIRTUAL_PREFIX);\n\nconst SCHEMA_ENV_BANNER = [\n \"process.env.GSETTINGS_SCHEMA_DIR = [\",\n \" decodeURIComponent(new URL(\\\".\\\", import.meta.url).pathname),\",\n \" process.env.GSETTINGS_SCHEMA_DIR,\",\n \"]\",\n \" .filter(Boolean)\",\n \" .join(\\\":\\\");\",\n].join(\"\\n\");\n\nconst ensureSchemaDir = (state: PluginState): string => {\n const existing = state.schemaDir.getPath();\n\n if (existing !== null) {\n return existing;\n }\n\n const runnerDir = process.env.GTKX_DEV_SCHEMA_DIR;\n\n return runnerDir ? state.schemaDir.adopt(runnerDir) : state.schemaDir.retain();\n};\n\nconst compileSchemaDir = (state: PluginState): void => {\n const dir = state.schemaDir.getPath();\n\n if (dir === null) {\n return;\n }\n\n compileSchemas(dir);\n process.env.GSETTINGS_SCHEMA_DIR = prependSchemaDir(dir, process.env.GSETTINGS_SCHEMA_DIR);\n};\n\nconst syncSchemaEnv = (state: PluginState): void => {\n if (state.rootDir === null) {\n return;\n }\n\n try {\n emitSchemaEnv(state.rootDir, state.dataDir, state.isV2ResourceImports);\n } catch (error_) {\n error(`Failed to generate GSettings schema types: ${errorMessage(error_)}`);\n }\n};\n\nconst cancelSchemaEnvSync = (state: PluginState): void => {\n if (state.schemaEnvTimer === null) {\n return;\n }\n\n clearTimeout(state.schemaEnvTimer);\n state.schemaEnvTimer = null;\n};\n\nconst scheduleSchemaEnvSync = (state: PluginState): void => {\n cancelSchemaEnvSync(state);\n\n state.schemaEnvTimer = setTimeout(() => {\n state.schemaEnvTimer = null;\n syncSchemaEnv(state);\n }, SCHEMA_ENV_DEBOUNCE_MS);\n};\n\nconst applyUserConfig = async (state: PluginState, config: UserConfig, loadConfig: ConfigLoader): Promise<void> => {\n const loaded = await loadConfig.load(config.root ?? process.cwd());\n state.isV2ResourceImports = loaded.config.future?.v2ResourceImports === true;\n state.dataDir = state.isV2ResourceImports ? null : resolveDataDir(loaded.root);\n};\n\nconst applyResolvedConfig = (state: PluginState, config: ResolvedConfig): void => {\n state.isBuild = config.command === \"build\";\n state.rootDir = typeof config.root === \"string\" ? config.root : null;\n syncSchemaEnv(state);\n};\n\nconst registerSchemaForMode = (state: PluginState, filePath: string, id: string): void => {\n const fileName = basename(filePath);\n\n if (state.isBuild) {\n state.buildSchemas.add(filePath);\n info(`Queued GSettings schema: ${fileName}`);\n\n return;\n }\n\n state.trackedSchemas.set(filePath, id);\n const dir = ensureSchemaDir(state);\n stageSchema(dir, filePath);\n compileSchemaDir(state);\n info(`Compiled GSettings schema: ${fileName}`);\n};\n\nconst loadSchemaModule = (ctx: PluginContext, state: PluginState, id: string): string | undefined => {\n if (!isVirtual(id)) {\n return undefined;\n }\n\n const filePath = fromVirtualId(id);\n const xml = readFileSync(filePath, \"utf8\");\n const fileName = basename(filePath);\n registerSchemaForMode(state, filePath, id);\n let parsed: ReturnType<typeof parseSchemaXml>;\n\n try {\n parsed = parseSchemaXml(xml, fileName);\n } catch (error) {\n if (!(error instanceof SchemaParseError)) {\n throw error;\n }\n\n ctx.error(error.message);\n }\n\n if (parsed.schemas.length === 0) {\n ctx.error(`No <schema id=\"...\"> found in ${fileName}`);\n }\n\n return renderRuntimeModule(parsed);\n};\n\nconst compileBuildSchemas = (schemaFiles: string[]): Buffer =>\n withStagingDir(\"schemas-build\", (dir) => {\n for (const filePath of schemaFiles) {\n stageSchema(dir, filePath);\n }\n\n compileSchemas(dir);\n\n return readFileSync(join(dir, \"gschemas.compiled\"));\n });\n\nconst buildSchemaPaths = (rootDir: string, schemaFiles: string[]): string[] =>\n schemaFiles.map((filePath) => {\n const rel = projectRelativeSchemaPath(rootDir, filePath);\n\n if (rel === null) {\n throw new Error(`Cannot package the GSettings schema ${filePath}: it is outside ${rootDir}`);\n }\n\n return rel;\n });\n\nconst emitBuildSchemas = (\n ctx: PluginContext,\n state: PluginState,\n buildManifest: BuildManifestCollector | undefined,\n): void => {\n if (!state.isBuild || state.rootDir === null) {\n return;\n }\n\n const rootDir = state.rootDir;\n const schemaFiles = sortStrings(state.buildSchemas);\n assertUniqueSchemaBasenames(schemaFiles);\n const schemas = buildSchemaPaths(rootDir, schemaFiles);\n\n if (buildManifest !== undefined) {\n buildManifest.schemas = schemas;\n }\n\n if (schemaFiles.length === 0) {\n return;\n }\n\n const compiled = compileBuildSchemas(schemaFiles);\n\n ctx.emitFile({\n type: \"asset\",\n fileName: \"gschemas.compiled\",\n source: compiled,\n });\n\n info(`Compiled ${String(schemaFiles.length)} GSettings schema(s)`);\n};\n\nconst handleSchemaHotUpdate = (state: PluginState, file: string, server: ViteDevServer): ModuleNode[] | undefined => {\n if (file.endsWith(SCHEMA_SUFFIX) || SOURCE_MODULE_RE.test(file)) {\n scheduleSchemaEnvSync(state);\n }\n\n const virtualId = state.trackedSchemas.get(file);\n\n if (!virtualId) {\n return;\n }\n\n const dir = ensureSchemaDir(state);\n stageSchema(dir, file);\n compileSchemaDir(state);\n info(`Recompiled GSettings schema: ${basename(file)}`);\n const mod = server.moduleGraph.getModuleById(virtualId);\n\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n\n return [mod];\n }\n\n return undefined;\n};\n\nconst watchSchemaFiles = (state: PluginState, server: ViteDevServer): void => {\n const onClose = (): void => {\n cancelSchemaEnvSync(state);\n state.schemaDir.release();\n };\n\n server.httpServer?.once(\"close\", onClose);\n server.watcher.once(\"close\", onClose);\n\n const refreshSchemaTypes = (file: string): void => {\n if (file.endsWith(SCHEMA_SUFFIX) || SOURCE_MODULE_RE.test(file)) {\n scheduleSchemaEnvSync(state);\n }\n };\n\n server.watcher.on(\"add\", refreshSchemaTypes);\n server.watcher.on(\"unlink\", refreshSchemaTypes);\n};\n\nfunction gtkxSettings(loadConfig: ConfigLoader, buildManifest?: BuildManifestCollector): Plugin {\n const state: PluginState = {\n schemaDir: createRetainedStagingDir(SCHEMA_STAGING_PREFIX),\n rootDir: null,\n dataDir: null,\n isV2ResourceImports: false,\n isBuild: false,\n schemaEnvTimer: null,\n trackedSchemas: new Map(),\n buildSchemas: new Set(),\n };\n\n return {\n name: \"gtkx:settings\",\n enforce: \"pre\",\n\n async config(config: UserConfig) {\n await applyUserConfig(state, config, loadConfig);\n },\n\n configResolved(config) {\n applyResolvedConfig(state, config);\n },\n\n configureServer(server) {\n watchSchemaFiles(state, server);\n },\n\n outputOptions(options) {\n if (!state.isBuild) {\n return;\n }\n\n return prependBanner(options, SCHEMA_ENV_BANNER);\n },\n\n async resolveId(source, importer, options) {\n if (!source.endsWith(SCHEMA_SUFFIX)) {\n return;\n }\n\n return resolveToVirtual(this, { source, importer, options });\n },\n\n load(id) {\n return loadSchemaModule(this, state, id);\n },\n\n buildEnd() {\n emitBuildSchemas(this, state, buildManifest);\n },\n\n closeBundle() {\n cancelSchemaEnvSync(state);\n state.schemaDir.release();\n },\n\n handleHotUpdate({ file, server }) {\n return handleSchemaHotUpdate(state, file, server);\n },\n };\n}\n\nexport { gtkxSettings };\n"]}
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;