@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/dist/gir/callback.js
CHANGED
|
@@ -3,6 +3,7 @@ const callbackFromNode = (node, context) => parseCallable(node, context);
|
|
|
3
3
|
const callbackAsFunction = (callback) => ({
|
|
4
4
|
name: callback.name,
|
|
5
5
|
doc: callback.doc,
|
|
6
|
+
annotations: callback.annotations,
|
|
6
7
|
cIdentifier: undefined,
|
|
7
8
|
movedTo: undefined,
|
|
8
9
|
throws: callback.throws,
|
package/dist/gir/callback.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../../src/gir/callback.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"callback.js","sourceRoot":"","sources":["../../src/gir/callback.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKjE,MAAM,gBAAgB,GAAG,CAAC,IAAa,EAAE,OAAqB,EAAe,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAE7G,MAAM,kBAAkB,GAAG,CAAC,QAAqB,EAAe,EAAE,CAAC,CAAC;IAChE,IAAI,EAAE,QAAQ,CAAC,IAAI;IACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;IACjB,WAAW,EAAE,QAAQ,CAAC,WAAW;IACjC,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ,CAAC,MAAM;IACvB,cAAc,EAAE,QAAQ,CAAC,cAAc;IACvC,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,UAAU,EAAE,QAAQ,CAAC,UAAU;IAC/B,WAAW,EAAE,QAAQ,CAAC,WAAW;CACpC,CAAC,CAAC;AAEH,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAoB,CAAC","sourcesContent":["import type { GirFunction } from \"./function.js\";\nimport type { RawNode } from \"./parse.js\";\nimport type { ParseContext } from \"./type-id.js\";\nimport { type GirCallable, parseCallable } from \"./parameter.js\";\n\n/** The signature of a function pointer type GIR declares, whether named or anonymous. */\ntype GirCallback = GirCallable;\n\nconst callbackFromNode = (node: RawNode, context: ParseContext): GirCallback => parseCallable(node, context);\n\nconst callbackAsFunction = (callback: GirCallback): GirFunction => ({\n name: callback.name,\n doc: callback.doc,\n annotations: callback.annotations,\n cIdentifier: undefined,\n movedTo: undefined,\n throws: callback.throws,\n introspectable: callback.introspectable,\n shadowedBy: undefined,\n finishFunc: undefined,\n instance: undefined,\n parameters: callback.parameters,\n returnValue: callback.returnValue,\n});\n\nexport { callbackFromNode, callbackAsFunction, type GirCallback };\n"]}
|
package/dist/gir/class.d.ts
CHANGED
|
@@ -1,30 +1,61 @@
|
|
|
1
1
|
import type { ParseContext } from "./type-id.js";
|
|
2
|
+
import { type GirAnnotations } from "./annotations.js";
|
|
2
3
|
import { type GirFunction } from "./function.js";
|
|
3
4
|
import { type GirCallable } from "./parameter.js";
|
|
4
5
|
import { type RawNode } from "./parse.js";
|
|
5
6
|
import { type GirProperty } from "./property.js";
|
|
7
|
+
/** A `<virtual-method>` on a class or interface: the vtable slot's own documentation and signature. */
|
|
8
|
+
type GirVirtualMethod = GirCallable & {
|
|
9
|
+
/** Method GIR names as invoking this slot, absent when the slot has no invoker. */
|
|
10
|
+
invoker: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
/** A `<class>` or `<interface>` declared by a GIR namespace. */
|
|
6
13
|
type GirClass = {
|
|
14
|
+
/** Name GIR gives the type, without its namespace prefix. */
|
|
7
15
|
name: string;
|
|
16
|
+
/** Documentation GIR carries for the type. */
|
|
8
17
|
doc: string | undefined;
|
|
18
|
+
/** Release and deprecation annotations GIR carries on the type. */
|
|
19
|
+
annotations: GirAnnotations;
|
|
20
|
+
/** C type of an instance, such as `GtkWidget`. */
|
|
9
21
|
cType: string | undefined;
|
|
22
|
+
/** The class it derives from, qualified when it lives in another namespace. */
|
|
10
23
|
parent: string | undefined;
|
|
24
|
+
/** GType name the type registers under, such as `GtkWidget`. */
|
|
11
25
|
glibTypeName: string | undefined;
|
|
26
|
+
/** C function returning the GType, such as `gtk_widget_get_type`. */
|
|
12
27
|
glibGetType: string | undefined;
|
|
28
|
+
/** Record holding the class or interface vtable, which virtual method bindings are laid out against. */
|
|
13
29
|
glibTypeStruct: string | undefined;
|
|
30
|
+
/** C function that takes a reference, on a type that manages its own refcount. */
|
|
14
31
|
glibRefFunc: string | undefined;
|
|
32
|
+
/** C function that drops a reference, on a type that manages its own refcount. */
|
|
15
33
|
glibUnrefFunc: string | undefined;
|
|
34
|
+
/** Whether the type is its own GType fundamental rather than a GObject descendant. */
|
|
16
35
|
fundamental: boolean;
|
|
36
|
+
/** Whether the class cannot be instantiated on its own. */
|
|
17
37
|
isAbstract: boolean;
|
|
38
|
+
/** Whether the type came from an `<interface>` rather than a `<class>`. */
|
|
18
39
|
isInterface: boolean;
|
|
40
|
+
/** Whether GIR exposes the type to bindings; codegen skips it when false. */
|
|
19
41
|
introspectable: boolean;
|
|
42
|
+
/** Interfaces the class implements. */
|
|
20
43
|
implements: string[];
|
|
44
|
+
/** Types an implementer of this interface must also provide. */
|
|
21
45
|
prerequisites: string[];
|
|
46
|
+
/** Methods taking an instance. */
|
|
22
47
|
methods: GirFunction[];
|
|
48
|
+
/** Functions returning a new instance. */
|
|
23
49
|
constructors: GirFunction[];
|
|
50
|
+
/** Functions namespaced under the type that take no instance. */
|
|
24
51
|
functions: GirFunction[];
|
|
52
|
+
/** GObject properties the type declares. */
|
|
25
53
|
properties: GirProperty[];
|
|
54
|
+
/** GObject signals the type declares. */
|
|
26
55
|
signals: GirCallable[];
|
|
56
|
+
/** Virtual methods the type declares, carrying the documentation their vtable slots are generated from. */
|
|
57
|
+
vfuncs: GirVirtualMethod[];
|
|
27
58
|
};
|
|
28
59
|
declare const classFromNode: (node: RawNode, isInterface: boolean, context: ParseContext) => GirClass;
|
|
29
|
-
export { classFromNode, type GirClass };
|
|
60
|
+
export { classFromNode, type GirClass, type GirVirtualMethod };
|
|
30
61
|
//# sourceMappingURL=class.d.ts.map
|
package/dist/gir/class.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/gir/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EA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ChC,kFAAkF;IAClF,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,sFAAsF;IACtF,WAAW,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,UAAU,EAAE,OAAO,CAAC;IACpB,2EAA2E;IAC3E,WAAW,EAAE,OAAO,CAAC;IACrB,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;IACxB,uCAAuC;IACvC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,gEAAgE;IAChE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kCAAkC;IAClC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,0CAA0C;IAC1C,YAAY,EAAE,WAAW,EAAE,CAAC;IAC5B,iEAAiE;IACjE,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,4CAA4C;IAC5C,UAAU,EAAE,WAAW,EAAE,CAAC;IAC1B,yCAAyC;IACzC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,2GAA2G;IAC3G,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC9B,CAAC;AAQF,QAAA,MAAM,aAAa,GAAI,MAAM,OAAO,EAAE,aAAa,OAAO,EAAE,SAAS,YAAY,KAAG,QAyBlF,CAAC;AAEH,OAAO,EAAE,aAAa,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
package/dist/gir/class.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { documentedFromNode } from "./annotations.js";
|
|
1
2
|
import { functionFromNode } from "./function.js";
|
|
2
3
|
import { parseCallable } from "./parameter.js";
|
|
3
|
-
import { attr, getChildren,
|
|
4
|
+
import { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue } from "./parse.js";
|
|
4
5
|
import { propertyFromNode } from "./property.js";
|
|
6
|
+
const virtualMethodsFromNode = (node, context) => getChildren(node, "virtual-method").map((vfunc) => ({
|
|
7
|
+
...parseCallable(vfunc, context),
|
|
8
|
+
invoker: attr(vfunc, "invoker"),
|
|
9
|
+
}));
|
|
5
10
|
const classFromNode = (node, isInterface, context) => ({
|
|
6
|
-
|
|
7
|
-
doc: getDoc(node),
|
|
11
|
+
...documentedFromNode(node),
|
|
8
12
|
cType: attr(node, "c:type"),
|
|
9
13
|
parent: attr(node, "parent"),
|
|
10
14
|
glibTypeName: attr(node, "glib:type-name"),
|
|
@@ -27,6 +31,7 @@ const classFromNode = (node, isInterface, context) => ({
|
|
|
27
31
|
functions: getChildren(node, "function").map((fn) => functionFromNode(fn, context)),
|
|
28
32
|
properties: getChildren(node, "property").map((property) => propertyFromNode(property, context)),
|
|
29
33
|
signals: getChildren(node, "glib:signal").map((signal) => parseCallable(signal, context)),
|
|
34
|
+
vfuncs: virtualMethodsFromNode(node, context),
|
|
30
35
|
});
|
|
31
36
|
export { classFromNode };
|
|
32
37
|
//# sourceMappingURL=class.js.map
|
package/dist/gir/class.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/gir/class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAoB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"class.js","sourceRoot":"","sources":["../../src/gir/class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,EAAoB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,UAAU,EAAgB,MAAM,YAAY,CAAC;AAC9F,OAAO,EAAoB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAwDnE,MAAM,sBAAsB,GAAG,CAAC,IAAa,EAAE,OA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C,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;SACjD,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC;IACzD,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvF,YAAY,EAAE,WAAW,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACnG,SAAS,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IACnF,UAAU,EAAE,WAAW,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAChG,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzF,MAAM,EAAE,sBAAsB,CAAC,IAAI,EAAE,OAAO,CAAC;CAChD,CAAC,CAAC;AAEH,OAAO,EAAE,aAAa,EAAwC,CAAC","sourcesContent":["import type { ParseContext } from \"./type-id.js\";\nimport { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport { functionFromNode, type GirFunction } from \"./function.js\";\nimport { type GirCallable, parseCallable } from \"./parameter.js\";\nimport { attr, getChildren, GIR_CONSTRUCTOR_TAG, isAttrTrue, type RawNode } from \"./parse.js\";\nimport { type GirProperty, propertyFromNode } from \"./property.js\";\n\n/** A `<virtual-method>` on a class or interface: the vtable slot's own documentation and signature. */\ntype GirVirtualMethod = GirCallable & {\n /** Method GIR names as invoking this slot, absent when the slot has no invoker. */\n invoker: string | undefined;\n};\n\n/** A `<class>` or `<interface>` declared by a GIR namespace. */\ntype GirClass = {\n /** Name GIR gives the type, without its namespace prefix. */\n name: string;\n /** Documentation GIR carries for the type. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the type. */\n annotations: GirAnnotations;\n /** C type of an instance, such as `GtkWidget`. */\n cType: string | undefined;\n /** The class it derives from, qualified when it lives in another namespace. */\n parent: string | undefined;\n /** GType name the type registers under, such as `GtkWidget`. */\n glibTypeName: string | undefined;\n /** C function returning the GType, such as `gtk_widget_get_type`. */\n glibGetType: string | undefined;\n /** Record holding the class or interface vtable, which virtual method bindings are laid out against. */\n glibTypeStruct: string | undefined;\n /** C function that takes a reference, on a type that manages its own refcount. */\n glibRefFunc: string | undefined;\n /** C function that drops a reference, on a type that manages its own refcount. */\n glibUnrefFunc: string | undefined;\n /** Whether the type is its own GType fundamental rather than a GObject descendant. */\n fundamental: boolean;\n /** Whether the class cannot be instantiated on its own. */\n isAbstract: boolean;\n /** Whether the type came from an `<interface>` rather than a `<class>`. */\n isInterface: boolean;\n /** Whether GIR exposes the type to bindings; codegen skips it when false. */\n introspectable: boolean;\n /** Interfaces the class implements. */\n implements: string[];\n /** Types an implementer of this interface must also provide. */\n prerequisites: string[];\n /** Methods taking an instance. */\n methods: GirFunction[];\n /** Functions returning a new instance. */\n constructors: GirFunction[];\n /** Functions namespaced under the type that take no instance. */\n functions: GirFunction[];\n /** GObject properties the type declares. */\n properties: GirProperty[];\n /** GObject signals the type declares. */\n signals: GirCallable[];\n /** Virtual methods the type declares, carrying the documentation their vtable slots are generated from. */\n vfuncs: GirVirtualMethod[];\n};\n\nconst virtualMethodsFromNode = (node: RawNode, context: ParseContext): GirVirtualMethod[] =>\n getChildren(node, \"virtual-method\").map((vfunc) => ({\n ...parseCallable(vfunc, context),\n invoker: attr(vfunc, \"invoker\"),\n }));\n\nconst classFromNode = (node: RawNode, isInterface: boolean, context: ParseContext): GirClass => ({\n ...documentedFromNode(node),\n cType: attr(node, \"c:type\"),\n parent: attr(node, \"parent\"),\n glibTypeName: attr(node, \"glib:type-name\"),\n glibGetType: attr(node, \"glib:get-type\"),\n glibTypeStruct: attr(node, \"glib:type-struct\"),\n glibRefFunc: attr(node, \"glib:ref-func\"),\n glibUnrefFunc: attr(node, \"glib:unref-func\"),\n fundamental: isAttrTrue(node, \"glib:fundamental\"),\n isAbstract: isAttrTrue(node, \"abstract\"),\n isInterface,\n introspectable: isAttrTrue(node, \"introspectable\", true),\n implements: getChildren(node, \"implements\")\n .map((implement) => attr(implement, \"name\"))\n .filter((name): name is string => name !== undefined),\n prerequisites: getChildren(node, \"prerequisite\")\n .map((prerequisite) => attr(prerequisite, \"name\"))\n .filter((name): name is string => name !== undefined),\n methods: getChildren(node, \"method\").map((method) => functionFromNode(method, context)),\n constructors: getChildren(node, GIR_CONSTRUCTOR_TAG).map((ctor) => functionFromNode(ctor, context)),\n functions: getChildren(node, \"function\").map((fn) => functionFromNode(fn, context)),\n properties: getChildren(node, \"property\").map((property) => propertyFromNode(property, context)),\n signals: getChildren(node, \"glib:signal\").map((signal) => parseCallable(signal, context)),\n vfuncs: virtualMethodsFromNode(node, context),\n});\n\nexport { classFromNode, type GirClass, type GirVirtualMethod };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type CursorParameterNames = {
|
|
2
|
+
cursor: string;
|
|
3
|
+
base: string;
|
|
4
|
+
length: string;
|
|
5
|
+
};
|
|
6
|
+
declare const PARAMETERS_MISSING_ARRAY_EXTENT: Map<string, CursorParameterNames[]>;
|
|
7
|
+
export { PARAMETERS_MISSING_ARRAY_EXTENT, type CursorParameterNames };
|
|
8
|
+
//# sourceMappingURL=cursor-overrides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-overrides.d.ts","sourceRoot":"","sources":["../../src/gir/cursor-overrides.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,QAAA,MAAM,+BAA+B,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,CAGvE,CAAC;AAEH,OAAO,EAAE,+BAA+B,EAAE,KAAK,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const PARAMETERS_MISSING_ARRAY_EXTENT = new Map([
|
|
2
|
+
["g_utf8_validate", [{ cursor: "end", base: "str", length: "max_len" }]],
|
|
3
|
+
["g_utf8_validate_len", [{ cursor: "end", base: "str", length: "max_len" }]],
|
|
4
|
+
]);
|
|
5
|
+
export { PARAMETERS_MISSING_ARRAY_EXTENT };
|
|
6
|
+
//# sourceMappingURL=cursor-overrides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-overrides.js","sourceRoot":"","sources":["../../src/gir/cursor-overrides.ts"],"names":[],"mappings":"AAMA,MAAM,+BAA+B,GAAwC,IAAI,GAAG,CAAC;IACjF,CAAC,iBAAiB,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACxE,CAAC,qBAAqB,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;CAC/E,CAAC,CAAC;AAEH,OAAO,EAAE,+BAA+B,EAA6B,CAAC","sourcesContent":["type CursorParameterNames = {\n cursor: string;\n base: string;\n length: string;\n};\n\nconst PARAMETERS_MISSING_ARRAY_EXTENT: Map<string, CursorParameterNames[]> = new Map([\n [\"g_utf8_validate\", [{ cursor: \"end\", base: \"str\", length: \"max_len\" }]],\n [\"g_utf8_validate_len\", [{ cursor: \"end\", base: \"str\", length: \"max_len\" }]],\n]);\n\nexport { PARAMETERS_MISSING_ARRAY_EXTENT, type CursorParameterNames };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emittable.d.ts","sourceRoot":"","sources":["../../src/gir/emittable.ts"],"names":[],"mappings":"AAAA,KAAK,WAAW,GAAG;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,QAAQ,WAAW,KAAG,OAAoE,CAAC;AAEtH,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emittable.js","sourceRoot":"","sources":["../../src/gir/emittable.ts"],"names":[],"mappings":"AAKA,MAAM,iBAAiB,GAAG,CAAC,MAAmB,EAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,cAAc,KAAK,KAAK,CAAC;AAEtH,OAAO,EAAE,iBAAiB,EAAE,CAAC","sourcesContent":["type NamedEntity = {\n name: string;\n introspectable?: boolean | undefined;\n};\n\nconst isEmittableEntity = (entity: NamedEntity): boolean => entity.name.length > 0 && entity.introspectable !== false;\n\nexport { isEmittableEntity };\n"]}
|
package/dist/gir/enum.d.ts
CHANGED
|
@@ -1,21 +1,41 @@
|
|
|
1
|
+
import { type GirAnnotations } from "./annotations.js";
|
|
1
2
|
import { type RawNode } from "./parse.js";
|
|
3
|
+
/** One member of a {@link GirEnum}. */
|
|
2
4
|
type EnumMember = {
|
|
5
|
+
/** The member's GIR name, which the emitted key is derived from. */
|
|
3
6
|
name: string;
|
|
7
|
+
/** Documentation prose from GIR, emitted as the member's JSDoc. */
|
|
4
8
|
doc: string | undefined;
|
|
9
|
+
/** Release and deprecation annotations GIR carries on the member. */
|
|
10
|
+
annotations: GirAnnotations;
|
|
11
|
+
/** The member's numeric value, `0` when GIR declares none. */
|
|
5
12
|
value: string;
|
|
13
|
+
/** C constant the member is exposed as, such as `GTK_ORIENTATION_HORIZONTAL`. */
|
|
6
14
|
cIdentifier: string | undefined;
|
|
7
15
|
};
|
|
16
|
+
/** Whether an enum is a plain enumeration or a bitfield of flags. */
|
|
8
17
|
type EnumKind = "enumeration" | "bitfield";
|
|
18
|
+
/** An enumeration or bitfield declared by a GIR namespace. */
|
|
9
19
|
type GirEnum = {
|
|
20
|
+
/** Whether the declaration is a plain enumeration or a bitfield. */
|
|
10
21
|
kind: EnumKind;
|
|
22
|
+
/** Name the enum is exported under, without its namespace prefix. */
|
|
11
23
|
name: string;
|
|
24
|
+
/** Documentation prose from GIR, emitted as the enum's JSDoc. */
|
|
12
25
|
doc: string | undefined;
|
|
26
|
+
/** Release and deprecation annotations GIR carries on the enum. */
|
|
27
|
+
annotations: GirAnnotations;
|
|
28
|
+
/** GType name of the enum, absent when it is not registered with GLib. */
|
|
13
29
|
glibTypeName: string | undefined;
|
|
30
|
+
/** C function returning the enum's GType, absent when it is not registered with GLib. */
|
|
14
31
|
glibGetType: string | undefined;
|
|
32
|
+
/** Quark name of the GError domain the members are codes of, absent on enums that carry no domain. */
|
|
15
33
|
errorDomain: string | undefined;
|
|
34
|
+
/** Whether the enum is introspectable; code generation skips the ones that are not. */
|
|
16
35
|
introspectable: boolean;
|
|
36
|
+
/** The enum's members, in declaration order. */
|
|
17
37
|
members: EnumMember[];
|
|
18
38
|
};
|
|
19
39
|
declare const enumFromNode: (node: RawNode, kind: EnumKind) => GirEnum;
|
|
20
|
-
export { enumFromNode, type GirEnum };
|
|
40
|
+
export { enumFromNode, type EnumMember, type GirEnum };
|
|
21
41
|
//# sourceMappingURL=enum.d.ts.map
|
package/dist/gir/enum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/gir/enum.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../src/gir/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAEzE,uCAAuC;AACvC,KAAK,UAAU,GAAG;IACd,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,qEAAqE;IACrE,WAAW,EAAE,cAAc,CAAC;IAC5B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,iFAAiF;IACjF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC,CAAC;AAEF,qEAAqE;AACrE,KAAK,QAAQ,GAAG,aAAa,GAAG,UAAU,CAAC;AAE3C,8DAA8D;AAC9D,KAAK,OAAO,GAAG;IACX,oEAAoE;IACpE,IAAI,EAAE,QAAQ,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,mEAAmE;IACnE,WAAW,EAAE,cAAc,CAAC;IAC5B,0EAA0E;IAC1E,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,yFAAyF;IACzF,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,sGAAsG;IACtG,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,uFAAuF;IACvF,cAAc,EAAE,OAAO,CAAC;IACxB,gDAAgD;IAChD,OAAO,EAAE,UAAU,EAAE,CAAC;CACzB,CAAC;AAQF,QAAA,MAAM,YAAY,GAAI,MAAM,OAAO,EAAE,MAAM,QAAQ,KAAG,OAQpD,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,CAAC"}
|
package/dist/gir/enum.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { documentedFromNode } from "./annotations.js";
|
|
2
|
+
import { attr, getChildren, isAttrTrue } from "./parse.js";
|
|
3
|
+
const enumMemberFromNode = (node) => ({
|
|
4
|
+
...documentedFromNode(node),
|
|
5
|
+
value: attr(node, "value") ?? "0",
|
|
6
|
+
cIdentifier: attr(node, "c:identifier"),
|
|
7
|
+
});
|
|
2
8
|
const enumFromNode = (node, kind) => ({
|
|
3
9
|
kind,
|
|
4
|
-
|
|
5
|
-
doc: getDoc(node),
|
|
10
|
+
...documentedFromNode(node),
|
|
6
11
|
glibTypeName: attr(node, "glib:type-name"),
|
|
7
12
|
glibGetType: attr(node, "glib:get-type"),
|
|
8
13
|
errorDomain: attr(node, "glib:error-domain"),
|
|
9
14
|
introspectable: isAttrTrue(node, "introspectable", true),
|
|
10
|
-
members: getChildren(node, "member").map((member) => (
|
|
11
|
-
name: nameAttr(member),
|
|
12
|
-
doc: getDoc(member),
|
|
13
|
-
value: attr(member, "value") ?? "0",
|
|
14
|
-
cIdentifier: attr(member, "c:identifier"),
|
|
15
|
-
})),
|
|
15
|
+
members: getChildren(node, "member").map((member) => enumMemberFromNode(member)),
|
|
16
16
|
});
|
|
17
17
|
export { enumFromNode };
|
|
18
18
|
//# sourceMappingURL=enum.js.map
|
package/dist/gir/enum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../src/gir/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../src/gir/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAgB,MAAM,YAAY,CAAC;AAyCzE,MAAM,kBAAkB,GAAG,CAAC,IAAa,EAAc,EAAE,CAAC,CAAC;IACvD,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAC3B,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG;IACjC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;CAC1C,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,IAAc,EAAW,EAAE,CAAC,CAAC;IAC9D,IAAI;IACJ,GAAG,kBAAkB,CAAC,IAAI,CAAC;IAC3B,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAC1C,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC;IACxC,WAAW,EAAE,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAC5C,cAAc,EAAE,UAAU,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC;IACxD,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;CACnF,CAAC,CAAC;AAEH,OAAO,EAAE,YAAY,EAAiC,CAAC","sourcesContent":["import { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport { attr, getChildren, isAttrTrue, type RawNode } from \"./parse.js\";\n\n/** One member of a {@link GirEnum}. */\ntype EnumMember = {\n /** The member's GIR name, which the emitted key is derived from. */\n name: string;\n /** Documentation prose from GIR, emitted as the member's JSDoc. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the member. */\n annotations: GirAnnotations;\n /** The member's numeric value, `0` when GIR declares none. */\n value: string;\n /** C constant the member is exposed as, such as `GTK_ORIENTATION_HORIZONTAL`. */\n cIdentifier: string | undefined;\n};\n\n/** Whether an enum is a plain enumeration or a bitfield of flags. */\ntype EnumKind = \"enumeration\" | \"bitfield\";\n\n/** An enumeration or bitfield declared by a GIR namespace. */\ntype GirEnum = {\n /** Whether the declaration is a plain enumeration or a bitfield. */\n kind: EnumKind;\n /** Name the enum is exported under, without its namespace prefix. */\n name: string;\n /** Documentation prose from GIR, emitted as the enum's JSDoc. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the enum. */\n annotations: GirAnnotations;\n /** GType name of the enum, absent when it is not registered with GLib. */\n glibTypeName: string | undefined;\n /** C function returning the enum's GType, absent when it is not registered with GLib. */\n glibGetType: string | undefined;\n /** Quark name of the GError domain the members are codes of, absent on enums that carry no domain. */\n errorDomain: string | undefined;\n /** Whether the enum is introspectable; code generation skips the ones that are not. */\n introspectable: boolean;\n /** The enum's members, in declaration order. */\n members: EnumMember[];\n};\n\nconst enumMemberFromNode = (node: RawNode): EnumMember => ({\n ...documentedFromNode(node),\n value: attr(node, \"value\") ?? \"0\",\n cIdentifier: attr(node, \"c:identifier\"),\n});\n\nconst enumFromNode = (node: RawNode, kind: EnumKind): GirEnum => ({\n kind,\n ...documentedFromNode(node),\n glibTypeName: attr(node, \"glib:type-name\"),\n glibGetType: attr(node, \"glib:get-type\"),\n errorDomain: attr(node, \"glib:error-domain\"),\n introspectable: isAttrTrue(node, \"introspectable\", true),\n members: getChildren(node, \"member\").map((member) => enumMemberFromNode(member)),\n});\n\nexport { enumFromNode, type EnumMember, type GirEnum };\n"]}
|
package/dist/gir/field.d.ts
CHANGED
|
@@ -1,18 +1,34 @@
|
|
|
1
1
|
import type { ParseContext, TypeId } from "./type-id.js";
|
|
2
|
+
import { type GirAnnotations } from "./annotations.js";
|
|
2
3
|
import { type RawNode } from "./parse.js";
|
|
4
|
+
/**
|
|
5
|
+
* One slot in a record or union layout: a named field, or a nested struct or union
|
|
6
|
+
* whose own members are laid out inline.
|
|
7
|
+
*/
|
|
3
8
|
type GirField = {
|
|
9
|
+
/** Field name as GIR spells it. */
|
|
4
10
|
name: string;
|
|
11
|
+
/** Documentation prose from GIR, emitted as the field accessor's JSDoc. */
|
|
5
12
|
doc: string | undefined;
|
|
13
|
+
/** Release and deprecation annotations GIR carries on the field. */
|
|
14
|
+
annotations: GirAnnotations;
|
|
15
|
+
/** The field's value type, absent for a nested struct or union and for one GIR leaves undeclared. */
|
|
6
16
|
type: TypeId | undefined;
|
|
17
|
+
/** The C type spelled on the field, which decides whether it is read through a pointer. */
|
|
7
18
|
cType: string | undefined;
|
|
19
|
+
/** Whether the field can be read; one that is neither readable nor writable gets no accessor at all. */
|
|
8
20
|
readable: boolean;
|
|
21
|
+
/** Whether the field can be written, which is what earns it a setter alongside its getter. */
|
|
9
22
|
writable: boolean;
|
|
23
|
+
/** Whether the field is private to the library, as every nested struct or union is. */
|
|
10
24
|
private: boolean;
|
|
25
|
+
/** Width in bits when the field is a C bitfield member. */
|
|
11
26
|
bits: number | undefined;
|
|
27
|
+
/** Members of a nested struct or union, absent for a named field. */
|
|
12
28
|
inlineMembers: GirField[] | undefined;
|
|
13
|
-
|
|
29
|
+
/** Whether {@link GirField.inlineMembers} overlap as a union rather than following one another as a struct. */
|
|
30
|
+
isInlineUnion: boolean;
|
|
14
31
|
};
|
|
15
|
-
declare const fieldFromNode: (node: RawNode, context: ParseContext) => GirField;
|
|
16
32
|
declare const collectFields: (node: RawNode, context: ParseContext) => GirField[];
|
|
17
|
-
export { collectFields,
|
|
33
|
+
export { collectFields, type GirField };
|
|
18
34
|
//# sourceMappingURL=field.d.ts.map
|
package/dist/gir/field.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/gir/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/gir/field.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAoD,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5F;;;GAGG;AACH,KAAK,QAAQ,GAAG;IACZ,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,oEAAoE;IACpE,WAAW,EAAE,cAAc,CAAC;IAC5B,qGAAqG;IACrG,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,2FAA2F;IAC3F,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,wGAAwG;IACxG,QAAQ,EAAE,OAAO,CAAC;IAClB,8FAA8F;IAC9F,QAAQ,EAAE,OAAO,CAAC;IAClB,uFAAuF;IACvF,OAAO,EAAE,OAAO,CAAC;IACjB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,qEAAqE;IACrE,aAAa,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC;IACtC,+GAA+G;IAC/G,aAAa,EAAE,OAAO,CAAC;CAC1B,CAAC;AA0BF,QAAA,MAAM,aAAa,GAAI,MAAM,OAAO,EAAE,SAAS,YAAY,KAAG,QAAQ,EAIrE,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,KAAK,QAAQ,EAAE,CAAC"}
|
package/dist/gir/field.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { documentedFromNode } from "./annotations.js";
|
|
2
|
+
import { attr, getChild, getChildren, intAttr, isAttrTrue } from "./parse.js";
|
|
2
3
|
import { typeRefFromNode } from "./type-ref.js";
|
|
3
4
|
const fieldFromNode = (node, context) => ({
|
|
4
|
-
|
|
5
|
-
doc: getDoc(node),
|
|
5
|
+
...documentedFromNode(node),
|
|
6
6
|
type: typeRefFromNode(node, context),
|
|
7
7
|
cType: attr(getChild(node, "type"), "c:type"),
|
|
8
8
|
readable: isAttrTrue(node, "readable", true),
|
|
@@ -10,11 +10,10 @@ const fieldFromNode = (node, context) => ({
|
|
|
10
10
|
private: isAttrTrue(node, "private", false),
|
|
11
11
|
bits: intAttr(node, "bits"),
|
|
12
12
|
inlineMembers: undefined,
|
|
13
|
-
|
|
13
|
+
isInlineUnion: false,
|
|
14
14
|
});
|
|
15
15
|
const anonymousMemberFromNode = (node, isUnion, context) => ({
|
|
16
|
-
|
|
17
|
-
doc: getDoc(node),
|
|
16
|
+
...documentedFromNode(node),
|
|
18
17
|
type: undefined,
|
|
19
18
|
cType: undefined,
|
|
20
19
|
readable: false,
|
|
@@ -22,12 +21,12 @@ const anonymousMemberFromNode = (node, isUnion, context) => ({
|
|
|
22
21
|
private: true,
|
|
23
22
|
bits: undefined,
|
|
24
23
|
inlineMembers: collectFields(node, context),
|
|
25
|
-
|
|
24
|
+
isInlineUnion: isUnion,
|
|
26
25
|
});
|
|
27
26
|
const collectFields = (node, context) => [
|
|
28
27
|
...getChildren(node, "field").map((field) => fieldFromNode(field, context)),
|
|
29
28
|
...getChildren(node, "union").map((member) => anonymousMemberFromNode(member, true, context)),
|
|
30
29
|
...getChildren(node, "record").map((member) => anonymousMemberFromNode(member, false, context)),
|
|
31
30
|
];
|
|
32
|
-
export { collectFields
|
|
31
|
+
export { collectFields };
|
|
33
32
|
//# sourceMappingURL=field.js.map
|
package/dist/gir/field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/gir/field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../src/gir/field.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAuB,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,QAAQ,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AAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3E,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7F,GAAG,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;CAClG,CAAC;AAEF,OAAO,EAAE,aAAa,EAAiB,CAAC","sourcesContent":["import type { ParseContext, TypeId } from \"./type-id.js\";\nimport { documentedFromNode, type GirAnnotations } from \"./annotations.js\";\nimport { attr, getChild, getChildren, intAttr, isAttrTrue, type RawNode } from \"./parse.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\n/**\n * One slot in a record or union layout: a named field, or a nested struct or union\n * whose own members are laid out inline.\n */\ntype GirField = {\n /** Field name as GIR spells it. */\n name: string;\n /** Documentation prose from GIR, emitted as the field accessor's JSDoc. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the field. */\n annotations: GirAnnotations;\n /** The field's value type, absent for a nested struct or union and for one GIR leaves undeclared. */\n type: TypeId | undefined;\n /** The C type spelled on the field, which decides whether it is read through a pointer. */\n cType: string | undefined;\n /** Whether the field can be read; one that is neither readable nor writable gets no accessor at all. */\n readable: boolean;\n /** Whether the field can be written, which is what earns it a setter alongside its getter. */\n writable: boolean;\n /** Whether the field is private to the library, as every nested struct or union is. */\n private: boolean;\n /** Width in bits when the field is a C bitfield member. */\n bits: number | undefined;\n /** Members of a nested struct or union, absent for a named field. */\n inlineMembers: GirField[] | undefined;\n /** Whether {@link GirField.inlineMembers} overlap as a union rather than following one another as a struct. */\n isInlineUnion: boolean;\n};\n\nconst fieldFromNode = (node: RawNode, context: ParseContext): GirField => ({\n ...documentedFromNode(node),\n type: typeRefFromNode(node, context),\n cType: attr(getChild(node, \"type\"), \"c:type\"),\n readable: isAttrTrue(node, \"readable\", true),\n writable: isAttrTrue(node, \"writable\", false),\n private: isAttrTrue(node, \"private\", false),\n bits: intAttr(node, \"bits\"),\n inlineMembers: undefined,\n isInlineUnion: false,\n});\n\nconst anonymousMemberFromNode = (node: RawNode, isUnion: boolean, context: ParseContext): GirField => ({\n ...documentedFromNode(node),\n type: undefined,\n cType: undefined,\n readable: false,\n writable: false,\n private: true,\n bits: undefined,\n inlineMembers: collectFields(node, context),\n isInlineUnion: isUnion,\n});\n\nconst collectFields = (node: RawNode, context: ParseContext): GirField[] => [\n ...getChildren(node, \"field\").map((field) => fieldFromNode(field, context)),\n ...getChildren(node, \"union\").map((member) => anonymousMemberFromNode(member, true, context)),\n ...getChildren(node, \"record\").map((member) => anonymousMemberFromNode(member, false, context)),\n];\n\nexport { collectFields, type GirField };\n"]}
|
package/dist/gir/function.d.ts
CHANGED
|
@@ -1,17 +1,32 @@
|
|
|
1
|
+
import type { GirAnnotations } from "./annotations.js";
|
|
1
2
|
import type { ParseContext } from "./type-id.js";
|
|
2
3
|
import { type GirParameter, type GirReturnValue } from "./parameter.js";
|
|
3
4
|
import { type RawNode } from "./parse.js";
|
|
5
|
+
/** A callable declared by a GIR namespace, class, or record: a function, a method, or a constructor. */
|
|
4
6
|
type GirFunction = {
|
|
7
|
+
/** Local name within its owner, taken from the `shadows` annotation when the callable has one. */
|
|
5
8
|
name: string;
|
|
9
|
+
/** Documentation text carried by the GIR node. */
|
|
6
10
|
doc: string | undefined;
|
|
11
|
+
/** Release and deprecation annotations GIR carries on the callable. */
|
|
12
|
+
annotations: GirAnnotations;
|
|
13
|
+
/** C symbol the callable is invoked through. */
|
|
7
14
|
cIdentifier: string | undefined;
|
|
15
|
+
/** Whether the C function takes a trailing `GError` out parameter and can fail. */
|
|
8
16
|
throws: boolean;
|
|
17
|
+
/** Whether the GIR marks the callable as introspectable, and so bindable. */
|
|
9
18
|
introspectable: boolean;
|
|
19
|
+
/** Qualified `Type.member` the GIR redirects the callable to, from its `moved-to` annotation. */
|
|
10
20
|
movedTo: string | undefined;
|
|
21
|
+
/** Name of the callable that shadows this one, from the GIR's `shadowed-by` annotation. */
|
|
11
22
|
shadowedBy: string | undefined;
|
|
23
|
+
/** Name of the callable that completes this asynchronous one, from the GIR's `glib:finish-func`. */
|
|
12
24
|
finishFunc: string | undefined;
|
|
25
|
+
/** The instance the callable is invoked on, absent for constructors and namespace-level functions. */
|
|
13
26
|
instance: GirParameter | undefined;
|
|
27
|
+
/** Parameters other than the instance one, in declaration order. */
|
|
14
28
|
parameters: GirParameter[];
|
|
29
|
+
/** What the callable returns, with its transfer and nullability. */
|
|
15
30
|
returnValue: GirReturnValue;
|
|
16
31
|
};
|
|
17
32
|
declare const functionFromNode: (node: RawNode, context: ParseContext) => GirFunction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/gir/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/gir/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,cAAc,EAAoC,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1D,wGAAwG;AACxG,KAAK,WAAW,GAAG;IACf,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,uEAAuE;IACvE,WAAW,EAAE,cAAc,CAAC;IAC5B,gDAAgD;IAChD,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,mFAAmF;IACnF,MAAM,EAAE,OAAO,CAAC;IAChB,6EAA6E;IAC7E,cAAc,EAAE,OAAO,CAAC;IACxB,iGAAiG;IACjG,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,2FAA2F;IAC3F,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,oGAAoG;IACpG,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,sGAAsG;IACtG,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,oEAAoE;IACpE,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,oEAAoE;IACpE,WAAW,EAAE,cAAc,CAAC;CAC/B,CAAC;AAqDF,QAAA,MAAM,gBAAgB,GAAI,MAAM,OAAO,EAAE,SAAS,YAAY,KAAG,WAchE,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,KAAK,WAAW,EAAE,CAAC"}
|
package/dist/gir/function.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PARAMETERS_MISSING_ARRAY_EXTENT } from "./cursor-overrides.js";
|
|
1
2
|
import { PARAMETERS_MISSING_NULLABLE_ANNOTATION } from "./nullable-overrides.js";
|
|
2
3
|
import { parameterFromNode, parseCallable } from "./parameter.js";
|
|
3
4
|
import { attr, getChild } from "./parse.js";
|
|
@@ -15,9 +16,34 @@ const relaxMissingNullable = (fn) => {
|
|
|
15
16
|
}
|
|
16
17
|
return fn;
|
|
17
18
|
};
|
|
19
|
+
const parameterIndexFor = (parameters, name) => {
|
|
20
|
+
const index = parameters.findIndex((parameter) => parameter.name === name);
|
|
21
|
+
if (index === -1) {
|
|
22
|
+
throw new Error(`A cursor correction names a parameter the GIR does not declare: ${name}`);
|
|
23
|
+
}
|
|
24
|
+
return index;
|
|
25
|
+
};
|
|
26
|
+
const bindCursorParameters = (parameters, corrections) => {
|
|
27
|
+
for (const names of corrections) {
|
|
28
|
+
const parameter = parameters[parameterIndexFor(parameters, names.cursor)];
|
|
29
|
+
if (parameter !== undefined) {
|
|
30
|
+
parameter.cursor = {
|
|
31
|
+
baseIndex: parameterIndexFor(parameters, names.base),
|
|
32
|
+
lengthIndex: parameterIndexFor(parameters, names.length),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const bindMissingArrayExtent = (fn) => {
|
|
38
|
+
const corrections = fn.cIdentifier === undefined ? undefined : PARAMETERS_MISSING_ARRAY_EXTENT.get(fn.cIdentifier);
|
|
39
|
+
if (corrections !== undefined) {
|
|
40
|
+
bindCursorParameters(fn.parameters, corrections);
|
|
41
|
+
}
|
|
42
|
+
return fn;
|
|
43
|
+
};
|
|
18
44
|
const functionFromNode = (node, context) => {
|
|
19
45
|
const instanceNode = getChild(getChild(node, "parameters"), "instance-parameter");
|
|
20
|
-
return relaxMissingNullable({
|
|
46
|
+
return bindMissingArrayExtent(relaxMissingNullable({
|
|
21
47
|
...parseCallable(node, context),
|
|
22
48
|
name: attr(node, "shadows") ?? attr(node, "name") ?? "",
|
|
23
49
|
cIdentifier: attr(node, "c:identifier"),
|
|
@@ -25,7 +51,7 @@ const functionFromNode = (node, context) => {
|
|
|
25
51
|
shadowedBy: attr(node, "shadowed-by"),
|
|
26
52
|
finishFunc: attr(node, "glib:finish-func"),
|
|
27
53
|
instance: instanceNode === undefined ? undefined : parameterFromNode(instanceNode, context),
|
|
28
|
-
});
|
|
54
|
+
}));
|
|
29
55
|
};
|
|
30
56
|
export { functionFromNode };
|
|
31
57
|
//# sourceMappingURL=function.js.map
|
package/dist/gir/function.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/gir/function.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../src/gir/function.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AACnG,OA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U,CAAC;QAC/B,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QACrC,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC;QAC1C,QAAQ,EAAE,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,iBAAiB,CAAC,YAAY,EAAE,OAAO,CAAC;KAC9F,CAAC,CACL,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAoB,CAAC","sourcesContent":["import type { GirAnnotations } from \"./annotations.js\";\nimport type { ParseContext } from \"./type-id.js\";\nimport { type CursorParameterNames, PARAMETERS_MISSING_ARRAY_EXTENT } from \"./cursor-overrides.js\";\nimport { PARAMETERS_MISSING_NULLABLE_ANNOTATION } from \"./nullable-overrides.js\";\nimport { type GirParameter, type GirReturnValue, parameterFromNode, parseCallable } from \"./parameter.js\";\nimport { attr, getChild, type RawNode } from \"./parse.js\";\n\n/** A callable declared by a GIR namespace, class, or record: a function, a method, or a constructor. */\ntype GirFunction = {\n /** Local name within its owner, taken from the `shadows` annotation when the callable has one. */\n name: string;\n /** Documentation text carried by the GIR node. */\n doc: string | undefined;\n /** Release and deprecation annotations GIR carries on the callable. */\n annotations: GirAnnotations;\n /** C symbol the callable is invoked through. */\n cIdentifier: string | undefined;\n /** Whether the C function takes a trailing `GError` out parameter and can fail. */\n throws: boolean;\n /** Whether the GIR marks the callable as introspectable, and so bindable. */\n introspectable: boolean;\n /** Qualified `Type.member` the GIR redirects the callable to, from its `moved-to` annotation. */\n movedTo: string | undefined;\n /** Name of the callable that shadows this one, from the GIR's `shadowed-by` annotation. */\n shadowedBy: string | undefined;\n /** Name of the callable that completes this asynchronous one, from the GIR's `glib:finish-func`. */\n finishFunc: string | undefined;\n /** The instance the callable is invoked on, absent for constructors and namespace-level functions. */\n instance: GirParameter | undefined;\n /** Parameters other than the instance one, in declaration order. */\n parameters: GirParameter[];\n /** What the callable returns, with its transfer and nullability. */\n returnValue: GirReturnValue;\n};\n\nconst relaxParameters = (parameters: GirParameter[], names: string[]): void => {\n for (const parameter of parameters) {\n if (names.includes(parameter.name)) {\n parameter.nullable = true;\n }\n }\n};\n\nconst relaxMissingNullable = (fn: GirFunction): GirFunction => {\n const names = fn.cIdentifier === undefined ? undefined : PARAMETERS_MISSING_NULLABLE_ANNOTATION.get(fn.cIdentifier);\n\n if (names !== undefined) {\n relaxParameters(fn.parameters, names);\n }\n\n return fn;\n};\n\nconst parameterIndexFor = (parameters: GirParameter[], name: string): number => {\n const index = parameters.findIndex((parameter) => parameter.name === name);\n\n if (index === -1) {\n throw new Error(`A cursor correction names a parameter the GIR does not declare: ${name}`);\n }\n\n return index;\n};\n\nconst bindCursorParameters = (parameters: GirParameter[], corrections: CursorParameterNames[]): void => {\n for (const names of corrections) {\n const parameter = parameters[parameterIndexFor(parameters, names.cursor)];\n\n if (parameter !== undefined) {\n parameter.cursor = {\n baseIndex: parameterIndexFor(parameters, names.base),\n lengthIndex: parameterIndexFor(parameters, names.length),\n };\n }\n }\n};\n\nconst bindMissingArrayExtent = (fn: GirFunction): GirFunction => {\n const corrections = fn.cIdentifier === undefined ? undefined : PARAMETERS_MISSING_ARRAY_EXTENT.get(fn.cIdentifier);\n\n if (corrections !== undefined) {\n bindCursorParameters(fn.parameters, corrections);\n }\n\n return fn;\n};\n\nconst functionFromNode = (node: RawNode, context: ParseContext): GirFunction => {\n const instanceNode = getChild(getChild(node, \"parameters\"), \"instance-parameter\");\n\n return bindMissingArrayExtent(\n relaxMissingNullable({\n ...parseCallable(node, context),\n name: attr(node, \"shadows\") ?? attr(node, \"name\") ?? \"\",\n cIdentifier: attr(node, \"c:identifier\"),\n movedTo: attr(node, \"moved-to\"),\n shadowedBy: attr(node, \"shadowed-by\"),\n finishFunc: attr(node, \"glib:finish-func\"),\n instance: instanceNode === undefined ? undefined : parameterFromNode(instanceNode, context),\n }),\n );\n};\n\nexport { functionFromNode, type GirFunction };\n"]}
|
package/dist/gir/libraries.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/** A `libraries` config value: an explicit list, `"*"` for everything installed, or absent for the default. */
|
|
2
|
-
type LibrarySelection =
|
|
3
|
-
/** The `libraries` value that stands for every GIR library installed on the search path. */
|
|
4
|
-
declare const LIBRARIES_WILDCARD = "*";
|
|
2
|
+
type LibrarySelection = "*" | string[] | undefined;
|
|
5
3
|
/**
|
|
6
4
|
* Expands a `libraries` config value into the GIR identifiers to generate from: `"Gtk-4.0"` alone when
|
|
7
5
|
* nothing is configured, everything installed for `"*"`, and otherwise the given list with `"Gtk-4.0"`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../../src/gir/libraries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"libraries.d.ts","sourceRoot":"","sources":["../../src/gir/libraries.ts"],"names":[],"mappings":"AAaA,+GAA+G;AAC/G,KAAK,gBAAgB,GAAG,GAAG,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;AAOnD;;;;;;GAMG;AACH,QAAA,MAAM,gBAAgB,GAAI,WAAW,gBAAgB,EAAE,SAAS,MAAM,EAAE,KAAG,MAAM,EAqBhF,CAAC;AA4CF;;;GAGG;AACH,QAAA,MAAM,qBAAqB,GAAI,SAAS,MAAM,EAAE,KAAG,MAAM,EAQxD,CAAC;AAkBF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
|
package/dist/gir/libraries.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { sortStrings } from "@gtkx/utils";
|
|
2
2
|
import { readdirSync } from "node:fs";
|
|
3
|
-
/** The `libraries` value that stands for every GIR library installed on the search path. */
|
|
4
3
|
const LIBRARIES_WILDCARD = "*";
|
|
5
4
|
const GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\d+(?:\.\d+)*$/;
|
|
6
5
|
const DEFAULT_LIBRARIES = ["Gtk-4.0"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../../src/gir/libraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"libraries.js","sourceRoot":"","sources":["../../src/gir/libraries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAetC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,mBAAmB,GAAG,sCAAsC,CAAC;AACnE,MAAM,iBAAiB,GAAa,CAAC,SAAS,CAAC,CAAC;AAChD,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,CAAC,SAA2B,EAAE,OAAiB,EAAY,EAAE;IAClF,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,iBAAiB,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,SAAS,KAAK,kBAAkB,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAElD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,KAAK,CACX,gEAAgE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;gBACvF,gFAAgF,CACnF,CAAC;QACN,CAAC;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvE,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC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,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAE3E,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;YACnB,OAAO,UAAU,CAAC;QACtB,CAAC;IACL,CAAC;IAED,OAAO,CAAC,CAAC;AACb,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAyB,CAAC","sourcesContent":["import { sortStrings } from \"@gtkx/utils\";\nimport { readdirSync } from \"node:fs\";\n\n/** A namespace found on the GIR path, taken from the name of its `.gir` file. */\ntype GirNamespace = {\n /** Namespace the file describes, such as `Gtk`. */\n name: string;\n /** API version the file describes, such as `4.0`. */\n version: string;\n /** Name and version joined the way a `libraries` entry spells them, such as `Gtk-4.0`. */\n identifier: string;\n};\n\n/** A `libraries` config value: an explicit list, `\"*\"` for everything installed, or absent for the default. */\ntype LibrarySelection = \"*\" | string[] | undefined;\n\nconst LIBRARIES_WILDCARD = \"*\";\nconst GIR_LIBRARY_PATTERN = /^[A-Za-z][A-Za-z0-9]*-\\d+(?:\\.\\d+)*$/;\nconst DEFAULT_LIBRARIES: string[] = [\"Gtk-4.0\"];\nconst GIR_FILE_SUFFIX = \".gir\";\n\n/**\n * Expands a `libraries` config value into the GIR identifiers to generate from: `\"Gtk-4.0\"` alone when\n * nothing is configured, everything installed for `\"*\"`, and otherwise the given list with `\"Gtk-4.0\"`\n * prepended unless it already names a Gtk version.\n *\n * @throws If `\"*\"` matched no `.gir` file anywhere on the GIR path.\n */\nconst resolveLibraries = (libraries: LibrarySelection, girPath: string[]): string[] => {\n if (libraries === undefined) {\n return [...DEFAULT_LIBRARIES];\n }\n\n if (libraries === LIBRARIES_WILDCARD) {\n const discovered = discoverGirNamespaces(girPath);\n\n if (discovered.length === 0) {\n throw new Error(\n `gtkx.config.ts: \\`libraries: \"*\"\\` matched no .gir files in [${girPath.join(\", \")}]. ` +\n \"Install gobject-introspection data packages, or list the libraries explicitly.\",\n );\n }\n\n return discovered;\n }\n\n const hasGtk = libraries.some((library) => library.startsWith(\"Gtk-\"));\n\n return [...new Set([...(hasGtk ? [] : DEFAULT_LIBRARIES), ...libraries])];\n};\n\nconst readDirEntries = (dir: string): string[] => {\n try {\n return readdirSync(dir);\n } catch {\n return [];\n }\n};\n\nconst parseGirNamespace = (entry: string): GirNamespace | undefined => {\n if (!entry.endsWith(GIR_FILE_SUFFIX)) {\n return undefined;\n }\n\n const identifier = entry.slice(0, -GIR_FILE_SUFFIX.length);\n\n if (!GIR_LIBRARY_PATTERN.test(identifier)) {\n return undefined;\n }\n\n const separator = identifier.indexOf(\"-\");\n\n return { name: identifier.slice(0, separator), version: identifier.slice(separator + 1), identifier };\n};\n\nconst recordHighest = (highestByName: Map<string, GirNamespace>, parsed: GirNamespace): void => {\n const existing = highestByName.get(parsed.name);\n\n if (existing === undefined || compareVersions(parsed.version, existing.version) > 0) {\n highestByName.set(parsed.name, parsed);\n }\n};\n\nconst collectDirNamespaces = (highestByName: Map<string, GirNamespace>, dir: string): void => {\n for (const entry of readDirEntries(dir)) {\n const parsed = parseGirNamespace(entry);\n\n if (parsed !== undefined) {\n recordHighest(highestByName, parsed);\n }\n }\n};\n\n/**\n * Every GIR library installed on the search path, as sorted `Name-Version` identifiers. A namespace found\n * in more than one version contributes only its highest, and unreadable directories are skipped.\n */\nconst discoverGirNamespaces = (girPath: string[]): string[] => {\n const highestByName: Map<string, GirNamespace> = new Map();\n\n for (const dir of girPath) {\n collectDirNamespaces(highestByName, dir);\n }\n\n return sortStrings(highestByName.values().map(({ identifier }) => identifier));\n};\n\nconst compareVersions = (a: string, b: string): number => {\n const aParts = a.split(\".\");\n const bParts = b.split(\".\");\n const length = Math.max(aParts.length, bParts.length);\n\n for (let index = 0; index < length; index += 1) {\n const difference = Number(aParts[index] ?? 0) - Number(bParts[index] ?? 0);\n\n if (difference !== 0) {\n return difference;\n }\n }\n\n return 0;\n};\n\nexport { resolveLibraries, discoverGirNamespaces, type LibrarySelection };\n"]}
|