@gtkx/codegen 1.0.0 → 1.2.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.
- package/README.md +1 -1
- package/dist/analysis/descriptor-render.d.ts +12 -15
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +59 -38
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +25 -10
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +37 -9
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +4 -2
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +80 -38
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/interface-conflicts.d.ts +25 -0
- package/dist/analysis/interface-conflicts.d.ts.map +1 -0
- package/dist/analysis/interface-conflicts.js +139 -0
- package/dist/analysis/interface-conflicts.js.map +1 -0
- package/dist/analysis/param-capability.d.ts.map +1 -1
- package/dist/analysis/param-capability.js +3 -4
- package/dist/analysis/param-capability.js.map +1 -1
- package/dist/analysis/param-structure.js +2 -2
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +3 -2
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +26 -26
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/analysis/type-key.d.ts +5 -0
- package/dist/analysis/type-key.d.ts.map +1 -0
- package/dist/analysis/type-key.js +9 -0
- package/dist/analysis/type-key.js.map +1 -0
- package/dist/analysis/type-shape.d.ts +3 -2
- package/dist/analysis/type-shape.d.ts.map +1 -1
- package/dist/analysis/type-shape.js +2 -1
- package/dist/analysis/type-shape.js.map +1 -1
- package/dist/compile.d.ts +14 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +125 -24
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +2 -0
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +11 -10
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +5 -3
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/pipeline.d.ts +1 -0
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +93 -19
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +2 -1
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +5 -4
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +10 -9
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +20 -3
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +56 -37
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +1 -0
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +8 -2
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +7 -1
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +9 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +1 -2
- package/dist/gir/annotations.d.ts.map +1 -1
- package/dist/gir/annotations.js +1 -1
- package/dist/gir/annotations.js.map +1 -1
- package/dist/gir/cursor-overrides.d.ts +8 -0
- package/dist/gir/cursor-overrides.d.ts.map +1 -0
- package/dist/gir/cursor-overrides.js +6 -0
- package/dist/gir/cursor-overrides.js.map +1 -0
- package/dist/gir/emittable.d.ts +7 -0
- package/dist/gir/emittable.d.ts.map +1 -0
- package/dist/gir/emittable.js +3 -0
- package/dist/gir/emittable.js.map +1 -0
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +28 -2
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +1 -1
- package/dist/gir/gir-path.js +1 -1
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/library.d.ts +5 -1
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +9 -2
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +5 -1
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +4 -2
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +13 -1
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +1 -0
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +6 -6
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.js +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/guards.d.ts +16 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +11 -0
- package/dist/guards.js.map +1 -0
- package/dist/internal.d.ts +2 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -1
- package/dist/json.d.ts +3 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +11 -0
- package/dist/json.js.map +1 -0
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +8 -6
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +22 -7
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/parse.d.ts.map +1 -1
- package/dist/khronos/parse.js +3 -4
- package/dist/khronos/parse.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +1 -1
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +1 -7
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +1 -1
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +8 -4
- package/dist/khronos/render.js.map +1 -1
- package/dist/runner.d.ts +7 -1
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +21 -3
- package/dist/runner.js.map +1 -1
- package/dist/staging.d.ts +5 -0
- package/dist/staging.d.ts.map +1 -0
- package/dist/staging.js +57 -0
- package/dist/staging.js.map +1 -0
- package/dist/store/compile-store.d.ts +0 -1
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +7 -32
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callables.d.ts +6 -3
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +40 -30
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +9 -5
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +104 -44
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/companion.d.ts.map +1 -1
- package/dist/store/gi/companion.js +6 -6
- package/dist/store/gi/companion.js.map +1 -1
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +11 -3
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.js +1 -1
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +29 -12
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts +1 -3
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +24 -18
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +4 -1
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +34 -19
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/method.d.ts +7 -6
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +13 -24
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +3 -2
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +50 -5
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +21 -10
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts +2 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +6 -3
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +10 -8
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +49 -91
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts +8 -1
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +34 -13
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +20 -4
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts +6 -1
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +8 -1
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +19 -8
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.js +2 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.js +1 -1
- package/dist/store/gi/return-wrap.js.map +1 -1
- package/dist/store/gi/signal.d.ts +2 -1
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +55 -28
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +2 -1
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +4 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +60 -17
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +1 -0
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +15 -20
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/generated-elements.d.ts +2 -1
- package/dist/store/jsx/generated-elements.d.ts.map +1 -1
- package/dist/store/jsx/generated-elements.js +13 -7
- package/dist/store/jsx/generated-elements.js.map +1 -1
- package/dist/store/jsx/jsx.js +3 -3
- package/dist/store/jsx/jsx.js.map +1 -1
- package/dist/store/jsx/metadata.d.ts.map +1 -1
- package/dist/store/jsx/metadata.js +3 -1
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -4
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/resolve-store.d.ts +14 -3
- package/dist/store/resolve-store.d.ts.map +1 -1
- package/dist/store/resolve-store.js +98 -15
- package/dist/store/resolve-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +9 -7
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +54 -25
- package/dist/store/store-fs.js.map +1 -1
- package/dist/store/store-links.d.ts +3 -0
- package/dist/store/store-links.d.ts.map +1 -0
- package/dist/store/store-links.js +39 -0
- package/dist/store/store-links.js.map +1 -0
- package/dist/writer/comparison-context.d.ts +4 -0
- package/dist/writer/comparison-context.d.ts.map +1 -0
- package/dist/writer/comparison-context.js +13 -0
- package/dist/writer/comparison-context.js.map +1 -0
- package/dist/writer/context.d.ts +3 -3
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +11 -6
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/module.d.ts +13 -5
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +68 -11
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +8 -1
- package/dist/xml.d.ts.map +1 -1
- package/dist/xml.js +70 -1
- package/dist/xml.js.map +1 -1
- package/overrides/gobject/object.ts.ejs +2 -0
- package/package.json +14 -3
- package/src/analysis/descriptor-render.ts +106 -52
- package/src/analysis/descriptor.ts +76 -15
- package/src/analysis/inheritance.ts +134 -44
- package/src/analysis/interface-conflicts.ts +235 -0
- package/src/analysis/param-capability.ts +3 -6
- package/src/analysis/param-structure.ts +2 -2
- package/src/analysis/ts-type.ts +43 -28
- package/src/analysis/type-key.ts +14 -0
- package/src/analysis/type-shape.ts +5 -2
- package/src/compile.ts +192 -27
- package/src/docs/api-reference.ts +13 -10
- package/src/docs/element-page.ts +5 -2
- package/src/docs/pipeline.ts +140 -24
- package/src/docs/render.ts +7 -3
- package/src/docs/symbol-page.ts +12 -11
- package/src/fingerprint.ts +95 -47
- package/src/gi.ts +10 -2
- package/src/gir/ancestry.ts +17 -1
- package/src/gir/annotations.ts +1 -1
- package/src/gir/cursor-overrides.ts +12 -0
- package/src/gir/emittable.ts +8 -0
- package/src/gir/function.ts +45 -9
- package/src/gir/gir-path.ts +1 -1
- package/src/gir/library.ts +10 -2
- package/src/gir/namespace.ts +8 -2
- package/src/gir/parameter.ts +15 -0
- package/src/gir/parse.ts +10 -7
- package/src/gir/primitives.ts +1 -1
- package/src/guards.ts +23 -0
- package/src/internal.ts +2 -0
- package/src/json.ts +11 -0
- package/src/khronos/args.ts +9 -6
- package/src/khronos/modules.ts +25 -9
- package/src/khronos/parse.ts +3 -4
- package/src/khronos/pipeline.ts +1 -1
- package/src/khronos/plan.ts +0 -1
- package/src/khronos/render.ts +8 -6
- package/src/runner.ts +26 -4
- package/src/staging.ts +67 -0
- package/src/store/compile-store.ts +7 -38
- package/src/store/gi/callables.ts +60 -33
- package/src/store/gi/callback.ts +9 -9
- package/src/store/gi/class.ts +140 -53
- package/src/store/gi/companion.ts +7 -6
- package/src/store/gi/constant.ts +13 -3
- package/src/store/gi/constructor-props.ts +1 -1
- package/src/store/gi/enum.ts +36 -26
- package/src/store/gi/function.ts +30 -24
- package/src/store/gi/gtype-binding.ts +7 -2
- package/src/store/gi/interface.ts +39 -20
- package/src/store/gi/method.ts +26 -32
- package/src/store/gi/param-marshal.ts +77 -6
- package/src/store/gi/pipeline.ts +25 -15
- package/src/store/gi/properties.ts +8 -4
- package/src/store/gi/property-accessor.ts +73 -161
- package/src/store/gi/record-constructor.ts +53 -21
- package/src/store/gi/record-field-accessor.ts +26 -4
- package/src/store/gi/record-layout.ts +11 -1
- package/src/store/gi/record.ts +20 -12
- package/src/store/gi/registration.ts +2 -2
- package/src/store/gi/return-wrap.ts +1 -1
- package/src/store/gi/signal.ts +66 -42
- package/src/store/gi/value-marshalable.ts +3 -1
- package/src/store/gi/vtable.ts +97 -20
- package/src/store/gi-store.ts +26 -31
- package/src/store/jsx/generated-elements.ts +17 -8
- package/src/store/jsx/jsx.ts +3 -3
- package/src/store/jsx/metadata.ts +4 -1
- package/src/store/jsx-store.ts +3 -4
- package/src/store/resolve-store.ts +133 -18
- package/src/store/store-fs.ts +82 -35
- package/src/store/store-links.ts +49 -0
- package/src/writer/comparison-context.ts +18 -0
- package/src/writer/context.ts +12 -6
- package/src/writer/module.ts +101 -14
- package/src/xml.ts +103 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx.js","sourceRoot":"","sources":["../../../src/store/jsx/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EACH,4BAA4B,EAC5B,WAAW,EACX,gBAAgB,EAGhB,qBAAqB,EACr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S,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;IAElH,OAAO,GAAG,UAAU,aAAa,CAAC;AACtC,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { sourceStringLiteral } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport type { ImportsBuilder } from \"../../writer/imports.js\";\nimport { renderBlock } from \"../../writer/emit.js\";\nimport { getDoc } from \"../gi/doc-spec.js\";\nimport { elementPropTypeFor } from \"./element-prop-imports.js\";\nimport {\n collectInterfacePropsClasses,\n getGlibName,\n giNamespaceAlias,\n type GlibNamedClass,\n type HasContainerProps,\n hasInterfacePropsBody,\n newlyImplementedInterfaces,\n type ResolvedQualifiedInterface,\n} from \"./intrinsic-elements.js\";\nimport { buildElementPropsEntries, buildInterfacePropsEntries } from \"./props.js\";\n\ntype GenerateJsxOptions = {\n excludeNames: Set<string>;\n imports: ImportsBuilder;\n intrinsicElements: GlibNamedClass[];\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n};\n\ntype InterfaceBlockContext = {\n library: Library;\n targetNamespaceName: string;\n imports: ImportsBuilder;\n hasContainerProps: HasContainerProps;\n};\n\ntype RenderPropBlockContext = {\n isIntrinsicElementAncestor: (candidate: GirClass) => boolean;\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n targetNamespaceName: string;\n imports: ImportsBuilder;\n hasContainerProps: (glibName: string | undefined) => boolean;\n};\n\nconst ACCESSIBLE_INTERFACE_GLIB_NAME = \"GtkAccessible\";\nconst ACCESSIBLE_PROPS_NAME = \"AccessibleProps\";\n\nconst addGiNamespace = (imports: ImportsBuilder, namespaceName: string, alias: string): void => {\n if (namespaceName === \"\") {\n return;\n }\n\n imports.addNamespace(`@gtkx/gi/${namespaceName.toLowerCase()}`, alias, true);\n};\n\nconst addReactBuiltin = (imports: ImportsBuilder, name: string): void => {\n imports.addNamed(\"react\", name, true);\n};\n\nconst propLineName = (line: string): string | undefined => {\n const declaration = line.slice(line.lastIndexOf(\"\\n\") + 1);\n const name = declaration.split(/[?:]/, 1)[0]?.trim();\n\n return name === undefined || name === \"\" ? undefined : name;\n};\n\nconst acceptPropLine = (line: string, seen: Set<string>, result: string[]): void => {\n const name = propLineName(line);\n\n if (name !== undefined && seen.has(name)) {\n return;\n }\n\n if (name !== undefined) {\n seen.add(name);\n }\n\n result.push(line);\n};\n\nconst dedupePropLines = (lines: string[]): string[] => {\n const seen: Set<string> = new Set();\n const result: string[] = [];\n\n for (const line of lines) {\n acceptPropLine(line, seen, result);\n }\n\n return result;\n};\n\nconst generateJsxSection = (\n targetNamespace: GirNamespace,\n library: Library,\n options: GenerateJsxOptions,\n): { source: string; intrinsicCount: number } => {\n const { excludeNames, imports, intrinsicElements, intrinsicElementByGlibName } = options;\n const namespaceElements = intrinsicElements.filter((entry) => entry.namespace.name === targetNamespace.name);\n const intrinsicElementConsts = namespaceElements.filter((entry) => !excludeNames.has(entry.glibName));\n\n const constLines = intrinsicElementConsts.map(\n (entry) =>\n `${getDoc(entry.klass)}export const ${entry.glibName} = ` +\n `${sourceStringLiteral(entry.glibName)} as const;`,\n );\n\n const isIntrinsicElementAncestor = (candidate: GirClass): boolean => {\n const candidateGlib = getGlibName(candidate);\n\n return candidateGlib !== undefined && intrinsicElementByGlibName.has(candidateGlib);\n };\n\n addReactBuiltin(imports, \"ReactNode\");\n addReactBuiltin(imports, \"Ref\");\n const interfaceResult = renderInterfacePropBlocks(library, targetNamespace.name, options);\n let requiresReactElement = interfaceResult.requiresReactElement;\n const propBlocks: string[] = [...interfaceResult.blocks];\n\n const blockContext: RenderPropBlockContext = {\n isIntrinsicElementAncestor,\n intrinsicElementByGlibName,\n targetNamespaceName: targetNamespace.name,\n imports,\n hasContainerProps: interfaceResult.hasContainerProps,\n };\n\n for (const entry of namespaceElements) {\n const { block, objectPropNames } = renderPropBlock(library, entry, blockContext);\n\n if (objectPropNames.length > 0) {\n requiresReactElement = true;\n }\n\n propBlocks.push(block);\n }\n\n if (requiresReactElement) {\n addReactBuiltin(imports, \"ReactElement\");\n }\n\n const source = [\n constLines.join(\"\\n\\n\"),\n \"\",\n propBlocks.join(\"\\n\\n\"),\n \"\",\n renderJsxAugmentation(namespaceElements),\n ].join(\"\\n\");\n\n return { source, intrinsicCount: intrinsicElementConsts.length };\n};\n\nconst hasContainerProps: HasContainerProps = (glibName) =>\n glibName !== undefined && elementPropTypeFor(glibName) !== undefined;\n\nconst renderInterfacePropBlocks = (\n library: Library,\n targetNamespaceName: string,\n options: GenerateJsxOptions,\n): { blocks: string[]; requiresReactElement: boolean; hasContainerProps: HasContainerProps } => {\n const { imports, intrinsicElements } = options;\n const context: InterfaceBlockContext = { library, targetNamespaceName, imports, hasContainerProps };\n const blocks: string[] = [];\n let requiresReactElement = false;\n\n for (const iface of collectInterfacePropsClasses(\n library,\n intrinsicElements,\n targetNamespaceName,\n hasContainerProps,\n )) {\n const glibName = getGlibName(iface.klass);\n\n if (glibName === undefined) {\n continue;\n }\n\n const { block, objectPropNames } = renderInterfacePropsBlock(iface, glibName, context);\n\n if (objectPropNames.length > 0) {\n requiresReactElement = true;\n }\n\n blocks.push(block);\n }\n\n return { blocks, requiresReactElement, hasContainerProps };\n};\n\nconst registerCrossNsProps = (\n imports: ImportsBuilder,\n targetNamespaceName: string,\n namespaceName: string,\n propsName: string,\n): void => {\n if (namespaceName === targetNamespaceName) {\n return;\n }\n\n const ns = namespaceName.toLowerCase();\n imports.addNamed(`../${ns}/${ns}.js`, propsName, true);\n};\n\nconst interfacePropsRef = (\n iface: ResolvedQualifiedInterface,\n targetNamespaceName: string,\n imports: ImportsBuilder,\n): string | undefined => {\n const glib = getGlibName(iface.klass);\n\n if (glib === undefined) {\n return undefined;\n }\n\n registerCrossNsProps(imports, targetNamespaceName, iface.namespace.name, `${glib}Props`);\n\n return `${glib}Props<Self>`;\n};\n\nconst prerequisiteExtendRef = (\n prerequisiteName: string,\n iface: ResolvedQualifiedInterface,\n context: InterfaceBlockContext,\n): string | undefined => {\n const { library, targetNamespaceName, imports, hasContainerProps } = context;\n const resolved = library.resolveType(iface.namespace.name, prerequisiteName);\n\n if (resolved?.kind !== \"interface\") {\n return undefined;\n }\n\n if (!hasInterfacePropsBody(resolved.value, hasContainerProps)) {\n return undefined;\n }\n\n return interfacePropsRef({ klass: resolved.value, namespace: resolved.namespace }, targetNamespaceName, imports);\n};\n\nconst interfacePrerequisiteExtends = (iface: ResolvedQualifiedInterface, context: InterfaceBlockContext): string[] => {\n const refs: string[] = [];\n\n for (const prerequisiteName of iface.klass.prerequisites) {\n const ref = prerequisiteExtendRef(prerequisiteName, iface, context);\n\n if (ref !== undefined) {\n refs.push(ref);\n }\n }\n\n return refs;\n};\n\nconst renderInterfacePropsBlock = (\n iface: ResolvedQualifiedInterface,\n glib: string,\n context: InterfaceBlockContext,\n): { block: string; objectPropNames: string[] } => {\n const { library, imports } = context;\n\n const {\n propLines,\n imports: propImports,\n objectPropNames,\n } = buildInterfacePropsEntries({\n library,\n iface: iface.klass,\n namespace: iface.namespace,\n });\n\n for (const [namespace, alias] of propImports) {\n addGiNamespace(imports, namespace, alias);\n }\n\n const ownerLines = dedupePropLines(propLines);\n const prerequisiteExtends = interfacePrerequisiteExtends(iface, context);\n const declared = elementPropTypeFor(glib);\n\n if (declared !== undefined) {\n const alias = `${declared.export}Base`;\n imports.addNamed(declared.module, declared.export, true, alias);\n prerequisiteExtends.push(alias);\n }\n\n if (glib === ACCESSIBLE_INTERFACE_GLIB_NAME) {\n imports.addNamed(\"@gtkx/react\", ACCESSIBLE_PROPS_NAME, true);\n prerequisiteExtends.push(ACCESSIBLE_PROPS_NAME);\n }\n\n const extendsClause = prerequisiteExtends.length === 0 ? \"\" : ` extends ${prerequisiteExtends.join(\", \")}`;\n addGiNamespace(imports, iface.namespace.name, giNamespaceAlias(iface.namespace.name));\n const selfDefault = `${giNamespaceAlias(iface.namespace.name)}.${iface.klass.name}`;\n const signature = `export interface ${glib}Props<Self = ${selfDefault}>${extendsClause}`;\n const block = `${getDoc(iface.klass)}${renderBlock(signature, ownerLines.join(\"\\n\"))}`;\n\n return { block, objectPropNames };\n};\n\nconst renderJsxAugmentation = (namespaceElements: GlibNamedClass[]): string => {\n const elementLines = namespaceElements\n .filter((entry) => !entry.klass.isAbstract)\n .map((entry) => `${getDoc(entry.klass)}${entry.glibName}: ${entry.glibName}Props;`)\n .join(\"\\n\");\n\n const intrinsicInterface = renderBlock(\"interface IntrinsicElements\", elementLines);\n const reactJsxNamespace = renderBlock(\"namespace React.JSX\", intrinsicInterface);\n\n return renderBlock(\"declare global\", reactJsxNamespace);\n};\n\nconst renderPropBlock = (\n library: Library,\n entry: GlibNamedClass,\n context: RenderPropBlockContext,\n): { block: string; objectPropNames: string[] } => {\n const { propLines, imports, objectPropNames } = buildElementPropsEntries({\n library,\n klass: entry.klass,\n namespace: entry.namespace,\n isIntrinsicElementAncestor: context.isIntrinsicElementAncestor,\n });\n\n for (const [namespace, alias] of imports) {\n addGiNamespace(context.imports, namespace, alias);\n }\n\n addGiNamespace(context.imports, entry.namespace.name, giNamespaceAlias(entry.namespace.name));\n const ownerLines = dedupePropLines([\"ref?: Ref<Self | null> | undefined;\", ...propLines]);\n const extendsList = resolveElementExtends(library, entry, context);\n const extendsClause = extendsList.length === 0 ? \"\" : ` extends ${extendsList.join(\", \")}`;\n const selfDefault = `${giNamespaceAlias(entry.namespace.name)}.${entry.klass.name}`;\n\n const block = `${getDoc(entry.klass)}${renderBlock(\n `export interface ${entry.glibName}Props<Self = ${selfDefault}>${extendsClause}`,\n ownerLines.join(\"\\n\"),\n )}`;\n\n return { block, objectPropNames };\n};\n\nconst resolveElementExtends = (library: Library, entry: GlibNamedClass, context: RenderPropBlockContext): string[] => {\n const extendsList: string[] = [];\n const declared = elementPropTypeFor(entry.glibName);\n\n if (declared !== undefined) {\n const alias = `${declared.export}Base`;\n context.imports.addNamed(declared.module, declared.export, true, alias);\n extendsList.push(alias);\n }\n\n const parentRef = resolveParentPropsRef(library, entry, context);\n\n if (parentRef !== undefined) {\n extendsList.push(parentRef);\n }\n\n for (const iface of newlyImplementedInterfaces(entry.klass, entry.namespace, library, context.hasContainerProps)) {\n const ref = interfacePropsRef(iface, context.targetNamespaceName, context.imports);\n\n if (ref !== undefined) {\n extendsList.push(ref);\n }\n }\n\n return extendsList;\n};\n\nconst resolveParentClassLike = (library: Library, namespaceName: string, parent: string) => {\n const resolved = library.resolveType(namespaceName, parent);\n\n if (resolved === undefined) {\n return;\n }\n\n if (resolved.kind !== \"class\" && resolved.kind !== \"interface\") {\n return;\n }\n\n return resolved;\n};\n\nconst resolveParentPropsRef = (\n library: Library,\n entry: GlibNamedClass,\n context: RenderPropBlockContext,\n): string | undefined => {\n const parent = entry.klass.parent;\n\n if (parent === undefined) {\n return undefined;\n }\n\n const resolved = resolveParentClassLike(library, entry.namespace.name, parent);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const parentGlib = getGlibName(resolved.value);\n\n if (parentGlib === undefined) {\n return undefined;\n }\n\n if (!context.intrinsicElementByGlibName.has(parentGlib)) {\n return undefined;\n }\n\n registerCrossNsProps(context.imports, context.targetNamespaceName, resolved.namespace.name, `${parentGlib}Props`);\n\n return `${parentGlib}Props<Self>`;\n};\n\nexport { generateJsxSection };\n"]}
|
|
1
|
+
{"version":3,"file":"jsx.js","sourceRoot":"","sources":["../../../src/store/jsx/jsx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAK1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AAE,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE/E,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,UAAU,GAAG,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QACtD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,oBAAoB,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,GAAG,UAAU,OAAO,CAAC,CAAC;IAElH,OAAO,GAAG,UAAU,aAAa,CAAC;AACtC,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { sanitizeTypeIdentifier, sourceStringLiteral } from \"@gtkx/utils\";\nimport type { GirClass } from \"../../gir/class.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { GirNamespace } from \"../../gir/namespace.js\";\nimport type { ImportsBuilder } from \"../../writer/imports.js\";\nimport { renderBlock } from \"../../writer/emit.js\";\nimport { getDoc } from \"../gi/doc-spec.js\";\nimport { elementPropTypeFor } from \"./element-prop-imports.js\";\nimport {\n collectInterfacePropsClasses,\n getGlibName,\n giNamespaceAlias,\n type GlibNamedClass,\n type HasContainerProps,\n hasInterfacePropsBody,\n newlyImplementedInterfaces,\n type ResolvedQualifiedInterface,\n} from \"./intrinsic-elements.js\";\nimport { buildElementPropsEntries, buildInterfacePropsEntries } from \"./props.js\";\n\ntype GenerateJsxOptions = {\n excludeNames: Set<string>;\n imports: ImportsBuilder;\n intrinsicElements: GlibNamedClass[];\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n};\n\ntype InterfaceBlockContext = {\n library: Library;\n targetNamespaceName: string;\n imports: ImportsBuilder;\n hasContainerProps: HasContainerProps;\n};\n\ntype RenderPropBlockContext = {\n isIntrinsicElementAncestor: (candidate: GirClass) => boolean;\n intrinsicElementByGlibName: Map<string, GlibNamedClass>;\n targetNamespaceName: string;\n imports: ImportsBuilder;\n hasContainerProps: (glibName: string | undefined) => boolean;\n};\n\nconst ACCESSIBLE_INTERFACE_GLIB_NAME = \"GtkAccessible\";\nconst ACCESSIBLE_PROPS_NAME = \"AccessibleProps\";\n\nconst addGiNamespace = (imports: ImportsBuilder, namespaceName: string, alias: string): void => {\n if (namespaceName === \"\") {\n return;\n }\n\n imports.addNamespace(`@gtkx/gi/${namespaceName.toLowerCase()}`, alias, true);\n};\n\nconst addReactBuiltin = (imports: ImportsBuilder, name: string): void => {\n imports.addNamed(\"react\", name, true);\n};\n\nconst propLineName = (line: string): string | undefined => {\n const declaration = line.slice(line.lastIndexOf(\"\\n\") + 1);\n const name = declaration.split(/[?:]/, 1)[0]?.trim();\n\n return name === undefined || name === \"\" ? undefined : name;\n};\n\nconst acceptPropLine = (line: string, seen: Set<string>, result: string[]): void => {\n const name = propLineName(line);\n\n if (name !== undefined && seen.has(name)) {\n return;\n }\n\n if (name !== undefined) {\n seen.add(name);\n }\n\n result.push(line);\n};\n\nconst dedupePropLines = (lines: string[]): string[] => {\n const seen: Set<string> = new Set();\n const result: string[] = [];\n\n for (const line of lines) {\n acceptPropLine(line, seen, result);\n }\n\n return result;\n};\n\nconst generateJsxSection = (\n targetNamespace: GirNamespace,\n library: Library,\n options: GenerateJsxOptions,\n): { source: string; intrinsicCount: number } => {\n const { excludeNames, imports, intrinsicElements, intrinsicElementByGlibName } = options;\n const namespaceElements = intrinsicElements.filter((entry) => entry.namespace.name === targetNamespace.name);\n const intrinsicElementConsts = namespaceElements.filter((entry) => !excludeNames.has(entry.glibName));\n\n const constLines = intrinsicElementConsts.map(\n (entry) =>\n `${getDoc(entry.klass)}export const ${entry.glibName} = ` +\n `${sourceStringLiteral(entry.glibName)} as const;`,\n );\n\n const isIntrinsicElementAncestor = (candidate: GirClass): boolean => {\n const candidateGlib = getGlibName(candidate);\n\n return candidateGlib !== undefined && intrinsicElementByGlibName.has(candidateGlib);\n };\n\n addReactBuiltin(imports, \"ReactNode\");\n addReactBuiltin(imports, \"Ref\");\n const interfaceResult = renderInterfacePropBlocks(library, targetNamespace.name, options);\n let requiresReactElement = interfaceResult.requiresReactElement;\n const propBlocks: string[] = [...interfaceResult.blocks];\n\n const blockContext: RenderPropBlockContext = {\n isIntrinsicElementAncestor,\n intrinsicElementByGlibName,\n targetNamespaceName: targetNamespace.name,\n imports,\n hasContainerProps: interfaceResult.hasContainerProps,\n };\n\n for (const entry of namespaceElements) {\n const { block, objectPropNames } = renderPropBlock(library, entry, blockContext);\n\n if (objectPropNames.length > 0) {\n requiresReactElement = true;\n }\n\n propBlocks.push(block);\n }\n\n if (requiresReactElement) {\n addReactBuiltin(imports, \"ReactElement\");\n }\n\n const source = [\n constLines.join(\"\\n\\n\"),\n \"\",\n propBlocks.join(\"\\n\\n\"),\n \"\",\n renderJsxAugmentation(namespaceElements),\n ].join(\"\\n\");\n\n return { source, intrinsicCount: intrinsicElementConsts.length };\n};\n\nconst hasContainerProps: HasContainerProps = (glibName) =>\n glibName !== undefined && elementPropTypeFor(glibName) !== undefined;\n\nconst renderInterfacePropBlocks = (\n library: Library,\n targetNamespaceName: string,\n options: GenerateJsxOptions,\n): { blocks: string[]; requiresReactElement: boolean; hasContainerProps: HasContainerProps } => {\n const { imports, intrinsicElements } = options;\n const context: InterfaceBlockContext = { library, targetNamespaceName, imports, hasContainerProps };\n const blocks: string[] = [];\n let requiresReactElement = false;\n\n for (const iface of collectInterfacePropsClasses(\n library,\n intrinsicElements,\n targetNamespaceName,\n hasContainerProps,\n )) {\n const glibName = getGlibName(iface.klass);\n\n if (glibName === undefined) {\n continue;\n }\n\n const { block, objectPropNames } = renderInterfacePropsBlock(iface, glibName, context);\n\n if (objectPropNames.length > 0) {\n requiresReactElement = true;\n }\n\n blocks.push(block);\n }\n\n return { blocks, requiresReactElement, hasContainerProps };\n};\n\nconst registerCrossNsProps = (\n imports: ImportsBuilder,\n targetNamespaceName: string,\n namespaceName: string,\n propsName: string,\n): void => {\n if (namespaceName === targetNamespaceName) {\n return;\n }\n\n const ns = namespaceName.toLowerCase();\n imports.addNamed(`../${ns}/${ns}.js`, propsName, true);\n};\n\nconst interfacePropsRef = (\n iface: ResolvedQualifiedInterface,\n targetNamespaceName: string,\n imports: ImportsBuilder,\n): string | undefined => {\n const glib = getGlibName(iface.klass);\n\n if (glib === undefined) {\n return undefined;\n }\n\n registerCrossNsProps(imports, targetNamespaceName, iface.namespace.name, `${glib}Props`);\n\n return `${glib}Props<Self>`;\n};\n\nconst prerequisiteExtendRef = (\n prerequisiteName: string,\n iface: ResolvedQualifiedInterface,\n context: InterfaceBlockContext,\n): string | undefined => {\n const { library, targetNamespaceName, imports, hasContainerProps } = context;\n const resolved = library.resolveType(iface.namespace.name, prerequisiteName);\n\n if (resolved?.kind !== \"interface\") {\n return undefined;\n }\n\n if (!hasInterfacePropsBody(resolved.value, hasContainerProps)) {\n return undefined;\n }\n\n return interfacePropsRef({ klass: resolved.value, namespace: resolved.namespace }, targetNamespaceName, imports);\n};\n\nconst interfacePrerequisiteExtends = (iface: ResolvedQualifiedInterface, context: InterfaceBlockContext): string[] => {\n const refs: string[] = [];\n\n for (const prerequisiteName of iface.klass.prerequisites) {\n const ref = prerequisiteExtendRef(prerequisiteName, iface, context);\n\n if (ref !== undefined) {\n refs.push(ref);\n }\n }\n\n return refs;\n};\n\nconst renderInterfacePropsBlock = (\n iface: ResolvedQualifiedInterface,\n glib: string,\n context: InterfaceBlockContext,\n): { block: string; objectPropNames: string[] } => {\n const { library, imports } = context;\n\n const {\n propLines,\n imports: propImports,\n objectPropNames,\n } = buildInterfacePropsEntries({\n library,\n iface: iface.klass,\n namespace: iface.namespace,\n });\n\n for (const [namespace, alias] of propImports) {\n addGiNamespace(imports, namespace, alias);\n }\n\n const ownerLines = dedupePropLines(propLines);\n const prerequisiteExtends = interfacePrerequisiteExtends(iface, context);\n const declared = elementPropTypeFor(glib);\n\n if (declared !== undefined) {\n const alias = `${declared.export}Base`;\n imports.addNamed(declared.module, declared.export, true, alias);\n prerequisiteExtends.push(alias);\n }\n\n if (glib === ACCESSIBLE_INTERFACE_GLIB_NAME) {\n imports.addNamed(\"@gtkx/react\", ACCESSIBLE_PROPS_NAME, true);\n prerequisiteExtends.push(ACCESSIBLE_PROPS_NAME);\n }\n\n const extendsClause = prerequisiteExtends.length === 0 ? \"\" : ` extends ${prerequisiteExtends.join(\", \")}`;\n addGiNamespace(imports, iface.namespace.name, giNamespaceAlias(iface.namespace.name));\n const selfDefault = `${giNamespaceAlias(iface.namespace.name)}.${sanitizeTypeIdentifier(iface.klass.name)}`;\n const signature = `export interface ${glib}Props<Self = ${selfDefault}>${extendsClause}`;\n const block = `${getDoc(iface.klass)}${renderBlock(signature, ownerLines.join(\"\\n\"))}`;\n\n return { block, objectPropNames };\n};\n\nconst renderJsxAugmentation = (namespaceElements: GlibNamedClass[]): string => {\n const elementLines = namespaceElements\n .filter((entry) => !entry.klass.isAbstract)\n .map((entry) => `${getDoc(entry.klass)}${entry.glibName}: ${entry.glibName}Props;`)\n .join(\"\\n\");\n\n const intrinsicInterface = renderBlock(\"interface IntrinsicElements\", elementLines);\n const reactJsxNamespace = renderBlock(\"namespace React.JSX\", intrinsicInterface);\n\n return renderBlock(\"declare global\", reactJsxNamespace);\n};\n\nconst renderPropBlock = (\n library: Library,\n entry: GlibNamedClass,\n context: RenderPropBlockContext,\n): { block: string; objectPropNames: string[] } => {\n const { propLines, imports, objectPropNames } = buildElementPropsEntries({\n library,\n klass: entry.klass,\n namespace: entry.namespace,\n isIntrinsicElementAncestor: context.isIntrinsicElementAncestor,\n });\n\n for (const [namespace, alias] of imports) {\n addGiNamespace(context.imports, namespace, alias);\n }\n\n addGiNamespace(context.imports, entry.namespace.name, giNamespaceAlias(entry.namespace.name));\n const ownerLines = dedupePropLines([\"ref?: Ref<Self | null> | undefined;\", ...propLines]);\n const extendsList = resolveElementExtends(library, entry, context);\n const extendsClause = extendsList.length === 0 ? \"\" : ` extends ${extendsList.join(\", \")}`;\n const selfDefault = `${giNamespaceAlias(entry.namespace.name)}.${sanitizeTypeIdentifier(entry.klass.name)}`;\n\n const block = `${getDoc(entry.klass)}${renderBlock(\n `export interface ${entry.glibName}Props<Self = ${selfDefault}>${extendsClause}`,\n ownerLines.join(\"\\n\"),\n )}`;\n\n return { block, objectPropNames };\n};\n\nconst resolveElementExtends = (library: Library, entry: GlibNamedClass, context: RenderPropBlockContext): string[] => {\n const extendsList: string[] = [];\n const declared = elementPropTypeFor(entry.glibName);\n\n if (declared !== undefined) {\n const alias = `${declared.export}Base`;\n context.imports.addNamed(declared.module, declared.export, true, alias);\n extendsList.push(alias);\n }\n\n const parentRef = resolveParentPropsRef(library, entry, context);\n\n if (parentRef !== undefined) {\n extendsList.push(parentRef);\n }\n\n for (const iface of newlyImplementedInterfaces(entry.klass, entry.namespace, library, context.hasContainerProps)) {\n const ref = interfacePropsRef(iface, context.targetNamespaceName, context.imports);\n\n if (ref !== undefined) {\n extendsList.push(ref);\n }\n }\n\n return extendsList;\n};\n\nconst resolveParentClassLike = (library: Library, namespaceName: string, parent: string) => {\n const resolved = library.resolveType(namespaceName, parent);\n\n if (resolved === undefined) {\n return;\n }\n\n if (resolved.kind !== \"class\" && resolved.kind !== \"interface\") {\n return;\n }\n\n return resolved;\n};\n\nconst resolveParentPropsRef = (\n library: Library,\n entry: GlibNamedClass,\n context: RenderPropBlockContext,\n): string | undefined => {\n const parent = entry.klass.parent;\n\n if (parent === undefined) {\n return undefined;\n }\n\n const resolved = resolveParentClassLike(library, entry.namespace.name, parent);\n\n if (resolved === undefined) {\n return undefined;\n }\n\n const parentGlib = getGlibName(resolved.value);\n\n if (parentGlib === undefined) {\n return undefined;\n }\n\n if (!context.intrinsicElementByGlibName.has(parentGlib)) {\n return undefined;\n }\n\n registerCrossNsProps(context.imports, context.targetNamespaceName, resolved.namespace.name, `${parentGlib}Props`);\n\n return `${parentGlib}Props<Self>`;\n};\n\nexport { generateJsxSection };\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;
|
|
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"}
|
|
@@ -25,10 +25,12 @@ const generateMetadata = (library) => {
|
|
|
25
25
|
};
|
|
26
26
|
const collectIntrinsicElements = (library) => {
|
|
27
27
|
const entries = [];
|
|
28
|
+
const seen = new Set();
|
|
28
29
|
for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {
|
|
29
|
-
if (!isIntrinsicElementClass(klass, namespace, library)) {
|
|
30
|
+
if (!isIntrinsicElementClass(klass, namespace, library) || seen.has(glibName)) {
|
|
30
31
|
continue;
|
|
31
32
|
}
|
|
33
|
+
seen.add(glibName);
|
|
32
34
|
const sources = [
|
|
33
35
|
klass,
|
|
34
36
|
...implementedInterfaces(klass, namespace, library).map((entry) => entry.klass),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/store/jsx/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,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AAC;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,MAAM,oBAAoB,GAAG,CAAC,OAA2B,EAAU,EAAE,CACjE,mBAAmB,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,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\n for (const { glibName, klass, namespace } of iterateClassesWithGlibName(library)) {\n if (!isIntrinsicElementClass(klass, namespace, library)) {\n continue;\n }\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,aAAa,CAAC;AAOpF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAoB,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,iBAAiB,GACpB,MAAM,yBAAyB,CAAC;AAsBjC,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,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,MAAM,oBAAoB,GAAG,CAAC,OAA2B,EAAU,EAAE,CACjE,mBAAmB,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-store.d.ts","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,
|
|
1
|
+
{"version":3,"file":"jsx-store.d.ts","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAkC,KAAK,YAAY,EAA6B,MAAM,eAAe,CAAC;AAE7G,QAAA,MAAM,aAAa,GACf,SAAS,YAAY,EACrB,YAAY,gBAAgB,EAAE,EAC9B,UAAU,MAAM,EAChB,UAAU,OAAO,EAAE,KACpB,IAwBF,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/store/jsx-store.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { buildManifest, subpathExport, writeStore } from "./store-fs.js";
|
|
1
|
+
import { buildManifest, namespaceBarrel, subpathExport, writeStore } from "./store-fs.js";
|
|
2
2
|
const writeJsxStore = (options, namespaces, metadata, rawFiles) => {
|
|
3
3
|
const exportsMap = {
|
|
4
4
|
"./metadata": subpathExport("metadata"),
|
|
5
5
|
};
|
|
6
6
|
const files = [{ fileName: "metadata.ts", source: metadata }];
|
|
7
7
|
for (const { directory, source } of namespaces) {
|
|
8
|
-
files.push({ fileName: `${directory}/${directory}.tsx`, source });
|
|
9
|
-
exportsMap[`./${directory}`] = subpathExport(`${directory}
|
|
8
|
+
files.push({ fileName: `${directory}/${directory}.tsx`, source }, namespaceBarrel(directory));
|
|
9
|
+
exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);
|
|
10
10
|
}
|
|
11
11
|
writeStore({
|
|
12
12
|
storeDir: options.storeDir,
|
|
@@ -19,7 +19,6 @@ const writeJsxStore = (options, namespaces, metadata, rawFiles) => {
|
|
|
19
19
|
peerDependencies: { "@gtkx/gi": "*", "@gtkx/react": "*", react: "*" },
|
|
20
20
|
}),
|
|
21
21
|
rawFiles,
|
|
22
|
-
requiresEnvReference: true,
|
|
23
22
|
});
|
|
24
23
|
};
|
|
25
24
|
export { writeJsxStore };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsx-store.js","sourceRoot":"","sources":["../../src/store/jsx-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAqB,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ile } from \"./jsx/pipeline.js\";\nimport type { RawFile } from \"./store-fs.js\";\nimport { buildManifest, namespaceBarrel, type StoreOptions, subpathExport, writeStore } from \"./store-fs.js\";\n\nconst writeJsxStore = (\n options: StoreOptions,\n namespaces: JsxNamespaceFile[],\n metadata: string,\n rawFiles: RawFile[],\n): void => {\n const exportsMap: Record<string, unknown> = {\n \"./metadata\": subpathExport(\"metadata\"),\n };\n\n const files = [{ fileName: \"metadata.ts\", source: metadata }];\n\n for (const { directory, source } of namespaces) {\n files.push({ fileName: `${directory}/${directory}.tsx`, source }, namespaceBarrel(directory));\n exportsMap[`./${directory}`] = subpathExport(`${directory}/index`);\n }\n\n writeStore({\n storeDir: options.storeDir,\n linkDir: options.linkDir,\n files,\n manifest: buildManifest({\n name: \"@gtkx/jsx\",\n version: options.version,\n exports: exportsMap,\n peerDependencies: { \"@gtkx/gi\": \"*\", \"@gtkx/react\": \"*\", react: \"*\" },\n }),\n rawFiles,\n });\n};\n\nexport { writeJsxStore };\n"]}
|
|
@@ -11,18 +11,29 @@ type ResolvedStore = {
|
|
|
11
11
|
/** Subexport names of the installed `@gtkx/react`, empty when it is absent. */
|
|
12
12
|
reactSubexports: string[];
|
|
13
13
|
};
|
|
14
|
+
declare const getShadowingStorePaths: (projectRoot: string) => string[];
|
|
15
|
+
declare const sweepProjectStaging: (projectRoot: string) => void;
|
|
14
16
|
/**
|
|
15
17
|
* Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The
|
|
16
18
|
* result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has
|
|
17
19
|
* already resolved those can spread it straight into the call.
|
|
18
20
|
*
|
|
21
|
+
* Both stores go in one `node_modules`, found by walking the project's `node_modules` chain upwards:
|
|
22
|
+
* the one `@gtkx/react` resolves from, or `@gtkx/runtime`'s when no React is installed. That is the
|
|
23
|
+
* project's own directory when it installs those packages itself, and the workspace root when npm or
|
|
24
|
+
* yarn hoisted them there. Keeping the pair together is what lets the jsx store import the gi store, and
|
|
25
|
+
* anchoring them where the `@gtkx` packages sit is what lets `@gtkx/react`, the CLI, and the project's
|
|
26
|
+
* sources all reach the bindings. A package manager that hoists therefore gives every project sharing
|
|
27
|
+
* that `node_modules` one shared store.
|
|
28
|
+
*
|
|
19
29
|
* Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade
|
|
20
30
|
* invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.
|
|
21
31
|
*
|
|
22
|
-
* @param projectRoot Directory holding the project's `package.json
|
|
32
|
+
* @param projectRoot Directory holding the project's `package.json`, whose `node_modules` chain is walked.
|
|
23
33
|
* @returns The store locations and the React subexports that shape the jsx store.
|
|
24
|
-
* @throws If `@gtkx/runtime` cannot be resolved from the project
|
|
34
|
+
* @throws If `@gtkx/runtime` cannot be resolved from the project, or a `@gtkx` package that imports the
|
|
35
|
+
* bindings is installed above the `node_modules` the stores would go in, since it could not reach them.
|
|
25
36
|
*/
|
|
26
37
|
declare const resolveStore: (projectRoot: string) => ResolvedStore;
|
|
27
|
-
export { resolveStore, type ResolvedStore };
|
|
38
|
+
export { getShadowingStorePaths, resolveStore, sweepProjectStaging, type ResolvedStore };
|
|
28
39
|
//# sourceMappingURL=resolve-store.d.ts.map
|
|
@@ -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;
|
|
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;AA0IF,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,YAAY,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,CAAC"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
|
-
import { dirname, join, parse } from "node:path";
|
|
2
|
+
import { dirname, join, parse, relative, sep } from "node:path";
|
|
3
|
+
import { sweepStagingDirs } from "../staging.js";
|
|
3
4
|
const STORE_DIR = ".gtkx";
|
|
4
5
|
const SCOPE = "@gtkx";
|
|
6
|
+
const STORE_NAMES = ["gi", "jsx"];
|
|
7
|
+
const STORE_CONSUMERS = [
|
|
8
|
+
"@gtkx/cli",
|
|
9
|
+
"@gtkx/components",
|
|
10
|
+
"@gtkx/css",
|
|
11
|
+
"@gtkx/react",
|
|
12
|
+
"@gtkx/testing",
|
|
13
|
+
];
|
|
5
14
|
const readManifest = (path) => JSON.parse(readFileSync(path, "utf8"));
|
|
6
15
|
const subexportNames = (packageDir) => Object.keys(readManifest(join(packageDir, "package.json")).exports ?? {})
|
|
7
16
|
.filter((key) => key.startsWith("./") && key !== "./package.json")
|
|
8
17
|
.map((key) => key.slice(2));
|
|
9
|
-
const loadPackage = (manifest) => {
|
|
18
|
+
const loadPackage = (manifest, nodeModules) => {
|
|
10
19
|
if (!existsSync(manifest)) {
|
|
11
20
|
return null;
|
|
12
21
|
}
|
|
13
22
|
const real = realpathSync(manifest);
|
|
14
|
-
return { dir: dirname(real), version: readManifest(real).version ?? "0.0.0" };
|
|
23
|
+
return { dir: dirname(real), nodeModules, version: readManifest(real).version ?? "0.0.0" };
|
|
15
24
|
};
|
|
16
25
|
const nodeModulesChain = function* (projectRoot) {
|
|
17
26
|
const { root } = parse(projectRoot);
|
|
@@ -24,42 +33,116 @@ const nodeModulesChain = function* (projectRoot) {
|
|
|
24
33
|
};
|
|
25
34
|
const resolvePackage = (projectRoot, packageName) => {
|
|
26
35
|
for (const nodeModules of nodeModulesChain(projectRoot)) {
|
|
27
|
-
const found = loadPackage(join(nodeModules, packageName, "package.json"));
|
|
36
|
+
const found = loadPackage(join(nodeModules, packageName, "package.json"), nodeModules);
|
|
28
37
|
if (found !== null) {
|
|
29
38
|
return found;
|
|
30
39
|
}
|
|
31
40
|
}
|
|
32
|
-
|
|
41
|
+
const unscoped = packageName.replace(/^@[^/]+\//, "");
|
|
42
|
+
return loadPackage(join(projectRoot, "packages", unscoped, "package.json"), join(projectRoot, "node_modules"));
|
|
33
43
|
};
|
|
44
|
+
const isWithin = (parent, child) => {
|
|
45
|
+
const path = relative(parent, child);
|
|
46
|
+
return path === "" || (path !== ".." && !path.startsWith(`..${sep}`));
|
|
47
|
+
};
|
|
48
|
+
const canImport = (fromNodeModules, targetNodeModules) => isWithin(dirname(targetNodeModules), dirname(fromNodeModules));
|
|
34
49
|
const storeOptions = (nodeModules, name, version) => ({
|
|
35
50
|
storeDir: join(nodeModules, STORE_DIR, name),
|
|
36
51
|
linkDir: join(nodeModules, SCOPE, name),
|
|
37
52
|
version,
|
|
38
53
|
});
|
|
54
|
+
const resolveRuntime = (projectRoot) => {
|
|
55
|
+
const runtime = resolvePackage(projectRoot, "@gtkx/runtime");
|
|
56
|
+
if (runtime === null) {
|
|
57
|
+
throw new Error(`Cannot resolve @gtkx/runtime from ${projectRoot}; is it installed?`);
|
|
58
|
+
}
|
|
59
|
+
return runtime;
|
|
60
|
+
};
|
|
61
|
+
const storeNodeModules = (runtime, react) => {
|
|
62
|
+
if (react !== null && canImport(react.nodeModules, runtime.nodeModules)) {
|
|
63
|
+
return react.nodeModules;
|
|
64
|
+
}
|
|
65
|
+
return runtime.nodeModules;
|
|
66
|
+
};
|
|
67
|
+
const findUnreachableConsumer = (projectRoot, nodeModules) => {
|
|
68
|
+
for (const name of STORE_CONSUMERS) {
|
|
69
|
+
const consumer = resolvePackage(projectRoot, name);
|
|
70
|
+
if (consumer !== null && !canImport(consumer.nodeModules, nodeModules)) {
|
|
71
|
+
return { name, nodeModules: consumer.nodeModules };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
};
|
|
76
|
+
const unreachableConsumerMessage = (consumer, nodeModules) => `Cannot write the generated store to ${nodeModules}: ${consumer.name} is installed in ` +
|
|
77
|
+
`${consumer.nodeModules}, above it, so that copy can never import the generated @gtkx/gi. Install every ` +
|
|
78
|
+
"@gtkx package in one node_modules, then run gtkx codegen again.";
|
|
79
|
+
const checkConsumers = (projectRoot, nodeModules) => {
|
|
80
|
+
const consumer = findUnreachableConsumer(projectRoot, nodeModules);
|
|
81
|
+
if (consumer !== null) {
|
|
82
|
+
throw new Error(unreachableConsumerMessage(consumer, nodeModules));
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const jsxOptions = (react, nodeModules) => react === null ? null : storeOptions(nodeModules, "jsx", react.version);
|
|
86
|
+
const getReactSubexports = (react) => react === null ? [] : subexportNames(react.dir);
|
|
87
|
+
const storePaths = (nodeModules) => STORE_NAMES.flatMap((name) => [join(nodeModules, STORE_DIR, name), join(nodeModules, SCOPE, name)]);
|
|
88
|
+
const findStoreNodeModules = (projectRoot) => {
|
|
89
|
+
const runtime = resolvePackage(projectRoot, "@gtkx/runtime");
|
|
90
|
+
if (runtime === null) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return storeNodeModules(runtime, resolvePackage(projectRoot, "@gtkx/react"));
|
|
94
|
+
};
|
|
95
|
+
const getShadowingStorePaths = (projectRoot) => {
|
|
96
|
+
const nodeModules = join(projectRoot, "node_modules");
|
|
97
|
+
const anchored = findStoreNodeModules(projectRoot);
|
|
98
|
+
if (anchored === null || anchored === nodeModules) {
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
return storePaths(nodeModules);
|
|
102
|
+
};
|
|
103
|
+
const stagingRoots = (projectRoot) => {
|
|
104
|
+
const nodeModules = join(projectRoot, "node_modules");
|
|
105
|
+
const anchored = findStoreNodeModules(projectRoot);
|
|
106
|
+
return anchored === null || anchored === nodeModules ? [nodeModules] : [nodeModules, anchored];
|
|
107
|
+
};
|
|
108
|
+
const sweepProjectStaging = (projectRoot) => {
|
|
109
|
+
for (const nodeModules of stagingRoots(projectRoot)) {
|
|
110
|
+
for (const name of STORE_NAMES) {
|
|
111
|
+
sweepStagingDirs(join(nodeModules, STORE_DIR, name));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
39
115
|
/**
|
|
40
116
|
* Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The
|
|
41
117
|
* result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has
|
|
42
118
|
* already resolved those can spread it straight into the call.
|
|
43
119
|
*
|
|
120
|
+
* Both stores go in one `node_modules`, found by walking the project's `node_modules` chain upwards:
|
|
121
|
+
* the one `@gtkx/react` resolves from, or `@gtkx/runtime`'s when no React is installed. That is the
|
|
122
|
+
* project's own directory when it installs those packages itself, and the workspace root when npm or
|
|
123
|
+
* yarn hoisted them there. Keeping the pair together is what lets the jsx store import the gi store, and
|
|
124
|
+
* anchoring them where the `@gtkx` packages sit is what lets `@gtkx/react`, the CLI, and the project's
|
|
125
|
+
* sources all reach the bindings. A package manager that hoists therefore gives every project sharing
|
|
126
|
+
* that `node_modules` one shared store.
|
|
127
|
+
*
|
|
44
128
|
* Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade
|
|
45
129
|
* invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.
|
|
46
130
|
*
|
|
47
|
-
* @param projectRoot Directory holding the project's `package.json
|
|
131
|
+
* @param projectRoot Directory holding the project's `package.json`, whose `node_modules` chain is walked.
|
|
48
132
|
* @returns The store locations and the React subexports that shape the jsx store.
|
|
49
|
-
* @throws If `@gtkx/runtime` cannot be resolved from the project
|
|
133
|
+
* @throws If `@gtkx/runtime` cannot be resolved from the project, or a `@gtkx` package that imports the
|
|
134
|
+
* bindings is installed above the `node_modules` the stores would go in, since it could not reach them.
|
|
50
135
|
*/
|
|
51
136
|
const resolveStore = (projectRoot) => {
|
|
52
|
-
const runtime =
|
|
53
|
-
if (runtime === null) {
|
|
54
|
-
throw new Error(`Cannot resolve @gtkx/runtime from ${projectRoot}; is it installed?`);
|
|
55
|
-
}
|
|
137
|
+
const runtime = resolveRuntime(projectRoot);
|
|
56
138
|
const react = resolvePackage(projectRoot, "@gtkx/react");
|
|
57
|
-
const nodeModules =
|
|
139
|
+
const nodeModules = storeNodeModules(runtime, react);
|
|
140
|
+
checkConsumers(projectRoot, nodeModules);
|
|
58
141
|
return {
|
|
59
142
|
gi: storeOptions(nodeModules, "gi", runtime.version),
|
|
60
|
-
jsx: react
|
|
61
|
-
reactSubexports:
|
|
143
|
+
jsx: jsxOptions(react, nodeModules),
|
|
144
|
+
reactSubexports: getReactSubexports(react),
|
|
62
145
|
};
|
|
63
146
|
};
|
|
64
|
-
export { resolveStore };
|
|
147
|
+
export { getShadowingStorePaths, resolveStore, sweepProjectStaging };
|
|
65
148
|
//# sourceMappingURL=resolve-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-store.js","sourceRoot":"","sources":["../../src/store/resolve-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAkBjD,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1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O,CAAC,OAAO,CAAC;QACpD,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;QAC5E,eAAe,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC;KACnE,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAsB,CAAC","sourcesContent":["import { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join, parse } from \"node:path\";\nimport type { StoreOptions } from \"./store-fs.js\";\n\n/**\n * Where a project's generated stores live, ready to spread into `runCodegen`. `jsx` is null when the\n * project has no `@gtkx/react` installed, in which case only the `@gtkx/gi` store can be generated.\n */\ntype ResolvedStore = {\n /** Where the `@gtkx/gi` store goes, versioned by the installed `@gtkx/runtime`. */\n gi: StoreOptions;\n /** Where the `@gtkx/jsx` store goes, versioned by the installed `@gtkx/react`; null when it is absent. */\n jsx: StoreOptions | null;\n /** Subexport names of the installed `@gtkx/react`, empty when it is absent. */\n reactSubexports: string[];\n};\n\ntype ResolvedPackage = { dir: string; version: string };\n\nconst STORE_DIR = \".gtkx\";\nconst SCOPE = \"@gtkx\";\n\nconst readManifest = (path: string): { version?: string; exports?: Record<string, unknown> } =>\n JSON.parse(readFileSync(path, \"utf8\")) as { version?: string; exports?: Record<string, unknown> };\n\nconst subexportNames = (packageDir: string): string[] =>\n Object.keys(readManifest(join(packageDir, \"package.json\")).exports ?? {})\n .filter((key) => key.startsWith(\"./\") && key !== \"./package.json\")\n .map((key) => key.slice(2));\n\nconst loadPackage = (manifest: string): ResolvedPackage | null => {\n if (!existsSync(manifest)) {\n return null;\n }\n\n const real = realpathSync(manifest);\n\n return { dir: dirname(real), version: readManifest(real).version ?? \"0.0.0\" };\n};\n\nconst nodeModulesChain = function* (projectRoot: string): Generator<string> {\n const { root } = parse(projectRoot);\n let current = projectRoot;\n\n while (current !== root) {\n yield join(current, \"node_modules\");\n current = dirname(current);\n }\n\n yield join(root, \"node_modules\");\n};\n\nconst resolvePackage = (projectRoot: string, packageName: string): ResolvedPackage | null => {\n for (const nodeModules of nodeModulesChain(projectRoot)) {\n const found = loadPackage(join(nodeModules, packageName, \"package.json\"));\n\n if (found !== null) {\n return found;\n }\n }\n\n return loadPackage(join(projectRoot, \"packages\", packageName.replace(/^@[^/]+\\//, \"\"), \"package.json\"));\n};\n\nconst storeOptions = (nodeModules: string, name: string, version: string): StoreOptions => ({\n storeDir: join(nodeModules, STORE_DIR, name),\n linkDir: join(nodeModules, SCOPE, name),\n version,\n});\n\n/**\n * Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The\n * result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has\n * already resolved those can spread it straight into the call.\n *\n * Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade\n * invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.\n *\n * @param projectRoot Directory holding the project's `package.json` and `node_modules`.\n * @returns The store locations and the React subexports that shape the jsx store.\n * @throws If `@gtkx/runtime` cannot be resolved from the project.\n */\nconst resolveStore = (projectRoot: string): ResolvedStore => {\n const runtime = resolvePackage(projectRoot, \"@gtkx/runtime\");\n\n if (runtime === null) {\n throw new Error(`Cannot resolve @gtkx/runtime from ${projectRoot}; is it installed?`);\n }\n\n const react = resolvePackage(projectRoot, \"@gtkx/react\");\n const nodeModules = join(projectRoot, \"node_modules\");\n\n return {\n gi: storeOptions(nodeModules, \"gi\", runtime.version),\n jsx: react === null ? null : storeOptions(nodeModules, \"jsx\", react.version),\n reactSubexports: react === null ? [] : subexportNames(react.dir),\n };\n};\n\nexport { resolveStore, type ResolvedStore };\n"]}
|
|
1
|
+
{"version":3,"file":"resolve-store.js","sourceRoot":"","sources":["../../src/store/resolve-store.ts"],"names":[],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I,WAAW,EAAE,CAAC;YAC7B,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,YAAY,GAAG,CAAC,WAAmB,EAAiB,EAAE;IACxD,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,cAAc,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACrD,cAAc,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAEzC,OAAO;QACH,EAAE,EAAE,YAAY,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC;QACpD,GAAG,EAAE,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC;QACnC,eAAe,EAAE,kBAAkB,CAAC,KAAK,CAAC;KAC7C,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,mBAAmB,EAAsB,CAAC","sourcesContent":["import { existsSync, readFileSync, realpathSync } from \"node:fs\";\nimport { dirname, join, parse, relative, sep } from \"node:path\";\nimport type { StoreOptions } from \"./store-fs.js\";\nimport { sweepStagingDirs } from \"../staging.js\";\n\n/**\n * Where a project's generated stores live, ready to spread into `runCodegen`. `jsx` is null when the\n * project has no `@gtkx/react` installed, in which case only the `@gtkx/gi` store can be generated.\n */\ntype ResolvedStore = {\n /** Where the `@gtkx/gi` store goes, versioned by the installed `@gtkx/runtime`. */\n gi: StoreOptions;\n /** Where the `@gtkx/jsx` store goes, versioned by the installed `@gtkx/react`; null when it is absent. */\n jsx: StoreOptions | null;\n /** Subexport names of the installed `@gtkx/react`, empty when it is absent. */\n reactSubexports: string[];\n};\n\ntype ResolvedPackage = { dir: string; nodeModules: string; version: string };\ntype StoreConsumer = { name: string; nodeModules: string };\n\nconst STORE_DIR = \".gtkx\";\nconst SCOPE = \"@gtkx\";\nconst STORE_NAMES: string[] = [\"gi\", \"jsx\"];\n\nconst STORE_CONSUMERS: string[] = [\n \"@gtkx/cli\",\n \"@gtkx/components\",\n \"@gtkx/css\",\n \"@gtkx/react\",\n \"@gtkx/testing\",\n];\n\nconst readManifest = (path: string): { version?: string; exports?: Record<string, unknown> } =>\n JSON.parse(readFileSync(path, \"utf8\")) as { version?: string; exports?: Record<string, unknown> };\n\nconst subexportNames = (packageDir: string): string[] =>\n Object.keys(readManifest(join(packageDir, \"package.json\")).exports ?? {})\n .filter((key) => key.startsWith(\"./\") && key !== \"./package.json\")\n .map((key) => key.slice(2));\n\nconst loadPackage = (manifest: string, nodeModules: string): ResolvedPackage | null => {\n if (!existsSync(manifest)) {\n return null;\n }\n\n const real = realpathSync(manifest);\n\n return { dir: dirname(real), nodeModules, version: readManifest(real).version ?? \"0.0.0\" };\n};\n\nconst nodeModulesChain = function* (projectRoot: string): Generator<string> {\n const { root } = parse(projectRoot);\n let current = projectRoot;\n\n while (current !== root) {\n yield join(current, \"node_modules\");\n current = dirname(current);\n }\n\n yield join(root, \"node_modules\");\n};\n\nconst resolvePackage = (projectRoot: string, packageName: string): ResolvedPackage | null => {\n for (const nodeModules of nodeModulesChain(projectRoot)) {\n const found = loadPackage(join(nodeModules, packageName, \"package.json\"), nodeModules);\n\n if (found !== null) {\n return found;\n }\n }\n\n const unscoped = packageName.replace(/^@[^/]+\\//, \"\");\n\n return loadPackage(join(projectRoot, \"packages\", unscoped, \"package.json\"), join(projectRoot, \"node_modules\"));\n};\n\nconst isWithin = (parent: string, child: string): boolean => {\n const path = relative(parent, child);\n\n return path === \"\" || (path !== \"..\" && !path.startsWith(`..${sep}`));\n};\n\nconst canImport = (fromNodeModules: string, targetNodeModules: string): boolean =>\n isWithin(dirname(targetNodeModules), dirname(fromNodeModules));\n\nconst storeOptions = (nodeModules: string, name: string, version: string): StoreOptions => ({\n storeDir: join(nodeModules, STORE_DIR, name),\n linkDir: join(nodeModules, SCOPE, name),\n version,\n});\n\nconst resolveRuntime = (projectRoot: string): ResolvedPackage => {\n const runtime = resolvePackage(projectRoot, \"@gtkx/runtime\");\n\n if (runtime === null) {\n throw new Error(`Cannot resolve @gtkx/runtime from ${projectRoot}; is it installed?`);\n }\n\n return runtime;\n};\n\nconst storeNodeModules = (runtime: ResolvedPackage, react: ResolvedPackage | null): string => {\n if (react !== null && canImport(react.nodeModules, runtime.nodeModules)) {\n return react.nodeModules;\n }\n\n return runtime.nodeModules;\n};\n\nconst findUnreachableConsumer = (projectRoot: string, nodeModules: string): StoreConsumer | null => {\n for (const name of STORE_CONSUMERS) {\n const consumer = resolvePackage(projectRoot, name);\n\n if (consumer !== null && !canImport(consumer.nodeModules, nodeModules)) {\n return { name, nodeModules: consumer.nodeModules };\n }\n }\n\n return null;\n};\n\nconst unreachableConsumerMessage = (consumer: StoreConsumer, nodeModules: string): string =>\n `Cannot write the generated store to ${nodeModules}: ${consumer.name} is installed in ` +\n `${consumer.nodeModules}, above it, so that copy can never import the generated @gtkx/gi. Install every ` +\n \"@gtkx package in one node_modules, then run gtkx codegen again.\";\n\nconst checkConsumers = (projectRoot: string, nodeModules: string): void => {\n const consumer = findUnreachableConsumer(projectRoot, nodeModules);\n\n if (consumer !== null) {\n throw new Error(unreachableConsumerMessage(consumer, nodeModules));\n }\n};\n\nconst jsxOptions = (react: ResolvedPackage | null, nodeModules: string): StoreOptions | null =>\n react === null ? null : storeOptions(nodeModules, \"jsx\", react.version);\n\nconst getReactSubexports = (react: ResolvedPackage | null): string[] =>\n react === null ? [] : subexportNames(react.dir);\n\nconst storePaths = (nodeModules: string): string[] =>\n STORE_NAMES.flatMap((name) => [join(nodeModules, STORE_DIR, name), join(nodeModules, SCOPE, name)]);\n\nconst findStoreNodeModules = (projectRoot: string): string | null => {\n const runtime = resolvePackage(projectRoot, \"@gtkx/runtime\");\n\n if (runtime === null) {\n return null;\n }\n\n return storeNodeModules(runtime, resolvePackage(projectRoot, \"@gtkx/react\"));\n};\n\nconst getShadowingStorePaths = (projectRoot: string): string[] => {\n const nodeModules = join(projectRoot, \"node_modules\");\n const anchored = findStoreNodeModules(projectRoot);\n\n if (anchored === null || anchored === nodeModules) {\n return [];\n }\n\n return storePaths(nodeModules);\n};\n\nconst stagingRoots = (projectRoot: string): string[] => {\n const nodeModules = join(projectRoot, \"node_modules\");\n const anchored = findStoreNodeModules(projectRoot);\n\n return anchored === null || anchored === nodeModules ? [nodeModules] : [nodeModules, anchored];\n};\n\nconst sweepProjectStaging = (projectRoot: string): void => {\n for (const nodeModules of stagingRoots(projectRoot)) {\n for (const name of STORE_NAMES) {\n sweepStagingDirs(join(nodeModules, STORE_DIR, name));\n }\n }\n};\n\n/**\n * Resolves where a project's `@gtkx/gi` and `@gtkx/jsx` stores belong, from the project root alone. The\n * result supplies every `runCodegen` input except `libraries` and `girPath`, so a caller that has\n * already resolved those can spread it straight into the call.\n *\n * Both stores go in one `node_modules`, found by walking the project's `node_modules` chain upwards:\n * the one `@gtkx/react` resolves from, or `@gtkx/runtime`'s when no React is installed. That is the\n * project's own directory when it installs those packages itself, and the workspace root when npm or\n * yarn hoisted them there. Keeping the pair together is what lets the jsx store import the gi store, and\n * anchoring them where the `@gtkx` packages sit is what lets `@gtkx/react`, the CLI, and the project's\n * sources all reach the bindings. A package manager that hoists therefore gives every project sharing\n * that `node_modules` one shared store.\n *\n * Store versions come from the installed `@gtkx/runtime` and `@gtkx/react`, so a dependency upgrade\n * invalidates the stores. Pass explicit `gi` or `jsx` options to `runCodegen` to override any of it.\n *\n * @param projectRoot Directory holding the project's `package.json`, whose `node_modules` chain is walked.\n * @returns The store locations and the React subexports that shape the jsx store.\n * @throws If `@gtkx/runtime` cannot be resolved from the project, or a `@gtkx` package that imports the\n * bindings is installed above the `node_modules` the stores would go in, since it could not reach them.\n */\nconst resolveStore = (projectRoot: string): ResolvedStore => {\n const runtime = resolveRuntime(projectRoot);\n const react = resolvePackage(projectRoot, \"@gtkx/react\");\n const nodeModules = storeNodeModules(runtime, react);\n checkConsumers(projectRoot, nodeModules);\n\n return {\n gi: storeOptions(nodeModules, \"gi\", runtime.version),\n jsx: jsxOptions(react, nodeModules),\n reactSubexports: getReactSubexports(react),\n };\n};\n\nexport { getShadowingStorePaths, resolveStore, sweepProjectStaging, type ResolvedStore };\n"]}
|
package/dist/store/store-fs.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SourceModule } from "../compile.js";
|
|
1
2
|
/** Where one generated store is written and how it is reached. */
|
|
2
3
|
type StoreOptions = {
|
|
3
4
|
/** Directory the generated package is written to, replaced atomically on each run. */
|
|
@@ -7,10 +8,7 @@ type StoreOptions = {
|
|
|
7
8
|
/** Version stamped on the store's `package.json`, taken from the dependency the store is generated for. */
|
|
8
9
|
version: string;
|
|
9
10
|
};
|
|
10
|
-
type
|
|
11
|
-
fileName: string;
|
|
12
|
-
source: string;
|
|
13
|
-
};
|
|
11
|
+
type StoreLink = Pick<StoreOptions, "storeDir" | "linkDir">;
|
|
14
12
|
type Manifest = {
|
|
15
13
|
name: string;
|
|
16
14
|
type: "module";
|
|
@@ -32,16 +30,20 @@ type RawFile = {
|
|
|
32
30
|
type WriteStoreParams = {
|
|
33
31
|
storeDir: string;
|
|
34
32
|
linkDir: string;
|
|
35
|
-
files:
|
|
33
|
+
files: SourceModule[];
|
|
36
34
|
manifest: Manifest;
|
|
37
35
|
rawFiles?: RawFile[];
|
|
38
|
-
requiresEnvReference?: boolean;
|
|
39
36
|
};
|
|
40
37
|
declare const subpathExport: (stem: string) => {
|
|
41
38
|
types: string;
|
|
42
39
|
default: string;
|
|
43
40
|
};
|
|
41
|
+
declare const namespaceBarrel: (directory: string) => {
|
|
42
|
+
fileName: string;
|
|
43
|
+
source: string;
|
|
44
|
+
};
|
|
44
45
|
declare const buildManifest: (input: ManifestInput) => Manifest;
|
|
45
46
|
declare const writeStore: (params: WriteStoreParams) => void;
|
|
46
|
-
|
|
47
|
+
declare const ensureStoreLink: (link: StoreLink) => void;
|
|
48
|
+
export { subpathExport, buildManifest, ensureStoreLink, namespaceBarrel, writeStore, type StoreOptions, type RawFile, };
|
|
47
49
|
//# sourceMappingURL=store-fs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-fs.d.ts","sourceRoot":"","sources":["../../src/store/store-fs.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store-fs.d.ts","sourceRoot":"","sources":["../../src/store/store-fs.ts"],"names":[],"mappings":"AAYA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAIrE,kEAAkE;AAClE,KAAK,YAAY,GAAG;IAChB,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;IACjB,uGAAuG;IACvG,OAAO,EAAE,MAAM,CAAC;IAChB,2GAA2G;IAC3G,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,KAAK,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC;AAE5D,KAAK,QAAQ,GAAG;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,KAAK,O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