@gtkx/codegen 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +5 -4
  2. package/dist/analysis/descriptor-render.d.ts.map +1 -1
  3. package/dist/analysis/descriptor-render.js +1 -0
  4. package/dist/analysis/descriptor-render.js.map +1 -1
  5. package/dist/analysis/descriptor.d.ts +1 -0
  6. package/dist/analysis/descriptor.d.ts.map +1 -1
  7. package/dist/analysis/descriptor.js +1 -0
  8. package/dist/analysis/descriptor.js.map +1 -1
  9. package/dist/fingerprint.d.ts.map +1 -1
  10. package/dist/fingerprint.js +5 -1
  11. package/dist/fingerprint.js.map +1 -1
  12. package/dist/gi.d.ts.map +1 -1
  13. package/dist/gi.js +5 -1
  14. package/dist/gi.js.map +1 -1
  15. package/dist/guards.d.ts +2 -1
  16. package/dist/guards.d.ts.map +1 -1
  17. package/dist/guards.js +3 -1
  18. package/dist/guards.js.map +1 -1
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +2 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/store/gi/generated-libraries.d.ts +26 -0
  24. package/dist/store/gi/generated-libraries.d.ts.map +1 -0
  25. package/dist/store/gi/generated-libraries.js +53 -0
  26. package/dist/store/gi/generated-libraries.js.map +1 -0
  27. package/dist/store/gi-store.d.ts +6 -1
  28. package/dist/store/gi-store.d.ts.map +1 -1
  29. package/dist/store/gi-store.js +6 -2
  30. package/dist/store/gi-store.js.map +1 -1
  31. package/dist/store/jsx/metadata.d.ts.map +1 -1
  32. package/dist/store/jsx/metadata.js +35 -60
  33. package/dist/store/jsx/metadata.js.map +1 -1
  34. package/dist/store/resolve-store.d.ts.map +1 -1
  35. package/dist/store/resolve-store.js +1 -0
  36. package/dist/store/resolve-store.js.map +1 -1
  37. package/package.json +5 -5
  38. package/src/analysis/descriptor-render.ts +1 -0
  39. package/src/analysis/descriptor.ts +2 -0
  40. package/src/fingerprint.ts +8 -1
  41. package/src/gi.ts +5 -1
  42. package/src/guards.ts +6 -1
  43. package/src/index.ts +2 -0
  44. package/src/store/gi/generated-libraries.ts +91 -0
  45. package/src/store/gi-store.ts +15 -2
  46. package/src/store/jsx/metadata.ts +46 -99
  47. package/src/store/resolve-store.ts +1 -0
package/dist/gi.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"gi.js","sourceRoot":"","sources":["../src/gi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAwD,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAiBjE,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAmB,EAAE;IAC1D,MAAM,UAAU,GAAuB,EAAE,CAAC;IAC1C,MAAM,kBAAkB,GAA+B,EAAE,CAAC;IAE1D,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;QAClD,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEvD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC5B,kBAAkB,CAAC,IAAI,CAAC;gBACpB,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC;gBACxC,WAAW;gBACX,OAAO,EAAE,SAAS,CAAC,OAAO;aAC7B,CAAC,CAAC;YAEH,SAAS;QACb,CAAC;QAED,UAAU,CAAC,IAAI,CAAC;YACZ,SAAS,EAAE,kBAAkB,CAAC,SAAS,CAAC;YACxC,SAAS,EAAE,uBAAuB,CAAC,SAAS,EAAE,OAAO,CAAC;YACtD,OAAO,EAAE,SAAS,CAAC,OAAO;SAC7B,CAAC,CAAC;IACP,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,OAAyB,EAAU,EAAE;IACzE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAChH,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAEpE,MAAM,WAAW,GAAG,oBAAoB,CAAC;QACrC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,SAAS,EAAE,CAAC,GAAG,SAAS,CAAC;QACzB,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;QACrB,YAAY,EAAE,EAAE,CAAC,OAAO;QACxB,gBAAgB;QAChB,gBAAgB;QAChB,eAAe;QACf,cAAc;KACjB,CAAC,CAAC;IAEH,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAE9D,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Library } from \"./gir/library.js\";\nimport type { StoreOptions } from \"./store/store-fs.js\";\nimport { computeGiFingerprint } from \"./fingerprint.js\";\nimport { externalPackageFor } from \"./gir/external-namespaces.js\";\nimport { namespaceDirectory } from \"./gir/namespace.js\";\nimport { type GiExternalNamespaceInput, type GiNamespaceInput, writeGiStore } from \"./store/gi-store.js\";\nimport { generateNamespaceModule } from \"./store/gi/pipeline.js\";\n\ntype GiCodegenOptions = {\n gi: StoreOptions;\n libraries: string[];\n girPath: string[];\n isByteArrayTyped: boolean;\n isValueUnwrapped: boolean;\n isFinishTrimmed: boolean;\n isInoutInPlace: boolean;\n};\n\ntype SplitNamespaces = {\n namespaces: GiNamespaceInput[];\n externalNamespaces: GiExternalNamespaceInput[];\n};\n\nconst splitNamespaces = (library: Library): SplitNamespaces => {\n const namespaces: GiNamespaceInput[] = [];\n const externalNamespaces: GiExternalNamespaceInput[] = [];\n\n for (const namespace of library.namespaces.values()) {\n const packageName = externalPackageFor(namespace.name);\n\n if (packageName !== undefined) {\n externalNamespaces.push({\n directory: namespaceDirectory(namespace),\n packageName,\n girFile: namespace.girFile,\n });\n\n continue;\n }\n\n namespaces.push({\n directory: namespaceDirectory(namespace),\n rawSource: generateNamespaceModule(namespace, library),\n girFile: namespace.girFile,\n });\n }\n\n return { namespaces, externalNamespaces };\n};\n\nconst runGiCodegen = (library: Library, options: GiCodegenOptions): number => {\n const { gi, libraries, girPath, isByteArrayTyped, isValueUnwrapped, isFinishTrimmed, isInoutInPlace } = options;\n const { namespaces, externalNamespaces } = splitNamespaces(library);\n\n const fingerprint = computeGiFingerprint({\n girFiles: library.girFiles,\n libraries: [...libraries],\n girPath: [...girPath],\n storeVersion: gi.version,\n isByteArrayTyped,\n isValueUnwrapped,\n isFinishTrimmed,\n isInoutInPlace,\n });\n\n writeGiStore(gi, namespaces, externalNamespaces, fingerprint);\n\n return library.namespaces.size;\n};\n\nexport { runGiCodegen };\n"]}
1
+ {"version":3,"file":"gi.js","sourceRoot":"","sources":["../src/gi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAwD,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAiBjE,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAmB,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KACjB,CAAC,CAAC;IAEH,YAAY,CAAC,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE;QAC7C,WAAW;QACX,SAAS,EAAE,yBAAyB,CAAC,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC;KACtE,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;AACnC,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import type { Library } from \"./gir/library.js\";\nimport type { StoreOptions } from \"./store/store-fs.js\";\nimport { computeGiFingerprint } from \"./fingerprint.js\";\nimport { externalPackageFor } from \"./gir/external-namespaces.js\";\nimport { namespaceDirectory } from \"./gir/namespace.js\";\nimport { type GiExternalNamespaceInput, type GiNamespaceInput, writeGiStore } from \"./store/gi-store.js\";\nimport { collectGeneratedLibraries } from \"./store/gi/generated-libraries.js\";\nimport { generateNamespaceModule } from \"./store/gi/pipeline.js\";\n\ntype GiCodegenOptions = {\n gi: StoreOptions;\n libraries: string[];\n girPath: string[];\n isByteArrayTyped: boolean;\n isValueUnwrapped: boolean;\n isFinishTrimmed: boolean;\n isInoutInPlace: boolean;\n};\n\ntype SplitNamespaces = {\n namespaces: GiNamespaceInput[];\n externalNamespaces: GiExternalNamespaceInput[];\n};\n\nconst splitNamespaces = (library: Library): SplitNamespaces => {\n const namespaces: GiNamespaceInput[] = [];\n const externalNamespaces: GiExternalNamespaceInput[] = [];\n\n for (const namespace of library.namespaces.values()) {\n const packageName = externalPackageFor(namespace.name);\n\n if (packageName !== undefined) {\n externalNamespaces.push({\n directory: namespaceDirectory(namespace),\n packageName,\n girFile: namespace.girFile,\n });\n\n continue;\n }\n\n namespaces.push({\n directory: namespaceDirectory(namespace),\n rawSource: generateNamespaceModule(namespace, library),\n girFile: namespace.girFile,\n });\n }\n\n return { namespaces, externalNamespaces };\n};\n\nconst runGiCodegen = (library: Library, options: GiCodegenOptions): number => {\n const { gi, libraries, girPath, isByteArrayTyped, isValueUnwrapped, isFinishTrimmed, isInoutInPlace } = options;\n const { namespaces, externalNamespaces } = splitNamespaces(library);\n\n const fingerprint = computeGiFingerprint({\n girFiles: library.girFiles,\n libraries: [...libraries],\n girPath: [...girPath],\n storeVersion: gi.version,\n isByteArrayTyped,\n isValueUnwrapped,\n isFinishTrimmed,\n isInoutInPlace,\n });\n\n writeGiStore(gi, namespaces, externalNamespaces, {\n fingerprint,\n libraries: collectGeneratedLibraries(library.namespaces, libraries),\n });\n\n return library.namespaces.size;\n};\n\nexport { runGiCodegen };\n"]}
package/dist/guards.d.ts CHANGED
@@ -10,7 +10,8 @@ declare const isBoolean: (value: unknown) => value is boolean;
10
10
  declare const isNumber: (value: unknown) => value is number;
11
11
  declare const isString: (value: unknown) => value is string;
12
12
  declare const arrayGuard: <T>(isEntry: Guard<T>) => Guard<T[]>;
13
+ declare const recordGuard: <T>(isEntry: Guard<T>) => Guard<Record<string, T>>;
13
14
  declare const optionalGuard: <T>(isPresent: Guard<T>) => OptionalGuard<T>;
14
15
  declare const hasFields: <T extends object>(value: unknown, guards: FieldGuards<T>) => value is T;
15
- export { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard };
16
+ export { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard, recordGuard };
16
17
  //# sourceMappingURL=guards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAEA,KAAK,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC;AAC/C,KAAK,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,GAAG;IAAE,YAAY,EAAE,IAAI,CAAA;CAAE,CAAC;AACtE,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,G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a,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACxF,KAAK,WAAW,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAErE,QAAA,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OAAqC,CAAC;AACnF,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAmC,CAAC;AAChF,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAmC,CAAC;AAEhF,QAAA,MAAM,UAAU,GAAI,CAAC,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,CAAC,EAAE,CACyD,CAAC;AAE9G,QAAA,MAAM,WAAW,GAAI,CAAC,EAAE,SAAS,KAAK,CAAC,CAAC,CAAC,KAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAGG,CAAC;AAEvE,QAAA,MAAM,aAAa,GAAI,CAAC,EAAE,WAAW,KAAK,CAAC,CAAC,CAAC,KAAG,aAAa,CAAC,CAAC,CAGzD,CAAC;AAEP,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAAE,OAAO,OAAO,EAAE,QAAQ,WAAW,CAAC,CAAC,CAAC,KAAG,KAAK,IAAI,CACuB,CAAC;AAE/G,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,CAAC"}
package/dist/guards.js CHANGED
@@ -3,9 +3,11 @@ const isBoolean = (value) => typeof value === "boolean";
3
3
  const isNumber = (value) => typeof value === "number";
4
4
  const isString = (value) => typeof value === "string";
5
5
  const arrayGuard = (isEntry) => (value) => Array.isArray(value) && value.every((entry) => isEntry(entry));
6
+ const recordGuard = (isEntry) => (value) => isRecord(value) && !Array.isArray(value) &&
7
+ Object.values(value).every((entry) => isEntry(entry));
6
8
  const optionalGuard = (isPresent) => Object.assign((value) => value === undefined || isPresent(value), {
7
9
  __optional__: true,
8
10
  });
9
11
  const hasFields = (value, guards) => isRecord(value) && Object.entries(guards).every(([name, guard]) => guard(value[name]));
10
- export { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard };
12
+ export { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard, recordGuard };
11
13
  //# sourceMappingURL=guards.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC;AACnF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;AAChF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC;AAEhF,MAAM,UAAU,GAAG,CAAI,OAAiB,EAAc,EAAE,CACpD,CAAC,KAAc,EAAgB,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;AAE9G,MAAM,aAAa,GAAG,CAAI,SAAmB,EAAoB,EAAE,CAC/D,MAAM,CAAC,MAAM,CAAC,CAAC,KAAc,EAA0B,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE;IAC/F,YAAY,EAAE,IAAa;CAC9B,CAAC,CAAC;AAEP,MAAM,SAAS,GAAG,CAAmB,KAAc,EAAE,MAAsB,EAAc,EAAE,CACvF,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAE,KAAwB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE/G,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC","sourcesContent":["import { isRecord } from \"@gtkx/utils\";\n\ntype Guard<T> = (value: unknown) => value is T;\ntype OptionalGuard<T> = Guard<T | undefined> & { __optional__: true };\ntype FieldGuard<T> = [undefined] extends [T] ? OptionalGuard<NonNullable<T>> : Guard<T>;\ntype FieldGuards<T> = { [K in keyof Required<T>]: FieldGuard<T[K]> };\n\nconst isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\nconst isNumber = (value: unknown): value is number => typeof value === \"number\";\nconst isString = (value: unknown): value is string => typeof value === \"string\";\n\nconst arrayGuard = <T>(isEntry: Guard<T>): Guard<T[]> =>\n (value: unknown): value is T[] => Array.isArray(value) && value.every((entry: unknown) => isEntry(entry));\n\nconst optionalGuard = <T>(isPresent: Guard<T>): OptionalGuard<T> =>\n Object.assign((value: unknown): value is T | undefined => value === undefined || isPresent(value), {\n __optional__: true as const,\n });\n\nconst hasFields = <T extends object>(value: unknown, guards: FieldGuards<T>): value is T =>\n isRecord(value) && Object.entries(guards).every(([name, guard]) => (guard as Guard<unknown>)(value[name]));\n\nexport { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard };\n"]}
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOvC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAoB,EAAE,CAAC,OAAO,KAAK,KAAK,SAAS,CAAC;AACnF,MAAM,QAA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a,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { isRecord } from \"@gtkx/utils\";\n\ntype Guard<T> = (value: unknown) => value is T;\ntype OptionalGuard<T> = Guard<T | undefined> & { __optional__: true };\ntype FieldGuard<T> = [undefined] extends [T] ? OptionalGuard<NonNullable<T>> : Guard<T>;\ntype FieldGuards<T> = { [K in keyof Required<T>]: FieldGuard<T[K]> };\n\nconst isBoolean = (value: unknown): value is boolean => typeof value === \"boolean\";\nconst isNumber = (value: unknown): value is number => typeof value === \"number\";\nconst isString = (value: unknown): value is string => typeof value === \"string\";\n\nconst arrayGuard = <T>(isEntry: Guard<T>): Guard<T[]> =>\n (value: unknown): value is T[] => Array.isArray(value) && value.every((entry: unknown) => isEntry(entry));\n\nconst recordGuard = <T>(isEntry: Guard<T>): Guard<Record<string, T>> =>\n (value: unknown): value is Record<string, T> =>\n isRecord(value) && !Array.isArray(value) &&\n Object.values(value).every((entry: unknown) => isEntry(entry));\n\nconst optionalGuard = <T>(isPresent: Guard<T>): OptionalGuard<T> =>\n Object.assign((value: unknown): value is T | undefined => value === undefined || isPresent(value), {\n __optional__: true as const,\n });\n\nconst hasFields = <T extends object>(value: unknown, guards: FieldGuards<T>): value is T =>\n isRecord(value) && Object.entries(guards).every(([name, guard]) => (guard as Guard<unknown>)(value[name]));\n\nexport { arrayGuard, hasFields, isBoolean, isNumber, isString, optionalGuard, recordGuard };\n"]}
package/dist/index.d.ts CHANGED
@@ -9,6 +9,8 @@ export { type BuiltinElements, type ModuleExport, readBuiltinElements } from "./
9
9
  /** @public */
10
10
  export { type CodegenRunnerOptions, type CodegenRunnerResult, runCodegen } from "./runner.js";
11
11
  /** @public */
12
+ export { type GeneratedLibraries, readGeneratedLibraries } from "./store/gi/generated-libraries.js";
13
+ /** @public */
12
14
  export type { ElementProps } from "./store/jsx/element-prop-imports.js";
13
15
  /** @public */
14
16
  export { type GeneratedElement, readGeneratedElements } from "./store/jsx/generated-elements.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EACH,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc;AACd,OAAO,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpG,cAAc;AACd,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzG,cAAc;AACd,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9F,cAAc;AACd,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,cAAc;AACd,OAAO,EAAE,KAAK,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACjG,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpF,cAAc;AACd,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,cAAc;AACd,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EACH,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc;AACd,OAAO,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpG,cAAc;AACd,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzG,cAAc;AACd,OAAO,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9F,cAAc;AACd,OAAO,EAAE,KAAK,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AACpG,cAAc;AACd,YAAY,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACxE,cAAc;AACd,OAAO,EAAE,KAAK,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACjG,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,8BAA8B,CAAC;AACpF,cAAc;AACd,OAAO,EAAE,KAAK,aAAa,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC5E,cAAc;AACd,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -9,6 +9,8 @@ export { readBuiltinElements } from "./react/element-config.js";
9
9
  /** @public */
10
10
  export { runCodegen } from "./runner.js";
11
11
  /** @public */
12
+ export { readGeneratedLibraries } from "./store/gi/generated-libraries.js";
13
+ /** @public */
12
14
  export { readGeneratedElements } from "./store/jsx/generated-elements.js";
13
15
  /** @public */
14
16
  export { mergeOmittedProps } from "./store/jsx/omitted-props.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EACH,gBAAgB,EAShB,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc;AACd,OAAO,EAAE,qBAAqB,EAAyB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpG,cAAc;AACd,OAAO,EAA2C,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzG,cAAc;AACd,OAAO,EAAuD,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9F,cAAc;AACd,OAAO,EAAyB,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACjG,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAqB,MAAM,8BAA8B,CAAC;AACpF,cAAc;AACd,OAAO,EAAsB,YAAY,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/** @public */\nexport {\n API_SYMBOL_KINDS,\n type ApiLookupResult,\n type ApiNamespaceSummary,\n type ApiReference,\n type ApiReferenceOptions,\n type ApiSearchOptions,\n type ApiSymbol,\n type ApiSymbolKind,\n type ApiSymbolQuery,\n loadApiReference,\n} from \"./docs/api-reference.js\";\n/** @public */\nexport { resolveGirPath } from \"./gir/gir-path.js\";\n/** @public */\nexport { discoverGirNamespaces, type LibrarySelection, resolveLibraries } from \"./gir/libraries.js\";\n/** @public */\nexport { type BuiltinElements, type ModuleExport, readBuiltinElements } from \"./react/element-config.js\";\n/** @public */\nexport { type CodegenRunnerOptions, type CodegenRunnerResult, runCodegen } from \"./runner.js\";\n/** @public */\nexport type { ElementProps } from \"./store/jsx/element-prop-imports.js\";\n/** @public */\nexport { type GeneratedElement, readGeneratedElements } from \"./store/jsx/generated-elements.js\";\n/** @public */\nexport { mergeOmittedProps, type OmittedProps } from \"./store/jsx/omitted-props.js\";\n/** @public */\nexport { type ResolvedStore, resolveStore } from \"./store/resolve-store.js\";\n/** @public */\nexport type { StoreOptions } from \"./store/store-fs.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EACH,gBAAgB,EAShB,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc;AACd,OAAO,EAAE,qBAAqB,EAAyB,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACpG,cAAc;AACd,OAAO,EAA2C,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACzG,cAAc;AACd,OAAO,EAAuD,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9F,cAAc;AACd,OAAO,EAA2B,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAGpG,cAAc;AACd,OAAO,EAAyB,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AACjG,cAAc;AACd,OAAO,EAAE,iBAAiB,EAAqB,MAAM,8BAA8B,CAAC;AACpF,cAAc;AACd,OAAO,EAAsB,YAAY,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["/** @public */\nexport {\n API_SYMBOL_KINDS,\n type ApiLookupResult,\n type ApiNamespaceSummary,\n type ApiReference,\n type ApiReferenceOptions,\n type ApiSearchOptions,\n type ApiSymbol,\n type ApiSymbolKind,\n type ApiSymbolQuery,\n loadApiReference,\n} from \"./docs/api-reference.js\";\n/** @public */\nexport { resolveGirPath } from \"./gir/gir-path.js\";\n/** @public */\nexport { discoverGirNamespaces, type LibrarySelection, resolveLibraries } from \"./gir/libraries.js\";\n/** @public */\nexport { type BuiltinElements, type ModuleExport, readBuiltinElements } from \"./react/element-config.js\";\n/** @public */\nexport { type CodegenRunnerOptions, type CodegenRunnerResult, runCodegen } from \"./runner.js\";\n/** @public */\nexport { type GeneratedLibraries, readGeneratedLibraries } from \"./store/gi/generated-libraries.js\";\n/** @public */\nexport type { ElementProps } from \"./store/jsx/element-prop-imports.js\";\n/** @public */\nexport { type GeneratedElement, readGeneratedElements } from \"./store/jsx/generated-elements.js\";\n/** @public */\nexport { mergeOmittedProps, type OmittedProps } from \"./store/jsx/omitted-props.js\";\n/** @public */\nexport { type ResolvedStore, resolveStore } from \"./store/resolve-store.js\";\n/** @public */\nexport type { StoreOptions } from \"./store/store-fs.js\";\n"]}
@@ -0,0 +1,26 @@
1
+ import type { GirNamespace } from "../../gir/namespace.js";
2
+ /** What a generated `@gtkx/gi` store binds, and the library releases it was generated against. */
3
+ type GeneratedLibraries = {
4
+ /** GIR identifiers the store binds, such as `Gtk-4.0`, expanded from the project's `libraries`. */
5
+ libraries: string[];
6
+ /**
7
+ * `MAJOR.MINOR` release, keyed by GIR identifier. A library whose GIR declares no `MAJOR_VERSION`
8
+ * and `MINOR_VERSION` is absent, so an entry is present only for those that name their release.
9
+ */
10
+ versions: Record<string, string>;
11
+ };
12
+ declare const LIBRARIES_FILENAME = "libraries.json";
13
+ declare const collectGeneratedLibraries: (namespaces: Map<string, GirNamespace>, libraries: string[]) => GeneratedLibraries;
14
+ declare const renderGeneratedLibraries: (generated: GeneratedLibraries) => string;
15
+ /**
16
+ * Reads which GIR libraries a generated `@gtkx/gi` store binds and which release of each its GIR declared,
17
+ * out of the inventory codegen writes into the store. Answers "what does this project bind, and how new does
18
+ * the installed library have to be" without parsing a `.gir` file or querying pkg-config.
19
+ *
20
+ * @param giStoreDir The gi store directory, as given by `resolveStore(projectRoot).gi.storeDir`.
21
+ * @returns What the store recorded, or null when it holds no inventory codegen wrote, which covers an absent,
22
+ * unreadable, unparseable and structurally foreign store file alike.
23
+ */
24
+ declare const readGeneratedLibraries: (giStoreDir: string) => GeneratedLibraries | null;
25
+ export { LIBRARIES_FILENAME, collectGeneratedLibraries, type GeneratedLibraries, readGeneratedLibraries, renderGeneratedLibraries, };
26
+ //# sourceMappingURL=generated-libraries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-libraries.d.ts","sourceRoot":"","sources":["../../../src/store/gi/generated-libraries.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D,kGAAkG;AAClG,KAAK,kBAAkB,GAAG;IACtB,mGAAmG;IACnG,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF,QAAA,MAAM,kBAAkB,mBAAmB,CAAC;AAwB5C,QAAA,MAAM,yBAAyB,GAC3B,YAAY,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EACrC,WAAW,MAAM,EAAE,KACpB,kBAcF,CAAC;AAEF,QAAA,MAAM,wBAAwB,GAAI,WAAW,kBAAkB,KAAG,MACrB,CAAC;AAQ9C;;;;;;;;GAQG;AACH,QAAA,MAAM,sBAAsB,GAAI,YAAY,MAAM,KAAG,kBAAkB,GAAG,IAIzE,CAAC;AAEF,OAAO,EACH,kBAAkB,EAClB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,wBAAwB,GAC3B,CAAC"}
@@ -0,0 +1,53 @@
1
+ import { sortStrings } from "@gtkx/utils";
2
+ import { join } from "node:path";
3
+ import { arrayGuard, hasFields, isString, recordGuard } from "../../guards.js";
4
+ import { readJsonFile } from "../../json.js";
5
+ const LIBRARIES_FILENAME = "libraries.json";
6
+ const MAJOR_CONSTANT = "MAJOR_VERSION";
7
+ const MINOR_CONSTANT = "MINOR_VERSION";
8
+ const DIGITS = /^\d+$/;
9
+ const constantValue = (namespace, name) => {
10
+ const constant = namespace.constants.find((entry) => entry.name === name);
11
+ return constant !== undefined && DIGITS.test(constant.value) ? constant.value : undefined;
12
+ };
13
+ const namespaceVersion = (namespace) => {
14
+ const major = constantValue(namespace, MAJOR_CONSTANT);
15
+ const minor = constantValue(namespace, MINOR_CONSTANT);
16
+ return major === undefined || minor === undefined ? undefined : `${major}.${minor}`;
17
+ };
18
+ const getNamespaceName = (library) => {
19
+ const separator = library.indexOf("-");
20
+ return separator === -1 ? library : library.slice(0, separator);
21
+ };
22
+ const collectGeneratedLibraries = (namespaces, libraries) => {
23
+ const sorted = sortStrings(libraries);
24
+ const versions = {};
25
+ for (const library of sorted) {
26
+ const namespace = namespaces.get(getNamespaceName(library));
27
+ const version = namespace === undefined ? undefined : namespaceVersion(namespace);
28
+ if (version !== undefined) {
29
+ versions[library] = version;
30
+ }
31
+ }
32
+ return { libraries: sorted, versions };
33
+ };
34
+ const renderGeneratedLibraries = (generated) => `${JSON.stringify(generated, null, 2)}\n`;
35
+ const isGeneratedLibraries = (value) => hasFields(value, {
36
+ libraries: arrayGuard(isString),
37
+ versions: recordGuard(isString),
38
+ });
39
+ /**
40
+ * Reads which GIR libraries a generated `@gtkx/gi` store binds and which release of each its GIR declared,
41
+ * out of the inventory codegen writes into the store. Answers "what does this project bind, and how new does
42
+ * the installed library have to be" without parsing a `.gir` file or querying pkg-config.
43
+ *
44
+ * @param giStoreDir The gi store directory, as given by `resolveStore(projectRoot).gi.storeDir`.
45
+ * @returns What the store recorded, or null when it holds no inventory codegen wrote, which covers an absent,
46
+ * unreadable, unparseable and structurally foreign store file alike.
47
+ */
48
+ const readGeneratedLibraries = (giStoreDir) => {
49
+ const parsed = readJsonFile(join(giStoreDir, LIBRARIES_FILENAME));
50
+ return isGeneratedLibraries(parsed) ? parsed : null;
51
+ };
52
+ export { LIBRARIES_FILENAME, collectGeneratedLibraries, readGeneratedLibraries, renderGeneratedLibraries, };
53
+ //# sourceMappingURL=generated-libraries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generated-libraries.js","sourceRoot":"","sources":["../../../src/store/gi/generated-libraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MA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AAwB,GAC3B,CAAC","sourcesContent":["import { sortStrings } from \"@gtkx/utils\";\nimport { join } from \"node:path\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport { arrayGuard, hasFields, isString, recordGuard } from \"../../guards.js\";\nimport { readJsonFile } from \"../../json.js\";\n\n/** What a generated `@gtkx/gi` store binds, and the library releases it was generated against. */\ntype GeneratedLibraries = {\n /** GIR identifiers the store binds, such as `Gtk-4.0`, expanded from the project's `libraries`. */\n libraries: string[];\n /**\n * `MAJOR.MINOR` release, keyed by GIR identifier. A library whose GIR declares no `MAJOR_VERSION`\n * and `MINOR_VERSION` is absent, so an entry is present only for those that name their release.\n */\n versions: Record<string, string>;\n};\n\nconst LIBRARIES_FILENAME = \"libraries.json\";\nconst MAJOR_CONSTANT = \"MAJOR_VERSION\";\nconst MINOR_CONSTANT = \"MINOR_VERSION\";\nconst DIGITS = /^\\d+$/;\n\nconst constantValue = (namespace: GirNamespace, name: string): string | undefined => {\n const constant = namespace.constants.find((entry) => entry.name === name);\n\n return constant !== undefined && DIGITS.test(constant.value) ? constant.value : undefined;\n};\n\nconst namespaceVersion = (namespace: GirNamespace): string | undefined => {\n const major = constantValue(namespace, MAJOR_CONSTANT);\n const minor = constantValue(namespace, MINOR_CONSTANT);\n\n return major === undefined || minor === undefined ? undefined : `${major}.${minor}`;\n};\n\nconst getNamespaceName = (library: string): string => {\n const separator = library.indexOf(\"-\");\n\n return separator === -1 ? library : library.slice(0, separator);\n};\n\nconst collectGeneratedLibraries = (\n namespaces: Map<string, GirNamespace>,\n libraries: string[],\n): GeneratedLibraries => {\n const sorted = sortStrings(libraries);\n const versions: Record<string, string> = {};\n\n for (const library of sorted) {\n const namespace = namespaces.get(getNamespaceName(library));\n const version = namespace === undefined ? undefined : namespaceVersion(namespace);\n\n if (version !== undefined) {\n versions[library] = version;\n }\n }\n\n return { libraries: sorted, versions };\n};\n\nconst renderGeneratedLibraries = (generated: GeneratedLibraries): string =>\n `${JSON.stringify(generated, null, 2)}\\n`;\n\nconst isGeneratedLibraries = (value: unknown): value is GeneratedLibraries =>\n hasFields<GeneratedLibraries>(value, {\n libraries: arrayGuard(isString),\n versions: recordGuard(isString),\n });\n\n/**\n * Reads which GIR libraries a generated `@gtkx/gi` store binds and which release of each its GIR declared,\n * out of the inventory codegen writes into the store. Answers \"what does this project bind, and how new does\n * the installed library have to be\" without parsing a `.gir` file or querying pkg-config.\n *\n * @param giStoreDir The gi store directory, as given by `resolveStore(projectRoot).gi.storeDir`.\n * @returns What the store recorded, or null when it holds no inventory codegen wrote, which covers an absent,\n * unreadable, unparseable and structurally foreign store file alike.\n */\nconst readGeneratedLibraries = (giStoreDir: string): GeneratedLibraries | null => {\n const parsed = readJsonFile(join(giStoreDir, LIBRARIES_FILENAME));\n\n return isGeneratedLibraries(parsed) ? parsed : null;\n};\n\nexport {\n LIBRARIES_FILENAME,\n collectGeneratedLibraries,\n type GeneratedLibraries,\n readGeneratedLibraries,\n renderGeneratedLibraries,\n};\n"]}
@@ -1,4 +1,5 @@
1
1
  import { type GiFingerprint } from "../fingerprint.js";
2
+ import { type GeneratedLibraries } from "./gi/generated-libraries.js";
2
3
  import { type StoreOptions } from "./store-fs.js";
3
4
  type GiNamespaceInput = {
4
5
  directory: string;
@@ -10,6 +11,10 @@ type GiExternalNamespaceInput = {
10
11
  packageName: string;
11
12
  girFile: string;
12
13
  };
13
- declare const writeGiStore: (options: StoreOptions, namespaces: GiNamespaceInput[], externalNamespaces: GiExternalNamespaceInput[], fingerprint: GiFingerprint) => void;
14
+ type GiStoreRecords = {
15
+ fingerprint: GiFingerprint;
16
+ libraries: GeneratedLibraries;
17
+ };
18
+ declare const writeGiStore: (options: StoreOptions, namespaces: GiNamespaceInput[], externalNamespaces: GiExternalNamespaceInput[], records: GiStoreRecords) => void;
14
19
  export { writeGiStore, type GiExternalNamespaceInput, type GiNamespaceInput };
15
20
  //# sourceMappingURL=gi-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAkC,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE7G,KAAK,gBAAgB,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AA0EF,QAAA,MAAM,YAAY,GACd,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,oBAAoB,wBAAwB,EAAE,EAC9C,aAAa,aAAa,KAC3B,IAeF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,wBAAwB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"gi-store.d.ts","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAKA,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EACH,KAAK,kBAAkB,EAG1B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAkC,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE7G,KAAK,gBAAgB,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,wBAAwB,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,WAAW,EAAE,aAAa,CAAC;IAC3B,SAAS,EAAE,kBAAkB,CAAC;CACjC,CAAC;AA0EF,QAAA,MAAM,YAAY,GACd,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,oBAAoB,wBAAwB,EAAE,EAC9C,SAAS,cAAc,KACxB,IAkBF,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,wBAAwB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
@@ -3,6 +3,7 @@ import { existsSync, readdirSync, readFileSync } from "node:fs";
3
3
  import { dirname, join, resolve } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { FINGERPRINT_FILENAME } from "../fingerprint.js";
6
+ import { LIBRARIES_FILENAME, renderGeneratedLibraries, } from "./gi/generated-libraries.js";
6
7
  import { buildManifest, namespaceBarrel, subpathExport, writeStore } from "./store-fs.js";
7
8
  const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "overrides");
8
9
  const overrideFiles = (directory) => {
@@ -50,7 +51,7 @@ const storePeerDependencies = (externalNamespaces) => Object.fromEntries(sortStr
50
51
  name,
51
52
  "*",
52
53
  ]));
53
- const writeGiStore = (options, namespaces, externalNamespaces, fingerprint) => {
54
+ const writeGiStore = (options, namespaces, externalNamespaces, records) => {
54
55
  const { collected, exportsMap } = collectStoreSources(namespaces, externalNamespaces);
55
56
  writeStore({
56
57
  storeDir: options.storeDir,
@@ -62,7 +63,10 @@ const writeGiStore = (options, namespaces, externalNamespaces, fingerprint) => {
62
63
  exports: exportsMap,
63
64
  peerDependencies: storePeerDependencies(externalNamespaces),
64
65
  }),
65
- rawFiles: [{ relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(fingerprint, null, 2)}\n` }],
66
+ rawFiles: [
67
+ { relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(records.fingerprint, null, 2)}\n` },
68
+ { relativePath: LIBRARIES_FILENAME, content: renderGeneratedLibraries(records.libraries) },
69
+ ],
66
70
  });
67
71
  };
68
72
  export { writeGiStore };
@@ -1 +1 @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AAQ,EAAE,CAAC,EAAE,YAAY,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;KAC3G,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAwD,CAAC","sourcesContent":["import { sortStrings } from \"@gtkx/utils\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { SourceModule } from \"../compile.js\";\nimport { FINGERPRINT_FILENAME, type GiFingerprint } from \"../fingerprint.js\";\nimport { buildManifest, namespaceBarrel, type StoreOptions, subpathExport, writeStore } from \"./store-fs.js\";\n\ntype GiNamespaceInput = {\n directory: string;\n rawSource: string;\n girFile: string;\n};\n\ntype GiExternalNamespaceInput = {\n directory: string;\n packageName: string;\n girFile: string;\n};\n\nconst OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), \"..\", \"..\", \"overrides\");\n\nconst overrideFiles = (directory: string): SourceModule[] => {\n const dir = join(OVERRIDES_ROOT, directory);\n\n if (!existsSync(dir)) {\n return [];\n }\n\n return readdirSync(dir)\n .filter((name) => name.endsWith(\".ejs\") && name !== \"index.ts.ejs\")\n .map((name) => overrideModule(`${directory}/overrides/${name.replace(/\\.ejs$/, \"\")}`, join(dir, name)));\n};\n\nconst overrideModule = (fileName: string, overridePath: string): SourceModule => ({\n fileName,\n source: readFileSync(overridePath, \"utf8\"),\n origin: overridePath,\n});\n\nconst barrelFile = (directory: string, girFile: string): SourceModule => {\n const barrel = namespaceBarrel(directory);\n const overrideIndex = join(OVERRIDES_ROOT, directory, \"index.ts.ejs\");\n\n if (!existsSync(overrideIndex)) {\n return { ...barrel, origin: girFile };\n }\n\n return overrideModule(barrel.fileName, overrideIndex);\n};\n\nconst externalShimModule = ({ directory, packageName, girFile }: GiExternalNamespaceInput): SourceModule => ({\n fileName: `${directory}/index.ts`,\n source:\n `/** @deprecated Import from \"${packageName}\" instead; this alias is removed in GTKX 2.0. */\\n` +\n `export * from \"${packageName}\";\\n`,\n origin: girFile,\n});\n\nconst collectStoreSources = (\n namespaces: GiNamespaceInput[],\n externalNamespaces: GiExternalNamespaceInput[],\n): { collected: SourceModule[]; exportsMap: Record<string, unknown> } => {\n const exportsMap: Record<string, unknown> = {};\n const collected: SourceModule[] = [];\n\n for (const { directory, rawSource, girFile } of namespaces) {\n collected.push(\n { fileName: `${directory}/${directory}.ts`, source: rawSource, origin: girFile },\n ...overrideFiles(directory),\n barrelFile(directory, girFile),\n );\n\n exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);\n }\n\n for (const external of externalNamespaces) {\n collected.push(externalShimModule(external));\n exportsMap[`./${external.directory}`] = subpathExport(`${external.directory}/index`);\n }\n\n return { collected, exportsMap };\n};\n\nconst storePeerDependencies = (externalNamespaces: GiExternalNamespaceInput[]): Record<string, string> =>\n Object.fromEntries(\n sortStrings([\"@gtkx/runtime\", ...externalNamespaces.map((entry) => entry.packageName)]).map((name) => [\n name,\n \"*\",\n ]),\n );\n\nconst writeGiStore = (\n options: StoreOptions,\n namespaces: GiNamespaceInput[],\n externalNamespaces: GiExternalNamespaceInput[],\n fingerprint: GiFingerprint,\n): void => {\n const { collected, exportsMap } = collectStoreSources(namespaces, externalNamespaces);\n\n writeStore({\n storeDir: options.storeDir,\n linkDir: options.linkDir,\n files: collected,\n manifest: buildManifest({\n name: \"@gtkx/gi\",\n version: options.version,\n exports: exportsMap,\n peerDependencies: storePeerDependencies(externalNamespaces),\n }),\n rawFiles: [{ relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(fingerprint, null, 2)}\\n` }],\n });\n};\n\nexport { writeGiStore, type GiExternalNamespaceInput, type GiNamespaceInput };\n"]}
1
+ {"version":3,"file":"gi-store.js","sourceRoot":"","sources":["../../src/store/gi-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAA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AY,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;YACpG,EAAE,YAAY,EAAE,kBAAkB,EAAE,OAAO,EAAE,wBAAwB,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;SAC7F;KACJ,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAwD,CAAC","sourcesContent":["import { sortStrings } from \"@gtkx/utils\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { SourceModule } from \"../compile.js\";\nimport { FINGERPRINT_FILENAME, type GiFingerprint } from \"../fingerprint.js\";\nimport {\n type GeneratedLibraries,\n LIBRARIES_FILENAME,\n renderGeneratedLibraries,\n} from \"./gi/generated-libraries.js\";\nimport { buildManifest, namespaceBarrel, type StoreOptions, subpathExport, writeStore } from \"./store-fs.js\";\n\ntype GiNamespaceInput = {\n directory: string;\n rawSource: string;\n girFile: string;\n};\n\ntype GiExternalNamespaceInput = {\n directory: string;\n packageName: string;\n girFile: string;\n};\n\ntype GiStoreRecords = {\n fingerprint: GiFingerprint;\n libraries: GeneratedLibraries;\n};\n\nconst OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), \"..\", \"..\", \"overrides\");\n\nconst overrideFiles = (directory: string): SourceModule[] => {\n const dir = join(OVERRIDES_ROOT, directory);\n\n if (!existsSync(dir)) {\n return [];\n }\n\n return readdirSync(dir)\n .filter((name) => name.endsWith(\".ejs\") && name !== \"index.ts.ejs\")\n .map((name) => overrideModule(`${directory}/overrides/${name.replace(/\\.ejs$/, \"\")}`, join(dir, name)));\n};\n\nconst overrideModule = (fileName: string, overridePath: string): SourceModule => ({\n fileName,\n source: readFileSync(overridePath, \"utf8\"),\n origin: overridePath,\n});\n\nconst barrelFile = (directory: string, girFile: string): SourceModule => {\n const barrel = namespaceBarrel(directory);\n const overrideIndex = join(OVERRIDES_ROOT, directory, \"index.ts.ejs\");\n\n if (!existsSync(overrideIndex)) {\n return { ...barrel, origin: girFile };\n }\n\n return overrideModule(barrel.fileName, overrideIndex);\n};\n\nconst externalShimModule = ({ directory, packageName, girFile }: GiExternalNamespaceInput): SourceModule => ({\n fileName: `${directory}/index.ts`,\n source:\n `/** @deprecated Import from \"${packageName}\" instead; this alias is removed in GTKX 2.0. */\\n` +\n `export * from \"${packageName}\";\\n`,\n origin: girFile,\n});\n\nconst collectStoreSources = (\n namespaces: GiNamespaceInput[],\n externalNamespaces: GiExternalNamespaceInput[],\n): { collected: SourceModule[]; exportsMap: Record<string, unknown> } => {\n const exportsMap: Record<string, unknown> = {};\n const collected: SourceModule[] = [];\n\n for (const { directory, rawSource, girFile } of namespaces) {\n collected.push(\n { fileName: `${directory}/${directory}.ts`, source: rawSource, origin: girFile },\n ...overrideFiles(directory),\n barrelFile(directory, girFile),\n );\n\n exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);\n }\n\n for (const external of externalNamespaces) {\n collected.push(externalShimModule(external));\n exportsMap[`./${external.directory}`] = subpathExport(`${external.directory}/index`);\n }\n\n return { collected, exportsMap };\n};\n\nconst storePeerDependencies = (externalNamespaces: GiExternalNamespaceInput[]): Record<string, string> =>\n Object.fromEntries(\n sortStrings([\"@gtkx/runtime\", ...externalNamespaces.map((entry) => entry.packageName)]).map((name) => [\n name,\n \"*\",\n ]),\n );\n\nconst writeGiStore = (\n options: StoreOptions,\n namespaces: GiNamespaceInput[],\n externalNamespaces: GiExternalNamespaceInput[],\n records: GiStoreRecords,\n): void => {\n const { collected, exportsMap } = collectStoreSources(namespaces, externalNamespaces);\n\n writeStore({\n storeDir: options.storeDir,\n linkDir: options.linkDir,\n files: collected,\n manifest: buildManifest({\n name: \"@gtkx/gi\",\n version: options.version,\n exports: exportsMap,\n peerDependencies: storePeerDependencies(externalNamespaces),\n }),\n rawFiles: [\n { relativePath: FINGERPRINT_FILENAME, content: `${JSON.stringify(records.fingerprint, null, 2)}\\n` },\n { relativePath: LIBRARIES_FILENAME, content: renderGeneratedLibraries(records.libraries) },\n ],\n });\n};\n\nexport { writeGiStore, type GiExternalNamespaceInput, type GiNamespaceInput };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAoCpD,QAAA,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,MAyB5C,CAAC;AAmUF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AA+BpD,QAAA,MAAM,gBAAgB,GAAI,SAAS,OAAO,KAAG,MAiB5C,CAAC;AA2RF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -2,25 +2,25 @@ import { sortStringsBy, sourceStringLiteral, toCamelIdentifier } from "@gtkx/uti
2
2
  import { inputParameters } from "../../analysis/param-structure.js";
3
3
  import { isConstructableProperty } from "../../gir/property.js";
4
4
  import { implementedInterfaces, isIntrinsicElementClass, iterateClassesWithGlibName, signalHandlerName, } from "./intrinsic-elements.js";
5
+ const READABLE = 1;
6
+ const WRITABLE = 2;
7
+ const CONSTRUCT = 4;
8
+ const CONSTRUCT_ONLY = 8;
9
+ const PROPERTY_ENTRY_TYPE = "/** The GObject name of a property, what a write may do to it, and the value it resets to. */\n" +
10
+ "export type PropertyEntry = [name: string, flags: number, defaultValue?: unknown];";
5
11
  const INTEGER_PATTERN = /^-?\d+$/;
6
12
  const FLOAT_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i;
7
13
  const generateMetadata = (library) => {
8
14
  const intrinsicElements = collectIntrinsicElements(library);
9
15
  const signalsEntries = intrinsicElements.map(({ glibName, signals }) => ` "${glibName}": ${renderSignalsObject(signals)},`);
10
- const constructOnlyEntries = intrinsicElements
11
- .filter(({ constructOnly }) => constructOnly.length > 0)
12
- .map(({ glibName, constructOnly }) => ` "${glibName}": ${renderStringSet(constructOnly)},`);
13
- const constructableEntries = intrinsicElements
14
- .filter(({ constructable }) => constructable.length > 0)
15
- .map(({ glibName, constructable }) => ` "${glibName}": ${renderStringSet(constructable)},`);
16
- const defaultsEntries = intrinsicElements
17
- .filter(({ defaults }) => defaults.length > 0)
18
- .map(({ glibName, defaults }) => ` "${glibName}": ${renderDefaultsObject(defaults)},`);
16
+ const propertyEntries = intrinsicElements
17
+ .filter(({ properties }) => properties.length > 0)
18
+ .map(({ glibName, properties }) => ` "${glibName}": ${renderPropertiesObject(properties)},`);
19
19
  return `${[
20
+ PROPERTY_ENTRY_TYPE,
20
21
  `export const signals: Record<string, Record<string, string>> = {\n${signalsEntries.join("\n")}\n};`,
21
- `export const constructOnlyProps: Record<string, Set<string>> = {\n${constructOnlyEntries.join("\n")}\n};`,
22
- `export const constructProps: Record<string, Set<string>> = {\n${constructableEntries.join("\n")}\n};`,
23
- `export const defaultProps: Record<string, Record<string, unknown>> = {\n${defaultsEntries.join("\n")}\n};`,
22
+ "export const properties: Record<string, Record<string, PropertyEntry>> = " +
23
+ `{\n${propertyEntries.join("\n")}\n};`,
24
24
  ].join("\n\n")}\n`;
25
25
  };
26
26
  const collectIntrinsicElements = (library) => {
@@ -38,9 +38,7 @@ const collectIntrinsicElements = (library) => {
38
38
  entries.push({
39
39
  glibName,
40
40
  signals: collectSignals(sources),
41
- constructOnly: collectConstructOnly(sources),
42
- constructable: collectConstructable(sources),
43
- defaults: collectDefaultProps(library, sources),
41
+ properties: collectProperties(library, sources),
44
42
  });
45
43
  }
46
44
  return sortStringsBy(entries, (entry) => entry.glibName);
@@ -63,29 +61,37 @@ const collectSignals = (sources) => {
63
61
  }
64
62
  return signals;
65
63
  };
66
- const collectPropNamesFromSource = (source, collector) => {
67
- const { shouldKeep, seen, names } = collector;
64
+ const propertyFlags = (property) => {
65
+ const construct = isConstructableProperty(property) && !property.constructOnly ? CONSTRUCT : 0;
66
+ const constructOnly = property.constructOnly ? CONSTRUCT_ONLY : 0;
67
+ return (property.readable ? READABLE : 0) |
68
+ (property.writable ? WRITABLE : 0) |
69
+ construct |
70
+ constructOnly;
71
+ };
72
+ const propertyEntryLiteral = (library, klass, property) => {
73
+ const head = `${sourceStringLiteral(property.name)},${String(propertyFlags(property))}`;
74
+ const literal = isDefaultCandidate(property) ? renderDefaultLiteral(library, klass, property) : undefined;
75
+ return literal === undefined ? `[${head}]` : `[${head},${literal}]`;
76
+ };
77
+ const collectPropertiesFromSource = (library, source, seen, entries) => {
68
78
  for (const property of source.properties) {
69
- if (!shouldKeep(property)) {
70
- continue;
71
- }
72
79
  const jsName = toCamelIdentifier(property.name);
73
- if (seen.has(jsName)) {
80
+ if (!property.introspectable || seen.has(jsName)) {
74
81
  continue;
75
82
  }
76
83
  seen.add(jsName);
77
- names.push(jsName);
84
+ entries.push([jsName, propertyEntryLiteral(library, source, property)]);
78
85
  }
79
86
  };
80
- const collectPropNames = (sources, shouldKeep) => {
81
- const collector = { shouldKeep, seen: new Set(), names: [] };
87
+ const collectProperties = (library, sources) => {
88
+ const seen = new Set();
89
+ const entries = [];
82
90
  for (const source of sources) {
83
- collectPropNamesFromSource(source, collector);
91
+ collectPropertiesFromSource(library, source, seen, entries);
84
92
  }
85
- return collector.names;
93
+ return entries;
86
94
  };
87
- const collectConstructOnly = (sources) => collectPropNames(sources, (property) => property.constructOnly && property.introspectable);
88
- const collectConstructable = (sources) => collectPropNames(sources, (property) => isConstructableProperty(property) && property.introspectable);
89
95
  const renderObjectLiteral = (entries, renderValue) => {
90
96
  if (entries.length === 0) {
91
97
  return "{}";
@@ -93,39 +99,9 @@ const renderObjectLiteral = (entries, renderValue) => {
93
99
  const lines = entries.map(([key, value]) => ` ${sourceStringLiteral(key)}: ${renderValue(value)}`);
94
100
  return `{\n${lines.join(",\n")}\n }`;
95
101
  };
96
- const renderStringSet = (names) => `new Set([${names.map((name) => sourceStringLiteral(name)).join(",")}])`;
102
+ const renderPropertiesObject = (entries) => renderObjectLiteral(entries, (value) => value);
97
103
  const renderSignalsObject = (entries) => renderObjectLiteral(entries, sourceStringLiteral);
98
- const collectDefaultsFromClass = (klass, collector) => {
99
- for (const property of klass.properties) {
100
- const entry = defaultPropEntry(collector.library, klass, property, collector.seen);
101
- if (entry !== undefined) {
102
- collector.defaults.push(entry);
103
- }
104
- }
105
- };
106
- const collectDefaultProps = (library, sources) => {
107
- const collector = { library, seen: new Set(), defaults: [] };
108
- for (const klass of sources) {
109
- collectDefaultsFromClass(klass, collector);
110
- }
111
- return collector.defaults;
112
- };
113
104
  const isDefaultCandidate = (property) => (property.writable || property.construct) && !property.constructOnly && property.introspectable;
114
- const defaultPropEntry = (library, klass, property, seen) => {
115
- if (!isDefaultCandidate(property)) {
116
- return undefined;
117
- }
118
- const jsName = toCamelIdentifier(property.name);
119
- if (seen.has(jsName)) {
120
- return undefined;
121
- }
122
- seen.add(jsName);
123
- const literal = renderDefaultLiteral(library, klass, property);
124
- if (literal === undefined) {
125
- return undefined;
126
- }
127
- return [jsName, literal];
128
- };
129
105
  const willSetterRejectNull = (library, klass, property) => {
130
106
  if (property.setter === undefined) {
131
107
  return false;
@@ -250,6 +226,5 @@ const enumDefaultLiteral = (enumType, raw) => {
250
226
  const member = enumType.members.find((entry) => entry.cIdentifier === trimmed || entry.name === trimmed);
251
227
  return member?.value;
252
228
  };
253
- const renderDefaultsObject = (entries) => renderObjectLiteral(entries, (literal) => literal);
254
229
  export { generateMetadata };
255
230
  //# sourceMappingURL=metadata.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAAA,OAAO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AAC,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { sortStringsBy, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirEnum } from \"../../gir/enum.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { PrimitiveCategory } from \"../../gir/primitives.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { GirType } from \"../../gir/type.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport {\n implementedInterfaces,\n isIntrinsicElementClass,\n iterateClassesWithGlibName,\n signalHandlerName,\n} from \"./intrinsic-elements.js\";\n\ntype IntrinsicElementEntry = {\n glibName: string;\n signals: [string, string][];\n constructOnly: string[];\n constructable: string[];\n defaults: [string, string][];\n};\n\ntype PropNameCollector = {\n shouldKeep: (property: GirProperty) => boolean;\n seen: Set<string>;\n names: string[];\n};\n\ntype DefaultPropsCollector = {\n library: Library;\n seen: Set<string>;\n defaults: [string, string][];\n};\n\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst FLOAT_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i;\n\nconst generateMetadata = (library: Library): string => {\n const intrinsicElements = collectIntrinsicElements(library);\n\n const signalsEntries = intrinsicElements.map(\n ({ glibName, signals }) => ` \"${glibName}\": ${renderSignalsObject(signals)},`,\n );\n\n const constructOnlyEntries = intrinsicElements\n .filter(({ constructOnly }) => constructOnly.length > 0)\n .map(({ glibName, constructOnly }) => ` \"${glibName}\": ${renderStringSet(constructOnly)},`);\n\n const constructableEntries = intrinsicElements\n .filter(({ constructable }) => constructable.length > 0)\n .map(({ glibName, constructable }) => ` \"${glibName}\": ${renderStringSet(constructable)},`);\n\n const defaultsEntries = intrinsicElements\n .filter(({ defaults }) => defaults.length > 0)\n .map(({ glibName, defaults }) => ` \"${glibName}\": ${renderDefaultsObject(defaults)},`);\n\n return `${[\n `export const signals: Record<string, Record<string, string>> = {\\n${signalsEntries.join(\"\\n\")}\\n};`,\n `export const constructOnlyProps: Record<string, Set<string>> = {\\n${constructOnlyEntries.join(\"\\n\")}\\n};`,\n `export const constructProps: Record<string, Set<string>> = {\\n${constructableEntries.join(\"\\n\")}\\n};`,\n `export const defaultProps: Record<string, Record<string, unknown>> = {\\n${defaultsEntries.join(\"\\n\")}\\n};`,\n ].join(\"\\n\\n\")}\\n`;\n};\n\nconst collectIntrinsicElements = (library: Library): IntrinsicElementEntry[] => {\n const entries: IntrinsicElementEntry[] = [];\n const seen: Set<string> = new Set();\n\n for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {\n if (!isIntrinsicElementClass(klass, namespace, library) || seen.has(glibName)) {\n continue;\n }\n\n seen.add(glibName);\n\n const sources: GirClass[] = [\n klass,\n ...implementedInterfaces(klass, namespace, library).map((entry) => entry.klass),\n ];\n\n entries.push({\n glibName,\n signals: collectSignals(sources),\n constructOnly: collectConstructOnly(sources),\n constructable: collectConstructable(sources),\n defaults: collectDefaultProps(library, sources),\n });\n }\n\n return sortStringsBy(entries, (entry) => entry.glibName);\n};\n\nconst collectSignalsFromSource = (source: GirClass, seen: Set<string>, signals: [string, string][]): void => {\n for (const signal of source.signals) {\n const handlerName = signalHandlerName(signal.name);\n\n if (seen.has(handlerName)) {\n continue;\n }\n\n seen.add(handlerName);\n signals.push([handlerName, signal.name] as const);\n }\n};\n\nconst collectSignals = (sources: GirClass[]): [string, string][] => {\n const seen: Set<string> = new Set();\n const signals: [string, string][] = [];\n\n for (const source of sources) {\n collectSignalsFromSource(source, seen, signals);\n }\n\n return signals;\n};\n\nconst collectPropNamesFromSource = (source: GirClass, collector: PropNameCollector): void => {\n const { shouldKeep, seen, names } = collector;\n\n for (const property of source.properties) {\n if (!shouldKeep(property)) {\n continue;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n continue;\n }\n\n seen.add(jsName);\n names.push(jsName);\n }\n};\n\nconst collectPropNames = (sources: GirClass[], shouldKeep: (property: GirProperty) => boolean): string[] => {\n const collector: PropNameCollector = { shouldKeep, seen: new Set<string>(), names: [] };\n\n for (const source of sources) {\n collectPropNamesFromSource(source, collector);\n }\n\n return collector.names;\n};\n\nconst collectConstructOnly = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => property.constructOnly && property.introspectable);\n\nconst collectConstructable = (sources: GirClass[]): string[] =>\n collectPropNames(sources, (property) => isConstructableProperty(property) && property.introspectable);\n\nconst renderObjectLiteral = (entries: [string, string][], renderValue: (value: string) => string): string => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const lines = entries.map(([key, value]) => ` ${sourceStringLiteral(key)}: ${renderValue(value)}`);\n\n return `{\\n${lines.join(\",\\n\")}\\n }`;\n};\n\nconst renderStringSet = (names: string[]): string =>\n `new Set([${names.map((name) => sourceStringLiteral(name)).join(\",\")}])`;\n\nconst renderSignalsObject = (entries: [string, string][]): string => renderObjectLiteral(entries, sourceStringLiteral);\n\nconst collectDefaultsFromClass = (klass: GirClass, collector: DefaultPropsCollector): void => {\n for (const property of klass.properties) {\n const entry = defaultPropEntry(collector.library, klass, property, collector.seen);\n\n if (entry !== undefined) {\n collector.defaults.push(entry);\n }\n }\n};\n\nconst collectDefaultProps = (library: Library, sources: GirClass[]): [string, string][] => {\n const collector: DefaultPropsCollector = { library, seen: new Set<string>(), defaults: [] };\n\n for (const klass of sources) {\n collectDefaultsFromClass(klass, collector);\n }\n\n return collector.defaults;\n};\n\nconst isDefaultCandidate = (property: GirProperty): boolean =>\n (property.writable || property.construct) && !property.constructOnly && property.introspectable;\n\nconst defaultPropEntry = (\n library: Library,\n klass: GirClass,\n property: GirProperty,\n seen: Set<string>,\n): [string, string] | undefined => {\n if (!isDefaultCandidate(property)) {\n return undefined;\n }\n\n const jsName = toCamelIdentifier(property.name);\n\n if (seen.has(jsName)) {\n return undefined;\n }\n\n seen.add(jsName);\n const literal = renderDefaultLiteral(library, klass, property);\n\n if (literal === undefined) {\n return undefined;\n }\n\n return [jsName, literal];\n};\n\nconst willSetterRejectNull = (library: Library, klass: GirClass, property: GirProperty): boolean => {\n if (property.setter === undefined) {\n return false;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return false;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value !== undefined && !value.parameter.nullable && !value.parameter.optional;\n};\n\nconst setterValueRef = (library: Library, klass: GirClass, property: GirProperty): TypeId | undefined => {\n if (property.setter === undefined) {\n return undefined;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return undefined;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value?.parameter.type;\n};\n\nconst renderDefaultLiteral = (library: Library, klass: GirClass, property: GirProperty): string | undefined => {\n if (property.defaultValue === \"NULL\" && willSetterRejectNull(library, klass, property)) {\n return undefined;\n }\n\n const ref = setterValueRef(library, klass, property) ?? property.type;\n\n return resolveDefaultLiteral(library, ref, property.defaultValue);\n};\n\nconst resolveDefaultLiteral = (\n library: Library,\n ref: TypeId | undefined,\n raw: string | undefined,\n): string | undefined => {\n if (raw === undefined) {\n return undefined;\n }\n\n if (raw === \"NULL\") {\n return \"null\";\n }\n\n if (ref === undefined) {\n return undefined;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n return resolveTypeDefaultLiteral(library, resolved, raw);\n};\n\nconst resolveTypeDefaultLiteral = (library: Library, resolved: GirType, raw: string): string | undefined => {\n if (resolved.kind === \"primitive\") {\n return primitiveDefaultLiteral(resolved.category, raw);\n }\n\n if (resolved.kind === \"enum\") {\n return enumDefaultLiteral(resolved.value, raw);\n }\n\n if (resolved.kind === \"alias\") {\n return resolveDefaultLiteral(library, resolved.value.target, raw);\n }\n\n return undefined;\n};\n\nconst booleanDefaultLiteral = (raw: string): string | undefined => {\n if (raw === \"TRUE\") {\n return \"true\";\n }\n\n if (raw === \"FALSE\") {\n return \"false\";\n }\n\n return undefined;\n};\n\nconst integerDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n return INTEGER_PATTERN.test(trimmed) ? trimmed : undefined;\n};\n\nconst floatDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (!FLOAT_PATTERN.test(trimmed)) {\n return undefined;\n }\n\n const value = Number(trimmed);\n\n return Number.isFinite(value) ? String(value) : undefined;\n};\n\nconst primitiveDefaultLiteral = (category: PrimitiveCategory, raw: string): string | undefined => {\n switch (category) {\n case \"boolean\": {\n return booleanDefaultLiteral(raw);\n }\n case \"int8\":\n case \"int16\":\n case \"int32\":\n case \"uint8\":\n case \"uint16\":\n case \"uint32\":\n case \"int64\":\n case \"uint64\":\n case \"unichar\": {\n return integerDefaultLiteral(raw);\n }\n case \"float32\":\n case \"float64\": {\n return floatDefaultLiteral(raw);\n }\n case \"string\": {\n return sourceStringLiteral(raw);\n }\n case \"bigint64\":\n case \"biguint64\":\n case \"gtype\": {\n return bigintDefaultLiteral(raw);\n }\n case \"pointer\":\n case \"void\": {\n return undefined;\n }\n }\n};\n\nconst bigintDefaultLiteral = (raw: string): string | undefined => {\n const integer = integerDefaultLiteral(raw);\n\n return integer === undefined ? undefined : `${integer}n`;\n};\n\nconst enumDefaultLiteral = (enumType: GirEnum, raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (INTEGER_PATTERN.test(trimmed)) {\n return trimmed;\n }\n\n const member = enumType.members.find((entry) => entry.cIdentifier === trimmed || entry.name === trimmed);\n\n return member?.value;\n};\n\nconst renderDefaultsObject = (entries: [string, string][]): string =>\n renderObjectLiteral(entries, (literal) => literal);\n\nexport { generateMetadata };\n"]}
1
+ {"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAA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BAAmB,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;QACD,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,OAAO,oBAAoB,CAAC,GAAG,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,SAAS,CAAC;QACf,KAAK,MAAM,CAAC,CAAC,CAAC;YACV,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAsB,EAAE;IAC7D,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAE3C,OAAO,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;AAC7D,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,QAAiB,EAAE,GAAW,EAAsB,EAAE;IAC9E,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IAE3B,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,WAAW,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC;IAEzG,OAAO,MAAM,EAAE,KAAK,CAAC;AACzB,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import { sortStringsBy, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { GirEnum } from \"../../gir/enum.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { PrimitiveCategory } from \"../../gir/primitives.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport type { GirType } from \"../../gir/type.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\nimport { type GirProperty, isConstructableProperty } from \"../../gir/property.js\";\nimport {\n implementedInterfaces,\n isIntrinsicElementClass,\n iterateClassesWithGlibName,\n signalHandlerName,\n} from \"./intrinsic-elements.js\";\n\ntype IntrinsicElementEntry = {\n glibName: string;\n signals: [string, string][];\n properties: [string, string][];\n};\n\nconst READABLE = 1;\nconst WRITABLE = 2;\nconst CONSTRUCT = 4;\nconst CONSTRUCT_ONLY = 8;\n\nconst PROPERTY_ENTRY_TYPE =\n \"/** The GObject name of a property, what a write may do to it, and the value it resets to. */\\n\" +\n \"export type PropertyEntry = [name: string, flags: number, defaultValue?: unknown];\";\n\nconst INTEGER_PATTERN = /^-?\\d+$/;\nconst FLOAT_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+-]?\\d+)?$/i;\n\nconst generateMetadata = (library: Library): string => {\n const intrinsicElements = collectIntrinsicElements(library);\n\n const signalsEntries = intrinsicElements.map(\n ({ glibName, signals }) => ` \"${glibName}\": ${renderSignalsObject(signals)},`,\n );\n\n const propertyEntries = intrinsicElements\n .filter(({ properties }) => properties.length > 0)\n .map(({ glibName, properties }) => ` \"${glibName}\": ${renderPropertiesObject(properties)},`);\n\n return `${[\n PROPERTY_ENTRY_TYPE,\n `export const signals: Record<string, Record<string, string>> = {\\n${signalsEntries.join(\"\\n\")}\\n};`,\n \"export const properties: Record<string, Record<string, PropertyEntry>> = \" +\n `{\\n${propertyEntries.join(\"\\n\")}\\n};`,\n ].join(\"\\n\\n\")}\\n`;\n};\n\nconst collectIntrinsicElements = (library: Library): IntrinsicElementEntry[] => {\n const entries: IntrinsicElementEntry[] = [];\n const seen: Set<string> = new Set();\n\n for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {\n if (!isIntrinsicElementClass(klass, namespace, library) || seen.has(glibName)) {\n continue;\n }\n\n seen.add(glibName);\n\n const sources: GirClass[] = [\n klass,\n ...implementedInterfaces(klass, namespace, library).map((entry) => entry.klass),\n ];\n\n entries.push({\n glibName,\n signals: collectSignals(sources),\n properties: collectProperties(library, sources),\n });\n }\n\n return sortStringsBy(entries, (entry) => entry.glibName);\n};\n\nconst collectSignalsFromSource = (source: GirClass, seen: Set<string>, signals: [string, string][]): void => {\n for (const signal of source.signals) {\n const handlerName = signalHandlerName(signal.name);\n\n if (seen.has(handlerName)) {\n continue;\n }\n\n seen.add(handlerName);\n signals.push([handlerName, signal.name] as const);\n }\n};\n\nconst collectSignals = (sources: GirClass[]): [string, string][] => {\n const seen: Set<string> = new Set();\n const signals: [string, string][] = [];\n\n for (const source of sources) {\n collectSignalsFromSource(source, seen, signals);\n }\n\n return signals;\n};\n\nconst propertyFlags = (property: GirProperty): number => {\n const construct = isConstructableProperty(property) && !property.constructOnly ? CONSTRUCT : 0;\n const constructOnly = property.constructOnly ? CONSTRUCT_ONLY : 0;\n\n return (property.readable ? READABLE : 0) |\n (property.writable ? WRITABLE : 0) |\n construct |\n constructOnly;\n};\n\nconst propertyEntryLiteral = (library: Library, klass: GirClass, property: GirProperty): string => {\n const head = `${sourceStringLiteral(property.name)},${String(propertyFlags(property))}`;\n const literal = isDefaultCandidate(property) ? renderDefaultLiteral(library, klass, property) : undefined;\n\n return literal === undefined ? `[${head}]` : `[${head},${literal}]`;\n};\n\nconst collectPropertiesFromSource = (\n library: Library,\n source: GirClass,\n seen: Set<string>,\n entries: [string, string][],\n): void => {\n for (const property of source.properties) {\n const jsName = toCamelIdentifier(property.name);\n\n if (!property.introspectable || seen.has(jsName)) {\n continue;\n }\n\n seen.add(jsName);\n entries.push([jsName, propertyEntryLiteral(library, source, property)]);\n }\n};\n\nconst collectProperties = (library: Library, sources: GirClass[]): [string, string][] => {\n const seen: Set<string> = new Set();\n const entries: [string, string][] = [];\n\n for (const source of sources) {\n collectPropertiesFromSource(library, source, seen, entries);\n }\n\n return entries;\n};\n\nconst renderObjectLiteral = (entries: [string, string][], renderValue: (value: string) => string): string => {\n if (entries.length === 0) {\n return \"{}\";\n }\n\n const lines = entries.map(([key, value]) => ` ${sourceStringLiteral(key)}: ${renderValue(value)}`);\n\n return `{\\n${lines.join(\",\\n\")}\\n }`;\n};\n\nconst renderPropertiesObject = (entries: [string, string][]): string =>\n renderObjectLiteral(entries, (value) => value);\n\nconst renderSignalsObject = (entries: [string, string][]): string => renderObjectLiteral(entries, sourceStringLiteral);\n\nconst isDefaultCandidate = (property: GirProperty): boolean =>\n (property.writable || property.construct) && !property.constructOnly && property.introspectable;\n\nconst willSetterRejectNull = (library: Library, klass: GirClass, property: GirProperty): boolean => {\n if (property.setter === undefined) {\n return false;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return false;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value !== undefined && !value.parameter.nullable && !value.parameter.optional;\n};\n\nconst setterValueRef = (library: Library, klass: GirClass, property: GirProperty): TypeId | undefined => {\n if (property.setter === undefined) {\n return undefined;\n }\n\n const setter = klass.methods.find((method) => method.name === property.setter);\n\n if (setter === undefined) {\n return undefined;\n }\n\n const [value] = inputParameters(library, setter);\n\n return value?.parameter.type;\n};\n\nconst renderDefaultLiteral = (library: Library, klass: GirClass, property: GirProperty): string | undefined => {\n if (property.defaultValue === \"NULL\" && willSetterRejectNull(library, klass, property)) {\n return undefined;\n }\n\n const ref = setterValueRef(library, klass, property) ?? property.type;\n\n return resolveDefaultLiteral(library, ref, property.defaultValue);\n};\n\nconst resolveDefaultLiteral = (\n library: Library,\n ref: TypeId | undefined,\n raw: string | undefined,\n): string | undefined => {\n if (raw === undefined) {\n return undefined;\n }\n\n if (raw === \"NULL\") {\n return \"null\";\n }\n\n if (ref === undefined) {\n return undefined;\n }\n\n const resolved = library.typeFor(ref);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n return resolveTypeDefaultLiteral(library, resolved, raw);\n};\n\nconst resolveTypeDefaultLiteral = (library: Library, resolved: GirType, raw: string): string | undefined => {\n if (resolved.kind === \"primitive\") {\n return primitiveDefaultLiteral(resolved.category, raw);\n }\n\n if (resolved.kind === \"enum\") {\n return enumDefaultLiteral(resolved.value, raw);\n }\n\n if (resolved.kind === \"alias\") {\n return resolveDefaultLiteral(library, resolved.value.target, raw);\n }\n\n return undefined;\n};\n\nconst booleanDefaultLiteral = (raw: string): string | undefined => {\n if (raw === \"TRUE\") {\n return \"true\";\n }\n\n if (raw === \"FALSE\") {\n return \"false\";\n }\n\n return undefined;\n};\n\nconst integerDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n return INTEGER_PATTERN.test(trimmed) ? trimmed : undefined;\n};\n\nconst floatDefaultLiteral = (raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (!FLOAT_PATTERN.test(trimmed)) {\n return undefined;\n }\n\n const value = Number(trimmed);\n\n return Number.isFinite(value) ? String(value) : undefined;\n};\n\nconst primitiveDefaultLiteral = (category: PrimitiveCategory, raw: string): string | undefined => {\n switch (category) {\n case \"boolean\": {\n return booleanDefaultLiteral(raw);\n }\n case \"int8\":\n case \"int16\":\n case \"int32\":\n case \"uint8\":\n case \"uint16\":\n case \"uint32\":\n case \"int64\":\n case \"uint64\":\n case \"unichar\": {\n return integerDefaultLiteral(raw);\n }\n case \"float32\":\n case \"float64\": {\n return floatDefaultLiteral(raw);\n }\n case \"string\": {\n return sourceStringLiteral(raw);\n }\n case \"bigint64\":\n case \"biguint64\":\n case \"gtype\": {\n return bigintDefaultLiteral(raw);\n }\n case \"pointer\":\n case \"void\": {\n return undefined;\n }\n }\n};\n\nconst bigintDefaultLiteral = (raw: string): string | undefined => {\n const integer = integerDefaultLiteral(raw);\n\n return integer === undefined ? undefined : `${integer}n`;\n};\n\nconst enumDefaultLiteral = (enumType: GirEnum, raw: string): string | undefined => {\n const trimmed = raw.trim();\n\n if (INTEGER_PATTERN.test(trimmed)) {\n return trimmed;\n }\n\n const member = enumType.members.find((entry) => entry.cIdentifier === trimmed || entry.name === trimmed);\n\n return member?.value;\n};\n\nexport { generateMetadata };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-store.d.ts","sourceRoot":"","sources":["../../src/store/resolve-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD;;;GAGG;AACH,KAAK,aAAa,GAAG;IACjB,mFAAmF;IACnF,EAAE,EAAE,YAAY,CAAC;IACjB,0GAA0G;IAC1G,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;IACzB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAqCF,QAAA,MAAM,gBAAgB,GAAc,aAAa,MAAM,KAAG,SAAS,CAAC,MAAM,CAUzE,CAAC;AA6FF,QAAA,MAAM,sBAAsB,GAAI,aAAa,MAAM,KAAG,MAAM,EAS3D,CAAC;AASF,QAAA,MAAM,mBAAmB,GAAI,aAAa,MAAM,KAAG,IAMlD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,YAAY,GAAI,aAAa,MAAM,KAAG,aAW3C,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"resolve-store.d.ts","sourceRoot":"","sources":["../../src/store/resolve-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD;;;GAGG;AACH,KAAK,aAAa,GAAG;IACjB,mFAAmF;IACnF,EAAE,EAAE,YAAY,CAAC;IACjB,0GAA0G;IAC1G,GAAG,EAAE,YAAY,GAAG,IAAI,CAAC;IACzB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAsCF,QAAA,MAAM,gBAAgB,GAAc,aAAa,MAAM,KAAG,SAAS,CAAC,MAAM,CAUzE,CAAC;AA6FF,QAAA,MAAM,sBAAsB,GAAI,aAAa,MAAM,KAAG,MAAM,EAS3D,CAAC;AASF,QAAA,MAAM,mBAAmB,GAAI,aAAa,MAAM,KAAG,IAMlD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,YAAY,GAAI,aAAa,MAAM,KAAG,aAW3C,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,CAAC"}
@@ -9,6 +9,7 @@ const STORE_CONSUMERS = [
9
9
  "@gtkx/cli",
10
10
  "@gtkx/components",
11
11
  "@gtkx/css",
12
+ "@gtkx/navigation",
12
13
  "@gtkx/react",
13
14
  "@gtkx/runtime",
14
15
  "@gtkx/testing",