@gtkx/cli 1.6.0 → 2.0.0-beta.2

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 (309) hide show
  1. package/README.md +5 -5
  2. package/dist/builder.d.ts +1 -0
  3. package/dist/builder.d.ts.map +1 -1
  4. package/dist/builder.js +17 -5
  5. package/dist/builder.js.map +1 -1
  6. package/dist/cli.js +2 -0
  7. package/dist/cli.js.map +1 -1
  8. package/dist/codegen/freshness.d.ts.map +1 -1
  9. package/dist/codegen/freshness.js +45 -16
  10. package/dist/codegen/freshness.js.map +1 -1
  11. package/dist/codegen/reference.d.ts.map +1 -1
  12. package/dist/codegen/reference.js +1 -7
  13. package/dist/codegen/reference.js.map +1 -1
  14. package/dist/codegen/report.d.ts.map +1 -1
  15. package/dist/codegen/report.js +5 -16
  16. package/dist/codegen/report.js.map +1 -1
  17. package/dist/codegen/run-codegen.d.ts +7 -7
  18. package/dist/codegen/run-codegen.d.ts.map +1 -1
  19. package/dist/codegen/run-codegen.js +35 -107
  20. package/dist/codegen/run-codegen.js.map +1 -1
  21. package/dist/codegen/store-resolver.d.ts +1 -2
  22. package/dist/codegen/store-resolver.d.ts.map +1 -1
  23. package/dist/codegen/store-resolver.js +10 -19
  24. package/dist/codegen/store-resolver.js.map +1 -1
  25. package/dist/commands/build.d.ts +5 -0
  26. package/dist/commands/build.d.ts.map +1 -1
  27. package/dist/commands/build.js +83 -10
  28. package/dist/commands/build.js.map +1 -1
  29. package/dist/commands/codegen.d.ts +1 -0
  30. package/dist/commands/codegen.d.ts.map +1 -1
  31. package/dist/commands/codegen.js +6 -5
  32. package/dist/commands/codegen.js.map +1 -1
  33. package/dist/commands/deploy.d.ts +1 -0
  34. package/dist/commands/deploy.d.ts.map +1 -1
  35. package/dist/commands/deploy.js +4 -2
  36. package/dist/commands/deploy.js.map +1 -1
  37. package/dist/commands/dev.d.ts +8 -0
  38. package/dist/commands/dev.d.ts.map +1 -1
  39. package/dist/commands/dev.js +19 -1
  40. package/dist/commands/dev.js.map +1 -1
  41. package/dist/commands/docs.d.ts.map +1 -1
  42. package/dist/commands/docs.js +5 -15
  43. package/dist/commands/docs.js.map +1 -1
  44. package/dist/deploy/freedesktop/copyright.d.ts.map +1 -1
  45. package/dist/deploy/freedesktop/copyright.js +2 -13
  46. package/dist/deploy/freedesktop/copyright.js.map +1 -1
  47. package/dist/deploy/freedesktop/metainfo.d.ts.map +1 -1
  48. package/dist/deploy/freedesktop/metainfo.js +41 -2
  49. package/dist/deploy/freedesktop/metainfo.js.map +1 -1
  50. package/dist/deploy/freedesktop/xml.d.ts.map +1 -1
  51. package/dist/deploy/freedesktop/xml.js +21 -25
  52. package/dist/deploy/freedesktop/xml.js.map +1 -1
  53. package/dist/deploy/nfpm/config.d.ts.map +1 -1
  54. package/dist/deploy/nfpm/config.js +5 -2
  55. package/dist/deploy/nfpm/config.js.map +1 -1
  56. package/dist/deploy/nfpm/contents.d.ts.map +1 -1
  57. package/dist/deploy/nfpm/contents.js +8 -0
  58. package/dist/deploy/nfpm/contents.js.map +1 -1
  59. package/dist/deploy/node-runtime/elf.d.ts +2 -1
  60. package/dist/deploy/node-runtime/elf.d.ts.map +1 -1
  61. package/dist/deploy/node-runtime/elf.js +32 -5
  62. package/dist/deploy/node-runtime/elf.js.map +1 -1
  63. package/dist/deploy/node-runtime/index.d.ts +2 -1
  64. package/dist/deploy/node-runtime/index.d.ts.map +1 -1
  65. package/dist/deploy/node-runtime/index.js +73 -4
  66. package/dist/deploy/node-runtime/index.js.map +1 -1
  67. package/dist/deploy/node-runtime/license.d.ts.map +1 -1
  68. package/dist/deploy/node-runtime/license.js +2 -9
  69. package/dist/deploy/node-runtime/license.js.map +1 -1
  70. package/dist/deploy/notices/node-runtime.js +2 -2
  71. package/dist/deploy/notices/node-runtime.js.map +1 -1
  72. package/dist/deploy/notices/packages.d.ts.map +1 -1
  73. package/dist/deploy/notices/packages.js +3 -10
  74. package/dist/deploy/notices/packages.js.map +1 -1
  75. package/dist/deploy/payload/copy-tree.d.ts.map +1 -1
  76. package/dist/deploy/payload/copy-tree.js +3 -3
  77. package/dist/deploy/payload/copy-tree.js.map +1 -1
  78. package/dist/deploy/payload/launcher.d.ts.map +1 -1
  79. package/dist/deploy/payload/launcher.js +14 -1
  80. package/dist/deploy/payload/launcher.js.map +1 -1
  81. package/dist/deploy/payload/stage.d.ts.map +1 -1
  82. package/dist/deploy/payload/stage.js +2 -4
  83. package/dist/deploy/payload/stage.js.map +1 -1
  84. package/dist/deploy/run-deploy.d.ts +1 -0
  85. package/dist/deploy/run-deploy.d.ts.map +1 -1
  86. package/dist/deploy/run-deploy.js +100 -14
  87. package/dist/deploy/run-deploy.js.map +1 -1
  88. package/dist/deploy/settings/build-manifest.d.ts +6 -1
  89. package/dist/deploy/settings/build-manifest.d.ts.map +1 -1
  90. package/dist/deploy/settings/build-manifest.js +17 -17
  91. package/dist/deploy/settings/build-manifest.js.map +1 -1
  92. package/dist/deploy/settings/extra-files.d.ts +1 -1
  93. package/dist/deploy/settings/extra-files.d.ts.map +1 -1
  94. package/dist/deploy/settings/extra-files.js +22 -1
  95. package/dist/deploy/settings/extra-files.js.map +1 -1
  96. package/dist/deploy/settings/index.d.ts +1 -0
  97. package/dist/deploy/settings/index.d.ts.map +1 -1
  98. package/dist/deploy/settings/index.js +2 -1
  99. package/dist/deploy/settings/index.js.map +1 -1
  100. package/dist/deploy/settings/libraries.d.ts.map +1 -1
  101. package/dist/deploy/settings/libraries.js +2 -19
  102. package/dist/deploy/settings/libraries.js.map +1 -1
  103. package/dist/deploy/settings/paths.d.ts +2 -2
  104. package/dist/deploy/settings/paths.d.ts.map +1 -1
  105. package/dist/deploy/settings/paths.js +110 -12
  106. package/dist/deploy/settings/paths.js.map +1 -1
  107. package/dist/deploy/settings/screenshots.d.ts.map +1 -1
  108. package/dist/deploy/settings/screenshots.js +6 -31
  109. package/dist/deploy/settings/screenshots.js.map +1 -1
  110. package/dist/deploy/targets/flatpak-pnpm.js +4 -4
  111. package/dist/deploy/targets/flatpak-pnpm.js.map +1 -1
  112. package/dist/deploy/targets/flatpak-source.d.ts.map +1 -1
  113. package/dist/deploy/targets/flatpak-source.js +15 -6
  114. package/dist/deploy/targets/flatpak-source.js.map +1 -1
  115. package/dist/deploy/targets/flatpak-sources.js +1 -1
  116. package/dist/deploy/targets/flatpak-sources.js.map +1 -1
  117. package/dist/deploy/types.d.ts +1 -0
  118. package/dist/deploy/types.d.ts.map +1 -1
  119. package/dist/deploy/types.js.map +1 -1
  120. package/dist/dev/headless.d.ts +3 -0
  121. package/dist/dev/headless.d.ts.map +1 -0
  122. package/dist/dev/headless.js +35 -0
  123. package/dist/dev/headless.js.map +1 -0
  124. package/dist/dev/runner-deps.js +1 -1
  125. package/dist/dev/runner-deps.js.map +1 -1
  126. package/dist/dev/runner-main.d.ts.map +1 -1
  127. package/dist/dev/runner-main.js +1 -2
  128. package/dist/dev/runner-main.js.map +1 -1
  129. package/dist/dev/schema-dir.d.ts +1 -1
  130. package/dist/dev/schema-dir.d.ts.map +1 -1
  131. package/dist/dev/schema-dir.js +2 -4
  132. package/dist/dev/schema-dir.js.map +1 -1
  133. package/dist/i18n/catalogs.d.ts.map +1 -1
  134. package/dist/i18n/catalogs.js +2 -1
  135. package/dist/i18n/catalogs.js.map +1 -1
  136. package/dist/i18n/metadata-templates.d.ts.map +1 -1
  137. package/dist/i18n/metadata-templates.js +2 -1
  138. package/dist/i18n/metadata-templates.js.map +1 -1
  139. package/dist/i18n/source-messages.d.ts +3 -21
  140. package/dist/i18n/source-messages.d.ts.map +1 -1
  141. package/dist/i18n/source-messages.js +900 -85
  142. package/dist/i18n/source-messages.js.map +1 -1
  143. package/dist/i18n/types.d.ts +6 -7
  144. package/dist/i18n/types.d.ts.map +1 -1
  145. package/dist/i18n/types.js +83 -96
  146. package/dist/i18n/types.js.map +1 -1
  147. package/dist/internal/build-manifest.d.ts +5 -2
  148. package/dist/internal/build-manifest.d.ts.map +1 -1
  149. package/dist/internal/build-manifest.js +15 -2
  150. package/dist/internal/build-manifest.js.map +1 -1
  151. package/dist/internal/build-output.d.ts +8 -0
  152. package/dist/internal/build-output.d.ts.map +1 -0
  153. package/dist/internal/build-output.js +69 -0
  154. package/dist/internal/build-output.js.map +1 -0
  155. package/dist/internal/docs-elements.js +2 -2
  156. package/dist/internal/docs-elements.js.map +1 -1
  157. package/dist/internal/entry-arg.d.ts +4 -1
  158. package/dist/internal/entry-arg.d.ts.map +1 -1
  159. package/dist/internal/entry-arg.js +7 -1
  160. package/dist/internal/entry-arg.js.map +1 -1
  161. package/dist/internal/icon-path.d.ts.map +1 -1
  162. package/dist/internal/icon-path.js +5 -16
  163. package/dist/internal/icon-path.js.map +1 -1
  164. package/dist/internal/output-directory.d.ts +15 -0
  165. package/dist/internal/output-directory.d.ts.map +1 -0
  166. package/dist/internal/output-directory.js +490 -0
  167. package/dist/internal/output-directory.js.map +1 -0
  168. package/dist/internal/prepare-project.d.ts +2 -0
  169. package/dist/internal/prepare-project.d.ts.map +1 -1
  170. package/dist/internal/prepare-project.js +3 -3
  171. package/dist/internal/prepare-project.js.map +1 -1
  172. package/dist/internal/source-imports.d.ts.map +1 -1
  173. package/dist/internal/source-imports.js +10 -41
  174. package/dist/internal/source-imports.js.map +1 -1
  175. package/dist/mcp/client.js +2 -2
  176. package/dist/mcp/client.js.map +1 -1
  177. package/dist/settings/render.d.ts +0 -1
  178. package/dist/settings/render.d.ts.map +1 -1
  179. package/dist/settings/render.js +1 -11
  180. package/dist/settings/render.js.map +1 -1
  181. package/dist/settings/schema.d.ts +2 -2
  182. package/dist/settings/schema.d.ts.map +1 -1
  183. package/dist/settings/schema.js +21 -62
  184. package/dist/settings/schema.js.map +1 -1
  185. package/dist/vite-plugins/asset-imports.d.ts +1 -2
  186. package/dist/vite-plugins/asset-imports.d.ts.map +1 -1
  187. package/dist/vite-plugins/asset-imports.js +19 -32
  188. package/dist/vite-plugins/asset-imports.js.map +1 -1
  189. package/dist/vite-plugins/asset-specifier.d.ts +1 -3
  190. package/dist/vite-plugins/asset-specifier.d.ts.map +1 -1
  191. package/dist/vite-plugins/asset-specifier.js +1 -4
  192. package/dist/vite-plugins/asset-specifier.js.map +1 -1
  193. package/dist/vite-plugins/build-manifest.d.ts +5 -1
  194. package/dist/vite-plugins/build-manifest.d.ts.map +1 -1
  195. package/dist/vite-plugins/build-manifest.js +2 -1
  196. package/dist/vite-plugins/build-manifest.js.map +1 -1
  197. package/dist/vite-plugins/i18n.d.ts.map +1 -1
  198. package/dist/vite-plugins/i18n.js +59 -6
  199. package/dist/vite-plugins/i18n.js.map +1 -1
  200. package/dist/vite-plugins/index.d.ts +8 -1
  201. package/dist/vite-plugins/index.d.ts.map +1 -1
  202. package/dist/vite-plugins/index.js +8 -6
  203. package/dist/vite-plugins/index.js.map +1 -1
  204. package/dist/vite-plugins/resources.d.ts.map +1 -1
  205. package/dist/vite-plugins/resources.js +32 -97
  206. package/dist/vite-plugins/resources.js.map +1 -1
  207. package/dist/vite-plugins/self-contained.d.ts.map +1 -1
  208. package/dist/vite-plugins/self-contained.js +159 -158
  209. package/dist/vite-plugins/self-contained.js.map +1 -1
  210. package/dist/vite-plugins/settings-worker-env.d.ts.map +1 -1
  211. package/dist/vite-plugins/settings-worker-env.js +2 -4
  212. package/dist/vite-plugins/settings-worker-env.js.map +1 -1
  213. package/dist/vite-plugins/settings.d.ts +1 -2
  214. package/dist/vite-plugins/settings.d.ts.map +1 -1
  215. package/dist/vite-plugins/settings.js +8 -14
  216. package/dist/vite-plugins/settings.js.map +1 -1
  217. package/dist/vite-plugins/undeclared-library.d.ts.map +1 -1
  218. package/dist/vite-plugins/undeclared-library.js +10 -13
  219. package/dist/vite-plugins/undeclared-library.js.map +1 -1
  220. package/dist/vite-plugins/worker.d.ts.map +1 -1
  221. package/dist/vite-plugins/worker.js +0 -1
  222. package/dist/vite-plugins/worker.js.map +1 -1
  223. package/package.json +21 -15
  224. package/src/builder.ts +18 -5
  225. package/src/cli.ts +3 -0
  226. package/src/codegen/freshness.ts +66 -17
  227. package/src/codegen/reference.ts +1 -8
  228. package/src/codegen/report.ts +5 -21
  229. package/src/codegen/run-codegen.ts +42 -151
  230. package/src/codegen/store-resolver.ts +10 -26
  231. package/src/commands/build.ts +13 -2
  232. package/src/commands/codegen.ts +6 -5
  233. package/src/commands/deploy.ts +4 -2
  234. package/src/commands/dev.ts +20 -1
  235. package/src/commands/docs.ts +5 -17
  236. package/src/deploy/freedesktop/copyright.ts +2 -14
  237. package/src/deploy/freedesktop/metainfo.ts +73 -21
  238. package/src/deploy/freedesktop/xml.ts +24 -32
  239. package/src/deploy/nfpm/config.ts +5 -2
  240. package/src/deploy/nfpm/contents.ts +8 -0
  241. package/src/deploy/node-runtime/elf.ts +43 -5
  242. package/src/deploy/node-runtime/index.ts +105 -5
  243. package/src/deploy/node-runtime/license.ts +2 -8
  244. package/src/deploy/notices/node-runtime.ts +2 -2
  245. package/src/deploy/notices/packages.ts +3 -11
  246. package/src/deploy/payload/copy-tree.ts +3 -4
  247. package/src/deploy/payload/launcher.ts +20 -1
  248. package/src/deploy/payload/stage.ts +3 -7
  249. package/src/deploy/run-deploy.ts +56 -16
  250. package/src/deploy/settings/build-manifest.ts +30 -17
  251. package/src/deploy/settings/extra-files.ts +26 -2
  252. package/src/deploy/settings/index.ts +3 -1
  253. package/src/deploy/settings/libraries.ts +1 -22
  254. package/src/deploy/settings/paths.ts +68 -13
  255. package/src/deploy/settings/screenshots.ts +8 -46
  256. package/src/deploy/targets/flatpak-pnpm.ts +4 -4
  257. package/src/deploy/targets/flatpak-source.ts +17 -6
  258. package/src/deploy/targets/flatpak-sources.ts +1 -1
  259. package/src/deploy/types.ts +1 -0
  260. package/src/dev/headless.ts +40 -0
  261. package/src/dev/runner-deps.ts +1 -1
  262. package/src/dev/runner-main.ts +1 -2
  263. package/src/dev/schema-dir.ts +2 -4
  264. package/src/i18n/catalogs.ts +2 -1
  265. package/src/i18n/metadata-templates.ts +2 -1
  266. package/src/i18n/source-messages.ts +1442 -262
  267. package/src/i18n/types.ts +97 -131
  268. package/src/internal/build-manifest.ts +25 -1
  269. package/src/internal/build-output.ts +99 -0
  270. package/src/internal/docs-elements.ts +2 -2
  271. package/src/internal/entry-arg.ts +8 -1
  272. package/src/internal/icon-path.ts +6 -19
  273. package/src/internal/output-directory.ts +699 -0
  274. package/src/internal/prepare-project.ts +5 -5
  275. package/src/internal/source-imports.ts +14 -50
  276. package/src/mcp/client.ts +2 -2
  277. package/src/settings/render.ts +1 -13
  278. package/src/settings/schema.ts +19 -81
  279. package/src/vite-plugins/asset-imports.ts +20 -44
  280. package/src/vite-plugins/asset-specifier.ts +0 -5
  281. package/src/vite-plugins/build-manifest.ts +7 -1
  282. package/src/vite-plugins/i18n.ts +87 -5
  283. package/src/vite-plugins/index.ts +16 -11
  284. package/src/vite-plugins/resources.ts +37 -140
  285. package/src/vite-plugins/self-contained.ts +184 -185
  286. package/src/vite-plugins/settings-worker-env.ts +2 -4
  287. package/src/vite-plugins/settings.ts +11 -20
  288. package/src/vite-plugins/undeclared-library.ts +14 -20
  289. package/src/vite-plugins/worker.ts +0 -1
  290. package/dist/i18n/binding-extractor.d.ts +0 -30
  291. package/dist/i18n/binding-extractor.d.ts.map +0 -1
  292. package/dist/i18n/binding-extractor.js +0 -1324
  293. package/dist/i18n/binding-extractor.js.map +0 -1
  294. package/dist/i18n/extractor-plugin.d.ts +0 -8
  295. package/dist/i18n/extractor-plugin.d.ts.map +0 -1
  296. package/dist/i18n/extractor-plugin.js +0 -247
  297. package/dist/i18n/extractor-plugin.js.map +0 -1
  298. package/dist/internal/data-dir.d.ts +0 -4
  299. package/dist/internal/data-dir.d.ts.map +0 -1
  300. package/dist/internal/data-dir.js +0 -52
  301. package/dist/internal/data-dir.js.map +0 -1
  302. package/dist/vite-plugins/animated.d.ts +0 -5
  303. package/dist/vite-plugins/animated.d.ts.map +0 -1
  304. package/dist/vite-plugins/animated.js +0 -325
  305. package/dist/vite-plugins/animated.js.map +0 -1
  306. package/src/i18n/binding-extractor.ts +0 -1969
  307. package/src/i18n/extractor-plugin.ts +0 -413
  308. package/src/internal/data-dir.ts +0 -70
  309. package/src/vite-plugins/animated.ts +0 -486
@@ -1,18 +1,13 @@
1
- import type { ESTree, Plugin, VisitorObject } from "vite";
1
+ import type { Plugin } from "vite";
2
+ import { type NodePath, parseSync, type Scope, traverse } from "@babel/core";
2
3
  import { isBuiltin } from "node:module";
3
4
  import { posix } from "node:path";
4
- import { parseSync, Visitor } from "vite";
5
5
 
6
- type Bindings = {
7
- declarations: Map<string, number>;
8
- factories: Set<string>;
9
- requires: Set<string>;
10
- urls: Set<string>;
11
- };
6
+ type BindingKind = "factory" | "module" | "require" | "url";
7
+
8
+ type ResolvedBinding = NonNullable<ReturnType<Scope["getBinding"]>>;
12
9
 
13
10
  type Scan = {
14
- bindings: Bindings;
15
- calls: ESTree.CallExpression[];
16
11
  sources: string[];
17
12
  };
18
13
 
@@ -21,199 +16,208 @@ type Chunk = {
21
16
  code: string;
22
17
  };
23
18
 
24
- type PatternItem =
25
- | ESTree.BindingPattern |
26
- ESTree.BindingProperty |
27
- ESTree.BindingRestElement |
28
- ESTree.FormalParameterRest |
29
- ESTree.TSParameterProperty |
30
- null;
31
-
32
19
  const REQUIRE_FACTORY = "createRequire";
33
20
  const REQUIRE_BINDING = "require";
34
21
  const RESOLVE_PROPERTY = "resolve";
35
- const MODULE_BUILTIN = "node:module";
22
+ const URL_PROPERTY = "url";
23
+ const MODULE_BUILTINS = new Set(["module", "node:module"]);
36
24
  const OUTPUT_DIRECTORY = ".";
37
25
  const RELATIVE_SPECIFIER = /^\.\.?(?:\/|$)/;
38
26
 
39
- const exportName = (name: ESTree.ModuleExportName): string | null => (name.type === "Identifier" ? name.name : null);
40
- const referenceName = (node: ESTree.Argument): string | null => (node.type === "Identifier" ? node.name : null);
41
-
42
- const countName = (declarations: Map<string, number>, name: string | null): void => {
43
- if (name !== null) {
44
- declarations.set(name, (declarations.get(name) ?? 0) + 1);
27
+ const importedName = (path: NodePath): string | null => {
28
+ if (!path.isImportSpecifier()) {
29
+ return null;
45
30
  }
31
+
32
+ const { imported } = path.node;
33
+
34
+ return imported.type === "Identifier" ? imported.name : imported.value;
46
35
  };
47
36
 
48
- const boundPattern = (item: PatternItem): ESTree.BindingPattern | null => {
49
- if (item === null) {
37
+ const importKind = (path: NodePath): BindingKind | null => {
38
+ const declaration = path.parentPath;
39
+
40
+ if (!declaration.isImportDeclaration() || !MODULE_BUILTINS.has(declaration.node.source.value)) {
50
41
  return null;
51
42
  }
52
43
 
53
- if (item.type === "Property") {
54
- return item.value;
44
+ if (importedName(path) === REQUIRE_FACTORY) {
45
+ return "factory";
55
46
  }
56
47
 
57
- if (item.type === "RestElement") {
58
- return item.argument;
48
+ return path.isImportNamespaceSpecifier() || path.isImportDefaultSpecifier() ? "module" : null;
49
+ };
50
+
51
+ const memberName = (path: NodePath): string | null => {
52
+ if (!path.isMemberExpression()) {
53
+ return null;
59
54
  }
60
55
 
61
- return item.type === "TSParameterProperty" ? item.parameter : item;
62
- };
56
+ const property = path.get("property");
63
57
 
64
- const countPatterns = (declarations: Map<string, number>, items: PatternItem[]): void => {
65
- for (const item of items) {
66
- countPattern(declarations, boundPattern(item));
58
+ if (path.node.computed) {
59
+ return property.isStringLiteral() ? property.node.value : null;
67
60
  }
61
+
62
+ return property.isIdentifier() ? property.node.name : null;
68
63
  };
69
64
 
70
- const countPattern = (declarations: Map<string, number>, pattern: ESTree.BindingPattern | null): void => {
71
- if (pattern === null) {
72
- return;
65
+ const isImportMeta = (path: NodePath): boolean =>
66
+ path.isMetaProperty() && path.node.meta.name === "import" && path.node.property.name === "meta";
67
+
68
+ const isDirectMetaUrl = (path: NodePath): boolean => {
69
+ if (!path.isMemberExpression() || memberName(path) !== URL_PROPERTY) {
70
+ return false;
73
71
  }
74
72
 
75
- if (pattern.type === "Identifier") {
76
- countName(declarations, pattern.name);
73
+ const object = path.get("object");
77
74
 
78
- return;
75
+ return isImportMeta(object);
76
+ };
77
+
78
+ const bindingKind = (binding: ResolvedBinding, seen: Set<ResolvedBinding>): BindingKind | null => {
79
+ if (seen.has(binding)) {
80
+ return null;
79
81
  }
80
82
 
81
- if (pattern.type === "AssignmentPattern") {
82
- countPattern(declarations, pattern.left);
83
+ const next = new Set(seen).add(binding);
84
+ const imported = importKind(binding.path);
83
85
 
84
- return;
86
+ if (imported !== null) {
87
+ return imported;
88
+ }
89
+
90
+ if (!binding.path.isVariableDeclarator()) {
91
+ return null;
85
92
  }
86
93
 
87
- countPatterns(declarations, pattern.type === "ObjectPattern" ? pattern.properties : pattern.elements);
94
+ const initializer = binding.path.get("init");
95
+
96
+ return initializer.node === null ? null : expressionKind(initializer, next);
88
97
  };
89
98
 
90
- const countFunction = (
91
- declarations: Map<string, number>,
92
- node: ESTree.ArrowFunctionExpression | ESTree.Function,
93
- ): void => {
94
- countPattern(declarations, node.id);
95
- countPatterns(declarations, node.params);
99
+ const nameKind = (scope: Scope, name: string, seen: Set<ResolvedBinding>): BindingKind | null => {
100
+ const binding = scope.getBinding(name);
101
+
102
+ if (binding !== undefined) {
103
+ return bindingKind(binding, seen);
104
+ }
105
+
106
+ if (name === REQUIRE_FACTORY) {
107
+ return "factory";
108
+ }
109
+
110
+ return name === REQUIRE_BINDING ? "require" : null;
96
111
  };
97
112
 
98
- const declarationVisitor = (declarations: Map<string, number>): VisitorObject => ({
99
- ArrowFunctionExpression: (node) => {
100
- countFunction(declarations, node);
101
- },
102
- CatchClause: (node) => {
103
- countPattern(declarations, node.param);
104
- },
105
- ClassDeclaration: (node) => {
106
- countPattern(declarations, node.id);
107
- },
108
- ClassExpression: (node) => {
109
- countPattern(declarations, node.id);
110
- },
111
- ExportSpecifier: (node) => {
112
- countName(declarations, exportName(node.local));
113
- },
114
- FunctionDeclaration: (node) => {
115
- countFunction(declarations, node);
116
- },
117
- FunctionExpression: (node) => {
118
- countFunction(declarations, node);
119
- },
120
- ImportDefaultSpecifier: (node) => {
121
- countPattern(declarations, node.local);
122
- },
123
- ImportNamespaceSpecifier: (node) => {
124
- countPattern(declarations, node.local);
125
- },
126
- ImportSpecifier: (node) => {
127
- countPattern(declarations, node.local);
128
- },
129
- VariableDeclarator: (node) => {
130
- countPattern(declarations, node.id);
131
- },
132
- });
133
-
134
- const isUnshadowed = (name: string, bindings: Bindings): boolean => (bindings.declarations.get(name) ?? 0) <= 1;
135
-
136
- const templateString = (node: ESTree.TemplateLiteral): string | null => {
137
- const [quasi] = node.quasis;
138
-
139
- return quasi === undefined || node.expressions.length > 0 ? null : quasi.value.cooked;
113
+ const isModuleExpression = (path: NodePath, seen: Set<ResolvedBinding>): boolean => {
114
+ if (path.isIdentifier()) {
115
+ return nameKind(path.scope, path.node.name, seen) === "module";
116
+ }
117
+
118
+ if (!path.isCallExpression()) {
119
+ return false;
120
+ }
121
+
122
+ const [source] = path.get("arguments");
123
+ const callee = path.get("callee");
124
+ const sourceName = source === undefined ? null : literalString(source);
125
+
126
+ return (
127
+ sourceName !== null &&
128
+ MODULE_BUILTINS.has(sourceName) &&
129
+ isRequireExpression(callee, seen)
130
+ );
140
131
  };
141
132
 
142
- const literalString = (node: ESTree.Argument | null): string | null => {
143
- if (node?.type === "TemplateLiteral") {
144
- return templateString(node);
133
+ const isFactoryExpression = (path: NodePath, seen: Set<ResolvedBinding>): boolean => {
134
+ if (path.isIdentifier()) {
135
+ return nameKind(path.scope, path.node.name, seen) === "factory";
145
136
  }
146
137
 
147
- return node?.type === "Literal" && typeof node.value === "string" ? node.value : null;
138
+ if (!path.isMemberExpression() || memberName(path) !== REQUIRE_FACTORY) {
139
+ return false;
140
+ }
141
+
142
+ return isModuleExpression(path.get("object"), seen);
148
143
  };
149
144
 
150
- const isMetaUrl = (node: ESTree.Argument, bindings: Bindings): boolean => {
151
- if (node.type === "MemberExpression") {
152
- return node.object.type === "MetaProperty";
145
+ const isRequireFactoryCall = (path: NodePath, seen: Set<ResolvedBinding>): boolean => {
146
+ if (!path.isCallExpression()) {
147
+ return false;
153
148
  }
154
149
 
155
- const name = referenceName(node);
150
+ const callee = path.get("callee");
156
151
 
157
- return name !== null && bindings.urls.has(name) && isUnshadowed(name, bindings);
152
+ return isFactoryExpression(callee, seen);
158
153
  };
159
154
 
160
- const hasMetaUrl = (node: ESTree.CallExpression, bindings: Bindings): boolean =>
161
- node.arguments.some((argument) => isMetaUrl(argument, bindings));
155
+ const expressionKind = (path: NodePath, seen: Set<ResolvedBinding>): BindingKind | null => {
156
+ if (isDirectMetaUrl(path)) {
157
+ return "url";
158
+ }
162
159
 
163
- const isRequireName = (name: string | null, bindings: Bindings): boolean =>
164
- name !== null && (name === REQUIRE_BINDING || bindings.requires.has(name)) && isUnshadowed(name, bindings);
160
+ if (path.isIdentifier()) {
161
+ return nameKind(path.scope, path.node.name, seen);
162
+ }
165
163
 
166
- const isFactoryName = (name: string | null, bindings: Bindings): boolean =>
167
- name !== null && (name === REQUIRE_FACTORY || bindings.factories.has(name)) && isUnshadowed(name, bindings);
164
+ if (isFactoryExpression(path, seen)) {
165
+ return "factory";
166
+ }
168
167
 
169
- const isRequireFactory = (node: ESTree.Argument, bindings: Bindings): boolean =>
170
- node.type === "CallExpression" &&
171
- (isFactoryName(referenceName(node.callee), bindings) || hasMetaUrl(node, bindings));
168
+ if (isModuleExpression(path, seen)) {
169
+ return "module";
170
+ }
172
171
 
173
- const isResolveTarget = (object: ESTree.Expression, bindings: Bindings): boolean =>
174
- object.type === "MetaProperty" ||
175
- isRequireName(referenceName(object), bindings) ||
176
- isRequireFactory(object, bindings);
172
+ return isRequireFactoryCall(path, seen) ? "require" : null;
173
+ };
177
174
 
178
- const isResolveMember = (callee: ESTree.Expression, bindings: Bindings): boolean =>
179
- callee.type === "MemberExpression" &&
180
- !callee.computed &&
181
- callee.property.type === "Identifier" &&
182
- callee.property.name === RESOLVE_PROPERTY &&
183
- isResolveTarget(callee.object, bindings);
175
+ const isMetaUrl = (path: NodePath): boolean =>
176
+ isDirectMetaUrl(path) ||
177
+ (path.isIdentifier() && nameKind(path.scope, path.node.name, new Set()) === "url");
184
178
 
185
- const isResolvingCall = (call: ESTree.CallExpression, bindings: Bindings): boolean =>
186
- hasMetaUrl(call, bindings) ||
187
- isRequireName(referenceName(call.callee), bindings) ||
188
- isRequireFactory(call.callee, bindings) ||
189
- isResolveMember(call.callee, bindings);
179
+ const isRequireExpression = (path: NodePath, seen: Set<ResolvedBinding> = new Set()): boolean =>
180
+ isRequireFactoryCall(path, seen) ||
181
+ (path.isIdentifier() && nameKind(path.scope, path.node.name, seen) === "require");
190
182
 
191
- const collectFactories = (node: ESTree.ImportDeclaration, bindings: Bindings): void => {
192
- if (node.source.value !== MODULE_BUILTIN) {
193
- return;
183
+ const hasMetaUrlArgument = (path: NodePath): boolean => {
184
+ if (!path.isCallExpression()) {
185
+ return false;
194
186
  }
195
187
 
196
- for (const specifier of node.specifiers) {
197
- if (specifier.type === "ImportSpecifier" && exportName(specifier.imported) === REQUIRE_FACTORY) {
198
- bindings.factories.add(specifier.local.name);
199
- }
200
- }
188
+ return path.get("arguments").some((argument) => isMetaUrl(argument));
201
189
  };
202
190
 
203
- const collectBinding = (node: ESTree.VariableDeclarator, bindings: Bindings): void => {
204
- const { id, init } = node;
191
+ const isResolveMember = (path: NodePath): boolean => {
192
+ if (!path.isMemberExpression() || memberName(path) !== RESOLVE_PROPERTY) {
193
+ return false;
194
+ }
205
195
 
206
- if (init === null || id.type !== "Identifier") {
207
- return;
196
+ const object = path.get("object");
197
+
198
+ return isImportMeta(object) || isRequireExpression(object);
199
+ };
200
+
201
+ const isResolvingCall = (path: NodePath): boolean => {
202
+ if (!path.isCallExpression()) {
203
+ return false;
208
204
  }
209
205
 
210
- if (isMetaUrl(init, bindings)) {
211
- bindings.urls.add(id.name);
206
+ const callee = path.get("callee");
207
+
208
+ return hasMetaUrlArgument(path) || isRequireExpression(callee) || isResolveMember(callee);
209
+ };
210
+
211
+ const literalString = (path: NodePath): string | null => {
212
+ if (path.isStringLiteral()) {
213
+ return path.node.value;
212
214
  }
213
215
 
214
- if (isRequireFactory(init, bindings)) {
215
- bindings.requires.add(id.name);
216
+ if (!path.isTemplateLiteral() || path.node.expressions.length > 0) {
217
+ return null;
216
218
  }
219
+
220
+ return path.node.quasis[0]?.value.cooked ?? null;
217
221
  };
218
222
 
219
223
  const collectSource = (scan: Scan, source: string | null): void => {
@@ -222,55 +226,51 @@ const collectSource = (scan: Scan, source: string | null): void => {
222
226
  }
223
227
  };
224
228
 
225
- const collectCall = (scan: Scan, node: ESTree.CallExpression): void => {
226
- if (node.arguments.some((argument) => literalString(argument) !== null)) {
227
- scan.calls.push(node);
229
+ const collectCallSources = (scan: Scan, path: NodePath): void => {
230
+ if (!isResolvingCall(path) || !path.isCallExpression()) {
231
+ return;
228
232
  }
229
- };
230
233
 
231
- const scanVisitor = (scan: Scan): VisitorObject => ({
232
- CallExpression: (node) => {
233
- collectCall(scan, node);
234
- },
235
- ExportAllDeclaration: (node) => {
236
- collectSource(scan, node.source.value);
237
- },
238
- ExportNamedDeclaration: (node) => {
239
- collectSource(scan, node.source?.value ?? null);
240
- },
241
- ImportDeclaration: (node) => {
242
- collectFactories(node, scan.bindings);
243
- collectSource(scan, node.source.value);
244
- },
245
- ImportExpression: (node) => {
246
- collectSource(scan, literalString(node.source));
247
- },
248
- VariableDeclarator: (node) => {
249
- collectBinding(node, scan.bindings);
250
- },
251
- });
234
+ for (const argument of path.get("arguments")) {
235
+ collectSource(scan, literalString(argument));
236
+ }
237
+ };
252
238
 
253
239
  const scanChunk = (chunk: Chunk): Scan => {
254
- const scan: Scan = {
255
- bindings: { declarations: new Map(), factories: new Set(), requires: new Set(), urls: new Set() },
256
- calls: [],
257
- sources: [],
258
- };
240
+ const scan: Scan = { sources: [] };
241
+ const ast = parseSync(chunk.code, {
242
+ ast: true,
243
+ babelrc: false,
244
+ configFile: false,
245
+ filename: chunk.fileName,
246
+ sourceType: "module",
247
+ });
248
+
249
+ if (ast === null) {
250
+ throw new Error(`Cannot inspect ${chunk.fileName}`);
251
+ }
259
252
 
260
- const { program } = parseSync(chunk.fileName, chunk.code);
261
- new Visitor(declarationVisitor(scan.bindings.declarations)).visit(program);
262
- new Visitor(scanVisitor(scan)).visit(program);
253
+ traverse(ast, {
254
+ CallExpression: (path) => {
255
+ collectCallSources(scan, path);
256
+ },
257
+ ExportAllDeclaration: (path) => {
258
+ collectSource(scan, path.node.source.value);
259
+ },
260
+ ExportNamedDeclaration: (path) => {
261
+ collectSource(scan, path.node.source?.value ?? null);
262
+ },
263
+ ImportDeclaration: (path) => {
264
+ collectSource(scan, path.node.source.value);
265
+ },
266
+ ImportExpression: (path) => {
267
+ collectSource(scan, literalString(path.get("source")));
268
+ },
269
+ });
263
270
 
264
271
  return scan;
265
272
  };
266
273
 
267
- const callSpecifiers = (scan: Scan): string[] =>
268
- scan.calls
269
- .filter((call) => isResolvingCall(call, scan.bindings))
270
- .flatMap((call) => call.arguments)
271
- .map((argument) => literalString(argument))
272
- .filter((specifier) => specifier !== null);
273
-
274
274
  const isReachable = (specifier: string, directory: string, emitted: Set<string>): boolean => {
275
275
  if (isBuiltin(specifier)) {
276
276
  return true;
@@ -286,10 +286,9 @@ const isReachable = (specifier: string, directory: string, emitted: Set<string>)
286
286
  };
287
287
 
288
288
  const unreachableSpecifiers = (chunk: Chunk, emitted: Set<string>): string[] => {
289
- const scan = scanChunk(chunk);
290
289
  const directory = posix.dirname(chunk.fileName);
291
290
 
292
- return new Set([...scan.sources, ...callSpecifiers(scan)])
291
+ return new Set(scanChunk(chunk).sources)
293
292
  .values()
294
293
  .filter((specifier) => !isReachable(specifier, directory, emitted))
295
294
  .toArray()
@@ -1,7 +1,6 @@
1
1
  import type { UserConfig } from "vite";
2
2
  import type { Plugin } from "vitest/config";
3
- import { createConfigLoader, resolveFuture } from "@gtkx/config/internal";
4
- import { resolveDataDir } from "../internal/data-dir.js";
3
+ import { createConfigLoader } from "@gtkx/config/internal";
5
4
  import { prependSchemaDir, stageAndCompileProjectSchemas } from "../settings/schema.js";
6
5
 
7
6
  function gtkxSettingsWorkerEnv(): Plugin {
@@ -13,8 +12,7 @@ function gtkxSettingsWorkerEnv(): Plugin {
13
12
 
14
13
  async config(config: UserConfig) {
15
14
  const loaded = await loadConfig.load(config.root ?? process.cwd());
16
- const dataDir = resolveFuture(loaded.config.future).isResourceImported ? null : resolveDataDir(loaded.root);
17
- const dir = stageAndCompileProjectSchemas(loaded.root, dataDir);
15
+ const dir = stageAndCompileProjectSchemas(loaded.root);
18
16
 
19
17
  if (dir === null) {
20
18
  return;
@@ -1,13 +1,10 @@
1
- import type { ConfigLoader } from "@gtkx/config";
2
- import type { ModuleNode, Plugin, ResolvedConfig, UserConfig, ViteDevServer } from "vite";
3
- import { resolveFuture } from "@gtkx/config/internal";
1
+ import type { ModuleNode, Plugin, ResolvedConfig, ViteDevServer } from "vite";
4
2
  import { error, errorMessage, info, sortStrings } from "@gtkx/utils";
5
3
  import { readFileSync } from "node:fs";
6
4
  import { basename, join } from "node:path";
7
5
  import type { BuildManifestCollector } from "../internal/build-manifest.js";
8
6
  import type { AssetEmitter } from "./asset-emitter.js";
9
7
  import { prependBanner } from "../internal/banner.js";
10
- import { resolveDataDir } from "../internal/data-dir.js";
11
8
  import { createRetainedStagingDir, type RetainedStagingDir, withStagingDir } from "../internal/staging-dir.js";
12
9
  import { compileSchemas } from "../settings/compile.js";
13
10
  import { parseSchemaXml, SchemaParseError } from "../settings/parser.js";
@@ -25,8 +22,6 @@ import { createVirtualNamespace } from "./virtual-module.js";
25
22
  type PluginState = {
26
23
  schemaDir: RetainedStagingDir;
27
24
  rootDir: string | null;
28
- dataDir: string | null;
29
- isV2ResourceImports: boolean;
30
25
  isBuild: boolean;
31
26
  schemaEnvTimer: ReturnType<typeof setTimeout> | null;
32
27
  trackedSchemas: Map<string, string>;
@@ -81,7 +76,7 @@ const syncSchemaEnv = (state: PluginState): void => {
81
76
  }
82
77
 
83
78
  try {
84
- emitSchemaEnv(state.rootDir, state.dataDir, state.isV2ResourceImports);
79
+ emitSchemaEnv(state.rootDir);
85
80
  } catch (error_) {
86
81
  error(`Failed to generate GSettings schema types: ${errorMessage(error_)}`);
87
82
  }
@@ -105,12 +100,6 @@ const scheduleSchemaEnvSync = (state: PluginState): void => {
105
100
  }, SCHEMA_ENV_DEBOUNCE_MS);
106
101
  };
107
102
 
108
- const applyUserConfig = async (state: PluginState, config: UserConfig, loadConfig: ConfigLoader): Promise<void> => {
109
- const loaded = await loadConfig.load(config.root ?? process.cwd());
110
- state.isV2ResourceImports = resolveFuture(loaded.config.future).isResourceImported;
111
- state.dataDir = state.isV2ResourceImports ? null : resolveDataDir(loaded.root);
112
- };
113
-
114
103
  const applyResolvedConfig = (state: PluginState, config: ResolvedConfig): void => {
115
104
  state.isBuild = config.command === "build";
116
105
  state.rootDir = typeof config.root === "string" ? config.root : null;
@@ -173,6 +162,12 @@ const compileBuildSchemas = (schemaFiles: string[]): Buffer =>
173
162
  return readFileSync(join(dir, "gschemas.compiled"));
174
163
  });
175
164
 
165
+ const rejectLegacySchemaSpecifier = (source: string): void => {
166
+ if (source.startsWith("#data/")) {
167
+ throw new Error(`${JSON.stringify(source)} uses the legacy #data schema form`);
168
+ }
169
+ };
170
+
176
171
  const buildSchemaPaths = (rootDir: string, schemaFiles: string[]): string[] =>
177
172
  schemaFiles.map((filePath) => {
178
173
  const rel = projectRelativeSchemaPath(rootDir, filePath);
@@ -262,12 +257,10 @@ const watchSchemaFiles = (state: PluginState, server: ViteDevServer): void => {
262
257
  server.watcher.on("unlink", refreshSchemaTypes);
263
258
  };
264
259
 
265
- function gtkxSettings(loadConfig: ConfigLoader, buildManifest?: BuildManifestCollector): Plugin {
260
+ function gtkxSettings(buildManifest?: BuildManifestCollector): Plugin {
266
261
  const state: PluginState = {
267
262
  schemaDir: createRetainedStagingDir(SCHEMA_STAGING_PREFIX),
268
263
  rootDir: null,
269
- dataDir: null,
270
- isV2ResourceImports: false,
271
264
  isBuild: false,
272
265
  schemaEnvTimer: null,
273
266
  trackedSchemas: new Map(),
@@ -278,10 +271,6 @@ function gtkxSettings(loadConfig: ConfigLoader, buildManifest?: BuildManifestCol
278
271
  name: "gtkx:settings",
279
272
  enforce: "pre",
280
273
 
281
- async config(config: UserConfig) {
282
- await applyUserConfig(state, config, loadConfig);
283
- },
284
-
285
274
  configResolved(config) {
286
275
  applyResolvedConfig(state, config);
287
276
  },
@@ -303,6 +292,8 @@ function gtkxSettings(loadConfig: ConfigLoader, buildManifest?: BuildManifestCol
303
292
  return;
304
293
  }
305
294
 
295
+ rejectLegacySchemaSpecifier(source);
296
+
306
297
  return resolveToVirtual(this, { source, importer, options });
307
298
  },
308
299
 
@@ -15,11 +15,12 @@ type PluginState = {
15
15
  type GeneratedModule = {
16
16
  source: string;
17
17
  kind: string;
18
- namespace: string | null;
18
+ namespace: string;
19
19
  importer: string;
20
20
  };
21
21
 
22
22
  const GENERATED_MODULE_PATTERN = /^@gtkx\/(gi|jsx)\/([a-z0-9]+)$/;
23
+ const DEFAULT_LIBRARY_NAMESPACES: Set<string> = new Set(["gtk", "adw"]);
23
24
 
24
25
  const girSearchPaths = async (state: PluginState): Promise<string[]> => {
25
26
  if (state.girPath === null) {
@@ -36,10 +37,6 @@ const findGirIdentifier = (girPath: string[], namespace: string): string | undef
36
37
  discoverGirNamespaces(girPath).find((identifier) => getNamespace(identifier) === namespace);
37
38
 
38
39
  const parseGeneratedModule = (source: string, importer: string | undefined): GeneratedModule | null => {
39
- if (source === "@gtkx/jsx") {
40
- return { source, kind: "jsx", namespace: null, importer: importer ?? "the project's sources" };
41
- }
42
-
43
40
  const matched = GENERATED_MODULE_PATTERN.exec(source);
44
41
  const kind = matched?.[1];
45
42
  const namespace = matched?.[2];
@@ -74,7 +71,7 @@ const hasStoreModule = (storeDir: string, exportKey: string): boolean => {
74
71
  };
75
72
 
76
73
  const unreachableStoreError = (generated: GeneratedModule, options: StoreOptions): Error => {
77
- const provided = generated.namespace === null ? "its index module" : `"${generated.namespace}"`;
74
+ const provided = `"${generated.namespace}"`;
78
75
 
79
76
  return new Error(
80
77
  `Cannot resolve "${generated.source}": the generated store in ${options.storeDir} does provide ` +
@@ -84,21 +81,22 @@ const unreachableStoreError = (generated: GeneratedModule, options: StoreOptions
84
81
  );
85
82
  };
86
83
 
87
- const missingIndexError = (generated: GeneratedModule): Error =>
88
- new Error(
89
- `Cannot resolve "${generated.source}": the binding store has no index module. ` +
90
- "Run gtkx codegen to regenerate the store.",
91
- );
92
-
93
84
  const undeclaredLibraryError = (source: string, namespace: string, girPath: string[]): Error => {
94
85
  const identifier = findGirIdentifier(girPath, namespace);
95
86
 
96
87
  if (identifier === undefined) {
97
88
  return new Error(
98
89
  `Cannot resolve "${source}": the binding store has no "${namespace}" module, and no ` +
99
- `GIR data for it was found in [${girPath.join(", ")}]. If "${namespace}" is a library, ` +
100
- "install its gobject-introspection data package and add its GIR identifier to `libraries` in " +
101
- "gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.",
90
+ `GIR data for it was found in [${girPath.join(", ")}]. If "${namespace}" is a library, install ` +
91
+ "its gobject-introspection data package. Gtk-4.0 and Adw-1 are bound by default; add only other " +
92
+ "GIR identifiers to `libraries` in gtkx.config.ts. Otherwise run gtkx codegen to regenerate the store.",
93
+ );
94
+ }
95
+
96
+ if (DEFAULT_LIBRARY_NAMESPACES.has(namespace)) {
97
+ return new Error(
98
+ `Cannot resolve "${source}": the "${identifier}" bindings have not been generated. ` +
99
+ "The Gtk and Adwaita namespaces are bound by default; run gtkx dev or gtkx build again.",
102
100
  );
103
101
  }
104
102
 
@@ -110,16 +108,12 @@ const undeclaredLibraryError = (source: string, namespace: string, girPath: stri
110
108
 
111
109
  const unresolvedModuleError = async (state: PluginState, generated: GeneratedModule): Promise<Error> => {
112
110
  const options = getStoreOptions(state.root, generated.kind);
113
- const exportKey = generated.namespace === null ? "." : `./${generated.namespace}`;
111
+ const exportKey = `./${generated.namespace}`;
114
112
 
115
113
  if (options !== null && hasStoreModule(options.storeDir, exportKey)) {
116
114
  return unreachableStoreError(generated, options);
117
115
  }
118
116
 
119
- if (generated.namespace === null) {
120
- return missingIndexError(generated);
121
- }
122
-
123
117
  return undeclaredLibraryError(generated.source, generated.namespace, await girSearchPaths(state));
124
118
  };
125
119