@gtkx/codegen 0.21.0 → 1.0.0-rc.1
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 +173 -0
- package/dist/analysis/descriptor-render.d.ts +18 -0
- package/dist/analysis/descriptor-render.d.ts.map +1 -0
- package/dist/analysis/descriptor-render.js +297 -0
- package/dist/analysis/descriptor-render.js.map +1 -0
- package/dist/analysis/descriptor.d.ts +59 -0
- package/dist/analysis/descriptor.d.ts.map +1 -0
- package/dist/analysis/descriptor.js +123 -0
- package/dist/analysis/descriptor.js.map +1 -0
- package/dist/analysis/inheritance.d.ts +38 -0
- package/dist/analysis/inheritance.d.ts.map +1 -0
- package/dist/analysis/inheritance.js +193 -0
- package/dist/analysis/inheritance.js.map +1 -0
- package/dist/analysis/param-structure.d.ts +26 -0
- package/dist/analysis/param-structure.d.ts.map +1 -0
- package/dist/analysis/param-structure.js +107 -0
- package/dist/analysis/param-structure.js.map +1 -0
- package/dist/analysis/ts-type.d.ts +19 -0
- package/dist/analysis/ts-type.d.ts.map +1 -0
- package/dist/analysis/ts-type.js +65 -0
- package/dist/analysis/ts-type.js.map +1 -0
- package/dist/compile.d.ts +18 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +123 -0
- package/dist/compile.js.map +1 -0
- package/dist/docs/api-reference.d.ts +66 -0
- package/dist/docs/api-reference.d.ts.map +1 -0
- package/dist/docs/api-reference.js +299 -0
- package/dist/docs/api-reference.js.map +1 -0
- package/dist/docs/element-page.d.ts +15 -0
- package/dist/docs/element-page.d.ts.map +1 -0
- package/dist/docs/element-page.js +221 -0
- package/dist/docs/element-page.js.map +1 -0
- package/dist/docs/pipeline.d.ts +25 -0
- package/dist/docs/pipeline.d.ts.map +1 -0
- package/dist/docs/pipeline.js +130 -0
- package/dist/docs/pipeline.js.map +1 -0
- package/dist/docs/render.d.ts +32 -0
- package/dist/docs/render.d.ts.map +1 -0
- package/dist/docs/render.js +134 -0
- package/dist/docs/render.js.map +1 -0
- package/dist/docs/symbol-page.d.ts +41 -0
- package/dist/docs/symbol-page.d.ts.map +1 -0
- package/dist/docs/symbol-page.js +338 -0
- package/dist/docs/symbol-page.js.map +1 -0
- package/dist/fingerprint.d.ts +6 -26
- package/dist/fingerprint.d.ts.map +1 -1
- package/dist/fingerprint.js +30 -18
- package/dist/fingerprint.js.map +1 -1
- package/dist/gir/ancestry.d.ts +9 -0
- package/dist/gir/ancestry.d.ts.map +1 -0
- package/dist/gir/ancestry.js +29 -0
- package/dist/gir/ancestry.js.map +1 -0
- package/dist/gir/callback.d.ts +9 -10
- package/dist/gir/callback.d.ts.map +1 -1
- package/dist/gir/callback.js +17 -16
- package/dist/gir/callback.js.map +1 -1
- package/dist/gir/class.d.ts +22 -43
- package/dist/gir/class.d.ts.map +1 -1
- package/dist/gir/class.js +11 -23
- package/dist/gir/class.js.map +1 -1
- package/dist/gir/enum.d.ts +13 -31
- package/dist/gir/enum.d.ts.map +1 -1
- package/dist/gir/enum.js +7 -14
- package/dist/gir/enum.js.map +1 -1
- package/dist/gir/field.d.ts +10 -23
- package/dist/gir/field.d.ts.map +1 -1
- package/dist/gir/field.js +12 -18
- package/dist/gir/field.js.map +1 -1
- package/dist/gir/function.d.ts +11 -42
- package/dist/gir/function.d.ts.map +1 -1
- package/dist/gir/function.js +7 -20
- package/dist/gir/function.js.map +1 -1
- package/dist/gir/gir-path.d.ts +2 -0
- package/dist/gir/gir-path.d.ts.map +1 -0
- package/dist/gir/gir-path.js +41 -0
- package/dist/gir/gir-path.js.map +1 -0
- package/dist/gir/libraries.d.ts +4 -0
- package/dist/gir/libraries.d.ts.map +1 -0
- package/dist/gir/libraries.js +62 -0
- package/dist/gir/libraries.js.map +1 -0
- package/dist/gir/library.d.ts +37 -0
- package/dist/gir/library.d.ts.map +1 -0
- package/dist/gir/library.js +218 -0
- package/dist/gir/library.js.map +1 -0
- package/dist/gir/namespace.d.ts +36 -50
- package/dist/gir/namespace.d.ts.map +1 -1
- package/dist/gir/namespace.js +46 -36
- package/dist/gir/namespace.js.map +1 -1
- package/dist/gir/parameter.d.ts +25 -69
- package/dist/gir/parameter.d.ts.map +1 -1
- package/dist/gir/parameter.js +36 -57
- package/dist/gir/parameter.js.map +1 -1
- package/dist/gir/parse.d.ts +6 -70
- package/dist/gir/parse.d.ts.map +1 -1
- package/dist/gir/parse.js +32 -80
- package/dist/gir/parse.js.map +1 -1
- package/dist/gir/primitives.d.ts +3 -34
- package/dist/gir/primitives.d.ts.map +1 -1
- package/dist/gir/primitives.js +19 -35
- package/dist/gir/primitives.js.map +1 -1
- package/dist/gir/property.d.ts +16 -25
- package/dist/gir/property.d.ts.map +1 -1
- package/dist/gir/property.js +12 -9
- package/dist/gir/property.js.map +1 -1
- package/dist/gir/record.d.ts +27 -0
- package/dist/gir/record.d.ts.map +1 -0
- package/dist/gir/record.js +25 -0
- package/dist/gir/record.js.map +1 -0
- package/dist/gir/size.d.ts +10 -57
- package/dist/gir/size.d.ts.map +1 -1
- package/dist/gir/size.js +0 -25
- package/dist/gir/size.js.map +1 -1
- package/dist/gir/type-id.d.ts +49 -0
- package/dist/gir/type-id.d.ts.map +1 -0
- package/dist/gir/type-id.js +8 -0
- package/dist/gir/type-id.js.map +1 -0
- package/dist/gir/type-ref.d.ts +3 -77
- package/dist/gir/type-ref.d.ts.map +1 -1
- package/dist/gir/type-ref.js +35 -65
- package/dist/gir/type-ref.js.map +1 -1
- package/dist/gir/type.d.ts +33 -0
- package/dist/gir/type.d.ts.map +1 -0
- package/dist/gir/type.js +2 -0
- package/dist/gir/type.js.map +1 -0
- package/dist/index.d.ts +5 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -11
- package/dist/index.js.map +1 -1
- package/dist/khronos/args.d.ts +30 -0
- package/dist/khronos/args.d.ts.map +1 -0
- package/dist/khronos/args.js +150 -0
- package/dist/khronos/args.js.map +1 -0
- package/dist/khronos/jsdoc.d.ts +21 -0
- package/dist/khronos/jsdoc.d.ts.map +1 -0
- package/dist/khronos/jsdoc.js +59 -0
- package/dist/khronos/jsdoc.js.map +1 -0
- package/dist/khronos/model.d.ts +37 -0
- package/dist/khronos/model.d.ts.map +1 -0
- package/dist/khronos/model.js +132 -0
- package/dist/khronos/model.js.map +1 -0
- package/dist/khronos/modules.d.ts +11 -0
- package/dist/khronos/modules.d.ts.map +1 -0
- package/dist/khronos/modules.js +58 -0
- package/dist/khronos/modules.js.map +1 -0
- package/dist/khronos/parse.d.ts +9 -0
- package/dist/khronos/parse.d.ts.map +1 -0
- package/dist/khronos/parse.js +61 -0
- package/dist/khronos/parse.js.map +1 -0
- package/dist/khronos/pipeline.d.ts +24 -0
- package/dist/khronos/pipeline.d.ts.map +1 -0
- package/dist/khronos/pipeline.js +182 -0
- package/dist/khronos/pipeline.js.map +1 -0
- package/dist/khronos/plan.d.ts +80 -0
- package/dist/khronos/plan.d.ts.map +1 -0
- package/dist/khronos/plan.js +136 -0
- package/dist/khronos/plan.js.map +1 -0
- package/dist/khronos/render.d.ts +16 -0
- package/dist/khronos/render.d.ts.map +1 -0
- package/dist/khronos/render.js +158 -0
- package/dist/khronos/render.js.map +1 -0
- package/dist/khronos/select.d.ts +15 -0
- package/dist/khronos/select.d.ts.map +1 -0
- package/dist/khronos/select.js +45 -0
- package/dist/khronos/select.js.map +1 -0
- package/dist/runner.d.ts +29 -47
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +78 -53
- package/dist/runner.js.map +1 -1
- package/dist/store/compile-store.d.ts +9 -0
- package/dist/store/compile-store.d.ts.map +1 -0
- package/dist/store/compile-store.js +38 -0
- package/dist/store/compile-store.js.map +1 -0
- package/dist/store/gi/async.d.ts +4 -0
- package/dist/store/gi/async.d.ts.map +1 -0
- package/dist/store/gi/async.js +41 -0
- package/dist/store/gi/async.js.map +1 -0
- package/dist/store/gi/callables.d.ts +36 -0
- package/dist/store/gi/callables.d.ts.map +1 -0
- package/dist/store/gi/callables.js +202 -0
- package/dist/store/gi/callables.js.map +1 -0
- package/dist/store/gi/callback.d.ts +4 -0
- package/dist/store/gi/callback.d.ts.map +1 -0
- package/dist/store/gi/callback.js +14 -0
- package/dist/store/gi/callback.js.map +1 -0
- package/dist/store/gi/class-struct-record.d.ts +9 -0
- package/dist/store/gi/class-struct-record.d.ts.map +1 -0
- package/dist/store/gi/class-struct-record.js +34 -0
- package/dist/store/gi/class-struct-record.js.map +1 -0
- package/dist/store/gi/class.d.ts +4 -0
- package/dist/store/gi/class.d.ts.map +1 -0
- package/dist/store/gi/class.js +169 -0
- package/dist/store/gi/class.js.map +1 -0
- package/dist/store/gi/companion.d.ts +4 -0
- package/dist/store/gi/companion.d.ts.map +1 -0
- package/dist/store/gi/companion.js +13 -0
- package/dist/store/gi/companion.js.map +1 -0
- package/dist/store/gi/constant.d.ts +5 -0
- package/dist/store/gi/constant.d.ts.map +1 -0
- package/dist/store/gi/constant.js +18 -0
- package/dist/store/gi/constant.js.map +1 -0
- package/dist/store/gi/constructor-props.d.ts +5 -0
- package/dist/store/gi/constructor-props.d.ts.map +1 -0
- package/dist/store/gi/constructor-props.js +64 -0
- package/dist/store/gi/constructor-props.js.map +1 -0
- package/dist/store/gi/enum.d.ts +5 -0
- package/dist/store/gi/enum.d.ts.map +1 -0
- package/dist/store/gi/enum.js +38 -0
- package/dist/store/gi/enum.js.map +1 -0
- package/dist/store/gi/function.d.ts +8 -0
- package/dist/store/gi/function.d.ts.map +1 -0
- package/dist/store/gi/function.js +87 -0
- package/dist/store/gi/function.js.map +1 -0
- package/dist/store/gi/gtype-binding.d.ts +10 -0
- package/dist/store/gi/gtype-binding.d.ts.map +1 -0
- package/dist/store/gi/gtype-binding.js +20 -0
- package/dist/store/gi/gtype-binding.js.map +1 -0
- package/dist/store/gi/interface.d.ts +4 -0
- package/dist/store/gi/interface.d.ts.map +1 -0
- package/dist/store/gi/interface.js +99 -0
- package/dist/store/gi/interface.js.map +1 -0
- package/dist/store/gi/item-comparators.d.ts +6 -0
- package/dist/store/gi/item-comparators.d.ts.map +1 -0
- package/dist/store/gi/item-comparators.js +76 -0
- package/dist/store/gi/item-comparators.js.map +1 -0
- package/dist/store/gi/method.d.ts +24 -0
- package/dist/store/gi/method.d.ts.map +1 -0
- package/dist/store/gi/method.js +279 -0
- package/dist/store/gi/method.js.map +1 -0
- package/dist/store/gi/param-marshal.d.ts +9 -0
- package/dist/store/gi/param-marshal.d.ts.map +1 -0
- package/dist/store/gi/param-marshal.js +37 -0
- package/dist/store/gi/param-marshal.js.map +1 -0
- package/dist/store/gi/pipeline.d.ts +4 -0
- package/dist/store/gi/pipeline.d.ts.map +1 -0
- package/dist/store/gi/pipeline.js +80 -0
- package/dist/store/gi/pipeline.js.map +1 -0
- package/dist/store/gi/properties.d.ts +5 -0
- package/dist/store/gi/properties.d.ts.map +1 -0
- package/dist/store/gi/properties.js +30 -0
- package/dist/store/gi/properties.js.map +1 -0
- package/dist/store/gi/property-accessor.d.ts +26 -0
- package/dist/store/gi/property-accessor.d.ts.map +1 -0
- package/dist/store/gi/property-accessor.js +132 -0
- package/dist/store/gi/property-accessor.js.map +1 -0
- package/dist/store/gi/record-constructor.d.ts +5 -0
- package/dist/store/gi/record-constructor.d.ts.map +1 -0
- package/dist/store/gi/record-constructor.js +65 -0
- package/dist/store/gi/record-constructor.js.map +1 -0
- package/dist/store/gi/record-field-accessor.d.ts +25 -0
- package/dist/store/gi/record-field-accessor.d.ts.map +1 -0
- package/dist/store/gi/record-field-accessor.js +288 -0
- package/dist/store/gi/record-field-accessor.js.map +1 -0
- package/dist/store/gi/record-layout.d.ts +14 -0
- package/dist/store/gi/record-layout.d.ts.map +1 -0
- package/dist/store/gi/record-layout.js +96 -0
- package/dist/store/gi/record-layout.js.map +1 -0
- package/dist/store/gi/record.d.ts +4 -0
- package/dist/store/gi/record.d.ts.map +1 -0
- package/dist/store/gi/record.js +59 -0
- package/dist/store/gi/record.js.map +1 -0
- package/dist/store/gi/registration.d.ts +16 -0
- package/dist/store/gi/registration.d.ts.map +1 -0
- package/dist/store/gi/registration.js +20 -0
- package/dist/store/gi/registration.js.map +1 -0
- package/dist/store/gi/return-wrap.d.ts +10 -0
- package/dist/store/gi/return-wrap.d.ts.map +1 -0
- package/dist/store/gi/return-wrap.js +46 -0
- package/dist/store/gi/return-wrap.js.map +1 -0
- package/dist/store/gi/runtime-override.d.ts +3 -0
- package/dist/store/gi/runtime-override.d.ts.map +1 -0
- package/dist/{writers → store/gi}/runtime-override.js +0 -15
- package/dist/store/gi/runtime-override.js.map +1 -0
- package/dist/store/gi/signal.d.ts +5 -0
- package/dist/store/gi/signal.d.ts.map +1 -0
- package/dist/store/gi/signal.js +233 -0
- package/dist/store/gi/signal.js.map +1 -0
- package/dist/store/gi/vtable.d.ts +4 -0
- package/dist/store/gi/vtable.d.ts.map +1 -0
- package/dist/store/gi/vtable.js +78 -0
- package/dist/store/gi/vtable.js.map +1 -0
- package/dist/store/gi-store.d.ts +9 -0
- package/dist/store/gi-store.d.ts.map +1 -0
- package/dist/store/gi-store.js +57 -0
- package/dist/store/gi-store.js.map +1 -0
- package/dist/store/jsx-store.d.ts +5 -0
- package/dist/store/jsx-store.d.ts.map +1 -0
- package/dist/store/jsx-store.js +23 -0
- package/dist/store/jsx-store.js.map +1 -0
- package/dist/store/react/built-ins.d.ts +9 -0
- package/dist/store/react/built-ins.d.ts.map +1 -0
- package/dist/store/react/built-ins.js +226 -0
- package/dist/store/react/built-ins.js.map +1 -0
- package/dist/store/react/element-components.d.ts +15 -0
- package/dist/store/react/element-components.d.ts.map +1 -0
- package/dist/store/react/element-components.js +92 -0
- package/dist/store/react/element-components.js.map +1 -0
- package/dist/store/react/element-prop-types.d.ts +19 -0
- package/dist/store/react/element-prop-types.d.ts.map +1 -0
- package/dist/store/react/element-prop-types.js +244 -0
- package/dist/store/react/element-prop-types.js.map +1 -0
- package/dist/store/react/element-props.d.ts +4 -0
- package/dist/store/react/element-props.d.ts.map +1 -0
- package/dist/store/react/element-props.js +178 -0
- package/dist/store/react/element-props.js.map +1 -0
- package/dist/store/react/gir-index.d.ts +25 -0
- package/dist/store/react/gir-index.d.ts.map +1 -0
- package/dist/store/react/gir-index.js +55 -0
- package/dist/store/react/gir-index.js.map +1 -0
- package/dist/store/react/intrinsic-elements.d.ts +26 -0
- package/dist/store/react/intrinsic-elements.d.ts.map +1 -0
- package/dist/store/react/intrinsic-elements.js +107 -0
- package/dist/store/react/intrinsic-elements.js.map +1 -0
- package/dist/store/react/jsx.d.ts +18 -0
- package/dist/store/react/jsx.d.ts.map +1 -0
- package/dist/store/react/jsx.js +203 -0
- package/dist/store/react/jsx.js.map +1 -0
- package/dist/store/react/metadata.d.ts +4 -0
- package/dist/store/react/metadata.d.ts.map +1 -0
- package/dist/store/react/metadata.js +174 -0
- package/dist/store/react/metadata.js.map +1 -0
- package/dist/store/react/pipeline.d.ts +14 -0
- package/dist/store/react/pipeline.d.ts.map +1 -0
- package/dist/store/react/pipeline.js +60 -0
- package/dist/store/react/pipeline.js.map +1 -0
- package/dist/store/react/props.d.ts +36 -0
- package/dist/store/react/props.d.ts.map +1 -0
- package/dist/store/react/props.js +133 -0
- package/dist/store/react/props.js.map +1 -0
- package/dist/store/store-fs.d.ts +41 -0
- package/dist/store/store-fs.d.ts.map +1 -0
- package/dist/store/store-fs.js +71 -0
- package/dist/store/store-fs.js.map +1 -0
- package/dist/writer/context.d.ts +16 -0
- package/dist/writer/context.d.ts.map +1 -0
- package/dist/writer/context.js +44 -0
- package/dist/writer/context.js.map +1 -0
- package/dist/writer/doc.d.ts +2 -0
- package/dist/writer/doc.d.ts.map +1 -0
- package/dist/writer/doc.js +12 -0
- package/dist/writer/doc.js.map +1 -0
- package/dist/writer/emit.d.ts +8 -0
- package/dist/writer/emit.d.ts.map +1 -0
- package/dist/writer/emit.js +21 -0
- package/dist/writer/emit.js.map +1 -0
- package/dist/writer/gtk-doc.d.ts +2 -0
- package/dist/writer/gtk-doc.d.ts.map +1 -0
- package/dist/writer/gtk-doc.js +67 -0
- package/dist/writer/gtk-doc.js.map +1 -0
- package/dist/writer/imports.d.ts +10 -0
- package/dist/writer/imports.d.ts.map +1 -0
- package/dist/writer/imports.js +50 -0
- package/dist/writer/imports.js.map +1 -0
- package/dist/writer/module.d.ts +15 -0
- package/dist/writer/module.d.ts.map +1 -0
- package/dist/writer/module.js +46 -0
- package/dist/writer/module.js.map +1 -0
- package/overrides/cairo/context.ts.ejs +1269 -0
- package/overrides/cairo/font-face.ts.ejs +151 -0
- package/overrides/cairo/font-options.ts.ejs +199 -0
- package/overrides/cairo/image-surface.ts.ejs +132 -0
- package/overrides/cairo/index.ts.ejs +22 -0
- package/overrides/cairo/matrix.ts.ejs +171 -0
- package/overrides/cairo/pattern.ts.ejs +476 -0
- package/overrides/cairo/recording-surface.ts.ejs +102 -0
- package/overrides/cairo/region.ts.ejs +237 -0
- package/overrides/cairo/scaled-font.ts.ejs +330 -0
- package/overrides/cairo/surface.ts.ejs +296 -0
- package/overrides/gdk/index.ts.ejs +2 -0
- package/overrides/gdk/rgba.ts.ejs +11 -0
- package/overrides/gobject/index.ts.ejs +29 -0
- package/overrides/gobject/object.ts.ejs +51 -0
- package/overrides/gobject/value.ts.ejs +17 -0
- package/overrides/graphene/index.ts.ejs +2 -0
- package/overrides/graphene/structs.ts.ejs +37 -0
- package/overrides/gtk/constants.ts.ejs +3 -0
- package/overrides/gtk/index.ts.ejs +2 -0
- package/package.json +15 -15
- package/src/analysis/descriptor-render.ts +407 -0
- package/src/analysis/descriptor.ts +263 -0
- package/src/analysis/inheritance.ts +242 -0
- package/src/analysis/param-structure.ts +127 -0
- package/src/analysis/ts-type.ts +88 -0
- package/src/compile.ts +152 -0
- package/src/docs/api-reference.ts +361 -0
- package/src/docs/element-page.ts +290 -0
- package/src/docs/pipeline.ts +182 -0
- package/src/docs/render.ts +191 -0
- package/src/docs/symbol-page.ts +444 -0
- package/src/fingerprint.ts +40 -29
- package/src/gir/ancestry.ts +41 -0
- package/src/gir/callback.ts +25 -22
- package/src/gir/class.ts +31 -57
- package/src/gir/enum.ts +20 -38
- package/src/gir/field.ts +21 -36
- package/src/gir/function.ts +17 -56
- package/src/gir/gir-path.ts +49 -0
- package/src/gir/libraries.ts +77 -0
- package/src/gir/library.ts +248 -0
- package/src/gir/namespace.ts +85 -80
- package/src/gir/parameter.ts +64 -93
- package/src/gir/parse.ts +43 -95
- package/src/gir/primitives.ts +23 -45
- package/src/gir/property.ts +27 -29
- package/src/gir/record.ts +53 -0
- package/src/gir/size.ts +9 -56
- package/src/gir/type-id.ts +49 -0
- package/src/gir/type-ref.ts +35 -140
- package/src/gir/type.ts +16 -0
- package/src/index.ts +20 -15
- package/src/khronos/args.ts +202 -0
- package/src/khronos/jsdoc.ts +76 -0
- package/src/khronos/model.ts +166 -0
- package/src/khronos/modules.ts +75 -0
- package/src/khronos/parse.ts +66 -0
- package/src/khronos/pipeline.ts +234 -0
- package/src/khronos/plan.ts +191 -0
- package/src/khronos/registry/LICENSE +202 -0
- package/src/khronos/registry/gl.xml +47748 -0
- package/src/khronos/render.ts +193 -0
- package/src/khronos/select.ts +67 -0
- package/src/runner.ts +112 -75
- package/src/store/compile-store.ts +49 -0
- package/src/store/gi/async.ts +42 -0
- package/src/store/gi/callables.ts +309 -0
- package/src/store/gi/callback.ts +15 -0
- package/src/store/gi/class-struct-record.ts +40 -0
- package/src/store/gi/class.ts +212 -0
- package/src/store/gi/companion.ts +13 -0
- package/src/store/gi/constant.ts +24 -0
- package/src/store/gi/constructor-props.ts +82 -0
- package/src/store/gi/enum.ts +49 -0
- package/src/store/gi/function.ts +107 -0
- package/src/store/gi/gtype-binding.ts +33 -0
- package/src/store/gi/interface.ts +157 -0
- package/src/store/gi/item-comparators.ts +90 -0
- package/src/store/gi/method.ts +417 -0
- package/src/store/gi/param-marshal.ts +48 -0
- package/src/store/gi/pipeline.ts +85 -0
- package/src/store/gi/properties.ts +39 -0
- package/src/store/gi/property-accessor.ts +194 -0
- package/src/store/gi/record-constructor.ts +87 -0
- package/src/store/gi/record-field-accessor.ts +394 -0
- package/src/store/gi/record-layout.ts +134 -0
- package/src/store/gi/record.ts +66 -0
- package/src/store/gi/registration.ts +38 -0
- package/src/store/gi/return-wrap.ts +52 -0
- package/src/store/gi/runtime-override.ts +36 -0
- package/src/store/gi/signal.ts +310 -0
- package/src/store/gi/vtable.ts +99 -0
- package/src/store/gi-store.ts +79 -0
- package/src/store/jsx-store.ts +27 -0
- package/src/store/react/built-ins.ts +260 -0
- package/src/store/react/element-components.ts +138 -0
- package/src/store/react/element-prop-types.ts +280 -0
- package/src/store/react/element-props.ts +204 -0
- package/src/store/react/gir-index.ts +85 -0
- package/src/store/react/intrinsic-elements.ts +161 -0
- package/src/store/react/jsx.ts +294 -0
- package/src/store/react/metadata.ts +197 -0
- package/src/store/react/pipeline.ts +90 -0
- package/src/store/react/props.ts +197 -0
- package/src/store/store-fs.ts +112 -0
- package/src/writer/context.ts +48 -0
- package/src/writer/doc.ts +11 -0
- package/src/writer/emit.ts +26 -0
- package/src/writer/gtk-doc.ts +74 -0
- package/src/writer/imports.ts +59 -0
- package/src/writer/module.ts +45 -0
- package/LICENSE +0 -373
- package/dist/dsl/context.d.ts +0 -104
- package/dist/dsl/context.d.ts.map +0 -1
- package/dist/dsl/context.js +0 -140
- package/dist/dsl/context.js.map +0 -1
- package/dist/dsl/emit.d.ts +0 -28
- package/dist/dsl/emit.d.ts.map +0 -1
- package/dist/dsl/emit.js +0 -41
- package/dist/dsl/emit.js.map +0 -1
- package/dist/dsl/identifier.d.ts +0 -28
- package/dist/dsl/identifier.d.ts.map +0 -1
- package/dist/dsl/identifier.js +0 -45
- package/dist/dsl/identifier.js.map +0 -1
- package/dist/dsl/imports.d.ts +0 -58
- package/dist/dsl/imports.d.ts.map +0 -1
- package/dist/dsl/imports.js +0 -107
- package/dist/dsl/imports.js.map +0 -1
- package/dist/dsl/module.d.ts +0 -53
- package/dist/dsl/module.d.ts.map +0 -1
- package/dist/dsl/module.js +0 -76
- package/dist/dsl/module.js.map +0 -1
- package/dist/ffi/pipeline.d.ts +0 -19
- package/dist/ffi/pipeline.d.ts.map +0 -1
- package/dist/ffi/pipeline.js +0 -107
- package/dist/ffi/pipeline.js.map +0 -1
- package/dist/gi-store.d.ts +0 -34
- package/dist/gi-store.d.ts.map +0 -1
- package/dist/gi-store.js +0 -154
- package/dist/gi-store.js.map +0 -1
- package/dist/gir/boxed.d.ts +0 -66
- package/dist/gir/boxed.d.ts.map +0 -1
- package/dist/gir/boxed.js +0 -49
- package/dist/gir/boxed.js.map +0 -1
- package/dist/gir/qualified-name.d.ts +0 -37
- package/dist/gir/qualified-name.d.ts.map +0 -1
- package/dist/gir/qualified-name.js +0 -39
- package/dist/gir/qualified-name.js.map +0 -1
- package/dist/gir/qualify.d.ts +0 -32
- package/dist/gir/qualify.d.ts.map +0 -1
- package/dist/gir/qualify.js +0 -60
- package/dist/gir/qualify.js.map +0 -1
- package/dist/gir/repository.d.ts +0 -82
- package/dist/gir/repository.d.ts.map +0 -1
- package/dist/gir/repository.js +0 -122
- package/dist/gir/repository.js.map +0 -1
- package/dist/gir/signal.d.ts +0 -22
- package/dist/gir/signal.d.ts.map +0 -1
- package/dist/gir/signal.js +0 -20
- package/dist/gir/signal.js.map +0 -1
- package/dist/jsx-store.d.ts +0 -22
- package/dist/jsx-store.d.ts.map +0 -1
- package/dist/jsx-store.js +0 -40
- package/dist/jsx-store.js.map +0 -1
- package/dist/react/compounds-meta.d.ts +0 -18
- package/dist/react/compounds-meta.d.ts.map +0 -1
- package/dist/react/compounds-meta.js +0 -93
- package/dist/react/compounds-meta.js.map +0 -1
- package/dist/react/compounds.d.ts +0 -27
- package/dist/react/compounds.d.ts.map +0 -1
- package/dist/react/compounds.js +0 -164
- package/dist/react/compounds.js.map +0 -1
- package/dist/react/internal.d.ts +0 -14
- package/dist/react/internal.d.ts.map +0 -1
- package/dist/react/internal.js +0 -79
- package/dist/react/internal.js.map +0 -1
- package/dist/react/jsx.d.ts +0 -22
- package/dist/react/jsx.d.ts.map +0 -1
- package/dist/react/jsx.js +0 -134
- package/dist/react/jsx.js.map +0 -1
- package/dist/react/pipeline.d.ts +0 -13
- package/dist/react/pipeline.d.ts.map +0 -1
- package/dist/react/pipeline.js +0 -25
- package/dist/react/pipeline.js.map +0 -1
- package/dist/react/props.d.ts +0 -38
- package/dist/react/props.d.ts.map +0 -1
- package/dist/react/props.js +0 -231
- package/dist/react/props.js.map +0 -1
- package/dist/react/slot-props.d.ts +0 -10
- package/dist/react/slot-props.d.ts.map +0 -1
- package/dist/react/slot-props.js +0 -56
- package/dist/react/slot-props.js.map +0 -1
- package/dist/react/widgets.d.ts +0 -83
- package/dist/react/widgets.d.ts.map +0 -1
- package/dist/react/widgets.js +0 -152
- package/dist/react/widgets.js.map +0 -1
- package/dist/store-fs.d.ts +0 -109
- package/dist/store-fs.d.ts.map +0 -1
- package/dist/store-fs.js +0 -98
- package/dist/store-fs.js.map +0 -1
- package/dist/transpile.d.ts +0 -32
- package/dist/transpile.d.ts.map +0 -1
- package/dist/transpile.js +0 -63
- package/dist/transpile.js.map +0 -1
- package/dist/typecheck-store.d.ts +0 -41
- package/dist/typecheck-store.d.ts.map +0 -1
- package/dist/typecheck-store.js +0 -102
- package/dist/typecheck-store.js.map +0 -1
- package/dist/writers/alias.d.ts +0 -13
- package/dist/writers/alias.d.ts.map +0 -1
- package/dist/writers/alias.js +0 -17
- package/dist/writers/alias.js.map +0 -1
- package/dist/writers/async.d.ts +0 -22
- package/dist/writers/async.d.ts.map +0 -1
- package/dist/writers/async.js +0 -48
- package/dist/writers/async.js.map +0 -1
- package/dist/writers/boxed-constructor.d.ts +0 -26
- package/dist/writers/boxed-constructor.d.ts.map +0 -1
- package/dist/writers/boxed-constructor.js +0 -85
- package/dist/writers/boxed-constructor.js.map +0 -1
- package/dist/writers/boxed-field-accessor.d.ts +0 -18
- package/dist/writers/boxed-field-accessor.d.ts.map +0 -1
- package/dist/writers/boxed-field-accessor.js +0 -260
- package/dist/writers/boxed-field-accessor.js.map +0 -1
- package/dist/writers/boxed-layout.d.ts +0 -27
- package/dist/writers/boxed-layout.d.ts.map +0 -1
- package/dist/writers/boxed-layout.js +0 -128
- package/dist/writers/boxed-layout.js.map +0 -1
- package/dist/writers/boxed.d.ts +0 -20
- package/dist/writers/boxed.d.ts.map +0 -1
- package/dist/writers/boxed.js +0 -71
- package/dist/writers/boxed.js.map +0 -1
- package/dist/writers/callables.d.ts +0 -124
- package/dist/writers/callables.d.ts.map +0 -1
- package/dist/writers/callables.js +0 -283
- package/dist/writers/callables.js.map +0 -1
- package/dist/writers/callback.d.ts +0 -16
- package/dist/writers/callback.d.ts.map +0 -1
- package/dist/writers/callback.js +0 -38
- package/dist/writers/callback.js.map +0 -1
- package/dist/writers/class-struct-record.d.ts +0 -31
- package/dist/writers/class-struct-record.d.ts.map +0 -1
- package/dist/writers/class-struct-record.js +0 -67
- package/dist/writers/class-struct-record.js.map +0 -1
- package/dist/writers/class-struct.d.ts +0 -22
- package/dist/writers/class-struct.d.ts.map +0 -1
- package/dist/writers/class-struct.js +0 -85
- package/dist/writers/class-struct.js.map +0 -1
- package/dist/writers/class.d.ts +0 -16
- package/dist/writers/class.d.ts.map +0 -1
- package/dist/writers/class.js +0 -307
- package/dist/writers/class.js.map +0 -1
- package/dist/writers/constant.d.ts +0 -15
- package/dist/writers/constant.d.ts.map +0 -1
- package/dist/writers/constant.js +0 -23
- package/dist/writers/constant.js.map +0 -1
- package/dist/writers/constants.d.ts +0 -15
- package/dist/writers/constants.d.ts.map +0 -1
- package/dist/writers/constants.js +0 -23
- package/dist/writers/constants.js.map +0 -1
- package/dist/writers/constructor-props.d.ts +0 -32
- package/dist/writers/constructor-props.d.ts.map +0 -1
- package/dist/writers/constructor-props.js +0 -110
- package/dist/writers/constructor-props.js.map +0 -1
- package/dist/writers/enum.d.ts +0 -21
- package/dist/writers/enum.d.ts.map +0 -1
- package/dist/writers/enum.js +0 -48
- package/dist/writers/enum.js.map +0 -1
- package/dist/writers/function.d.ts +0 -40
- package/dist/writers/function.d.ts.map +0 -1
- package/dist/writers/function.js +0 -127
- package/dist/writers/function.js.map +0 -1
- package/dist/writers/gtype-binding.d.ts +0 -19
- package/dist/writers/gtype-binding.d.ts.map +0 -1
- package/dist/writers/gtype-binding.js +0 -40
- package/dist/writers/gtype-binding.js.map +0 -1
- package/dist/writers/inheritance.d.ts +0 -48
- package/dist/writers/inheritance.d.ts.map +0 -1
- package/dist/writers/inheritance.js +0 -90
- package/dist/writers/inheritance.js.map +0 -1
- package/dist/writers/interface.d.ts +0 -16
- package/dist/writers/interface.d.ts.map +0 -1
- package/dist/writers/interface.js +0 -155
- package/dist/writers/interface.js.map +0 -1
- package/dist/writers/method.d.ts +0 -150
- package/dist/writers/method.d.ts.map +0 -1
- package/dist/writers/method.js +0 -510
- package/dist/writers/method.js.map +0 -1
- package/dist/writers/param-classify.d.ts +0 -93
- package/dist/writers/param-classify.d.ts.map +0 -1
- package/dist/writers/param-classify.js +0 -163
- package/dist/writers/param-classify.js.map +0 -1
- package/dist/writers/property-accessor.d.ts +0 -19
- package/dist/writers/property-accessor.d.ts.map +0 -1
- package/dist/writers/property-accessor.js +0 -117
- package/dist/writers/property-accessor.js.map +0 -1
- package/dist/writers/registration.d.ts +0 -27
- package/dist/writers/registration.d.ts.map +0 -1
- package/dist/writers/registration.js +0 -30
- package/dist/writers/registration.js.map +0 -1
- package/dist/writers/return-wrap.d.ts +0 -39
- package/dist/writers/return-wrap.d.ts.map +0 -1
- package/dist/writers/return-wrap.js +0 -152
- package/dist/writers/return-wrap.js.map +0 -1
- package/dist/writers/runtime-override.d.ts +0 -18
- package/dist/writers/runtime-override.d.ts.map +0 -1
- package/dist/writers/runtime-override.js.map +0 -1
- package/dist/writers/signal.d.ts +0 -21
- package/dist/writers/signal.d.ts.map +0 -1
- package/dist/writers/signal.js +0 -260
- package/dist/writers/signal.js.map +0 -1
- package/dist/writers/ts-type.d.ts +0 -50
- package/dist/writers/ts-type.d.ts.map +0 -1
- package/dist/writers/ts-type.js +0 -75
- package/dist/writers/ts-type.js.map +0 -1
- package/dist/writers/types-ts.d.ts +0 -27
- package/dist/writers/types-ts.d.ts.map +0 -1
- package/dist/writers/types-ts.js +0 -97
- package/dist/writers/types-ts.js.map +0 -1
- package/dist/writers/value.d.ts +0 -89
- package/dist/writers/value.d.ts.map +0 -1
- package/dist/writers/value.js +0 -402
- package/dist/writers/value.js.map +0 -1
- package/src/dsl/context.ts +0 -146
- package/src/dsl/emit.ts +0 -42
- package/src/dsl/identifier.ts +0 -52
- package/src/dsl/imports.ts +0 -109
- package/src/dsl/module.ts +0 -75
- package/src/ffi/pipeline.ts +0 -113
- package/src/gi-store.ts +0 -199
- package/src/gir/boxed.ts +0 -94
- package/src/gir/qualified-name.ts +0 -55
- package/src/gir/qualify.ts +0 -64
- package/src/gir/repository.ts +0 -149
- package/src/gir/signal.ts +0 -36
- package/src/jsx-store.ts +0 -53
- package/src/react/compounds-meta.ts +0 -99
- package/src/react/compounds.ts +0 -204
- package/src/react/internal.ts +0 -91
- package/src/react/jsx.ts +0 -155
- package/src/react/pipeline.ts +0 -29
- package/src/react/props.ts +0 -307
- package/src/react/slot-props.ts +0 -57
- package/src/react/widgets.ts +0 -185
- package/src/store-fs.ts +0 -157
- package/src/transpile.ts +0 -80
- package/src/typecheck-store.ts +0 -136
- package/src/writers/alias.ts +0 -19
- package/src/writers/async.ts +0 -44
- package/src/writers/boxed-constructor.ts +0 -105
- package/src/writers/boxed-field-accessor.ts +0 -306
- package/src/writers/boxed-layout.ts +0 -166
- package/src/writers/boxed.ts +0 -77
- package/src/writers/callables.ts +0 -339
- package/src/writers/callback.ts +0 -40
- package/src/writers/class-struct-record.ts +0 -75
- package/src/writers/class-struct.ts +0 -96
- package/src/writers/class.ts +0 -384
- package/src/writers/constant.ts +0 -29
- package/src/writers/constructor-props.ts +0 -130
- package/src/writers/enum.ts +0 -53
- package/src/writers/function.ts +0 -136
- package/src/writers/gtype-binding.ts +0 -48
- package/src/writers/inheritance.ts +0 -104
- package/src/writers/interface.ts +0 -168
- package/src/writers/method.ts +0 -678
- package/src/writers/param-classify.ts +0 -178
- package/src/writers/property-accessor.ts +0 -139
- package/src/writers/registration.ts +0 -42
- package/src/writers/return-wrap.ts +0 -180
- package/src/writers/runtime-override.ts +0 -59
- package/src/writers/signal.ts +0 -318
- package/src/writers/ts-type.ts +0 -115
- package/src/writers/value.ts +0 -485
package/dist/gir/namespace.d.ts
CHANGED
|
@@ -1,65 +1,51 @@
|
|
|
1
|
-
import { type GirBoxed } from "./boxed.js";
|
|
2
1
|
import { type GirCallback } from "./callback.js";
|
|
3
2
|
import { type GirClass } from "./class.js";
|
|
4
3
|
import { type GirEnum } from "./enum.js";
|
|
5
4
|
import { type GirFunction } from "./function.js";
|
|
6
5
|
import { type RawNode } from "./parse.js";
|
|
7
|
-
import { type
|
|
8
|
-
|
|
6
|
+
import { type GirRecord } from "./record.js";
|
|
7
|
+
import type { ParseContext, TypeId } from "./type-id.js";
|
|
9
8
|
export type GirConstant = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly value: string;
|
|
15
|
-
readonly type: GirTypeRef | undefined;
|
|
9
|
+
name: string;
|
|
10
|
+
doc: string | undefined;
|
|
11
|
+
value: string;
|
|
12
|
+
type: TypeId | undefined;
|
|
16
13
|
};
|
|
17
|
-
/** A `<alias>` declaration at namespace level. */
|
|
18
14
|
export type GirAlias = {
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
name: string;
|
|
16
|
+
doc: string | undefined;
|
|
17
|
+
cType: string | undefined;
|
|
18
|
+
target: TypeId | undefined;
|
|
19
|
+
targetCType: string | undefined;
|
|
21
20
|
};
|
|
22
|
-
/**
|
|
23
|
-
* A single namespace loaded from one `.gir` file.
|
|
24
|
-
*
|
|
25
|
-
* The class lives in `namespace.ts` (mutable holder) because populating it
|
|
26
|
-
* involves walking the raw XML tree once, materialising each construct.
|
|
27
|
-
* After construction the public surface is read-only by convention.
|
|
28
|
-
*/
|
|
29
21
|
export type GirNamespace = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/** Other namespaces referenced via `<include>`. */
|
|
43
|
-
readonly includes: readonly NamespaceInclude[];
|
|
44
|
-
readonly classes: readonly GirClass[];
|
|
45
|
-
readonly interfaces: readonly GirClass[];
|
|
46
|
-
readonly boxeds: readonly GirBoxed[];
|
|
47
|
-
readonly enums: readonly GirEnum[];
|
|
48
|
-
readonly callbacks: readonly GirCallback[];
|
|
49
|
-
readonly functions: readonly GirFunction[];
|
|
50
|
-
readonly constants: readonly GirConstant[];
|
|
51
|
-
readonly aliases: readonly GirAlias[];
|
|
22
|
+
id: number;
|
|
23
|
+
name: string;
|
|
24
|
+
sharedLibrary: string | undefined;
|
|
25
|
+
cSymbolPrefixes: string[];
|
|
26
|
+
classes: GirClass[];
|
|
27
|
+
interfaces: GirClass[];
|
|
28
|
+
records: GirRecord[];
|
|
29
|
+
enums: GirEnum[];
|
|
30
|
+
callbacks: GirCallback[];
|
|
31
|
+
functions: GirFunction[];
|
|
32
|
+
constants: GirConstant[];
|
|
33
|
+
aliases: GirAlias[];
|
|
52
34
|
};
|
|
53
|
-
|
|
35
|
+
export declare const namespaceDirectory: (namespace: Pick<GirNamespace, "name">) => string;
|
|
54
36
|
type NamespaceInclude = {
|
|
55
|
-
|
|
56
|
-
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
57
39
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
export type NamespaceHeader = {
|
|
41
|
+
name: string;
|
|
42
|
+
sharedLibrary: string | undefined;
|
|
43
|
+
cSymbolPrefixes: string[];
|
|
44
|
+
includes: NamespaceInclude[];
|
|
45
|
+
namespaceNode: RawNode;
|
|
46
|
+
};
|
|
47
|
+
export declare const parseNamespaceHeader: (repositoryNode: RawNode) => NamespaceHeader;
|
|
48
|
+
export declare const createNamespaceShell: (header: NamespaceHeader, id: number) => GirNamespace;
|
|
49
|
+
export declare const populateNamespaceBody: (shell: GirNamespace, namespaceNode: RawNode, context: ParseContext) => void;
|
|
64
50
|
export {};
|
|
65
51
|
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/gir/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../src/gir/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAgB,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,EAA8C,KAAK,OAAO,EAAE,MAAM,YAAY,CAAC;AACtF,OAAO,EAAE,KAAK,SAAS,EAAkC,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGzD,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC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from "./boxed.js";
|
|
2
1
|
import { callbackFromNode } from "./callback.js";
|
|
3
2
|
import { classFromNode } from "./class.js";
|
|
4
3
|
import { enumFromNode } from "./enum.js";
|
|
5
4
|
import { functionFromNode } from "./function.js";
|
|
6
|
-
import { attr, childrenOf } from "./parse.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @param repositoryNode - The raw `<repository>` element returned by `parseGirFile`
|
|
12
|
-
*/
|
|
13
|
-
export const namespaceFromRepository = (repositoryNode) => {
|
|
5
|
+
import { attr, childOf, childrenOf, docOf, nameAttr } from "./parse.js";
|
|
6
|
+
import { isVtableRecord, recordFromNode } from "./record.js";
|
|
7
|
+
import { typeRefFromNode } from "./type-ref.js";
|
|
8
|
+
export const namespaceDirectory = (namespace) => namespace.name.toLowerCase();
|
|
9
|
+
export const parseNamespaceHeader = (repositoryNode) => {
|
|
14
10
|
const includes = childrenOf(repositoryNode, "include").map((include) => ({
|
|
15
|
-
name:
|
|
11
|
+
name: nameAttr(include),
|
|
16
12
|
version: attr(include, "version") ?? "",
|
|
17
13
|
}));
|
|
18
14
|
const namespaceNode = childrenOf(repositoryNode, "namespace")[0];
|
|
19
15
|
if (namespaceNode === undefined) {
|
|
20
16
|
throw new Error("GIR repository has no <namespace> child");
|
|
21
17
|
}
|
|
22
|
-
const name = attr(namespaceNode, "name") ?? "";
|
|
23
|
-
const version = attr(namespaceNode, "version") ?? "";
|
|
24
18
|
return {
|
|
25
|
-
name,
|
|
26
|
-
version,
|
|
27
|
-
identifier: `${name}-${version}`,
|
|
19
|
+
name: nameAttr(namespaceNode),
|
|
28
20
|
sharedLibrary: attr(namespaceNode, "shared-library"),
|
|
29
|
-
cIdentifierPrefixes: splitPrefixes(attr(namespaceNode, "c:identifier-prefixes")),
|
|
30
21
|
cSymbolPrefixes: splitPrefixes(attr(namespaceNode, "c:symbol-prefixes")),
|
|
31
22
|
includes,
|
|
32
|
-
|
|
33
|
-
interfaces: childrenOf(namespaceNode, "interface").map((iface) => classFromNode(iface, true)),
|
|
34
|
-
boxeds: collectBoxeds(namespaceNode),
|
|
35
|
-
enums: collectEnums(namespaceNode),
|
|
36
|
-
callbacks: childrenOf(namespaceNode, "callback").map(callbackFromNode),
|
|
37
|
-
functions: childrenOf(namespaceNode, "function").map((fn) => functionFromNode(fn, "function")),
|
|
38
|
-
constants: childrenOf(namespaceNode, "constant").map((constant) => ({
|
|
39
|
-
name: attr(constant, "name") ?? "",
|
|
40
|
-
cType: attr(constant, "c:type"),
|
|
41
|
-
cIdentifier: attr(constant, "c:identifier"),
|
|
42
|
-
value: attr(constant, "value") ?? "",
|
|
43
|
-
type: typeRefFromSlot(constant),
|
|
44
|
-
})),
|
|
45
|
-
aliases: childrenOf(namespaceNode, "alias").map((alias) => ({
|
|
46
|
-
name: attr(alias, "name") ?? "",
|
|
47
|
-
target: typeRefFromSlot(alias),
|
|
48
|
-
})),
|
|
23
|
+
namespaceNode,
|
|
49
24
|
};
|
|
50
25
|
};
|
|
26
|
+
export const createNamespaceShell = (header, id) => ({
|
|
27
|
+
id,
|
|
28
|
+
name: header.name,
|
|
29
|
+
sharedLibrary: header.sharedLibrary,
|
|
30
|
+
cSymbolPrefixes: header.cSymbolPrefixes,
|
|
31
|
+
classes: [],
|
|
32
|
+
interfaces: [],
|
|
33
|
+
records: [],
|
|
34
|
+
enums: [],
|
|
35
|
+
callbacks: [],
|
|
36
|
+
functions: [],
|
|
37
|
+
constants: [],
|
|
38
|
+
aliases: [],
|
|
39
|
+
});
|
|
40
|
+
export const populateNamespaceBody = (shell, namespaceNode, context) => {
|
|
41
|
+
shell.classes = childrenOf(namespaceNode, "class").map((klass) => classFromNode(klass, false, context));
|
|
42
|
+
shell.interfaces = childrenOf(namespaceNode, "interface").map((iface) => classFromNode(iface, true, context));
|
|
43
|
+
shell.records = collectRecords(namespaceNode, context);
|
|
44
|
+
shell.enums = collectEnums(namespaceNode);
|
|
45
|
+
shell.callbacks = childrenOf(namespaceNode, "callback").map((callback) => callbackFromNode(callback, context));
|
|
46
|
+
shell.functions = childrenOf(namespaceNode, "function").map((fn) => functionFromNode(fn, context));
|
|
47
|
+
shell.constants = childrenOf(namespaceNode, "constant").map((constant) => ({
|
|
48
|
+
name: nameAttr(constant),
|
|
49
|
+
doc: docOf(constant),
|
|
50
|
+
value: attr(constant, "value") ?? "",
|
|
51
|
+
type: typeRefFromNode(constant, context),
|
|
52
|
+
}));
|
|
53
|
+
shell.aliases = childrenOf(namespaceNode, "alias").map((alias) => ({
|
|
54
|
+
name: nameAttr(alias),
|
|
55
|
+
doc: docOf(alias),
|
|
56
|
+
cType: attr(alias, "c:type"),
|
|
57
|
+
target: typeRefFromNode(alias, context),
|
|
58
|
+
targetCType: attr(childOf(alias, "type"), "c:type"),
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
51
61
|
const splitPrefixes = (raw) => (raw ?? "").split(",").filter((prefix) => prefix.length > 0);
|
|
52
|
-
const
|
|
53
|
-
...childrenOf(namespaceNode, "record").map((record) =>
|
|
54
|
-
...childrenOf(namespaceNode, "union").map((union) =>
|
|
62
|
+
const collectRecords = (namespaceNode, context) => [
|
|
63
|
+
...childrenOf(namespaceNode, "record").map((record) => recordFromNode(record, isVtableRecord(record), false, context)),
|
|
64
|
+
...childrenOf(namespaceNode, "union").map((union) => recordFromNode(union, isVtableRecord(union), true, context)),
|
|
55
65
|
];
|
|
56
66
|
const collectEnums = (namespaceNode) => [
|
|
57
67
|
...childrenOf(namespaceNode, "enumeration").map((enumeration) => enumFromNode(enumeration, "enumeration")),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/gir/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"namespace.js","sourceRoot":"","sources":["../../src/gir/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,eAAe,CAAC;AACnE,OAAO,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CAClD,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CACjE;IACD,GAAG,UAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;CACpH,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,aAAsB,EAAa,EAAE,CAAC;IACxD,GAAG,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC1G,GAAG,UAAU,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;CACjG,CAAC","sourcesContent":["import { callbackFromNode, type GirCallback } from \"./callback.js\";\nimport { classFromNode, type GirClass } from \"./class.js\";\nimport { enumFromNode, type GirEnum } from \"./enum.js\";\nimport { functionFromNode, type GirFunction } from \"./function.js\";\nimport { attr, childOf, childrenOf, docOf, nameAttr, type RawNode } from \"./parse.js\";\nimport { type GirRecord, isVtableRecord, recordFromNode } from \"./record.js\";\nimport type { ParseContext, TypeId } from \"./type-id.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\nexport type GirConstant = {\n name: string;\n doc: string | undefined;\n value: string;\n type: TypeId | undefined;\n};\n\nexport type GirAlias = {\n name: string;\n doc: string | undefined;\n cType: string | undefined;\n target: TypeId | undefined;\n targetCType: string | undefined;\n};\n\nexport type GirNamespace = {\n id: number;\n name: string;\n sharedLibrary: string | undefined;\n cSymbolPrefixes: string[];\n classes: GirClass[];\n interfaces: GirClass[];\n records: GirRecord[];\n enums: GirEnum[];\n callbacks: GirCallback[];\n functions: GirFunction[];\n constants: GirConstant[];\n aliases: GirAlias[];\n};\n\nexport const namespaceDirectory = (namespace: Pick<GirNamespace, \"name\">): string => namespace.name.toLowerCase();\n\ntype NamespaceInclude = {\n name: string;\n version: string;\n};\n\nexport type NamespaceHeader = {\n name: string;\n sharedLibrary: string | undefined;\n cSymbolPrefixes: string[];\n includes: NamespaceInclude[];\n namespaceNode: RawNode;\n};\n\nexport const parseNamespaceHeader = (repositoryNode: RawNode): NamespaceHeader => {\n const includes = childrenOf(repositoryNode, \"include\").map<NamespaceInclude>((include) => ({\n name: nameAttr(include),\n version: attr(include, \"version\") ?? \"\",\n }));\n const namespaceNode = childrenOf(repositoryNode, \"namespace\")[0];\n if (namespaceNode === undefined) {\n throw new Error(\"GIR repository has no <namespace> child\");\n }\n return {\n name: nameAttr(namespaceNode),\n sharedLibrary: attr(namespaceNode, \"shared-library\"),\n cSymbolPrefixes: splitPrefixes(attr(namespaceNode, \"c:symbol-prefixes\")),\n includes,\n namespaceNode,\n };\n};\n\nexport const createNamespaceShell = (header: NamespaceHeader, id: number): GirNamespace => ({\n id,\n name: header.name,\n sharedLibrary: header.sharedLibrary,\n cSymbolPrefixes: header.cSymbolPrefixes,\n classes: [],\n interfaces: [],\n records: [],\n enums: [],\n callbacks: [],\n functions: [],\n constants: [],\n aliases: [],\n});\n\nexport const populateNamespaceBody = (shell: GirNamespace, namespaceNode: RawNode, context: ParseContext): void => {\n shell.classes = childrenOf(namespaceNode, \"class\").map((klass) => classFromNode(klass, false, context));\n shell.interfaces = childrenOf(namespaceNode, \"interface\").map((iface) => classFromNode(iface, true, context));\n shell.records = collectRecords(namespaceNode, context);\n shell.enums = collectEnums(namespaceNode);\n shell.callbacks = childrenOf(namespaceNode, \"callback\").map((callback) => callbackFromNode(callback, context));\n shell.functions = childrenOf(namespaceNode, \"function\").map((fn) => functionFromNode(fn, context));\n shell.constants = childrenOf(namespaceNode, \"constant\").map((constant) => ({\n name: nameAttr(constant),\n doc: docOf(constant),\n value: attr(constant, \"value\") ?? \"\",\n type: typeRefFromNode(constant, context),\n }));\n shell.aliases = childrenOf(namespaceNode, \"alias\").map((alias) => ({\n name: nameAttr(alias),\n doc: docOf(alias),\n cType: attr(alias, \"c:type\"),\n target: typeRefFromNode(alias, context),\n targetCType: attr(childOf(alias, \"type\"), \"c:type\"),\n }));\n};\n\nconst splitPrefixes = (raw: string | undefined): string[] =>\n (raw ?? \"\").split(\",\").filter((prefix) => prefix.length > 0);\n\nconst collectRecords = (namespaceNode: RawNode, context: ParseContext): GirRecord[] => [\n ...childrenOf(namespaceNode, \"record\").map((record) =>\n recordFromNode(record, isVtableRecord(record), false, context),\n ),\n ...childrenOf(namespaceNode, \"union\").map((union) => recordFromNode(union, isVtableRecord(union), true, context)),\n];\n\nconst collectEnums = (namespaceNode: RawNode): GirEnum[] => [\n ...childrenOf(namespaceNode, \"enumeration\").map((enumeration) => enumFromNode(enumeration, \"enumeration\")),\n ...childrenOf(namespaceNode, \"bitfield\").map((bitfield) => enumFromNode(bitfield, \"bitfield\")),\n];\n"]}
|
package/dist/gir/parameter.d.ts
CHANGED
|
@@ -1,82 +1,38 @@
|
|
|
1
1
|
import { type RawNode } from "./parse.js";
|
|
2
|
-
import {
|
|
3
|
-
/** Direction of a `<parameter>` (`in`, `out`, `inout`). */
|
|
2
|
+
import type { ParseContext, TypeId } from "./type-id.js";
|
|
4
3
|
type ParameterDirection = "in" | "out" | "inout";
|
|
5
|
-
/**
|
|
6
|
-
* Lifetime conveyed by `transfer-ownership`. Mirrors the GIR vocabulary one
|
|
7
|
-
* for one; the marshal layer translates to the runtime's `Ownership` set.
|
|
8
|
-
*/
|
|
9
4
|
export type ParameterTransfer = "none" | "full" | "container";
|
|
10
|
-
/** Lifetime of a callback parameter (`scope=…`). */
|
|
11
5
|
type CallbackScope = "call" | "notified" | "async" | "forever";
|
|
12
|
-
|
|
13
|
-
* A `<parameter>` or `<instance-parameter>` of a callable.
|
|
14
|
-
*
|
|
15
|
-
* Only the bits the FFI writers actually look at are retained; the original
|
|
16
|
-
* raw node is dropped so the domain model is self-describing.
|
|
17
|
-
*/
|
|
6
|
+
export declare const transferOwnership: (node: RawNode) => ParameterTransfer;
|
|
18
7
|
export type GirParameter = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
readonly scope: CallbackScope | undefined;
|
|
31
|
-
/** Index of the paired `gpointer user_data` parameter in the C signature. */
|
|
32
|
-
readonly closureIndex: number | undefined;
|
|
33
|
-
/** Index of the paired `GDestroyNotify` parameter in the C signature. */
|
|
34
|
-
readonly destroyIndex: number | undefined;
|
|
35
|
-
/** `true` for `<instance-parameter>` (the implicit `self` of a method). */
|
|
36
|
-
readonly isInstance: boolean;
|
|
37
|
-
/** `<varargs/>` parameter; not marshalable. */
|
|
38
|
-
readonly isVarargs: boolean;
|
|
8
|
+
name: string;
|
|
9
|
+
type: TypeId | undefined;
|
|
10
|
+
direction: ParameterDirection;
|
|
11
|
+
transferOwnership: ParameterTransfer;
|
|
12
|
+
nullable: boolean;
|
|
13
|
+
optional: boolean;
|
|
14
|
+
callerAllocates: boolean;
|
|
15
|
+
scope: CallbackScope | undefined;
|
|
16
|
+
closureIndex: number | undefined;
|
|
17
|
+
destroyIndex: number | undefined;
|
|
18
|
+
isVarargs: boolean;
|
|
39
19
|
};
|
|
40
|
-
|
|
41
|
-
* Builds a {@link GirParameter} from a `<parameter>` or `<instance-parameter>`.
|
|
42
|
-
*
|
|
43
|
-
* @param node - The XML element
|
|
44
|
-
* @param isInstance - Whether the source element was `<instance-parameter>`
|
|
45
|
-
*/
|
|
46
|
-
export declare const parameterFromNode: (node: RawNode, isInstance: boolean) => GirParameter;
|
|
47
|
-
/**
|
|
48
|
-
* Whether a parameter is a pure out-parameter: `direction="out"` and not
|
|
49
|
-
* caller-allocated, so it marshals through a `{ value }` cell the callee writes into.
|
|
50
|
-
*
|
|
51
|
-
* @param parameter - The parameter to test
|
|
52
|
-
*/
|
|
20
|
+
export declare const parameterFromNode: (node: RawNode, context: ParseContext) => GirParameter;
|
|
53
21
|
export declare const isOutParameter: (parameter: GirParameter) => boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Whether a parameter is a caller-allocated out-parameter: `direction="out"`
|
|
56
|
-
* with `caller-allocates="1"`, passed as a pre-built handle the callee fills
|
|
57
|
-
* in place rather than through a `{ value }` cell.
|
|
58
|
-
*
|
|
59
|
-
* @param parameter - The parameter to test
|
|
60
|
-
*/
|
|
61
22
|
export declare const isCallerAllocatedOut: (parameter: GirParameter) => boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Whether a parameter is an inout parameter (`direction="inout"`).
|
|
64
|
-
*
|
|
65
|
-
* @param parameter - The parameter to test
|
|
66
|
-
*/
|
|
67
23
|
export declare const isInoutParameter: (parameter: GirParameter) => boolean;
|
|
68
|
-
/** A `<return-value>` plus its inferred type and transfer settings. */
|
|
69
24
|
export type GirReturnValue = {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
25
|
+
type: TypeId | undefined;
|
|
26
|
+
transferOwnership: ParameterTransfer;
|
|
27
|
+
nullable: boolean;
|
|
28
|
+
skip: boolean;
|
|
73
29
|
};
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
export declare const
|
|
30
|
+
export type GirSignal = {
|
|
31
|
+
name: string;
|
|
32
|
+
doc: string | undefined;
|
|
33
|
+
parameters: GirParameter[];
|
|
34
|
+
returnValue: GirReturnValue;
|
|
35
|
+
};
|
|
36
|
+
export declare const parseCallable: (node: RawNode, context: ParseContext) => GirSignal;
|
|
81
37
|
export {};
|
|
82
38
|
//# sourceMappingURL=parameter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter.d.ts","sourceRoot":"","sources":["../../src/gir/parameter.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,SAAS,CAAC;IACzB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;CACjB,CAAC;AAcF,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,WAAW,EAAE,cAAc,CAAC;CAC/B,CAAC;AAEF,eAAO,MAAM,aAAa,SAAU,OAAO,WAAW,YAAY,KAAG,SASpE,CAAC"}
|
package/dist/gir/parameter.js
CHANGED
|
@@ -1,66 +1,45 @@
|
|
|
1
|
-
import { attr, attrBool, childOf } from "./parse.js";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
callerAllocates: attrBool(node, "caller-allocates"),
|
|
22
|
-
scope: attr(node, "scope"),
|
|
23
|
-
closureIndex: closure === undefined ? undefined : Number.parseInt(closure, 10),
|
|
24
|
-
destroyIndex: destroy === undefined ? undefined : Number.parseInt(destroy, 10),
|
|
25
|
-
isInstance,
|
|
26
|
-
isVarargs: childOf(node, "varargs") !== undefined,
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Whether a parameter is a pure out-parameter: `direction="out"` and not
|
|
31
|
-
* caller-allocated, so it marshals through a `{ value }` cell the callee writes into.
|
|
32
|
-
*
|
|
33
|
-
* @param parameter - The parameter to test
|
|
34
|
-
*/
|
|
1
|
+
import { attr, attrBool, childOf, childrenOf, docOf, intAttr, nameAttr, parseEnumAttr } from "./parse.js";
|
|
2
|
+
import { typeRefFromNode } from "./type-ref.js";
|
|
3
|
+
const DIRECTIONS = new Set(["in", "out", "inout"]);
|
|
4
|
+
const TRANSFERS = new Set(["none", "full", "container"]);
|
|
5
|
+
const SCOPES = new Set(["call", "notified", "async", "forever"]);
|
|
6
|
+
export const transferOwnership = (node) => parseEnumAttr(attr(node, "transfer-ownership"), TRANSFERS, "none", "transfer-ownership");
|
|
7
|
+
const nullableAttr = (node) => attrBool(node, "nullable") || attrBool(node, "allow-none");
|
|
8
|
+
export const parameterFromNode = (node, context) => ({
|
|
9
|
+
name: nameAttr(node),
|
|
10
|
+
type: typeRefFromNode(node, context),
|
|
11
|
+
direction: parseEnumAttr(attr(node, "direction"), DIRECTIONS, "in", "direction"),
|
|
12
|
+
transferOwnership: transferOwnership(node),
|
|
13
|
+
nullable: nullableAttr(node),
|
|
14
|
+
optional: attrBool(node, "optional"),
|
|
15
|
+
callerAllocates: attrBool(node, "caller-allocates"),
|
|
16
|
+
scope: parseEnumAttr(attr(node, "scope"), SCOPES, undefined, "scope"),
|
|
17
|
+
closureIndex: intAttr(node, "closure"),
|
|
18
|
+
destroyIndex: intAttr(node, "destroy"),
|
|
19
|
+
isVarargs: childOf(node, "varargs") !== undefined,
|
|
20
|
+
});
|
|
35
21
|
export const isOutParameter = (parameter) => parameter.direction === "out" && !parameter.callerAllocates;
|
|
36
|
-
/**
|
|
37
|
-
* Whether a parameter is a caller-allocated out-parameter: `direction="out"`
|
|
38
|
-
* with `caller-allocates="1"`, passed as a pre-built handle the callee fills
|
|
39
|
-
* in place rather than through a `{ value }` cell.
|
|
40
|
-
*
|
|
41
|
-
* @param parameter - The parameter to test
|
|
42
|
-
*/
|
|
43
22
|
export const isCallerAllocatedOut = (parameter) => parameter.direction === "out" && parameter.callerAllocates;
|
|
44
|
-
/**
|
|
45
|
-
* Whether a parameter is an inout parameter (`direction="inout"`).
|
|
46
|
-
*
|
|
47
|
-
* @param parameter - The parameter to test
|
|
48
|
-
*/
|
|
49
23
|
export const isInoutParameter = (parameter) => parameter.direction === "inout";
|
|
50
|
-
|
|
51
|
-
* Builds a {@link GirReturnValue} from a `<return-value>` element, or returns a
|
|
52
|
-
* void return when the element is missing.
|
|
53
|
-
*
|
|
54
|
-
* @param node - The `<return-value>` element, or `undefined`
|
|
55
|
-
*/
|
|
56
|
-
export const returnValueFromNode = (node) => {
|
|
24
|
+
const returnValueFromNode = (node, context) => {
|
|
57
25
|
if (node === undefined) {
|
|
58
|
-
return { type: undefined, transferOwnership: "none", nullable: false };
|
|
26
|
+
return { type: undefined, transferOwnership: "none", nullable: false, skip: false };
|
|
59
27
|
}
|
|
60
28
|
return {
|
|
61
|
-
type:
|
|
62
|
-
transferOwnership: (
|
|
63
|
-
nullable:
|
|
29
|
+
type: typeRefFromNode(node, context),
|
|
30
|
+
transferOwnership: transferOwnership(node),
|
|
31
|
+
nullable: nullableAttr(node),
|
|
32
|
+
skip: attrBool(node, "skip"),
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export const parseCallable = (node, context) => {
|
|
36
|
+
const parametersNode = childOf(node, "parameters");
|
|
37
|
+
const parameterNodes = childrenOf(parametersNode, "parameter");
|
|
38
|
+
return {
|
|
39
|
+
name: nameAttr(node),
|
|
40
|
+
doc: docOf(node),
|
|
41
|
+
parameters: parameterNodes.map((parameter) => parameterFromNode(parameter, context)),
|
|
42
|
+
returnValue: returnValueFromNode(childOf(node, "return-value"), context),
|
|
64
43
|
};
|
|
65
44
|
};
|
|
66
45
|
//# sourceMappingURL=parameter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/gir/parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAgB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/gir/parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,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a,EAAE,OAAqB,EAAa,EAAE;IAC7E,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACnD,MAAM,cAAc,GAAG,UAAU,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAC/D,OAAO;QACH,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;QACpB,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC;QAChB,UAAU,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACpF,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,OAAO,CAAC;KAC3E,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { attr, attrBool, childOf, childrenOf, docOf, intAttr, nameAttr, parseEnumAttr, type RawNode } from \"./parse.js\";\nimport type { ParseContext, TypeId } from \"./type-id.js\";\nimport { typeRefFromNode } from \"./type-ref.js\";\n\ntype ParameterDirection = \"in\" | \"out\" | \"inout\";\n\nexport type ParameterTransfer = \"none\" | \"full\" | \"container\";\n\ntype CallbackScope = \"call\" | \"notified\" | \"async\" | \"forever\";\n\nconst DIRECTIONS: Set<ParameterDirection> = new Set([\"in\", \"out\", \"inout\"]);\nconst TRANSFERS: Set<ParameterTransfer> = new Set([\"none\", \"full\", \"container\"]);\nconst SCOPES: Set<CallbackScope> = new Set([\"call\", \"notified\", \"async\", \"forever\"]);\n\nexport const transferOwnership = (node: RawNode): ParameterTransfer =>\n parseEnumAttr(attr(node, \"transfer-ownership\"), TRANSFERS, \"none\", \"transfer-ownership\");\n\nconst nullableAttr = (node: RawNode): boolean => attrBool(node, \"nullable\") || attrBool(node, \"allow-none\");\n\nexport type GirParameter = {\n name: string;\n type: TypeId | undefined;\n direction: ParameterDirection;\n transferOwnership: ParameterTransfer;\n nullable: boolean;\n optional: boolean;\n callerAllocates: boolean;\n scope: CallbackScope | undefined;\n closureIndex: number | undefined;\n destroyIndex: number | undefined;\n isVarargs: boolean;\n};\n\nexport const parameterFromNode = (node: RawNode, context: ParseContext): GirParameter => ({\n name: nameAttr(node),\n type: typeRefFromNode(node, context),\n direction: parseEnumAttr(attr(node, \"direction\"), DIRECTIONS, \"in\", \"direction\"),\n transferOwnership: transferOwnership(node),\n nullable: nullableAttr(node),\n optional: attrBool(node, \"optional\"),\n callerAllocates: attrBool(node, \"caller-allocates\"),\n scope: parseEnumAttr(attr(node, \"scope\"), SCOPES, undefined, \"scope\"),\n closureIndex: intAttr(node, \"closure\"),\n destroyIndex: intAttr(node, \"destroy\"),\n isVarargs: childOf(node, \"varargs\") !== undefined,\n});\n\nexport const isOutParameter = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && !parameter.callerAllocates;\n\nexport const isCallerAllocatedOut = (parameter: GirParameter): boolean =>\n parameter.direction === \"out\" && parameter.callerAllocates;\n\nexport const isInoutParameter = (parameter: GirParameter): boolean => parameter.direction === \"inout\";\n\nexport type GirReturnValue = {\n type: TypeId | undefined;\n transferOwnership: ParameterTransfer;\n nullable: boolean;\n skip: boolean;\n};\n\nconst returnValueFromNode = (node: RawNode | undefined, context: ParseContext): GirReturnValue => {\n if (node === undefined) {\n return { type: undefined, transferOwnership: \"none\", nullable: false, skip: false };\n }\n return {\n type: typeRefFromNode(node, context),\n transferOwnership: transferOwnership(node),\n nullable: nullableAttr(node),\n skip: attrBool(node, \"skip\"),\n };\n};\n\nexport type GirSignal = {\n name: string;\n doc: string | undefined;\n parameters: GirParameter[];\n returnValue: GirReturnValue;\n};\n\nexport const parseCallable = (node: RawNode, context: ParseContext): GirSignal => {\n const parametersNode = childOf(node, \"parameters\");\n const parameterNodes = childrenOf(parametersNode, \"parameter\");\n return {\n name: nameAttr(node),\n doc: docOf(node),\n parameters: parameterNodes.map((parameter) => parameterFromNode(parameter, context)),\n returnValue: returnValueFromNode(childOf(node, \"return-value\"), context),\n };\n};\n"]}
|
package/dist/gir/parse.d.ts
CHANGED
|
@@ -1,78 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Raw GIR XML element after parsing.
|
|
3
|
-
*
|
|
4
|
-
* Attributes are exposed under `@_<name>` keys (the default
|
|
5
|
-
* `fast-xml-parser` convention). Child elements appear under their tag name.
|
|
6
|
-
* Multi-occurrence tags (every container in {@link MULTI_TAGS}) are always
|
|
7
|
-
* arrays so callers do not need to disambiguate "single child" from "many
|
|
8
|
-
* children" at every access. Single-occurrence tags appear as bare objects.
|
|
9
|
-
*/
|
|
10
1
|
export type RawNode = {
|
|
11
|
-
|
|
2
|
+
[attributeOrChild: string]: unknown;
|
|
12
3
|
};
|
|
13
|
-
/**
|
|
14
|
-
* The tag name codegen reads GIR constructors under.
|
|
15
|
-
*
|
|
16
|
-
* GIR spells constructors `<constructor>`, but `fast-xml-parser` rejects the
|
|
17
|
-
* literal names `constructor`, `prototype`, and `__proto__` to guard against
|
|
18
|
-
* prototype pollution, with no opt-out. {@link parseGirFile} rewrites the tag
|
|
19
|
-
* to this token via `transformTagName` before that guard runs, so every
|
|
20
|
-
* downstream lookup of a constructor child must use this constant rather than
|
|
21
|
-
* the raw GIR name.
|
|
22
|
-
*/
|
|
23
4
|
export declare const GIR_CONSTRUCTOR_TAG = "gir-constructor";
|
|
24
|
-
/**
|
|
25
|
-
* Parses a GIR XML file from disk and returns its raw tree.
|
|
26
|
-
*
|
|
27
|
-
* The returned object always has a single `repository` property containing
|
|
28
|
-
* the root `<repository>` element. Callers should not interpret the tree
|
|
29
|
-
* directly — pass it to {@link GirRepository.load} (in `./repository.ts`),
|
|
30
|
-
* which builds the typed domain model on top of it.
|
|
31
|
-
*
|
|
32
|
-
* @param path - Absolute path to a `.gir` file
|
|
33
|
-
* @returns The raw repository node
|
|
34
|
-
*/
|
|
35
5
|
export declare const parseGirFile: (path: string) => RawNode;
|
|
36
|
-
/**
|
|
37
|
-
* Reads an attribute from a raw GIR node as a string, returning `undefined`
|
|
38
|
-
* when the attribute is absent.
|
|
39
|
-
*
|
|
40
|
-
* The `@_` prefix is added by `fast-xml-parser`; this helper hides that
|
|
41
|
-
* convention from the call sites.
|
|
42
|
-
*
|
|
43
|
-
* @param node - The raw element
|
|
44
|
-
* @param name - The attribute name (without the `@_` prefix)
|
|
45
|
-
*/
|
|
46
6
|
export declare const attr: (node: RawNode | undefined, name: string) => string | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Reads an attribute as a boolean using GIR's `"1"` / `"0"` convention.
|
|
49
|
-
*
|
|
50
|
-
* Attributes that are missing return the supplied default (defaulting to
|
|
51
|
-
* `false`). Any non-`"1"` value is treated as `false`.
|
|
52
|
-
*
|
|
53
|
-
* @param node - The raw element
|
|
54
|
-
* @param name - The attribute name (without the `@_` prefix)
|
|
55
|
-
* @param fallback - Value returned when the attribute is missing
|
|
56
|
-
*/
|
|
57
7
|
export declare const attrBool: (node: RawNode | undefined, name: string, fallback?: boolean) => boolean;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* this helper covers the residual case where a tag was registered as
|
|
63
|
-
* single-occurrence at the schema level but a particular file emits zero
|
|
64
|
-
* elements (returning `[]`) or where the caller wants a uniform array view.
|
|
65
|
-
*
|
|
66
|
-
* @param node - The parent element
|
|
67
|
-
* @param tag - The child tag name (with namespace prefix if any)
|
|
68
|
-
*/
|
|
69
|
-
export declare const childrenOf: (node: RawNode | undefined, tag: string) => readonly RawNode[];
|
|
70
|
-
/**
|
|
71
|
-
* Returns the single child of a raw node under a given tag, or `undefined`
|
|
72
|
-
* if absent. If multiple are present the first is returned.
|
|
73
|
-
*
|
|
74
|
-
* @param node - The parent element
|
|
75
|
-
* @param tag - The child tag name (with namespace prefix if any)
|
|
76
|
-
*/
|
|
8
|
+
export declare const nameAttr: (node: RawNode) => string;
|
|
9
|
+
export declare const intAttr: (node: RawNode, name: string) => number | undefined;
|
|
10
|
+
export declare const parseEnumAttr: <T extends string, F extends T | undefined>(raw: string | undefined, members: Set<T>, fallback: F, label: string) => T | F;
|
|
11
|
+
export declare const childrenOf: (node: RawNode | undefined, tag: string) => RawNode[];
|
|
77
12
|
export declare const childOf: (node: RawNode | undefined, tag: string) => RawNode | undefined;
|
|
13
|
+
export declare const docOf: (node: RawNode | undefined) => string | undefined;
|
|
78
14
|
//# sourceMappingURL=parse.d.ts.map
|
package/dist/gir/parse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/gir/parse.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/gir/parse.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,OAAO,GAAG;IAClB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC;CACvC,CAAC;AAyBF,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAkBrD,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,OAG3C,CAAC;AAEF,eAAO,MAAM,IAAI,SAAU,OAAO,GAAG,SAAS,QAAQ,MAAM,KAAG,MAAM,GAAG,SAIvE,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,OAAO,GAAG,SAAS,QAAQ,MAAM,yBAAqB,OAIpF,CAAC;AAEF,eAAO,MAAM,QAAQ,SAAU,OAAO,KAAG,MAAkC,CAAC;AAE5E,eAAO,MAAM,OAAO,SAAU,OAAO,QAAQ,MAAM,KAAG,MAAM,GAAG,SAG9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,CAAC,GAAG,SAAS,OAC9D,MAAM,GAAG,SAAS,WACd,GAAG,CAAC,CAAC,CAAC,YACL,CAAC,SACJ,MAAM,KACd,CAAC,GAAG,CAMN,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,OAAO,GAAG,SAAS,OAAO,MAAM,KAAG,OAAO,EAM1E,CAAC;AAEF,eAAO,MAAM,OAAO,SAAU,OAAO,GAAG,SAAS,OAAO,MAAM,KAAG,OAAO,GAAG,SAQ1E,CAAC;AAOF,eAAO,MAAM,KAAK,SAAU,OAAO,GAAG,SAAS,KAAG,MAAM,GAAG,SAU1D,CAAC"}
|