@gtkx/codegen 1.0.0-rc.4 → 1.1.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 +5 -5
- package/dist/analysis/descriptor-render.d.ts +13 -9
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +80 -50
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +16 -7
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +15 -3
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +4 -3
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +103 -58
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/interface-conflicts.d.ts +23 -0
- package/dist/analysis/interface-conflicts.d.ts.map +1 -0
- package/dist/analysis/interface-conflicts.js +144 -0
- package/dist/analysis/interface-conflicts.js.map +1 -0
- package/dist/analysis/nul-terminated-bytes.d.ts +5 -0
- package/dist/analysis/nul-terminated-bytes.d.ts.map +1 -0
- package/dist/analysis/nul-terminated-bytes.js +18 -0
- package/dist/analysis/nul-terminated-bytes.js.map +1 -0
- package/dist/analysis/param-capability.d.ts +5 -0
- package/dist/analysis/param-capability.d.ts.map +1 -0
- package/dist/analysis/param-capability.js +129 -0
- package/dist/analysis/param-capability.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +11 -4
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +42 -16
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +10 -17
- 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 +8 -0
- package/dist/analysis/type-shape.d.ts.map +1 -0
- package/dist/analysis/type-shape.js +12 -0
- package/dist/analysis/type-shape.js.map +1 -0
- package/dist/compile.d.ts +12 -3
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +73 -24
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +2 -2
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +17 -23
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +4 -4
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +36 -22
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/handwritten-props.d.ts +9 -0
- package/dist/docs/handwritten-props.d.ts.map +1 -0
- package/dist/docs/handwritten-props.js +149 -0
- package/dist/docs/handwritten-props.js.map +1 -0
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +87 -20
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +26 -5
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +88 -25
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +17 -0
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +132 -44
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +12 -1
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +44 -28
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts.map +1 -1
- package/dist/gi.js +1 -0
- package/dist/gi.js.map +1 -1
- package/dist/gir/ancestry.d.ts +8 -2
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +19 -1
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/annotations.d.ts +21 -0
- package/dist/gir/annotations.d.ts.map +1 -0
- package/dist/gir/annotations.js +15 -0
- package/dist/gir/annotations.js.map +1 -0
- package/dist/gir/callback.d.ts +1 -0
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +1 -0
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +32 -1
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +8 -3
- package/dist/gir/class.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/enum.d.ts +21 -1
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +9 -9
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +19 -3
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +7 -8
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +15 -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/libraries.d.ts +1 -3
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +0 -1
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +36 -0
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +35 -1
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +43 -1
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +8 -7
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +52 -1
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +8 -3
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +3 -1
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +9 -9
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +1 -0
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -0
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +3 -3
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +22 -0
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +3 -2
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +5 -4
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +35 -0
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +1 -0
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +1 -0
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +20 -0
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.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 +7 -6
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +28 -6
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/doc-context.d.ts +29 -0
- package/dist/khronos/doc-context.d.ts.map +1 -0
- package/dist/khronos/doc-context.js +29 -0
- package/dist/khronos/doc-context.js.map +1 -0
- package/dist/khronos/extensions.d.ts +13 -0
- package/dist/khronos/extensions.d.ts.map +1 -0
- package/dist/khronos/extensions.js +49 -0
- package/dist/khronos/extensions.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +17 -11
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +104 -46
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +42 -3
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +218 -63
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +9 -6
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +112 -27
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/notes.d.ts +19 -0
- package/dist/khronos/notes.d.ts.map +1 -0
- package/dist/khronos/notes.js +35 -0
- package/dist/khronos/notes.js.map +1 -0
- package/dist/khronos/param-pair.d.ts +1 -1
- package/dist/khronos/param-pair.d.ts.map +1 -1
- package/dist/khronos/param-pair.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 +4 -2
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +58 -27
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +3 -9
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +3 -3
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +8 -6
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +35 -26
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +21 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +47 -34
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +2 -2
- package/dist/react/element-config.d.ts.map +1 -1
- package/dist/react/element-config.js.map +1 -1
- package/dist/runner.d.ts +6 -8
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +16 -0
- 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 +1 -1
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +4 -2
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/callable-doc.d.ts +11 -0
- package/dist/store/gi/callable-doc.d.ts.map +1 -0
- package/dist/store/gi/callable-doc.js +62 -0
- package/dist/store/gi/callable-doc.js.map +1 -0
- package/dist/store/gi/callables.d.ts +9 -2
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +35 -40
- 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 +10 -6
- 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 +63 -40
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/closure-invocation.d.ts +4 -0
- package/dist/store/gi/closure-invocation.d.ts.map +1 -0
- package/dist/store/gi/closure-invocation.js +22 -0
- package/dist/store/gi/closure-invocation.js.map +1 -0
- 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 +12 -3
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +18 -20
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/doc-spec.d.ts +14 -0
- package/dist/store/gi/doc-spec.d.ts.map +1 -0
- package/dist/store/gi/doc-spec.js +23 -0
- package/dist/store/gi/doc-spec.js.map +1 -0
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +52 -19
- 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 +50 -29
- 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 +155 -26
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +3 -5
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +11 -2
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +80 -45
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +6 -2
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +54 -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 +23 -11
- 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 +7 -4
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +12 -5
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +98 -46
- 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 -11
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +3 -1
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +8 -3
- 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 +9 -2
- 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 +21 -9
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +1 -1
- package/dist/store/gi/registration.js +4 -4
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/runtime-override.d.ts +2 -1
- package/dist/store/gi/runtime-override.d.ts.map +1 -1
- package/dist/store/gi/runtime-override.js +8 -5
- package/dist/store/gi/runtime-override.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 +42 -37
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/value-marshalable.d.ts +1 -2
- package/dist/store/gi/value-marshalable.d.ts.map +1 -1
- package/dist/store/gi/value-marshalable.js +3 -2
- package/dist/store/gi/value-marshalable.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +19 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +257 -51
- 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/element-components.d.ts +1 -1
- package/dist/store/jsx/element-components.d.ts.map +1 -1
- package/dist/store/jsx/element-components.js +6 -4
- package/dist/store/jsx/element-components.js.map +1 -1
- package/dist/store/jsx/element-prop-imports.d.ts +1 -3
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-imports.js.map +1 -1
- package/dist/store/jsx/element-prop-types.d.ts +3 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -1
- package/dist/store/jsx/element-prop-types.js +7 -1
- package/dist/store/jsx/element-prop-types.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/intrinsic-elements.d.ts +4 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -1
- package/dist/store/jsx/intrinsic-elements.js.map +1 -1
- package/dist/store/jsx/jsx.d.ts.map +1 -1
- package/dist/store/jsx/jsx.js +10 -9
- 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 +5 -3
- package/dist/store/jsx/metadata.js.map +1 -1
- package/dist/store/jsx/pipeline.d.ts +1 -1
- package/dist/store/jsx/pipeline.d.ts.map +1 -1
- package/dist/store/jsx/pipeline.js.map +1 -1
- package/dist/store/jsx/props.d.ts +1 -7
- package/dist/store/jsx/props.d.ts.map +1 -1
- package/dist/store/jsx/props.js +14 -6
- package/dist/store/jsx/props.js.map +1 -1
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +3 -3
- 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 -6
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +59 -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 -2
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +11 -3
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc-tags.d.ts +21 -0
- package/dist/writer/doc-tags.d.ts.map +1 -0
- package/dist/writer/doc-tags.js +38 -0
- package/dist/writer/doc-tags.js.map +1 -0
- package/dist/writer/doc.d.ts +3 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +19 -6
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +1 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +64 -15
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/module.d.ts +17 -3
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +72 -3
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +7 -1
- package/dist/xml.d.ts.map +1 -1
- package/dist/xml.js +43 -1
- package/dist/xml.js.map +1 -1
- package/overrides/gdk/rgba.ts.ejs +26 -0
- package/overrides/gobject/object.ts.ejs +48 -3
- package/overrides/gobject/value.ts.ejs +7 -0
- package/overrides/graphene/structs.ts.ejs +55 -0
- package/package.json +15 -4
- package/src/analysis/descriptor-render.ts +130 -66
- package/src/analysis/descriptor.ts +35 -11
- package/src/analysis/inheritance.ts +166 -75
- package/src/analysis/interface-conflicts.ts +237 -0
- package/src/analysis/nul-terminated-bytes.ts +31 -0
- package/src/analysis/param-capability.ts +169 -0
- package/src/analysis/param-structure.ts +85 -25
- package/src/analysis/ts-type.ts +13 -17
- package/src/analysis/type-key.ts +14 -0
- package/src/analysis/type-shape.ts +24 -0
- package/src/compile.ts +110 -26
- package/src/docs/api-reference.ts +46 -34
- package/src/docs/element-page.ts +58 -49
- package/src/docs/handwritten-props.ts +230 -0
- package/src/docs/pipeline.ts +131 -21
- package/src/docs/render.ts +153 -35
- package/src/docs/symbol-page.ts +230 -80
- package/src/fingerprint.ts +86 -32
- package/src/gi.ts +1 -0
- package/src/gir/ancestry.ts +31 -1
- package/src/gir/annotations.ts +37 -0
- package/src/gir/callback.ts +2 -0
- package/src/gir/class.ts +42 -4
- package/src/gir/cursor-overrides.ts +12 -0
- package/src/gir/emittable.ts +8 -0
- package/src/gir/enum.ts +30 -10
- package/src/gir/field.ts +24 -9
- package/src/gir/function.ts +60 -9
- package/src/gir/libraries.ts +11 -3
- package/src/gir/library.ts +52 -3
- package/src/gir/namespace.ts +49 -7
- package/src/gir/parameter.ts +62 -3
- package/src/gir/parse.ts +13 -9
- package/src/gir/primitives.ts +1 -0
- package/src/gir/property.ts +18 -3
- package/src/gir/record.ts +24 -2
- package/src/gir/size.ts +8 -3
- package/src/gir/type-id.ts +49 -3
- package/src/gir/type-ref.ts +1 -0
- package/src/gir/type.ts +50 -6
- package/src/guards.ts +23 -0
- package/src/internal.ts +2 -0
- package/src/json.ts +11 -0
- package/src/khronos/args.ts +36 -13
- package/src/khronos/doc-context.ts +62 -0
- package/src/khronos/extensions.ts +85 -0
- package/src/khronos/jsdoc.ts +152 -56
- package/src/khronos/model.ts +314 -69
- package/src/khronos/modules.ts +150 -40
- package/src/khronos/notes.ts +74 -0
- package/src/khronos/param-pair.ts +1 -1
- package/src/khronos/parse.ts +3 -4
- package/src/khronos/pipeline.ts +95 -42
- package/src/khronos/plan.ts +4 -6
- package/src/khronos/render.ts +62 -50
- package/src/khronos/select.ts +91 -50
- package/src/react/element-config.ts +2 -2
- package/src/runner.ts +20 -9
- package/src/staging.ts +69 -0
- package/src/store/compile-store.ts +7 -5
- package/src/store/gi/callable-doc.ts +102 -0
- package/src/store/gi/callables.ts +58 -44
- package/src/store/gi/callback.ts +10 -9
- package/src/store/gi/class.ts +83 -49
- package/src/store/gi/closure-invocation.ts +26 -0
- package/src/store/gi/companion.ts +7 -6
- package/src/store/gi/constant.ts +14 -5
- package/src/store/gi/constructor-props.ts +19 -23
- package/src/store/gi/doc-spec.ts +38 -0
- package/src/store/gi/enum.ts +75 -26
- package/src/store/gi/function.ts +72 -44
- package/src/store/gi/gtype-binding.ts +7 -2
- package/src/store/gi/interface.ts +244 -37
- package/src/store/gi/item-comparators.ts +3 -5
- package/src/store/gi/method.ts +124 -69
- package/src/store/gi/param-marshal.ts +91 -6
- package/src/store/gi/pipeline.ts +28 -13
- package/src/store/gi/properties.ts +10 -5
- package/src/store/gi/property-accessor.ts +163 -75
- package/src/store/gi/record-constructor.ts +56 -19
- package/src/store/gi/record-field-accessor.ts +13 -4
- package/src/store/gi/record-layout.ts +12 -2
- package/src/store/gi/record.ts +24 -10
- package/src/store/gi/registration.ts +5 -5
- package/src/store/gi/runtime-override.ts +13 -6
- package/src/store/gi/signal.ts +54 -57
- package/src/store/gi/value-marshalable.ts +4 -2
- package/src/store/gi/vtable.ts +439 -61
- package/src/store/gi-store.ts +26 -31
- package/src/store/jsx/element-components.ts +8 -5
- package/src/store/jsx/element-prop-imports.ts +1 -3
- package/src/store/jsx/element-prop-types.ts +10 -1
- package/src/store/jsx/generated-elements.ts +17 -8
- package/src/store/jsx/intrinsic-elements.ts +4 -0
- package/src/store/jsx/jsx.ts +11 -9
- package/src/store/jsx/metadata.ts +6 -3
- package/src/store/jsx/pipeline.ts +1 -1
- package/src/store/jsx/props.ts +20 -7
- package/src/store/jsx-store.ts +3 -3
- package/src/store/resolve-store.ts +133 -18
- package/src/store/store-fs.ts +87 -34
- package/src/store/store-links.ts +49 -0
- package/src/writer/comparison-context.ts +18 -0
- package/src/writer/context.ts +14 -4
- package/src/writer/doc-tags.ts +70 -0
- package/src/writer/doc.ts +29 -6
- package/src/writer/gtk-doc.ts +82 -15
- package/src/writer/module.ts +114 -4
- package/src/xml.ts +61 -1
package/src/fingerprint.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { sortStrings } from "@gtkx/utils";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { type Dirent, existsSync, readdirSync, readFileSync } from "node:fs";
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
4
|
import { dirname, join, resolve } from "node:path";
|
|
6
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
+
import packageManifest from "../package.json" with { type: "json" };
|
|
7
|
+
import { arrayGuard, hasFields, isNumber, isString, optionalGuard } from "./guards.js";
|
|
8
|
+
import { readJsonFile } from "./json.js";
|
|
7
9
|
|
|
8
10
|
type GiFingerprint = {
|
|
9
11
|
value: string;
|
|
@@ -14,6 +16,17 @@ type GiFingerprint = {
|
|
|
14
16
|
|
|
15
17
|
type ModuleExport = { module: string; export: string };
|
|
16
18
|
|
|
19
|
+
type DocsFingerprintInput = {
|
|
20
|
+
basePath: string;
|
|
21
|
+
props: Record<string, ModuleExport>;
|
|
22
|
+
omittedProps: Record<string, string[]>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type DocsFingerprint = {
|
|
26
|
+
value: string;
|
|
27
|
+
gi: GiFingerprint;
|
|
28
|
+
};
|
|
29
|
+
|
|
17
30
|
type JsxFingerprintInput = {
|
|
18
31
|
reactVersion: string;
|
|
19
32
|
components: Record<string, ModuleExport>;
|
|
@@ -27,9 +40,8 @@ type JsxFingerprint = {
|
|
|
27
40
|
intrinsicElementCount: number;
|
|
28
41
|
};
|
|
29
42
|
|
|
30
|
-
const require = createRequire(import.meta.url);
|
|
31
43
|
const FINGERPRINT_FILENAME = ".codegen-fingerprint.json";
|
|
32
|
-
const CODEGEN_VERSION: string =
|
|
44
|
+
const CODEGEN_VERSION: string = packageManifest.version;
|
|
33
45
|
const OVERRIDES_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..", "overrides");
|
|
34
46
|
|
|
35
47
|
const sortAlpha = (values: string[]): string => sortStrings(values).join(",");
|
|
@@ -75,39 +87,87 @@ const computeGiFingerprint = (
|
|
|
75
87
|
girPath,
|
|
76
88
|
});
|
|
77
89
|
|
|
78
|
-
const
|
|
79
|
-
giStoreDir: string,
|
|
80
|
-
libraries: string[],
|
|
81
|
-
girPath: string[],
|
|
82
|
-
): boolean => {
|
|
83
|
-
const sentinelPath = join(giStoreDir, FINGERPRINT_FILENAME);
|
|
90
|
+
const readSentinel = (storeDir: string): unknown => readJsonFile(join(storeDir, FINGERPRINT_FILENAME));
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
const isGiFingerprint = (value: unknown): value is GiFingerprint =>
|
|
93
|
+
hasFields<GiFingerprint>(value, {
|
|
94
|
+
value: isString,
|
|
95
|
+
girFiles: arrayGuard(isString),
|
|
96
|
+
libraries: arrayGuard(isString),
|
|
97
|
+
girPath: optionalGuard(arrayGuard(isString)),
|
|
98
|
+
});
|
|
88
99
|
|
|
89
|
-
|
|
100
|
+
const isDocsFingerprint = (value: unknown): value is DocsFingerprint =>
|
|
101
|
+
hasFields<DocsFingerprint>(value, { value: isString, gi: isGiFingerprint });
|
|
90
102
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
} catch {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
103
|
+
const isJsxFingerprint = (value: unknown): value is JsxFingerprint =>
|
|
104
|
+
hasFields<JsxFingerprint>(value, { value: isString, intrinsicElementCount: isNumber });
|
|
96
105
|
|
|
106
|
+
const recordedGiValue = (sentinel: GiFingerprint, libraries: string[], girPath: string[]): string | undefined => {
|
|
97
107
|
if (!hasMatchingRecordedInputs(sentinel, libraries, girPath)) {
|
|
98
|
-
return
|
|
108
|
+
return undefined;
|
|
99
109
|
}
|
|
100
110
|
|
|
101
111
|
try {
|
|
102
|
-
return hashGi(sentinel.girFiles, sentinel.libraries, girPath)
|
|
112
|
+
return hashGi(sentinel.girFiles, sentinel.libraries, girPath);
|
|
103
113
|
} catch {
|
|
104
|
-
return
|
|
114
|
+
return undefined;
|
|
105
115
|
}
|
|
106
116
|
};
|
|
107
117
|
|
|
118
|
+
const isGiStoreFresh = (
|
|
119
|
+
giStoreDir: string,
|
|
120
|
+
libraries: string[],
|
|
121
|
+
girPath: string[],
|
|
122
|
+
): boolean => {
|
|
123
|
+
const sentinel = readSentinel(giStoreDir);
|
|
124
|
+
|
|
125
|
+
return isGiFingerprint(sentinel) && recordedGiValue(sentinel, libraries, girPath) === sentinel.value;
|
|
126
|
+
};
|
|
127
|
+
|
|
108
128
|
const hasMatchingRecordedInputs = (sentinel: GiFingerprint, libraries: string[], girPath: string[]): boolean =>
|
|
109
129
|
sortAlpha(sentinel.libraries) === sortAlpha(libraries) && sortAlpha(sentinel.girPath ?? []) === sortAlpha(girPath);
|
|
110
130
|
|
|
131
|
+
const hashDocs = (giValue: string, input: DocsFingerprintInput): string =>
|
|
132
|
+
createHash("sha256")
|
|
133
|
+
.update(
|
|
134
|
+
JSON.stringify([
|
|
135
|
+
giValue,
|
|
136
|
+
input.basePath,
|
|
137
|
+
serializeModuleExports(input.props),
|
|
138
|
+
serializeOmittedProps(input.omittedProps),
|
|
139
|
+
]),
|
|
140
|
+
)
|
|
141
|
+
.digest("hex");
|
|
142
|
+
|
|
143
|
+
const computeDocsFingerprint = (
|
|
144
|
+
girFiles: string[],
|
|
145
|
+
libraries: string[],
|
|
146
|
+
girPath: string[],
|
|
147
|
+
input: DocsFingerprintInput,
|
|
148
|
+
): DocsFingerprint => {
|
|
149
|
+
const gi = computeGiFingerprint(girFiles, libraries, girPath);
|
|
150
|
+
|
|
151
|
+
return { value: hashDocs(gi.value, input), gi };
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const isDocsOutputFresh = (
|
|
155
|
+
outDir: string,
|
|
156
|
+
libraries: string[],
|
|
157
|
+
girPath: string[],
|
|
158
|
+
input: DocsFingerprintInput,
|
|
159
|
+
): boolean => {
|
|
160
|
+
const sentinel = readSentinel(outDir);
|
|
161
|
+
|
|
162
|
+
if (!isDocsFingerprint(sentinel)) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const giValue = recordedGiValue(sentinel.gi, libraries, girPath);
|
|
167
|
+
|
|
168
|
+
return giValue !== undefined && hashDocs(giValue, input) === sentinel.value;
|
|
169
|
+
};
|
|
170
|
+
|
|
111
171
|
const serializeModuleExports = (map: Record<string, ModuleExport>): [string, string, string][] =>
|
|
112
172
|
sortStrings(Object.keys(map)).map((type) => [type, map[type]?.module ?? "", map[type]?.export ?? ""]);
|
|
113
173
|
|
|
@@ -137,17 +197,9 @@ const jsxStoreFreshness = (
|
|
|
137
197
|
jsxStoreDir: string,
|
|
138
198
|
input: JsxFingerprintInput,
|
|
139
199
|
): { isFresh: boolean; intrinsicElementCount: number } => {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
if (!existsSync(sentinelPath)) {
|
|
143
|
-
return { isFresh: false, intrinsicElementCount: 0 };
|
|
144
|
-
}
|
|
200
|
+
const sentinel = readSentinel(jsxStoreDir);
|
|
145
201
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
sentinel = JSON.parse(readFileSync(sentinelPath, "utf8")) as JsxFingerprint;
|
|
150
|
-
} catch {
|
|
202
|
+
if (!isJsxFingerprint(sentinel)) {
|
|
151
203
|
return { isFresh: false, intrinsicElementCount: 0 };
|
|
152
204
|
}
|
|
153
205
|
|
|
@@ -159,10 +211,12 @@ const jsxStoreFreshness = (
|
|
|
159
211
|
export {
|
|
160
212
|
FINGERPRINT_FILENAME,
|
|
161
213
|
computeGiFingerprint,
|
|
214
|
+
computeDocsFingerprint,
|
|
162
215
|
isGiStoreFresh,
|
|
216
|
+
isDocsOutputFresh,
|
|
163
217
|
computeJsxFingerprint,
|
|
164
218
|
jsxStoreFreshness,
|
|
219
|
+
type DocsFingerprintInput,
|
|
165
220
|
type GiFingerprint,
|
|
166
221
|
type JsxFingerprintInput,
|
|
167
|
-
type JsxFingerprint,
|
|
168
222
|
};
|
package/src/gi.ts
CHANGED
|
@@ -17,6 +17,7 @@ const runGiCodegen = (library: Library, options: GiCodegenOptions): number => {
|
|
|
17
17
|
const namespaces: GiNamespaceInput[] = Array.from(library.namespaces.values(), (namespace) => ({
|
|
18
18
|
directory: namespaceDirectory(namespace),
|
|
19
19
|
rawSource: generateNamespaceModule(namespace, library),
|
|
20
|
+
girFile: namespace.girFile,
|
|
20
21
|
}));
|
|
21
22
|
|
|
22
23
|
const fingerprint = computeGiFingerprint(library.girFiles, [...libraries], [...girPath]);
|
package/src/gir/ancestry.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import type { GirClass } from "./class.js";
|
|
2
2
|
import type { Library } from "./library.js";
|
|
3
3
|
import type { GirType } from "./type.js";
|
|
4
|
+
import { splitOptionalNamespace } from "./type-ref.js";
|
|
4
5
|
|
|
5
6
|
type ResolvedAncestor = {
|
|
6
7
|
klass: GirClass;
|
|
7
8
|
namespaceName: string;
|
|
8
9
|
};
|
|
9
10
|
|
|
11
|
+
type ParentRef = {
|
|
12
|
+
namespaceName: string | undefined;
|
|
13
|
+
typeName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getParentRef = (klass: GirClass): ParentRef | undefined => {
|
|
17
|
+
if (klass.parent === undefined) {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const [namespaceName, typeName] = splitOptionalNamespace(klass.parent);
|
|
22
|
+
|
|
23
|
+
return { namespaceName, typeName };
|
|
24
|
+
};
|
|
25
|
+
|
|
10
26
|
const getAncestor = (resolved: GirType | undefined): ResolvedAncestor | undefined =>
|
|
11
27
|
resolved !== undefined && (resolved.kind === "class" || resolved.kind === "interface")
|
|
12
28
|
? { klass: resolved.value, namespaceName: resolved.namespace.name }
|
|
@@ -28,6 +44,20 @@ const resolveInterface = (
|
|
|
28
44
|
return resolved?.kind === "interface" ? getAncestor(resolved) : undefined;
|
|
29
45
|
};
|
|
30
46
|
|
|
47
|
+
const resolveInterfaces = (library: Library, defaultNamespace: string, names: string[]): ResolvedAncestor[] => {
|
|
48
|
+
const interfaces: ResolvedAncestor[] = [];
|
|
49
|
+
|
|
50
|
+
for (const name of names) {
|
|
51
|
+
const iface = resolveInterface(library, defaultNamespace, name);
|
|
52
|
+
|
|
53
|
+
if (iface !== undefined) {
|
|
54
|
+
interfaces.push(iface);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return interfaces;
|
|
59
|
+
};
|
|
60
|
+
|
|
31
61
|
function* ancestorChain(library: Library, klass: GirClass, namespaceName: string): Generator<ResolvedAncestor> {
|
|
32
62
|
const visited: Set<string> = new Set();
|
|
33
63
|
let current: ResolvedAncestor | undefined = { klass, namespaceName };
|
|
@@ -50,4 +80,4 @@ function* ancestorChain(library: Library, klass: GirClass, namespaceName: string
|
|
|
50
80
|
}
|
|
51
81
|
}
|
|
52
82
|
|
|
53
|
-
export {
|
|
83
|
+
export { resolveClassOrInterface, resolveInterfaces, ancestorChain, getParentRef, type ResolvedAncestor };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { attr, getDoc, getDocDeprecated, isAttrTrue, nameAttr, type RawNode } from "./parse.js";
|
|
2
|
+
|
|
3
|
+
/** Release and deprecation annotations GIR carries on a documentable element. */
|
|
4
|
+
type GirAnnotations = {
|
|
5
|
+
/** Library release the symbol appeared in, from the `version` attribute. */
|
|
6
|
+
since: string | undefined;
|
|
7
|
+
/** Whether GIR marks the symbol deprecated. */
|
|
8
|
+
isDeprecated: boolean;
|
|
9
|
+
/** Release the symbol was deprecated in, from the `deprecated-version` attribute. */
|
|
10
|
+
deprecatedSince: string | undefined;
|
|
11
|
+
/** Prose from `<doc-deprecated>` naming what to use instead. */
|
|
12
|
+
deprecationDoc: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type DocumentedNode = {
|
|
16
|
+
name: string;
|
|
17
|
+
doc: string | undefined;
|
|
18
|
+
annotations: GirAnnotations;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const annotationsFromNode = (node: RawNode | undefined): GirAnnotations => ({
|
|
22
|
+
since: attr(node, "version"),
|
|
23
|
+
isDeprecated: isAttrTrue(node, "deprecated"),
|
|
24
|
+
deprecatedSince: attr(node, "deprecated-version"),
|
|
25
|
+
deprecationDoc: getDocDeprecated(node),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const documentedFromNode = (node: RawNode): DocumentedNode => ({
|
|
29
|
+
name: nameAttr(node),
|
|
30
|
+
doc: getDoc(node),
|
|
31
|
+
annotations: annotationsFromNode(node),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const hasAnnotations = (annotations: GirAnnotations): boolean =>
|
|
35
|
+
annotations.since !== undefined || annotations.isDeprecated || annotations.deprecatedSince !== undefined;
|
|
36
|
+
|
|
37
|
+
export { documentedFromNode, hasAnnotations, type GirAnnotations };
|
package/src/gir/callback.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { RawNode } from "./parse.js";
|
|
|
3
3
|
import type { ParseContext } from "./type-id.js";
|
|
4
4
|
import { type GirCallable, parseCallable } from "./parameter.js";
|
|
5
5
|
|
|
6
|
+
/** The signature of a function pointer type GIR declares, whether named or anonymous. */
|
|
6
7
|
type GirCallback = GirCallable;
|
|
7
8
|
|
|
8
9
|
const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback => parseCallable(node, context);
|
|
@@ -10,6 +11,7 @@ const callbackFromNode = (node: RawNode, context: ParseContext): GirCallback =>
|
|
|
10
11
|
const callbackAsFunction = (callback: GirCallback): GirFunction => ({
|
|
11
12
|
name: callback.name,
|
|
12
13
|
doc: callback.doc,
|
|
14
|
+
annotations: callback.annotations,
|
|
13
15
|
cIdentifier: undefined,
|
|
14
16
|
movedTo: undefined,
|
|
15
17
|
throws: callback.throws,
|
package/src/gir/class.ts
CHANGED
|
@@ -1,35 +1,72 @@
|
|
|
1
1
|
import type { ParseContext } from "./type-id.js";
|
|
2
|
+
import { documentedFromNode, type GirAnnotations } from "./annotations.js";
|
|
2
3
|
import { functionFromNode, type GirFunction } from "./function.js";
|
|
3
4
|
import { type GirCallable, parseCallable } from "./parameter.js";
|
|
4
|
-
import { attr, getChildren,
|
|
5
|
+
import { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue, type RawNode } from "./parse.js";
|
|
5
6
|
import { type GirProperty, propertyFromNode } from "./property.js";
|
|
6
7
|
|
|
8
|
+
/** A `<virtual-method>` on a class or interface: the vtable slot's own documentation and signature. */
|
|
9
|
+
type GirVirtualMethod = GirCallable & {
|
|
10
|
+
/** Method GIR names as invoking this slot, absent when the slot has no invoker. */
|
|
11
|
+
invoker: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** A `<class>` or `<interface>` declared by a GIR namespace. */
|
|
7
15
|
type GirClass = {
|
|
16
|
+
/** Name GIR gives the type, without its namespace prefix. */
|
|
8
17
|
name: string;
|
|
18
|
+
/** Documentation GIR carries for the type. */
|
|
9
19
|
doc: string | undefined;
|
|
20
|
+
/** Release and deprecation annotations GIR carries on the type. */
|
|
21
|
+
annotations: GirAnnotations;
|
|
22
|
+
/** C type of an instance, such as `GtkWidget`. */
|
|
10
23
|
cType: string | undefined;
|
|
24
|
+
/** The class it derives from, qualified when it lives in another namespace. */
|
|
11
25
|
parent: string | undefined;
|
|
26
|
+
/** GType name the type registers under, such as `GtkWidget`. */
|
|
12
27
|
glibTypeName: string | undefined;
|
|
28
|
+
/** C function returning the GType, such as `gtk_widget_get_type`. */
|
|
13
29
|
glibGetType: string | undefined;
|
|
30
|
+
/** Record holding the class or interface vtable, which virtual method bindings are laid out against. */
|
|
14
31
|
glibTypeStruct: string | undefined;
|
|
32
|
+
/** C function that takes a reference, on a type that manages its own refcount. */
|
|
15
33
|
glibRefFunc: string | undefined;
|
|
34
|
+
/** C function that drops a reference, on a type that manages its own refcount. */
|
|
16
35
|
glibUnrefFunc: string | undefined;
|
|
36
|
+
/** Whether the type is its own GType fundamental rather than a GObject descendant. */
|
|
17
37
|
fundamental: boolean;
|
|
38
|
+
/** Whether the class cannot be instantiated on its own. */
|
|
18
39
|
isAbstract: boolean;
|
|
40
|
+
/** Whether the type came from an `<interface>` rather than a `<class>`. */
|
|
19
41
|
isInterface: boolean;
|
|
42
|
+
/** Whether GIR exposes the type to bindings; codegen skips it when false. */
|
|
20
43
|
introspectable: boolean;
|
|
44
|
+
/** Interfaces the class implements. */
|
|
21
45
|
implements: string[];
|
|
46
|
+
/** Types an implementer of this interface must also provide. */
|
|
22
47
|
prerequisites: string[];
|
|
48
|
+
/** Methods taking an instance. */
|
|
23
49
|
methods: GirFunction[];
|
|
50
|
+
/** Functions returning a new instance. */
|
|
24
51
|
constructors: GirFunction[];
|
|
52
|
+
/** Functions namespaced under the type that take no instance. */
|
|
25
53
|
functions: GirFunction[];
|
|
54
|
+
/** GObject properties the type declares. */
|
|
26
55
|
properties: GirProperty[];
|
|
56
|
+
/** GObject signals the type declares. */
|
|
27
57
|
signals: GirCallable[];
|
|
58
|
+
/** Virtual methods the type declares, carrying the documentation their vtable slots are generated from. */
|
|
59
|
+
vfuncs: GirVirtualMethod[];
|
|
28
60
|
};
|
|
29
61
|
|
|
62
|
+
const virtualMethodsFromNode = (node: RawNode, context: ParseContext): GirVirtualMethod[] =>
|
|
63
|
+
getChildren(node, "virtual-method").map((vfunc) => ({
|
|
64
|
+
...parseCallable(vfunc, context),
|
|
65
|
+
invoker: attr(vfunc, "invoker"),
|
|
66
|
+
}));
|
|
67
|
+
|
|
30
68
|
const classFromNode = (node: RawNode, isInterface: boolean, context: ParseContext): GirClass => ({
|
|
31
|
-
|
|
32
|
-
doc: getDoc(node),
|
|
69
|
+
...documentedFromNode(node),
|
|
33
70
|
cType: attr(node, "c:type"),
|
|
34
71
|
parent: attr(node, "parent"),
|
|
35
72
|
glibTypeName: attr(node, "glib:type-name"),
|
|
@@ -52,6 +89,7 @@ const classFromNode = (node: RawNode, isInterface: boolean, context: ParseContex
|
|
|
52
89
|
functions: getChildren(node, "function").map((fn) => functionFromNode(fn, context)),
|
|
53
90
|
properties: getChildren(node, "property").map((property) => propertyFromNode(property, context)),
|
|
54
91
|
signals: getChildren(node, "glib:signal").map((signal) => parseCallable(signal, context)),
|
|
92
|
+
vfuncs: virtualMethodsFromNode(node, context),
|
|
55
93
|
});
|
|
56
94
|
|
|
57
|
-
export { classFromNode, type GirClass };
|
|
95
|
+
export { classFromNode, type GirClass, type GirVirtualMethod };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type CursorParameterNames = {
|
|
2
|
+
cursor: string;
|
|
3
|
+
base: string;
|
|
4
|
+
length: string;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
const PARAMETERS_MISSING_ARRAY_EXTENT: Map<string, CursorParameterNames[]> = new Map([
|
|
8
|
+
["g_utf8_validate", [{ cursor: "end", base: "str", length: "max_len" }]],
|
|
9
|
+
["g_utf8_validate_len", [{ cursor: "end", base: "str", length: "max_len" }]],
|
|
10
|
+
]);
|
|
11
|
+
|
|
12
|
+
export { PARAMETERS_MISSING_ARRAY_EXTENT, type CursorParameterNames };
|
package/src/gir/enum.ts
CHANGED
|
@@ -1,39 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { documentedFromNode, type GirAnnotations } from "./annotations.js";
|
|
2
|
+
import { attr, getChildren, isAttrTrue, type RawNode } from "./parse.js";
|
|
2
3
|
|
|
4
|
+
/** One member of a {@link GirEnum}. */
|
|
3
5
|
type EnumMember = {
|
|
6
|
+
/** The member's GIR name, which the emitted key is derived from. */
|
|
4
7
|
name: string;
|
|
8
|
+
/** Documentation prose from GIR, emitted as the member's JSDoc. */
|
|
5
9
|
doc: string | undefined;
|
|
10
|
+
/** Release and deprecation annotations GIR carries on the member. */
|
|
11
|
+
annotations: GirAnnotations;
|
|
12
|
+
/** The member's numeric value, `0` when GIR declares none. */
|
|
6
13
|
value: string;
|
|
14
|
+
/** C constant the member is exposed as, such as `GTK_ORIENTATION_HORIZONTAL`. */
|
|
7
15
|
cIdentifier: string | undefined;
|
|
8
16
|
};
|
|
9
17
|
|
|
18
|
+
/** Whether an enum is a plain enumeration or a bitfield of flags. */
|
|
10
19
|
type EnumKind = "enumeration" | "bitfield";
|
|
11
20
|
|
|
21
|
+
/** An enumeration or bitfield declared by a GIR namespace. */
|
|
12
22
|
type GirEnum = {
|
|
23
|
+
/** Whether the declaration is a plain enumeration or a bitfield. */
|
|
13
24
|
kind: EnumKind;
|
|
25
|
+
/** Name the enum is exported under, without its namespace prefix. */
|
|
14
26
|
name: string;
|
|
27
|
+
/** Documentation prose from GIR, emitted as the enum's JSDoc. */
|
|
15
28
|
doc: string | undefined;
|
|
29
|
+
/** Release and deprecation annotations GIR carries on the enum. */
|
|
30
|
+
annotations: GirAnnotations;
|
|
31
|
+
/** GType name of the enum, absent when it is not registered with GLib. */
|
|
16
32
|
glibTypeName: string | undefined;
|
|
33
|
+
/** C function returning the enum's GType, absent when it is not registered with GLib. */
|
|
17
34
|
glibGetType: string | undefined;
|
|
35
|
+
/** Quark name of the GError domain the members are codes of, absent on enums that carry no domain. */
|
|
18
36
|
errorDomain: string | undefined;
|
|
37
|
+
/** Whether the enum is introspectable; code generation skips the ones that are not. */
|
|
19
38
|
introspectable: boolean;
|
|
39
|
+
/** The enum's members, in declaration order. */
|
|
20
40
|
members: EnumMember[];
|
|
21
41
|
};
|
|
22
42
|
|
|
43
|
+
const enumMemberFromNode = (node: RawNode): EnumMember => ({
|
|
44
|
+
...documentedFromNode(node),
|
|
45
|
+
value: attr(node, "value") ?? "0",
|
|
46
|
+
cIdentifier: attr(node, "c:identifier"),
|
|
47
|
+
});
|
|
48
|
+
|
|
23
49
|
const enumFromNode = (node: RawNode, kind: EnumKind): GirEnum => ({
|
|
24
50
|
kind,
|
|
25
|
-
|
|
26
|
-
doc: getDoc(node),
|
|
51
|
+
...documentedFromNode(node),
|
|
27
52
|
glibTypeName: attr(node, "glib:type-name"),
|
|
28
53
|
glibGetType: attr(node, "glib:get-type"),
|
|
29
54
|
errorDomain: attr(node, "glib:error-domain"),
|
|
30
55
|
introspectable: isAttrTrue(node, "introspectable", true),
|
|
31
|
-
members: getChildren(node, "member").map((member) => (
|
|
32
|
-
name: nameAttr(member),
|
|
33
|
-
doc: getDoc(member),
|
|
34
|
-
value: attr(member, "value") ?? "0",
|
|
35
|
-
cIdentifier: attr(member, "c:identifier"),
|
|
36
|
-
})),
|
|
56
|
+
members: getChildren(node, "member").map((member) => enumMemberFromNode(member)),
|
|
37
57
|
});
|
|
38
58
|
|
|
39
|
-
export { enumFromNode, type GirEnum };
|
|
59
|
+
export { enumFromNode, type EnumMember, type GirEnum };
|
package/src/gir/field.ts
CHANGED
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import type { ParseContext, TypeId } from "./type-id.js";
|
|
2
|
-
import {
|
|
2
|
+
import { documentedFromNode, type GirAnnotations } from "./annotations.js";
|
|
3
|
+
import { attr, getChild, getChildren, intAttr, isAttrTrue, type RawNode } from "./parse.js";
|
|
3
4
|
import { typeRefFromNode } from "./type-ref.js";
|
|
4
5
|
|
|
6
|
+
/**
|
|
7
|
+
* One slot in a record or union layout: a named field, or a nested struct or union
|
|
8
|
+
* whose own members are laid out inline.
|
|
9
|
+
*/
|
|
5
10
|
type GirField = {
|
|
11
|
+
/** Field name as GIR spells it. */
|
|
6
12
|
name: string;
|
|
13
|
+
/** Documentation prose from GIR, emitted as the field accessor's JSDoc. */
|
|
7
14
|
doc: string | undefined;
|
|
15
|
+
/** Release and deprecation annotations GIR carries on the field. */
|
|
16
|
+
annotations: GirAnnotations;
|
|
17
|
+
/** The field's value type, absent for a nested struct or union and for one GIR leaves undeclared. */
|
|
8
18
|
type: TypeId | undefined;
|
|
19
|
+
/** The C type spelled on the field, which decides whether it is read through a pointer. */
|
|
9
20
|
cType: string | undefined;
|
|
21
|
+
/** Whether the field can be read; one that is neither readable nor writable gets no accessor at all. */
|
|
10
22
|
readable: boolean;
|
|
23
|
+
/** Whether the field can be written, which is what earns it a setter alongside its getter. */
|
|
11
24
|
writable: boolean;
|
|
25
|
+
/** Whether the field is private to the library, as every nested struct or union is. */
|
|
12
26
|
private: boolean;
|
|
27
|
+
/** Width in bits when the field is a C bitfield member. */
|
|
13
28
|
bits: number | undefined;
|
|
29
|
+
/** Members of a nested struct or union, absent for a named field. */
|
|
14
30
|
inlineMembers: GirField[] | undefined;
|
|
15
|
-
|
|
31
|
+
/** Whether {@link GirField.inlineMembers} overlap as a union rather than following one another as a struct. */
|
|
32
|
+
isInlineUnion: boolean;
|
|
16
33
|
};
|
|
17
34
|
|
|
18
35
|
const fieldFromNode = (node: RawNode, context: ParseContext): GirField => ({
|
|
19
|
-
|
|
20
|
-
doc: getDoc(node),
|
|
36
|
+
...documentedFromNode(node),
|
|
21
37
|
type: typeRefFromNode(node, context),
|
|
22
38
|
cType: attr(getChild(node, "type"), "c:type"),
|
|
23
39
|
readable: isAttrTrue(node, "readable", true),
|
|
@@ -25,12 +41,11 @@ const fieldFromNode = (node: RawNode, context: ParseContext): GirField => ({
|
|
|
25
41
|
private: isAttrTrue(node, "private", false),
|
|
26
42
|
bits: intAttr(node, "bits"),
|
|
27
43
|
inlineMembers: undefined,
|
|
28
|
-
|
|
44
|
+
isInlineUnion: false,
|
|
29
45
|
});
|
|
30
46
|
|
|
31
47
|
const anonymousMemberFromNode = (node: RawNode, isUnion: boolean, context: ParseContext): GirField => ({
|
|
32
|
-
|
|
33
|
-
doc: getDoc(node),
|
|
48
|
+
...documentedFromNode(node),
|
|
34
49
|
type: undefined,
|
|
35
50
|
cType: undefined,
|
|
36
51
|
readable: false,
|
|
@@ -38,7 +53,7 @@ const anonymousMemberFromNode = (node: RawNode, isUnion: boolean, context: Parse
|
|
|
38
53
|
private: true,
|
|
39
54
|
bits: undefined,
|
|
40
55
|
inlineMembers: collectFields(node, context),
|
|
41
|
-
|
|
56
|
+
isInlineUnion: isUnion,
|
|
42
57
|
});
|
|
43
58
|
|
|
44
59
|
const collectFields = (node: RawNode, context: ParseContext): GirField[] => [
|
|
@@ -47,4 +62,4 @@ const collectFields = (node: RawNode, context: ParseContext): GirField[] => [
|
|
|
47
62
|
...getChildren(node, "record").map((member) => anonymousMemberFromNode(member, false, context)),
|
|
48
63
|
];
|
|
49
64
|
|
|
50
|
-
export { collectFields,
|
|
65
|
+
export { collectFields, type GirField };
|
package/src/gir/function.ts
CHANGED
|
@@ -1,19 +1,35 @@
|
|
|
1
|
+
import type { GirAnnotations } from "./annotations.js";
|
|
1
2
|
import type { ParseContext } from "./type-id.js";
|
|
3
|
+
import { type CursorParameterNames, PARAMETERS_MISSING_ARRAY_EXTENT } from "./cursor-overrides.js";
|
|
2
4
|
import { PARAMETERS_MISSING_NULLABLE_ANNOTATION } from "./nullable-overrides.js";
|
|
3
5
|
import { type GirParameter, type GirReturnValue, parameterFromNode, parseCallable } from "./parameter.js";
|
|
4
6
|
import { attr, getChild, type RawNode } from "./parse.js";
|
|
5
7
|
|
|
8
|
+
/** A callable declared by a GIR namespace, class, or record: a function, a method, or a constructor. */
|
|
6
9
|
type GirFunction = {
|
|
10
|
+
/** Local name within its owner, taken from the `shadows` annotation when the callable has one. */
|
|
7
11
|
name: string;
|
|
12
|
+
/** Documentation text carried by the GIR node. */
|
|
8
13
|
doc: string | undefined;
|
|
14
|
+
/** Release and deprecation annotations GIR carries on the callable. */
|
|
15
|
+
annotations: GirAnnotations;
|
|
16
|
+
/** C symbol the callable is invoked through. */
|
|
9
17
|
cIdentifier: string | undefined;
|
|
18
|
+
/** Whether the C function takes a trailing `GError` out parameter and can fail. */
|
|
10
19
|
throws: boolean;
|
|
20
|
+
/** Whether the GIR marks the callable as introspectable, and so bindable. */
|
|
11
21
|
introspectable: boolean;
|
|
22
|
+
/** Qualified `Type.member` the GIR redirects the callable to, from its `moved-to` annotation. */
|
|
12
23
|
movedTo: string | undefined;
|
|
24
|
+
/** Name of the callable that shadows this one, from the GIR's `shadowed-by` annotation. */
|
|
13
25
|
shadowedBy: string | undefined;
|
|
26
|
+
/** Name of the callable that completes this asynchronous one, from the GIR's `glib:finish-func`. */
|
|
14
27
|
finishFunc: string | undefined;
|
|
28
|
+
/** The instance the callable is invoked on, absent for constructors and namespace-level functions. */
|
|
15
29
|
instance: GirParameter | undefined;
|
|
30
|
+
/** Parameters other than the instance one, in declaration order. */
|
|
16
31
|
parameters: GirParameter[];
|
|
32
|
+
/** What the callable returns, with its transfer and nullability. */
|
|
17
33
|
returnValue: GirReturnValue;
|
|
18
34
|
};
|
|
19
35
|
|
|
@@ -35,18 +51,53 @@ const relaxMissingNullable = (fn: GirFunction): GirFunction => {
|
|
|
35
51
|
return fn;
|
|
36
52
|
};
|
|
37
53
|
|
|
54
|
+
const parameterIndexFor = (parameters: GirParameter[], name: string): number => {
|
|
55
|
+
const index = parameters.findIndex((parameter) => parameter.name === name);
|
|
56
|
+
|
|
57
|
+
if (index === -1) {
|
|
58
|
+
throw new Error(`A cursor correction names a parameter the GIR does not declare: ${name}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return index;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const bindCursorParameters = (parameters: GirParameter[], corrections: CursorParameterNames[]): void => {
|
|
65
|
+
for (const names of corrections) {
|
|
66
|
+
const parameter = parameters[parameterIndexFor(parameters, names.cursor)];
|
|
67
|
+
|
|
68
|
+
if (parameter !== undefined) {
|
|
69
|
+
parameter.cursor = {
|
|
70
|
+
baseIndex: parameterIndexFor(parameters, names.base),
|
|
71
|
+
lengthIndex: parameterIndexFor(parameters, names.length),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const bindMissingArrayExtent = (fn: GirFunction): GirFunction => {
|
|
78
|
+
const corrections = fn.cIdentifier === undefined ? undefined : PARAMETERS_MISSING_ARRAY_EXTENT.get(fn.cIdentifier);
|
|
79
|
+
|
|
80
|
+
if (corrections !== undefined) {
|
|
81
|
+
bindCursorParameters(fn.parameters, corrections);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return fn;
|
|
85
|
+
};
|
|
86
|
+
|
|
38
87
|
const functionFromNode = (node: RawNode, context: ParseContext): GirFunction => {
|
|
39
88
|
const instanceNode = getChild(getChild(node, "parameters"), "instance-parameter");
|
|
40
89
|
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
90
|
+
return bindMissingArrayExtent(
|
|
91
|
+
relaxMissingNullable({
|
|
92
|
+
...parseCallable(node, context),
|
|
93
|
+
name: attr(node, "shadows") ?? attr(node, "name") ?? "",
|
|
94
|
+
cIdentifier: attr(node, "c:identifier"),
|
|
95
|
+
movedTo: attr(node, "moved-to"),
|
|
96
|
+
shadowedBy: attr(node, "shadowed-by"),
|
|
97
|
+
finishFunc: attr(node, "glib:finish-func"),
|
|
98
|
+
instance: instanceNode === undefined ? undefined : parameterFromNode(instanceNode, context),
|
|
99
|
+
}),
|
|
100
|
+
);
|
|
50
101
|
};
|
|
51
102
|
|
|
52
103
|
export { functionFromNode, type GirFunction };
|