@gtkx/codegen 1.0.0-rc.1 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis/descriptor-render.d.ts +18 -11
- package/dist/analysis/descriptor-render.d.ts.map +1 -1
- package/dist/analysis/descriptor-render.js +275 -152
- package/dist/analysis/descriptor-render.js.map +1 -1
- package/dist/analysis/descriptor.d.ts +37 -34
- package/dist/analysis/descriptor.d.ts.map +1 -1
- package/dist/analysis/descriptor.js +34 -30
- package/dist/analysis/descriptor.js.map +1 -1
- package/dist/analysis/inheritance.d.ts +16 -16
- package/dist/analysis/inheritance.d.ts.map +1 -1
- package/dist/analysis/inheritance.js +139 -84
- package/dist/analysis/inheritance.js.map +1 -1
- package/dist/analysis/param-structure.d.ts +14 -13
- package/dist/analysis/param-structure.d.ts.map +1 -1
- package/dist/analysis/param-structure.js +104 -53
- package/dist/analysis/param-structure.js.map +1 -1
- package/dist/analysis/ts-type.d.ts +6 -5
- package/dist/analysis/ts-type.d.ts.map +1 -1
- package/dist/analysis/ts-type.js +69 -23
- package/dist/analysis/ts-type.js.map +1 -1
- package/dist/compile.d.ts +5 -5
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +70 -63
- package/dist/compile.js.map +1 -1
- package/dist/docs/api-reference.d.ts +12 -11
- package/dist/docs/api-reference.d.ts.map +1 -1
- package/dist/docs/api-reference.js +194 -121
- package/dist/docs/api-reference.js.map +1 -1
- package/dist/docs/element-page.d.ts +6 -9
- package/dist/docs/element-page.d.ts.map +1 -1
- package/dist/docs/element-page.js +68 -133
- package/dist/docs/element-page.js.map +1 -1
- package/dist/docs/pipeline.d.ts +8 -7
- package/dist/docs/pipeline.d.ts.map +1 -1
- package/dist/docs/pipeline.js +79 -53
- package/dist/docs/pipeline.js.map +1 -1
- package/dist/docs/render.d.ts +21 -19
- package/dist/docs/render.d.ts.map +1 -1
- package/dist/docs/render.js +80 -71
- package/dist/docs/render.js.map +1 -1
- package/dist/docs/symbol-page.d.ts +6 -6
- package/dist/docs/symbol-page.d.ts.map +1 -1
- package/dist/docs/symbol-page.js +126 -84
- package/dist/docs/symbol-page.js.map +1 -1
- package/dist/fingerprint.d.ts +28 -5
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +66 -13
- package/dist/fingerprint.js.map +1 -1
- package/dist/gi.d.ts +13 -0
- package/dist/gi.d.ts.map +1 -0
- package/dist/gi.js +21 -0
- package/dist/gi.js.map +1 -0
- package/dist/gir/ancestry.d.ts +4 -3
- package/dist/gir/ancestry.d.ts.map +1 -1
- package/dist/gir/ancestry.js +12 -15
- package/dist/gir/ancestry.js.map +1 -1
- package/dist/gir/callback.d.ts +6 -11
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +6 -7
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +7 -5
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +14 -12
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +3 -3
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +7 -6
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +8 -3
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +30 -7
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +6 -3
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +23 -7
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +2 -1
- package/dist/gir/gir-path.d.ts.map +1 -1
- package/dist/gir/gir-path.js +26 -10
- package/dist/gir/gir-path.js.map +1 -1
- package/dist/gir/libraries.d.ts +3 -2
- package/dist/gir/libraries.d.ts.map +1 -1
- package/dist/gir/libraries.js +39 -27
- package/dist/gir/libraries.js.map +1 -1
- package/dist/gir/library.d.ts +17 -11
- package/dist/gir/library.d.ts.map +1 -1
- package/dist/gir/library.js +116 -92
- package/dist/gir/library.js.map +1 -1
- package/dist/gir/namespace.d.ts +10 -10
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +21 -20
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/nullable-overrides.d.ts +3 -0
- package/dist/gir/nullable-overrides.d.ts.map +1 -0
- package/dist/gir/nullable-overrides.js +5 -0
- package/dist/gir/nullable-overrides.js.map +1 -0
- package/dist/gir/parameter.d.ts +14 -12
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +27 -18
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +12 -13
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +50 -40
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +5 -4
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js +4 -3
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +5 -4
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +10 -9
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +5 -4
- package/dist/gir/record.d.ts.map +1 -1
- package/dist/gir/record.js +13 -12
- package/dist/gir/record.js.map +1 -1
- package/dist/gir/size.d.ts +6 -5
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +49 -47
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +17 -15
- package/dist/gir/type-id.d.ts.map +1 -1
- package/dist/gir/type-id.js +5 -1
- package/dist/gir/type-id.js.map +1 -1
- package/dist/gir/type-ref.d.ts +3 -2
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +36 -25
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +3 -2
- package/dist/gir/type.d.ts.map +1 -1
- package/dist/gir/type.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx.d.ts +26 -0
- package/dist/jsx.d.ts.map +1 -0
- package/dist/jsx.js +40 -0
- package/dist/jsx.js.map +1 -0
- package/dist/khronos/args.d.ts +7 -7
- package/dist/khronos/args.d.ts.map +1 -1
- package/dist/khronos/args.js +88 -67
- package/dist/khronos/args.js.map +1 -1
- package/dist/khronos/jsdoc.d.ts +4 -4
- package/dist/khronos/jsdoc.d.ts.map +1 -1
- package/dist/khronos/jsdoc.js +29 -16
- package/dist/khronos/jsdoc.js.map +1 -1
- package/dist/khronos/model.d.ts +8 -7
- package/dist/khronos/model.d.ts.map +1 -1
- package/dist/khronos/model.js +94 -59
- package/dist/khronos/model.js.map +1 -1
- package/dist/khronos/modules.d.ts +4 -3
- package/dist/khronos/modules.d.ts.map +1 -1
- package/dist/khronos/modules.js +40 -25
- package/dist/khronos/modules.js.map +1 -1
- package/dist/khronos/param-pair.d.ts +11 -0
- package/dist/khronos/param-pair.d.ts.map +1 -0
- package/dist/khronos/param-pair.js +6 -0
- package/dist/khronos/param-pair.js.map +1 -0
- package/dist/khronos/parse.d.ts +7 -8
- package/dist/khronos/parse.d.ts.map +1 -1
- package/dist/khronos/parse.js +17 -16
- package/dist/khronos/parse.js.map +1 -1
- package/dist/khronos/pipeline.d.ts +4 -4
- package/dist/khronos/pipeline.d.ts.map +1 -1
- package/dist/khronos/pipeline.js +97 -56
- package/dist/khronos/pipeline.js.map +1 -1
- package/dist/khronos/plan.d.ts +11 -10
- package/dist/khronos/plan.d.ts.map +1 -1
- package/dist/khronos/plan.js +109 -45
- package/dist/khronos/plan.js.map +1 -1
- package/dist/khronos/render.d.ts +5 -4
- package/dist/khronos/render.d.ts.map +1 -1
- package/dist/khronos/render.js +106 -59
- package/dist/khronos/render.js.map +1 -1
- package/dist/khronos/select.d.ts +4 -4
- package/dist/khronos/select.d.ts.map +1 -1
- package/dist/khronos/select.js +30 -19
- package/dist/khronos/select.js.map +1 -1
- package/dist/react/element-config.d.ts +17 -0
- package/dist/react/element-config.d.ts.map +1 -0
- package/dist/react/element-config.js +61 -0
- package/dist/react/element-config.js.map +1 -0
- package/dist/runner.d.ts +17 -10
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +45 -43
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +5 -3
- package/dist/store/compile-store.d.ts.map +1 -1
- package/dist/store/compile-store.js +24 -22
- package/dist/store/compile-store.js.map +1 -1
- package/dist/store/gi/async.d.ts +2 -1
- package/dist/store/gi/async.d.ts.map +1 -1
- package/dist/store/gi/async.js +28 -24
- package/dist/store/gi/async.js.map +1 -1
- package/dist/store/gi/callables.d.ts +26 -20
- package/dist/store/gi/callables.d.ts.map +1 -1
- package/dist/store/gi/callables.js +162 -100
- package/dist/store/gi/callables.js.map +1 -1
- package/dist/store/gi/callback.d.ts +3 -2
- package/dist/store/gi/callback.d.ts.map +1 -1
- package/dist/store/gi/callback.js +6 -3
- package/dist/store/gi/callback.js.map +1 -1
- package/dist/store/gi/class-struct-record.d.ts +4 -3
- package/dist/store/gi/class-struct-record.d.ts.map +1 -1
- package/dist/store/gi/class-struct-record.js +33 -15
- package/dist/store/gi/class-struct-record.js.map +1 -1
- package/dist/store/gi/class.d.ts +2 -1
- package/dist/store/gi/class.d.ts.map +1 -1
- package/dist/store/gi/class.js +86 -47
- package/dist/store/gi/class.js.map +1 -1
- package/dist/store/gi/companion.d.ts +2 -1
- package/dist/store/gi/companion.d.ts.map +1 -1
- package/dist/store/gi/companion.js +8 -5
- package/dist/store/gi/companion.js.map +1 -1
- package/dist/store/gi/constant.d.ts +3 -2
- package/dist/store/gi/constant.d.ts.map +1 -1
- package/dist/store/gi/constant.js +25 -8
- package/dist/store/gi/constant.js.map +1 -1
- package/dist/store/gi/constructor-props.d.ts +3 -2
- package/dist/store/gi/constructor-props.d.ts.map +1 -1
- package/dist/store/gi/constructor-props.js +17 -10
- package/dist/store/gi/constructor-props.js.map +1 -1
- package/dist/store/gi/enum.d.ts +3 -2
- package/dist/store/gi/enum.d.ts.map +1 -1
- package/dist/store/gi/enum.js +14 -11
- package/dist/store/gi/enum.js.map +1 -1
- package/dist/store/gi/function.d.ts +5 -4
- package/dist/store/gi/function.d.ts.map +1 -1
- package/dist/store/gi/function.js +50 -23
- package/dist/store/gi/function.js.map +1 -1
- package/dist/store/gi/gtype-binding.d.ts +4 -4
- package/dist/store/gi/gtype-binding.d.ts.map +1 -1
- package/dist/store/gi/gtype-binding.js +15 -11
- package/dist/store/gi/gtype-binding.js.map +1 -1
- package/dist/store/gi/interface.d.ts +2 -1
- package/dist/store/gi/interface.d.ts.map +1 -1
- package/dist/store/gi/interface.js +36 -18
- package/dist/store/gi/interface.js.map +1 -1
- package/dist/store/gi/item-comparators.d.ts +3 -2
- package/dist/store/gi/item-comparators.d.ts.map +1 -1
- package/dist/store/gi/item-comparators.js +33 -21
- package/dist/store/gi/item-comparators.js.map +1 -1
- package/dist/store/gi/method.d.ts +13 -13
- package/dist/store/gi/method.d.ts.map +1 -1
- package/dist/store/gi/method.js +187 -130
- package/dist/store/gi/method.js.map +1 -1
- package/dist/store/gi/param-marshal.d.ts +7 -6
- package/dist/store/gi/param-marshal.d.ts.map +1 -1
- package/dist/store/gi/param-marshal.js +26 -13
- package/dist/store/gi/param-marshal.js.map +1 -1
- package/dist/store/gi/pipeline.d.ts +2 -1
- package/dist/store/gi/pipeline.d.ts.map +1 -1
- package/dist/store/gi/pipeline.js +38 -23
- package/dist/store/gi/pipeline.js.map +1 -1
- package/dist/store/gi/properties.d.ts +2 -1
- package/dist/store/gi/properties.d.ts.map +1 -1
- package/dist/store/gi/properties.js +6 -4
- package/dist/store/gi/properties.js.map +1 -1
- package/dist/store/gi/property-accessor.d.ts +11 -10
- package/dist/store/gi/property-accessor.d.ts.map +1 -1
- package/dist/store/gi/property-accessor.js +86 -60
- package/dist/store/gi/property-accessor.js.map +1 -1
- package/dist/store/gi/record-constructor.d.ts +3 -2
- package/dist/store/gi/record-constructor.d.ts.map +1 -1
- package/dist/store/gi/record-constructor.js +36 -25
- package/dist/store/gi/record-constructor.js.map +1 -1
- package/dist/store/gi/record-field-accessor.d.ts +8 -8
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -1
- package/dist/store/gi/record-field-accessor.js +171 -99
- package/dist/store/gi/record-field-accessor.js.map +1 -1
- package/dist/store/gi/record-layout.d.ts +6 -5
- package/dist/store/gi/record-layout.d.ts.map +1 -1
- package/dist/store/gi/record-layout.js +75 -39
- package/dist/store/gi/record-layout.js.map +1 -1
- package/dist/store/gi/record.d.ts +2 -1
- package/dist/store/gi/record.d.ts.map +1 -1
- package/dist/store/gi/record.js +19 -13
- package/dist/store/gi/record.js.map +1 -1
- package/dist/store/gi/registration.d.ts +3 -3
- package/dist/store/gi/registration.d.ts.map +1 -1
- package/dist/store/gi/registration.js +3 -2
- package/dist/store/gi/registration.js.map +1 -1
- package/dist/store/gi/return-wrap.d.ts +2 -2
- package/dist/store/gi/return-wrap.d.ts.map +1 -1
- package/dist/store/gi/return-wrap.js +43 -22
- package/dist/store/gi/return-wrap.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 +6 -3
- package/dist/store/gi/runtime-override.js.map +1 -1
- package/dist/store/gi/signal.d.ts +3 -2
- package/dist/store/gi/signal.d.ts.map +1 -1
- package/dist/store/gi/signal.js +113 -66
- package/dist/store/gi/signal.js.map +1 -1
- package/dist/store/gi/vtable.d.ts +2 -1
- package/dist/store/gi/vtable.d.ts.map +1 -1
- package/dist/store/gi/vtable.js +60 -30
- package/dist/store/gi/vtable.js.map +1 -1
- package/dist/store/gi-store.d.ts +5 -4
- package/dist/store/gi-store.d.ts.map +1 -1
- package/dist/store/gi-store.js +4 -2
- package/dist/store/gi-store.js.map +1 -1
- package/dist/store/jsx/element-components.d.ts +23 -0
- package/dist/store/jsx/element-components.d.ts.map +1 -0
- package/dist/store/jsx/element-components.js +86 -0
- package/dist/store/jsx/element-components.js.map +1 -0
- package/dist/store/jsx/element-prop-imports.d.ts +17 -0
- package/dist/store/jsx/element-prop-imports.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-imports.js +15 -0
- package/dist/store/jsx/element-prop-imports.js.map +1 -0
- package/dist/store/jsx/element-prop-types.d.ts +10 -0
- package/dist/store/jsx/element-prop-types.d.ts.map +1 -0
- package/dist/store/jsx/element-prop-types.js +41 -0
- package/dist/store/jsx/element-prop-types.js.map +1 -0
- package/dist/store/jsx/gir-index.d.ts +16 -0
- package/dist/store/jsx/gir-index.d.ts.map +1 -0
- package/dist/store/jsx/gir-index.js +33 -0
- package/dist/store/jsx/gir-index.js.map +1 -0
- package/dist/store/jsx/intrinsic-elements.d.ts +27 -0
- package/dist/store/jsx/intrinsic-elements.d.ts.map +1 -0
- package/dist/store/jsx/intrinsic-elements.js +128 -0
- package/dist/store/jsx/intrinsic-elements.js.map +1 -0
- package/dist/store/{react → jsx}/jsx.d.ts +2 -4
- package/dist/store/jsx/jsx.d.ts.map +1 -0
- package/dist/store/{react → jsx}/jsx.js +110 -71
- package/dist/store/jsx/jsx.js.map +1 -0
- package/dist/store/jsx/metadata.d.ts +4 -0
- package/dist/store/jsx/metadata.d.ts.map +1 -0
- package/dist/store/{react → jsx}/metadata.js +148 -69
- package/dist/store/jsx/metadata.js.map +1 -0
- package/dist/store/jsx/pipeline.d.ts +21 -0
- package/dist/store/jsx/pipeline.d.ts.map +1 -0
- package/dist/store/{react → jsx}/pipeline.js +36 -15
- package/dist/store/jsx/pipeline.js.map +1 -0
- package/dist/store/{react → jsx}/props.d.ts +9 -12
- package/dist/store/jsx/props.d.ts.map +1 -0
- package/dist/store/jsx/props.js +158 -0
- package/dist/store/jsx/props.js.map +1 -0
- package/dist/store/jsx-store.d.ts +5 -3
- package/dist/store/jsx-store.d.ts.map +1 -1
- package/dist/store/jsx-store.js +4 -1
- package/dist/store/jsx-store.js.map +1 -1
- package/dist/store/store-fs.d.ts +14 -12
- package/dist/store/store-fs.d.ts.map +1 -1
- package/dist/store/store-fs.js +9 -7
- package/dist/store/store-fs.js.map +1 -1
- package/dist/writer/context.d.ts +2 -1
- package/dist/writer/context.d.ts.map +1 -1
- package/dist/writer/context.js +12 -6
- package/dist/writer/context.js.map +1 -1
- package/dist/writer/doc.d.ts +2 -1
- package/dist/writer/doc.d.ts.map +1 -1
- package/dist/writer/doc.js +13 -7
- package/dist/writer/doc.js.map +1 -1
- package/dist/writer/emit.d.ts +8 -7
- package/dist/writer/emit.d.ts.map +1 -1
- package/dist/writer/emit.js +13 -10
- package/dist/writer/emit.js.map +1 -1
- package/dist/writer/gtk-doc.d.ts +2 -1
- package/dist/writer/gtk-doc.d.ts.map +1 -1
- package/dist/writer/gtk-doc.js +29 -18
- package/dist/writer/gtk-doc.js.map +1 -1
- package/dist/writer/imports.d.ts +4 -2
- package/dist/writer/imports.d.ts.map +1 -1
- package/dist/writer/imports.js +35 -24
- package/dist/writer/imports.js.map +1 -1
- package/dist/writer/module.d.ts +3 -2
- package/dist/writer/module.d.ts.map +1 -1
- package/dist/writer/module.js +16 -9
- package/dist/writer/module.js.map +1 -1
- package/dist/xml.d.ts +4 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +10 -0
- package/dist/xml.js.map +1 -0
- package/overrides/cairo/context.ts.ejs +7 -7
- package/overrides/cairo/matrix.ts.ejs +2 -2
- package/overrides/cairo/recording-surface.ts.ejs +2 -2
- package/overrides/cairo/region.ts.ejs +1 -1
- package/overrides/cairo/scaled-font.ts.ejs +3 -3
- package/package.json +15 -9
- package/src/analysis/descriptor-render.ts +484 -168
- package/src/analysis/descriptor.ts +162 -125
- package/src/analysis/inheritance.ts +286 -98
- package/src/analysis/param-structure.ts +188 -57
- package/src/analysis/ts-type.ts +112 -26
- package/src/compile.ts +103 -76
- package/src/docs/api-reference.ts +340 -144
- package/src/docs/element-page.ts +137 -146
- package/src/docs/pipeline.ts +132 -73
- package/src/docs/render.ts +151 -87
- package/src/docs/symbol-page.ts +268 -123
- package/src/fingerprint.ts +127 -29
- package/src/gi.ts +26 -0
- package/src/gir/ancestry.ts +26 -14
- package/src/gir/callback.ts +10 -15
- package/src/gir/class.ts +20 -16
- package/src/gir/enum.ts +9 -7
- package/src/gir/field.ts +37 -8
- package/src/gir/function.ts +33 -9
- package/src/gir/gir-path.ts +36 -12
- package/src/gir/libraries.ts +56 -31
- package/src/gir/library.ts +200 -97
- package/src/gir/namespace.ts +42 -26
- package/src/gir/nullable-overrides.ts +5 -0
- package/src/gir/parameter.ts +80 -42
- package/src/gir/parse.ts +102 -47
- package/src/gir/primitives.ts +25 -23
- package/src/gir/property.ts +13 -11
- package/src/gir/record.ts +16 -14
- package/src/gir/size.ts +91 -58
- package/src/gir/type-id.ts +33 -18
- package/src/gir/type-ref.ts +62 -26
- package/src/gir/type.ts +10 -8
- package/src/index.ts +7 -0
- package/src/jsx.ts +70 -0
- package/src/khronos/args.ts +158 -89
- package/src/khronos/jsdoc.ts +67 -29
- package/src/khronos/model.ts +154 -53
- package/src/khronos/modules.ts +67 -27
- package/src/khronos/param-pair.ts +14 -0
- package/src/khronos/parse.ts +37 -17
- package/src/khronos/pipeline.ts +193 -90
- package/src/khronos/plan.ts +235 -86
- package/src/khronos/render.ts +208 -71
- package/src/khronos/select.ts +48 -18
- package/src/react/element-config.ts +91 -0
- package/src/runner.ts +93 -57
- package/src/store/compile-store.ts +32 -26
- package/src/store/gi/async.ts +48 -21
- package/src/store/gi/callables.ts +345 -136
- package/src/store/gi/callback.ts +13 -4
- package/src/store/gi/class-struct-record.ts +49 -17
- package/src/store/gi/class.ts +186 -64
- package/src/store/gi/companion.ts +15 -6
- package/src/store/gi/constant.ts +42 -8
- package/src/store/gi/constructor-props.ts +42 -16
- package/src/store/gi/enum.ts +28 -13
- package/src/store/gi/function.ts +90 -24
- package/src/store/gi/gtype-binding.ts +31 -18
- package/src/store/gi/interface.ts +101 -36
- package/src/store/gi/item-comparators.ts +74 -26
- package/src/store/gi/method.ts +376 -159
- package/src/store/gi/param-marshal.ts +38 -15
- package/src/store/gi/pipeline.ts +72 -22
- package/src/store/gi/properties.ts +16 -5
- package/src/store/gi/property-accessor.ts +192 -84
- package/src/store/gi/record-constructor.ts +62 -30
- package/src/store/gi/record-field-accessor.ts +380 -167
- package/src/store/gi/record-layout.ts +130 -43
- package/src/store/gi/record.ts +37 -14
- package/src/store/gi/registration.ts +15 -9
- package/src/store/gi/return-wrap.ts +71 -23
- package/src/store/gi/runtime-override.ts +13 -3
- package/src/store/gi/signal.ts +244 -104
- package/src/store/gi/vtable.ts +117 -41
- package/src/store/gi-store.ts +26 -13
- package/src/store/jsx/element-components.ts +152 -0
- package/src/store/jsx/element-prop-imports.ts +24 -0
- package/src/store/jsx/element-prop-types.ts +59 -0
- package/src/store/jsx/gir-index.ts +62 -0
- package/src/store/jsx/intrinsic-elements.ts +262 -0
- package/src/store/{react → jsx}/jsx.ts +213 -99
- package/src/store/jsx/metadata.ts +385 -0
- package/src/store/jsx/pipeline.ts +145 -0
- package/src/store/jsx/props.ts +274 -0
- package/src/store/jsx-store.ts +15 -3
- package/src/store/store-fs.ts +36 -20
- package/src/writer/context.ts +25 -6
- package/src/writer/doc.ts +19 -5
- package/src/writer/emit.ts +20 -11
- package/src/writer/gtk-doc.ts +48 -21
- package/src/writer/imports.ts +63 -28
- package/src/writer/module.ts +35 -11
- package/src/xml.ts +12 -0
- package/dist/store/react/built-ins.d.ts +0 -9
- package/dist/store/react/built-ins.d.ts.map +0 -1
- package/dist/store/react/built-ins.js +0 -226
- package/dist/store/react/built-ins.js.map +0 -1
- package/dist/store/react/element-components.d.ts +0 -15
- package/dist/store/react/element-components.d.ts.map +0 -1
- package/dist/store/react/element-components.js +0 -92
- package/dist/store/react/element-components.js.map +0 -1
- package/dist/store/react/element-prop-types.d.ts +0 -19
- package/dist/store/react/element-prop-types.d.ts.map +0 -1
- package/dist/store/react/element-prop-types.js +0 -244
- package/dist/store/react/element-prop-types.js.map +0 -1
- package/dist/store/react/element-props.d.ts +0 -4
- package/dist/store/react/element-props.d.ts.map +0 -1
- package/dist/store/react/element-props.js +0 -178
- package/dist/store/react/element-props.js.map +0 -1
- package/dist/store/react/gir-index.d.ts +0 -25
- package/dist/store/react/gir-index.d.ts.map +0 -1
- package/dist/store/react/gir-index.js +0 -55
- package/dist/store/react/gir-index.js.map +0 -1
- package/dist/store/react/intrinsic-elements.d.ts +0 -26
- package/dist/store/react/intrinsic-elements.d.ts.map +0 -1
- package/dist/store/react/intrinsic-elements.js +0 -107
- package/dist/store/react/intrinsic-elements.js.map +0 -1
- package/dist/store/react/jsx.d.ts.map +0 -1
- package/dist/store/react/jsx.js.map +0 -1
- package/dist/store/react/metadata.d.ts +0 -4
- package/dist/store/react/metadata.d.ts.map +0 -1
- package/dist/store/react/metadata.js.map +0 -1
- package/dist/store/react/pipeline.d.ts +0 -14
- package/dist/store/react/pipeline.d.ts.map +0 -1
- package/dist/store/react/pipeline.js.map +0 -1
- package/dist/store/react/props.d.ts.map +0 -1
- package/dist/store/react/props.js +0 -133
- package/dist/store/react/props.js.map +0 -1
- package/overrides/gtk/constants.ts.ejs +0 -3
- package/overrides/gtk/index.ts.ejs +0 -2
- package/src/store/react/built-ins.ts +0 -260
- package/src/store/react/element-components.ts +0 -138
- package/src/store/react/element-prop-types.ts +0 -280
- package/src/store/react/element-props.ts +0 -204
- package/src/store/react/gir-index.ts +0 -85
- package/src/store/react/intrinsic-elements.ts +0 -161
- package/src/store/react/metadata.ts +0 -197
- package/src/store/react/pipeline.ts +0 -90
- package/src/store/react/props.ts +0 -197
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element-config.d.ts","sourceRoot":"","sources":["../../src/react/element-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,oGAAoG;AACpG,KAAK,cAAc,GAAG;IAAE,SAAS,CAAC,EAAE,YAAY,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC;AAEzF,qFAAqF;AACrF,KAAK,eAAe,GAAG;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACzC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACvC,CAAC;AAkEF,QAAA,MAAM,mBAAmB,GAAU,iBAAiB,MAAM,EAAE,EAAE,YAAY,MAAM,KAAG,OAAO,CAAC,eAAe,CAUzG,CAAC;AAEF,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { readdirSync } from "node:fs";
|
|
2
|
+
const CONFIG_ENTRYPOINT = "config";
|
|
3
|
+
const CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;
|
|
4
|
+
const presentNamespaceDirs = (giStoreDir) => {
|
|
5
|
+
const dirs = new Set();
|
|
6
|
+
const entries = readdirSync(giStoreDir, { withFileTypes: true });
|
|
7
|
+
for (const entry of entries) {
|
|
8
|
+
if (entry.isDirectory()) {
|
|
9
|
+
dirs.add(entry.name);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return dirs;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus
|
|
16
|
+
* each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.
|
|
17
|
+
*/
|
|
18
|
+
const configEntrypoints = (reactSubexports, present) => reactSubexports.filter((sub) => {
|
|
19
|
+
if (sub === CONFIG_ENTRYPOINT) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));
|
|
23
|
+
});
|
|
24
|
+
const importBuiltinElements = async (entrypoint) => {
|
|
25
|
+
const specifier = `@gtkx/react/${entrypoint}`;
|
|
26
|
+
const imported = (await import(/* @vite-ignore */ specifier));
|
|
27
|
+
return imported.BUILTIN_ELEMENTS ?? {};
|
|
28
|
+
};
|
|
29
|
+
const applyBuiltinElement = (target, type, config) => {
|
|
30
|
+
if (config.component !== undefined) {
|
|
31
|
+
target.components[type] = config.component;
|
|
32
|
+
}
|
|
33
|
+
if (config.props !== undefined) {
|
|
34
|
+
target.props[type] = config.props;
|
|
35
|
+
}
|
|
36
|
+
if (config.lazy === true) {
|
|
37
|
+
target.lazyElements.push(type);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config
|
|
42
|
+
* entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;
|
|
43
|
+
* it must run only after the gi store has been linked.
|
|
44
|
+
*/
|
|
45
|
+
const collectBuiltinElements = (target, elements) => {
|
|
46
|
+
for (const [type, config] of Object.entries(elements)) {
|
|
47
|
+
applyBuiltinElement(target, type, config);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const readBuiltinElements = async (reactSubexports, giStoreDir) => {
|
|
51
|
+
const present = presentNamespaceDirs(giStoreDir);
|
|
52
|
+
const entrypoints = configEntrypoints(reactSubexports, present);
|
|
53
|
+
const result = { components: {}, lazyElements: [], props: {} };
|
|
54
|
+
for (const entrypoint of entrypoints) {
|
|
55
|
+
collectBuiltinElements(result, await importBuiltinElements(entrypoint));
|
|
56
|
+
}
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
export {} from "@gtkx/react/config";
|
|
60
|
+
export { readBuiltinElements };
|
|
61
|
+
//# sourceMappingURL=element-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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AM,EAAE,MAAM,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC;AAEF,OAAO,EAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAA6C,CAAC","sourcesContent":["import type { ModuleExport } from \"@gtkx/react/config\";\nimport { readdirSync } from \"node:fs\";\n\n/** The codegen-relevant subset of a React element config; behaviors are ignored at codegen time. */\ntype BuiltinElement = { component?: ModuleExport; lazy?: boolean; props?: ModuleExport };\n\n/** The framework's built-in element config, split into the maps codegen consumes. */\ntype BuiltinElements = {\n components: Record<string, ModuleExport>;\n lazyElements: string[];\n props: Record<string, ModuleExport>;\n};\n\nconst CONFIG_ENTRYPOINT = \"config\";\nconst CONFIG_SUFFIX = `/${CONFIG_ENTRYPOINT}`;\n\nconst presentNamespaceDirs = (giStoreDir: string): Set<string> => {\n const dirs: Set<string> = new Set();\n const entries = readdirSync(giStoreDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n dirs.add(entry.name);\n }\n }\n\n return dirs;\n};\n\n/**\n * The clean, reconciler-free `@gtkx/react` config entrypoints to import: the base `config` entry plus\n * each namespace's `<ns>/config` entry whose GIR namespace is present in the gi store.\n */\nconst configEntrypoints = (reactSubexports: string[], present: Set<string>): string[] =>\n reactSubexports.filter((sub) => {\n if (sub === CONFIG_ENTRYPOINT) {\n return true;\n }\n\n return sub.endsWith(CONFIG_SUFFIX) && present.has(sub.slice(0, sub.length - CONFIG_SUFFIX.length));\n });\n\nconst importBuiltinElements = async (entrypoint: string): Promise<Record<string, BuiltinElement>> => {\n const specifier = `@gtkx/react/${entrypoint}`;\n\n const imported = (await import(/* @vite-ignore */ specifier)) as {\n BUILTIN_ELEMENTS?: Record<string, BuiltinElement>;\n };\n\n return imported.BUILTIN_ELEMENTS ?? {};\n};\n\nconst applyBuiltinElement = (target: BuiltinElements, type: string, config: BuiltinElement): void => {\n if (config.component !== undefined) {\n target.components[type] = config.component;\n }\n\n if (config.props !== undefined) {\n target.props[type] = config.props;\n }\n\n if (config.lazy === true) {\n target.lazyElements.push(type);\n }\n};\n\n/**\n * Reads the framework's built-in element config by importing the freshly linked `@gtkx/react` config\n * entrypoints. These are reconciler-free, so importing them resolves `@gtkx/gi` but never `virtual:gtkx-config`;\n * it must run only after the gi store has been linked.\n */\nconst collectBuiltinElements = (target: BuiltinElements, elements: Record<string, BuiltinElement>): void => {\n for (const [type, config] of Object.entries(elements)) {\n applyBuiltinElement(target, type, config);\n }\n};\n\nconst readBuiltinElements = async (reactSubexports: string[], giStoreDir: string): Promise<BuiltinElements> => {\n const present = presentNamespaceDirs(giStoreDir);\n const entrypoints = configEntrypoints(reactSubexports, present);\n const result: BuiltinElements = { components: {}, lazyElements: [], props: {} };\n\n for (const entrypoint of entrypoints) {\n collectBuiltinElements(result, await importBuiltinElements(entrypoint));\n }\n\n return result;\n};\n\nexport { type ModuleExport } from \"@gtkx/react/config\";\nexport { readBuiltinElements, type BuiltinElement, type BuiltinElements };\n"]}
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { GiStoreOptions } from "./store/gi-store.js";
|
|
2
|
+
import type { JsxStoreOptions } from "./store/jsx-store.js";
|
|
2
3
|
import { type GlGenerationReport } from "./khronos/pipeline.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
4
|
+
type ModuleExport = {
|
|
5
|
+
module: string;
|
|
6
|
+
export: string;
|
|
7
|
+
};
|
|
8
|
+
type GlCodegenOptions = {
|
|
6
9
|
registryPath: string;
|
|
7
10
|
overrideExports: Set<string>;
|
|
8
11
|
outputDir: string;
|
|
9
12
|
resolveFrom: string;
|
|
10
13
|
};
|
|
11
|
-
|
|
14
|
+
type CodegenRunnerOptions = {
|
|
12
15
|
libraries?: string[];
|
|
13
16
|
girPath?: string[];
|
|
14
|
-
elementProps?: Record<string, ElementProp[]> | undefined;
|
|
15
17
|
gi?: GiStoreOptions;
|
|
16
18
|
jsx?: JsxStoreOptions | undefined;
|
|
19
|
+
reactSubexports?: string[];
|
|
20
|
+
userComponents?: Record<string, ModuleExport>;
|
|
21
|
+
userLazyElements?: string[];
|
|
22
|
+
userProps?: Record<string, ModuleExport>;
|
|
17
23
|
gl?: GlCodegenOptions;
|
|
18
24
|
force?: boolean;
|
|
19
25
|
};
|
|
20
|
-
|
|
26
|
+
type CodegenRunnerResult = {
|
|
21
27
|
regenerated: boolean;
|
|
22
28
|
namespaces: number;
|
|
23
29
|
intrinsicElements: number;
|
|
@@ -27,11 +33,12 @@ export type CodegenRunnerResult = {
|
|
|
27
33
|
/**
|
|
28
34
|
* Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
|
|
29
35
|
* configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
|
|
30
|
-
* fingerprint is stale unless `options.force` is set,
|
|
31
|
-
* `options.gl` is provided.
|
|
36
|
+
* fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
|
|
37
|
+
* the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
|
|
32
38
|
*
|
|
33
39
|
* @param options - What to generate and where to write it.
|
|
34
40
|
* @returns A summary of what was regenerated and how long the run took.
|
|
35
41
|
*/
|
|
36
|
-
|
|
42
|
+
declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
|
|
43
|
+
export { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };
|
|
37
44
|
//# sourceMappingURL=runner.d.ts.map
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner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,GAAU,SAAS,oBAAoB,KAAG,OAAO,CAAC,mBAAmB,CAYpF,CAAC;AA8FF,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,KAAK,oBAAoB,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
package/dist/runner.js
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { checkModules } from "./compile.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isGiStoreFresh } from "./fingerprint.js";
|
|
5
|
+
import { runGiCodegen } from "./gi.js";
|
|
5
6
|
import { Library } from "./gir/library.js";
|
|
6
|
-
import { namespaceDirectory } from "./gir/namespace.js";
|
|
7
7
|
import { generateGlModules } from "./khronos/pipeline.js";
|
|
8
|
-
import { generateNamespaceModule } from "./store/gi/pipeline.js";
|
|
9
|
-
import { writeGiStore } from "./store/gi-store.js";
|
|
10
|
-
import { writeJsxStore } from "./store/jsx-store.js";
|
|
11
|
-
import { generateJsxFiles } from "./store/react/pipeline.js";
|
|
12
8
|
/**
|
|
13
9
|
* Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
|
|
14
10
|
* configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
|
|
15
|
-
* fingerprint is stale unless `options.force` is set,
|
|
16
|
-
* `options.gl` is provided.
|
|
11
|
+
* fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or
|
|
12
|
+
* the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.
|
|
17
13
|
*
|
|
18
14
|
* @param options - What to generate and where to write it.
|
|
19
15
|
* @returns A summary of what was regenerated and how long the run took.
|
|
20
16
|
*/
|
|
21
|
-
|
|
17
|
+
const runCodegen = async (options) => {
|
|
22
18
|
const start = Date.now();
|
|
23
19
|
const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);
|
|
24
|
-
const
|
|
20
|
+
const store = await emitStores(options);
|
|
25
21
|
return {
|
|
26
|
-
regenerated:
|
|
27
|
-
namespaces:
|
|
28
|
-
intrinsicElements:
|
|
22
|
+
regenerated: store.regenerated,
|
|
23
|
+
namespaces: store.namespaces,
|
|
24
|
+
intrinsicElements: store.intrinsicElements,
|
|
29
25
|
duration: Date.now() - start,
|
|
30
26
|
gl,
|
|
31
27
|
};
|
|
@@ -46,40 +42,46 @@ const emitGlModules = (options) => {
|
|
|
46
42
|
}
|
|
47
43
|
return report;
|
|
48
44
|
};
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
45
|
+
const jsxUserOptions = (options) => ({
|
|
46
|
+
reactSubexports: options.reactSubexports ?? [],
|
|
47
|
+
userComponents: options.userComponents ?? {},
|
|
48
|
+
userLazyElements: options.userLazyElements ?? [],
|
|
49
|
+
userProps: options.userProps ?? {},
|
|
50
|
+
});
|
|
51
|
+
const emitJsxStore = async (input) => {
|
|
52
|
+
const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;
|
|
53
|
+
const { runJsxCodegen } = await import("./jsx.js");
|
|
54
|
+
const jsxResult = await runJsxCodegen({
|
|
55
|
+
getLibrary: loadLibrary,
|
|
56
|
+
jsx,
|
|
57
|
+
giStoreDir: gi.storeDir,
|
|
58
|
+
...jsxUserOptions(options),
|
|
59
|
+
giRegenerated,
|
|
60
|
+
force: options.force === true,
|
|
61
|
+
});
|
|
58
62
|
return {
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
regenerated: giRegenerated || jsxResult.regenerated,
|
|
64
|
+
namespaces,
|
|
65
|
+
intrinsicElements: jsxResult.intrinsicElementCount,
|
|
61
66
|
};
|
|
62
67
|
};
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const emitStoresWithConfig = async (config) => {
|
|
69
|
+
const { options, gi, jsx, libraries, girPath } = config;
|
|
70
|
+
let library;
|
|
71
|
+
const loadLibrary = () => (library ??= Library.load(libraries, girPath));
|
|
72
|
+
const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);
|
|
73
|
+
const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;
|
|
74
|
+
if (jsx === undefined) {
|
|
75
|
+
return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };
|
|
70
76
|
}
|
|
71
|
-
|
|
72
|
-
writeGiStore(gi, namespaces, {
|
|
73
|
-
value: computeFingerprint(library.girFiles, libs, elementProps),
|
|
74
|
-
girFiles: library.girFiles,
|
|
75
|
-
libraries: libs,
|
|
76
|
-
});
|
|
77
|
+
return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });
|
|
77
78
|
};
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return
|
|
79
|
+
const emitStores = async (options) => {
|
|
80
|
+
const { gi, jsx, libraries, girPath } = options;
|
|
81
|
+
if (gi === undefined || libraries === undefined || girPath === undefined) {
|
|
82
|
+
return { regenerated: false, namespaces: 0, intrinsicElements: 0 };
|
|
83
|
+
}
|
|
84
|
+
return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });
|
|
84
85
|
};
|
|
86
|
+
export { runCodegen };
|
|
85
87
|
//# sourceMappingURL=runner.js.map
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src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;QACvE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;IACvE,CAAC;IAED,OAAO,oBAAoB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAA8E,CAAC","sourcesContent":["import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { GiStoreOptions } from \"./store/gi-store.js\";\nimport type { JsxStoreOptions } from \"./store/jsx-store.js\";\nimport { checkModules } from \"./compile.js\";\nimport { isGiStoreFresh } from \"./fingerprint.js\";\nimport { runGiCodegen } from \"./gi.js\";\nimport { Library } from \"./gir/library.js\";\nimport { generateGlModules, type GlGenerationReport } from \"./khronos/pipeline.js\";\n\ntype ModuleExport = { module: string; export: string };\n\ntype GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\ntype CodegenRunnerOptions = {\n libraries?: string[];\n girPath?: string[];\n gi?: GiStoreOptions;\n jsx?: JsxStoreOptions | undefined;\n reactSubexports?: string[];\n userComponents?: Record<string, ModuleExport>;\n userLazyElements?: string[];\n userProps?: Record<string, ModuleExport>;\n gl?: GlCodegenOptions;\n force?: boolean;\n};\n\ntype CodegenRunnerResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n duration: number;\n gl?: GlGenerationReport | undefined;\n};\n\ntype StoreResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n};\n\n/**\n * Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the\n * configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its\n * fingerprint is stale unless `options.force` is set, then the jsx store is regenerated when the gi store or\n * the React element config changed; the OpenGL modules are regenerated whenever `options.gl` is provided.\n *\n * @param options - What to generate and where to write it.\n * @returns A summary of what was regenerated and how long the run took.\n */\nconst runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);\n const store = await emitStores(options);\n\n return {\n regenerated: store.regenerated,\n namespaces: store.namespaces,\n intrinsicElements: store.intrinsicElements,\n duration: Date.now() - start,\n gl,\n };\n};\n\nconst emitGlModules = (options: GlCodegenOptions): GlGenerationReport => {\n const { files, report } = generateGlModules({\n registryPath: options.registryPath,\n overrideExports: options.overrideExports,\n });\n\n checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n\n mkdirSync(options.outputDir, { recursive: true });\n\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n\n return report;\n};\n\nconst jsxUserOptions = (\n options: CodegenRunnerOptions,\n): {\n reactSubexports: string[];\n userComponents: Record<string, ModuleExport>;\n userLazyElements: string[];\n userProps: Record<string, ModuleExport>;\n} => ({\n reactSubexports: options.reactSubexports ?? [],\n userComponents: options.userComponents ?? {},\n userLazyElements: options.userLazyElements ?? [],\n userProps: options.userProps ?? {},\n});\n\nconst emitJsxStore = async (input: {\n options: CodegenRunnerOptions;\n jsx: JsxStoreOptions;\n gi: GiStoreOptions;\n loadLibrary: () => Library;\n giRegenerated: boolean;\n namespaces: number;\n}): Promise<StoreResult> => {\n const { options, jsx, gi, loadLibrary, giRegenerated, namespaces } = input;\n const { runJsxCodegen } = await import(\"./jsx.js\");\n\n const jsxResult = await runJsxCodegen({\n getLibrary: loadLibrary,\n jsx,\n giStoreDir: gi.storeDir,\n ...jsxUserOptions(options),\n giRegenerated,\n force: options.force === true,\n });\n\n return {\n regenerated: giRegenerated || jsxResult.regenerated,\n namespaces,\n intrinsicElements: jsxResult.intrinsicElementCount,\n };\n};\n\nconst emitStoresWithConfig = async (config: {\n options: CodegenRunnerOptions;\n gi: GiStoreOptions;\n jsx: JsxStoreOptions | undefined;\n libraries: string[];\n girPath: string[];\n}): Promise<StoreResult> => {\n const { options, gi, jsx, libraries, girPath } = config;\n let library: Library | undefined;\n const loadLibrary = (): Library => (library ??= Library.load(libraries, girPath));\n const isGiRegenerated = options.force === true || !isGiStoreFresh(gi.storeDir, libraries, girPath);\n const namespaces = isGiRegenerated ? runGiCodegen(loadLibrary(), gi, libraries, girPath) : 0;\n\n if (jsx === undefined) {\n return { regenerated: isGiRegenerated, namespaces, intrinsicElements: 0 };\n }\n\n return emitJsxStore({ options, jsx, gi, loadLibrary, giRegenerated: isGiRegenerated, namespaces });\n};\n\nconst emitStores = async (options: CodegenRunnerOptions): Promise<StoreResult> => {\n const { gi, jsx, libraries, girPath } = options;\n\n if (gi === undefined || libraries === undefined || girPath === undefined) {\n return { regenerated: false, namespaces: 0, intrinsicElements: 0 };\n }\n\n return emitStoresWithConfig({ options, gi, jsx, libraries, girPath });\n};\n\nexport { runCodegen, type GlCodegenOptions, type CodegenRunnerOptions, type CodegenRunnerResult };\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type SourceModule } from "../compile.js";
|
|
2
|
-
|
|
2
|
+
type CompileStoreParams = {
|
|
3
3
|
storeDir: string;
|
|
4
4
|
files: SourceModule[];
|
|
5
5
|
packageName: string;
|
|
6
|
-
|
|
6
|
+
/** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */
|
|
7
|
+
configEnv?: boolean;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
declare const compileStore: (params: CompileStoreParams) => void;
|
|
10
|
+
export { compileStore, type CompileStoreParams };
|
|
9
11
|
//# sourceMappingURL=compile-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-store.d.ts","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,
|
|
1
|
+
{"version":3,"file":"compile-store.d.ts","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,kBAAkB,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,iHAAiH;IACjH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAqBF,QAAA,MAAM,YAAY,GAAI,QAAQ,kBAAkB,KAAG,IAqBlD,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { rmSync } from "node:fs";
|
|
1
|
+
import { rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { compileProject } from "../compile.js";
|
|
4
4
|
const EMIT_OPTIONS = {
|
|
@@ -6,33 +6,35 @@ const EMIT_OPTIONS = {
|
|
|
6
6
|
removeComments: false,
|
|
7
7
|
sourceMap: false,
|
|
8
8
|
declarationMap: false,
|
|
9
|
-
noEmitOnError: true,
|
|
10
9
|
rootDir: ".",
|
|
11
10
|
outDir: ".",
|
|
12
11
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (typeof target !== "string")
|
|
20
|
-
continue;
|
|
21
|
-
const stem = target.replace(/^\.\//, "").replace(/\.js$/, "");
|
|
22
|
-
paths[`${packageName}${key.slice(1)}`] = [join(storeDir, stem)];
|
|
23
|
-
}
|
|
24
|
-
return paths;
|
|
12
|
+
const ENV_REFERENCE_FILE = "__gtkx-env__.d.ts";
|
|
13
|
+
const writeEnvReference = (storeDir) => {
|
|
14
|
+
writeFileSync(join(storeDir, ENV_REFERENCE_FILE), "/// <reference types=\"@gtkx/react/env\" />\n");
|
|
15
|
+
return () => {
|
|
16
|
+
rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });
|
|
17
|
+
};
|
|
25
18
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
19
|
+
const compileStore = (params) => {
|
|
20
|
+
const fileNames = params.files.map((file) => file.fileName);
|
|
21
|
+
const removeEnvReference = params.configEnv === true
|
|
22
|
+
? writeEnvReference(params.storeDir)
|
|
23
|
+
: () => undefined;
|
|
24
|
+
try {
|
|
25
|
+
compileProject({
|
|
26
|
+
projectDir: params.storeDir,
|
|
27
|
+
fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,
|
|
28
|
+
compilerOptions: EMIT_OPTIONS,
|
|
29
|
+
label: `the generated ${params.packageName} store`,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
finally {
|
|
33
|
+
removeEnvReference();
|
|
34
|
+
}
|
|
34
35
|
for (const file of params.files) {
|
|
35
36
|
rmSync(join(params.storeDir, file.fileName), { force: true });
|
|
36
37
|
}
|
|
37
38
|
};
|
|
39
|
+
export { compileStore };
|
|
38
40
|
//# sourceMappingURL=compile-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"compile-store.js","sourceRoot":"","sources":["../../src/store/compile-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AAUlE,MAAM,YAAY,GAAG;IACjB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K,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAA2B,CAAC","sourcesContent":["import { rmSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\ntype CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n /** Declare `virtual:gtkx-config` for the typecheck, needed when it follows imports into `@gtkx/react` source. */\n configEnv?: boolean;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst ENV_REFERENCE_FILE = \"__gtkx-env__.d.ts\";\n\nconst writeEnvReference = (storeDir: string): (() => void) => {\n writeFileSync(join(storeDir, ENV_REFERENCE_FILE), \"/// <reference types=\\\"@gtkx/react/env\\\" />\\n\");\n\n return () => {\n rmSync(join(storeDir, ENV_REFERENCE_FILE), { force: true });\n };\n};\n\nconst compileStore = (params: CompileStoreParams): void => {\n const fileNames = params.files.map((file) => file.fileName);\n\n const removeEnvReference = params.configEnv === true\n ? writeEnvReference(params.storeDir)\n : (): void => undefined;\n\n try {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.configEnv === true ? [ENV_REFERENCE_FILE, ...fileNames] : fileNames,\n compilerOptions: EMIT_OPTIONS,\n label: `the generated ${params.packageName} store`,\n });\n } finally {\n removeEnvReference();\n }\n\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n\nexport { compileStore, type CompileStoreParams };\n"]}
|
package/dist/store/gi/async.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { GirFunction } from "../../gir/function.js";
|
|
2
2
|
import type { Library } from "../../gir/library.js";
|
|
3
|
-
|
|
3
|
+
declare const matchAsyncFinish: (library: Library, fn: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
|
|
4
|
+
export { matchAsyncFinish };
|
|
4
5
|
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIpD,QAAA,MAAM,gBAAgB,GAClB,SAAS,OAAO,EAChB,IAAI,WAAW,EACf,UAAU,WAAW,EAAE,KACxB,WAAW,GAAG,SAYhB,CAAC;AA+CF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/store/gi/async.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
import { inputParameters } from "../../analysis/param-structure.js";
|
|
2
|
-
|
|
3
|
-
if (!hasCanonicalAsyncCallback(library, fn))
|
|
2
|
+
const matchAsyncFinish = (library, fn, siblings) => {
|
|
3
|
+
if (!hasCanonicalAsyncCallback(library, fn)) {
|
|
4
4
|
return undefined;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const finishFn = siblings.find((sibling) => sibling.name === finishName);
|
|
9
|
-
if (finishFn === undefined || !isPromisifiableFinish(library, finishFn))
|
|
5
|
+
}
|
|
6
|
+
const finishFn = findFinishSibling(fn, siblings);
|
|
7
|
+
if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) {
|
|
10
8
|
return undefined;
|
|
9
|
+
}
|
|
11
10
|
return finishFn;
|
|
12
11
|
};
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
const findFinishSibling = (fn, siblings) => {
|
|
13
|
+
const annotated = fn.finishFunc;
|
|
14
|
+
if (annotated !== undefined) {
|
|
15
|
+
return siblings.find((sibling) => sibling.name === annotated || sibling.cIdentifier === annotated);
|
|
16
|
+
}
|
|
17
|
+
if (fn.name.endsWith("_finish")) {
|
|
15
18
|
return undefined;
|
|
19
|
+
}
|
|
16
20
|
const root = fn.name.endsWith("_async") ? fn.name.slice(0, -"_async".length) : fn.name;
|
|
17
21
|
const finishName = `${root}_finish`;
|
|
18
|
-
return siblings.
|
|
22
|
+
return siblings.find((sibling) => sibling.name === finishName);
|
|
19
23
|
};
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
for (const parameter of fn.parameters) {
|
|
24
|
-
const ref = parameter.type;
|
|
25
|
-
if (ref === undefined || library.typeOf(ref)?.kind !== "callback")
|
|
26
|
-
continue;
|
|
27
|
-
if (library.nameOf(ref)?.typeName === "AsyncReadyCallback")
|
|
28
|
-
asyncReadyCallbacks += 1;
|
|
29
|
-
else
|
|
30
|
-
otherCallbacks += 1;
|
|
24
|
+
const callbackParameterName = (library, ref) => {
|
|
25
|
+
if (ref === undefined || library.typeFor(ref)?.kind !== "callback") {
|
|
26
|
+
return undefined;
|
|
31
27
|
}
|
|
32
|
-
return
|
|
28
|
+
return library.nameFor(ref)?.typeName;
|
|
29
|
+
};
|
|
30
|
+
const hasCanonicalAsyncCallback = (library, fn) => {
|
|
31
|
+
const callbackNames = fn.parameters
|
|
32
|
+
.map((parameter) => callbackParameterName(library, parameter.type))
|
|
33
|
+
.filter((name) => name !== undefined);
|
|
34
|
+
return callbackNames.length === 1 && callbackNames[0] === "AsyncReadyCallback";
|
|
33
35
|
};
|
|
34
36
|
const isPromisifiableFinish = (library, finishFn) => {
|
|
35
37
|
const inputs = inputParameters(library, finishFn);
|
|
36
|
-
if (inputs.length !== 1)
|
|
38
|
+
if (inputs.length !== 1) {
|
|
37
39
|
return false;
|
|
40
|
+
}
|
|
38
41
|
const only = inputs[0];
|
|
39
|
-
return only?.parameter.type !== undefined && library.
|
|
42
|
+
return only?.parameter.type !== undefined && library.nameFor(only.parameter.type)?.typeName === "AsyncResult";
|
|
40
43
|
};
|
|
44
|
+
export { matchAsyncFinish };
|
|
41
45
|
//# sourceMappingURL=async.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"async.js","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,gBAAgB,GAAG,CACrB,OAAgB,EAChB,EAAe,EACf,QAAuB,EACA,EAAE;IACzB,IAAI,CAAC,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;QAC1C,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,QAAQ,GAAG,iBAAiB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAEjD,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC;QACtE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,EAAe,EAAE,QAAuB,EAA2B,EAAE;IAC5F,MAAM,SAAS,GAAG,EAAE,CAAC,UAAU,CAAC;IAEhC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACrB,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AElD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;IAEvB,OAAO,IAAI,EAAE,SAAS,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,QAAQ,KAAK,aAAa,CAAC;AAClH,CAAC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import type { GirFunction } from \"../../gir/function.js\";\nimport type { Library } from \"../../gir/library.js\";\nimport type { TypeId } from \"../../gir/type-id.js\";\nimport { inputParameters } from \"../../analysis/param-structure.js\";\n\nconst matchAsyncFinish = (\n library: Library,\n fn: GirFunction,\n siblings: GirFunction[],\n): GirFunction | undefined => {\n if (!hasCanonicalAsyncCallback(library, fn)) {\n return undefined;\n }\n\n const finishFn = findFinishSibling(fn, siblings);\n\n if (finishFn === undefined || !isPromisifiableFinish(library, finishFn)) {\n return undefined;\n }\n\n return finishFn;\n};\n\nconst findFinishSibling = (fn: GirFunction, siblings: GirFunction[]): GirFunction | undefined => {\n const annotated = fn.finishFunc;\n\n if (annotated !== undefined) {\n return siblings.find((sibling) => sibling.name === annotated || sibling.cIdentifier === annotated);\n }\n\n if (fn.name.endsWith(\"_finish\")) {\n return undefined;\n }\n\n const root = fn.name.endsWith(\"_async\") ? fn.name.slice(0, -\"_async\".length) : fn.name;\n const finishName = `${root}_finish`;\n\n return siblings.find((sibling) => sibling.name === finishName);\n};\n\nconst callbackParameterName = (library: Library, ref: TypeId | undefined): string | undefined => {\n if (ref === undefined || library.typeFor(ref)?.kind !== \"callback\") {\n return undefined;\n }\n\n return library.nameFor(ref)?.typeName;\n};\n\nconst hasCanonicalAsyncCallback = (library: Library, fn: GirFunction): boolean => {\n const callbackNames = fn.parameters\n .map((parameter) => callbackParameterName(library, parameter.type))\n .filter((name): name is string => name !== undefined);\n\n return callbackNames.length === 1 && callbackNames[0] === \"AsyncReadyCallback\";\n};\n\nconst isPromisifiableFinish = (library: Library, finishFn: GirFunction): boolean => {\n const inputs = inputParameters(library, finishFn);\n\n if (inputs.length !== 1) {\n return false;\n }\n\n const only = inputs[0];\n\n return only?.parameter.type !== undefined && library.nameFor(only.parameter.type)?.typeName === \"AsyncResult\";\n};\n\nexport { matchAsyncFinish };\n"]}
|
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
import type { GirFunction } from "../../gir/function.js";
|
|
2
2
|
import type { ModuleContext } from "../../writer/context.js";
|
|
3
|
-
|
|
3
|
+
type Callables = {
|
|
4
4
|
constructors: GirFunction[];
|
|
5
5
|
functions: GirFunction[];
|
|
6
6
|
methods: GirFunction[];
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const indexMethodsByName: (methods: GirFunction[]) => Map<string, GirFunction>;
|
|
15
|
-
export declare const isEmittableCallable: (context: ModuleContext, callable: GirFunction) => boolean;
|
|
16
|
-
export declare const renderStaticSignature: (context: ModuleContext, callable: GirFunction, options?: {
|
|
17
|
-
returnTypeOverride?: string | undefined;
|
|
18
|
-
siblings?: GirFunction[] | undefined;
|
|
19
|
-
}) => {
|
|
20
|
-
name: string;
|
|
21
|
-
signature: string;
|
|
22
|
-
} | undefined;
|
|
23
|
-
export declare const classConstructorMemberNames: (context: ModuleContext, callables: Callables) => string[];
|
|
24
|
-
export declare const renderStaticHead: (context: ModuleContext, callables: Callables, ownerClassName: string) => string[];
|
|
8
|
+
type InstanceScope = {
|
|
9
|
+
ownerName: string;
|
|
10
|
+
methodByName: Map<string, GirFunction>;
|
|
11
|
+
statics: GirFunction[];
|
|
12
|
+
};
|
|
13
|
+
type InstanceMemberRenderer = (context: ModuleContext, callable: GirFunction, scope: InstanceScope, nameOverride?: string) => string | undefined;
|
|
25
14
|
type PlainTypeMembersOptions = {
|
|
26
15
|
context: ModuleContext;
|
|
27
16
|
className: string;
|
|
28
17
|
callables: Callables;
|
|
29
18
|
hasGtype: boolean;
|
|
30
19
|
};
|
|
31
|
-
|
|
20
|
+
declare const renderInstanceMethodSignature: InstanceMemberRenderer;
|
|
21
|
+
declare const renderClassInstanceMember: InstanceMemberRenderer;
|
|
22
|
+
declare const instanceScope: (ownerName: string, callables: Callables) => InstanceScope;
|
|
23
|
+
declare const dedupeCallables: (callables: GirFunction[]) => GirFunction[];
|
|
24
|
+
declare const generateBindings: (context: ModuleContext, callables: Callables) => void;
|
|
25
|
+
declare const matchStaticFinishFunction: (context: ModuleContext, callable: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
|
|
26
|
+
declare const indexMethodsByName: (methods: GirFunction[]) => Map<string, GirFunction>;
|
|
27
|
+
declare const isEmittableCallable: (context: ModuleContext, callable: GirFunction) => boolean;
|
|
28
|
+
declare const renderStaticSignature: (context: ModuleContext, callable: GirFunction, options?: {
|
|
29
|
+
returnTypeOverride?: string | undefined;
|
|
30
|
+
siblings?: GirFunction[] | undefined;
|
|
31
|
+
}) => {
|
|
32
|
+
name: string;
|
|
33
|
+
signature: string;
|
|
34
|
+
} | undefined;
|
|
35
|
+
declare const classConstructorMemberNames: (context: ModuleContext, callables: Callables) => string[];
|
|
36
|
+
declare const renderStaticHead: (context: ModuleContext, callables: Callables, ownerClassName: string) => string[];
|
|
37
|
+
declare const renderPlainTypeMembers: (options: PlainTypeMembersOptions) => {
|
|
32
38
|
members: string[];
|
|
33
39
|
claimedNames: Set<string>;
|
|
34
40
|
};
|
|
35
|
-
export {};
|
|
41
|
+
export { renderInstanceMethodSignature, renderClassInstanceMember, instanceScope, dedupeCallables, generateBindings, matchStaticFinishFunction, indexMethodsByName, isEmittableCallable, renderStaticSignature, classConstructorMemberNames, renderStaticHead, renderPlainTypeMembers, type Callables, type InstanceScope, };
|
|
36
42
|
//# sourceMappingURL=callables.d.ts.map
|