@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
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { lowerFirst, sourceStringLiteral, toCamelIdentifier } from "@gtkx/utils";
|
|
2
|
+
import { tBind, tInlineStruct, tRef, tString, tUint8, tVoid } from "../analysis/descriptor.js";
|
|
3
|
+
import { planArgs, scalarAliasOrGroup, scalarPrefixArgs, trackInto } from "./args.js";
|
|
4
|
+
import { commandJsDoc, inParamDocLine, singularJsDoc } from "./jsdoc.js";
|
|
5
|
+
const GL_LIB_EXPRESSION = "LIB";
|
|
6
|
+
const glBind = (name, argList, returnType) => tBind({
|
|
7
|
+
libExpr: GL_LIB_EXPRESSION,
|
|
8
|
+
symbolExpr: sourceStringLiteral(name),
|
|
9
|
+
argList,
|
|
10
|
+
returnType,
|
|
11
|
+
});
|
|
12
|
+
const commandExportName = (name) => toCamelIdentifier(name.startsWith("gl") ? lowerFirst(name.slice(2)) : name);
|
|
13
|
+
const singularize = (plural) => plural.endsWith("ies") ? `${plural.slice(0, -3)}y` : plural.replace(/s$/, "");
|
|
14
|
+
const renderDescriptorList = (descriptors) => descriptors.length === 0 ? "[]" : `[${descriptors.join(", ")}]`;
|
|
15
|
+
const buildEmittedReturn = (plan, returnGroup, usedTypes) => {
|
|
16
|
+
const track = trackInto(usedTypes);
|
|
17
|
+
switch (plan.kind) {
|
|
18
|
+
case "void":
|
|
19
|
+
return { tsType: "void", descriptor: tVoid };
|
|
20
|
+
case "scalar": {
|
|
21
|
+
const alias = track(scalarAliasOrGroup(plan.scalar, returnGroup));
|
|
22
|
+
return { tsType: alias, descriptor: plan.scalar.descriptor, expr: (call) => `${call} as ${alias}` };
|
|
23
|
+
}
|
|
24
|
+
case "boolean":
|
|
25
|
+
return { tsType: "boolean", descriptor: tUint8, expr: (call) => `(${call} as number) !== 0` };
|
|
26
|
+
case "string":
|
|
27
|
+
return { tsType: "string", descriptor: tString("borrowed"), expr: (call) => `${call} as string` };
|
|
28
|
+
case "sync":
|
|
29
|
+
return { tsType: track("GLsync"), descriptor: tInlineStruct(), expr: (call) => `${call} as GLsync` };
|
|
30
|
+
case "opaque-pointer":
|
|
31
|
+
return {
|
|
32
|
+
tsType: track("GLpointer"),
|
|
33
|
+
descriptor: tInlineStruct(),
|
|
34
|
+
expr: (call) => `${call} as GLpointer`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const returnTsType = (returned, outs) => {
|
|
39
|
+
if (outs.length === 0)
|
|
40
|
+
return returned.tsType;
|
|
41
|
+
const outTypes = outs.map((out) => out.tsType);
|
|
42
|
+
if (returned.expr === undefined) {
|
|
43
|
+
return outTypes.length === 1 && outTypes[0] !== undefined ? outTypes[0] : `[${outTypes.join(", ")}]`;
|
|
44
|
+
}
|
|
45
|
+
return `[${returned.tsType}, ${outTypes.join(", ")}]`;
|
|
46
|
+
};
|
|
47
|
+
const returnStatements = (call, returned, outs) => {
|
|
48
|
+
if (outs.length === 0) {
|
|
49
|
+
return returned.expr === undefined ? [`${call};`] : [`return ${returned.expr(call)};`];
|
|
50
|
+
}
|
|
51
|
+
const outValues = outs.map((out) => `${out.cellName}.value`);
|
|
52
|
+
if (returned.expr === undefined) {
|
|
53
|
+
const tail = outValues.length === 1 ? `return ${outValues[0]};` : `return [${outValues.join(", ")}];`;
|
|
54
|
+
return [`${call};`, tail];
|
|
55
|
+
}
|
|
56
|
+
return [`const result = ${call};`, `return [${returned.expr("result")}, ${outValues.join(", ")}];`];
|
|
57
|
+
};
|
|
58
|
+
export const renderCommand = (plan, feature, usedTypes) => {
|
|
59
|
+
const { command } = plan;
|
|
60
|
+
const exportName = commandExportName(command.name);
|
|
61
|
+
const { args, ins, outs } = planArgs(plan, usedTypes);
|
|
62
|
+
const returned = buildEmittedReturn(plan.returnPlan, command.returnGroup, usedTypes);
|
|
63
|
+
const signature = ins.map((arg) => `${arg.name}: ${arg.tsType}`).join(", ");
|
|
64
|
+
const argNames = args.map((arg) => (arg.out ? arg.cellName : arg.name)).join(", ");
|
|
65
|
+
const descriptors = renderDescriptorList(args.map((arg) => arg.descriptor));
|
|
66
|
+
const tsReturn = returnTsType(returned, outs);
|
|
67
|
+
const jsDoc = commandJsDoc({ command, feature, ins, outs, returnPlan: plan.returnPlan });
|
|
68
|
+
const seeds = outs.map((out) => out.seed);
|
|
69
|
+
const bindExpression = glBind(command.name, descriptors, returned.descriptor);
|
|
70
|
+
const inline = plan.params.some((paramPlan) => paramPlan.kind === "string-out");
|
|
71
|
+
const bindingName = inline ? "binding" : toCamelIdentifier(command.name);
|
|
72
|
+
const body = [
|
|
73
|
+
...seeds,
|
|
74
|
+
...(inline ? [`const ${bindingName} = ${bindExpression};`] : []),
|
|
75
|
+
...returnStatements(`${bindingName}(${argNames})`, returned, outs),
|
|
76
|
+
]
|
|
77
|
+
.map((line) => ` ${line}`)
|
|
78
|
+
.join("\n");
|
|
79
|
+
return {
|
|
80
|
+
exportName,
|
|
81
|
+
...(inline ? {} : { binding: `const ${bindingName} = ${bindExpression};` }),
|
|
82
|
+
declaration: `${jsDoc}\nexport function ${exportName}(${signature}): ${tsReturn} {\n${body}\n}`,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const GEN_FAMILY = /^gl(Gen|Create)[A-Z][A-Za-z]*s$/;
|
|
86
|
+
const DELETE_FAMILY = /^glDelete[A-Z][A-Za-z]*s$/;
|
|
87
|
+
export const deriveGenSingular = (plan, feature, usedTypes) => {
|
|
88
|
+
if (!GEN_FAMILY.test(plan.command.name))
|
|
89
|
+
return undefined;
|
|
90
|
+
const countIndex = plan.params.length - 2;
|
|
91
|
+
const outIndex = plan.params.length - 1;
|
|
92
|
+
const countPlan = plan.params[countIndex];
|
|
93
|
+
const outPlan = plan.params[outIndex];
|
|
94
|
+
const countParam = plan.command.params[countIndex];
|
|
95
|
+
const outParam = plan.command.params[outIndex];
|
|
96
|
+
if (countPlan?.kind !== "scalar" || outPlan?.kind !== "ref-array-out")
|
|
97
|
+
return undefined;
|
|
98
|
+
if (countParam === undefined || outParam === undefined)
|
|
99
|
+
return undefined;
|
|
100
|
+
if (outPlan.lenParamName !== countParam.name || outParam.objectClass === undefined)
|
|
101
|
+
return undefined;
|
|
102
|
+
const prefix = scalarPrefixArgs(plan, usedTypes);
|
|
103
|
+
if (prefix === undefined)
|
|
104
|
+
return undefined;
|
|
105
|
+
const exportName = singularize(commandExportName(plan.command.name));
|
|
106
|
+
const bindingName = `${plan.command.name}Single`;
|
|
107
|
+
const descriptors = [
|
|
108
|
+
...prefix.map((arg) => arg.descriptor),
|
|
109
|
+
countPlan.scalar.descriptor,
|
|
110
|
+
tRef(outPlan.scalar.descriptor),
|
|
111
|
+
];
|
|
112
|
+
usedTypes.add(outPlan.scalar.tsAlias);
|
|
113
|
+
const signature = prefix.map((arg) => `${arg.name}: ${arg.tsType}`).join(", ");
|
|
114
|
+
const callArgs = [...prefix.map((arg) => arg.name), "1", "out"].join(", ");
|
|
115
|
+
const jsDoc = singularJsDoc({
|
|
116
|
+
commandName: plan.command.name,
|
|
117
|
+
feature,
|
|
118
|
+
summary: `Returns one ${outParam.objectClass} object name via \`${plan.command.name}(${prefix.length > 0 ? "..., " : ""}1, ...)\`.`,
|
|
119
|
+
body: [
|
|
120
|
+
...prefix.map((arg) => inParamDocLine(plan.command, arg)),
|
|
121
|
+
` * @returns The new ${outParam.objectClass} object name`,
|
|
122
|
+
],
|
|
123
|
+
});
|
|
124
|
+
const body = [` const out = { value: 0 };`, ` ${bindingName}(${callArgs});`, " return out.value;"].join("\n");
|
|
125
|
+
const binding = glBind(plan.command.name, renderDescriptorList(descriptors), tVoid);
|
|
126
|
+
return {
|
|
127
|
+
exportName,
|
|
128
|
+
binding: `const ${bindingName} = ${binding};`,
|
|
129
|
+
declaration: `${jsDoc}\nexport function ${exportName}(${signature}): ${outPlan.scalar.tsAlias} {\n${body}\n}`,
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
export const deriveDeleteSingular = (plan, feature, usedTypes) => {
|
|
133
|
+
if (!DELETE_FAMILY.test(plan.command.name))
|
|
134
|
+
return undefined;
|
|
135
|
+
if (plan.params.length !== 2)
|
|
136
|
+
return undefined;
|
|
137
|
+
const [countPlan, arrayPlan] = plan.params;
|
|
138
|
+
const [countParam, arrayParam] = plan.command.params;
|
|
139
|
+
if (countPlan?.kind !== "scalar" || arrayPlan?.kind !== "array-in")
|
|
140
|
+
return undefined;
|
|
141
|
+
if (countParam === undefined || arrayParam === undefined)
|
|
142
|
+
return undefined;
|
|
143
|
+
if (arrayParam.len !== countParam.name || arrayParam.objectClass === undefined)
|
|
144
|
+
return undefined;
|
|
145
|
+
const exportName = singularize(commandExportName(plan.command.name));
|
|
146
|
+
usedTypes.add(arrayPlan.scalar.tsAlias);
|
|
147
|
+
const jsDoc = singularJsDoc({
|
|
148
|
+
commandName: plan.command.name,
|
|
149
|
+
feature,
|
|
150
|
+
summary: `Deletes one ${arrayParam.objectClass} object name via \`${plan.command.name}(1, ...)\`.`,
|
|
151
|
+
body: [` * @param name - The ${arrayParam.objectClass} object name to delete`],
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
exportName,
|
|
155
|
+
declaration: `${jsDoc}\nexport function ${exportName}(name: ${arrayPlan.scalar.tsAlias}): void {\n ${plan.command.name}(1, [name]);\n}`,
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/khronos/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,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SAAS;QAAE,OAAO,SAAS,CAAC;IACjG,MAAM,UAAU,GAAG,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACrE,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,aAAa,CAAC;QACxB,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;QAC9B,OAAO;QACP,OAAO,EAAE,eAAe,UAAU,CAAC,WAAW,sBAAsB,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa;QAClG,IAAI,EAAE,CAAC,wBAAwB,UAAU,CAAC,WAAW,wBAAwB,CAAC;KACjF,CAAC,CAAC;IACH,OAAO;QACH,UAAU;QACV,WAAW,EAAE,GAAG,KAAK,qBAAqB,UAAU,UAAU,SAAS,CAAC,MAAM,CAAC,OAAO,kBAAkB,IAAI,CAAC,OAAO,CAAC,IAAI,iBAAiB;KAC7I,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { lowerFirst, sourceStringLiteral, toCamelIdentifier } from \"@gtkx/utils\";\nimport { tBind, tInlineStruct, tRef, tString, tUint8, tVoid } from \"../analysis/descriptor.js\";\nimport { type OutArg, planArgs, scalarAliasOrGroup, scalarPrefixArgs, trackInto } from \"./args.js\";\nimport { commandJsDoc, inParamDocLine, singularJsDoc } from \"./jsdoc.js\";\nimport type { CommandPlan, ReturnPlan } from \"./plan.js\";\n\nconst GL_LIB_EXPRESSION = \"LIB\";\n\nconst glBind = (name: string, argList: string, returnType: string): string =>\n tBind({\n libExpr: GL_LIB_EXPRESSION,\n symbolExpr: sourceStringLiteral(name),\n argList,\n returnType,\n });\n\nconst commandExportName = (name: string): string =>\n toCamelIdentifier(name.startsWith(\"gl\") ? lowerFirst(name.slice(2)) : name);\n\nconst singularize = (plural: string): string =>\n plural.endsWith(\"ies\") ? `${plural.slice(0, -3)}y` : plural.replace(/s$/, \"\");\n\nconst renderDescriptorList = (descriptors: string[]): string =>\n descriptors.length === 0 ? \"[]\" : `[${descriptors.join(\", \")}]`;\n\nexport type RenderedCommand = {\n exportName: string;\n binding?: string;\n declaration: string;\n};\n\ntype EmittedReturn = {\n tsType: string;\n descriptor: string;\n expr?: (call: string) => string;\n};\n\nconst buildEmittedReturn = (\n plan: ReturnPlan,\n returnGroup: string | undefined,\n usedTypes: Set<string>,\n): EmittedReturn => {\n const track = trackInto(usedTypes);\n switch (plan.kind) {\n case \"void\":\n return { tsType: \"void\", descriptor: tVoid };\n case \"scalar\": {\n const alias = track(scalarAliasOrGroup(plan.scalar, returnGroup));\n return { tsType: alias, descriptor: plan.scalar.descriptor, expr: (call) => `${call} as ${alias}` };\n }\n case \"boolean\":\n return { tsType: \"boolean\", descriptor: tUint8, expr: (call) => `(${call} as number) !== 0` };\n case \"string\":\n return { tsType: \"string\", descriptor: tString(\"borrowed\"), expr: (call) => `${call} as string` };\n case \"sync\":\n return { tsType: track(\"GLsync\"), descriptor: tInlineStruct(), expr: (call) => `${call} as GLsync` };\n case \"opaque-pointer\":\n return {\n tsType: track(\"GLpointer\"),\n descriptor: tInlineStruct(),\n expr: (call) => `${call} as GLpointer`,\n };\n }\n};\n\nconst returnTsType = (returned: EmittedReturn, outs: OutArg[]): string => {\n if (outs.length === 0) return returned.tsType;\n const outTypes = outs.map((out) => out.tsType);\n if (returned.expr === undefined) {\n return outTypes.length === 1 && outTypes[0] !== undefined ? outTypes[0] : `[${outTypes.join(\", \")}]`;\n }\n return `[${returned.tsType}, ${outTypes.join(\", \")}]`;\n};\n\nconst returnStatements = (call: string, returned: EmittedReturn, outs: OutArg[]): string[] => {\n if (outs.length === 0) {\n return returned.expr === undefined ? [`${call};`] : [`return ${returned.expr(call)};`];\n }\n const outValues = outs.map((out) => `${out.cellName}.value`);\n if (returned.expr === undefined) {\n const tail = outValues.length === 1 ? `return ${outValues[0]};` : `return [${outValues.join(\", \")}];`;\n return [`${call};`, tail];\n }\n return [`const result = ${call};`, `return [${returned.expr(\"result\")}, ${outValues.join(\", \")}];`];\n};\n\nexport const renderCommand = (\n plan: CommandPlan & { ok: true },\n feature: string,\n usedTypes: Set<string>,\n): RenderedCommand => {\n const { command } = plan;\n const exportName = commandExportName(command.name);\n const { args, ins, outs } = planArgs(plan, usedTypes);\n const returned = buildEmittedReturn(plan.returnPlan, command.returnGroup, usedTypes);\n const signature = ins.map((arg) => `${arg.name}: ${arg.tsType}`).join(\", \");\n const argNames = args.map((arg) => (arg.out ? arg.cellName : arg.name)).join(\", \");\n const descriptors = renderDescriptorList(args.map((arg) => arg.descriptor));\n const tsReturn = returnTsType(returned, outs);\n const jsDoc = commandJsDoc({ command, feature, ins, outs, returnPlan: plan.returnPlan });\n const seeds = outs.map((out) => out.seed);\n const bindExpression = glBind(command.name, descriptors, returned.descriptor);\n const inline = plan.params.some((paramPlan) => paramPlan.kind === \"string-out\");\n const bindingName = inline ? \"binding\" : toCamelIdentifier(command.name);\n const body = [\n ...seeds,\n ...(inline ? [`const ${bindingName} = ${bindExpression};`] : []),\n ...returnStatements(`${bindingName}(${argNames})`, returned, outs),\n ]\n .map((line) => ` ${line}`)\n .join(\"\\n\");\n return {\n exportName,\n ...(inline ? {} : { binding: `const ${bindingName} = ${bindExpression};` }),\n declaration: `${jsDoc}\\nexport function ${exportName}(${signature}): ${tsReturn} {\\n${body}\\n}`,\n };\n};\n\nconst GEN_FAMILY = /^gl(Gen|Create)[A-Z][A-Za-z]*s$/;\nconst DELETE_FAMILY = /^glDelete[A-Z][A-Za-z]*s$/;\n\nexport const deriveGenSingular = (\n plan: CommandPlan & { ok: true },\n feature: string,\n usedTypes: Set<string>,\n): RenderedCommand | undefined => {\n if (!GEN_FAMILY.test(plan.command.name)) return undefined;\n const countIndex = plan.params.length - 2;\n const outIndex = plan.params.length - 1;\n const countPlan = plan.params[countIndex];\n const outPlan = plan.params[outIndex];\n const countParam = plan.command.params[countIndex];\n const outParam = plan.command.params[outIndex];\n if (countPlan?.kind !== \"scalar\" || outPlan?.kind !== \"ref-array-out\") return undefined;\n if (countParam === undefined || outParam === undefined) return undefined;\n if (outPlan.lenParamName !== countParam.name || outParam.objectClass === undefined) return undefined;\n const prefix = scalarPrefixArgs(plan, usedTypes);\n if (prefix === undefined) return undefined;\n const exportName = singularize(commandExportName(plan.command.name));\n const bindingName = `${plan.command.name}Single`;\n const descriptors = [\n ...prefix.map((arg) => arg.descriptor),\n countPlan.scalar.descriptor,\n tRef(outPlan.scalar.descriptor),\n ];\n usedTypes.add(outPlan.scalar.tsAlias);\n const signature = prefix.map((arg) => `${arg.name}: ${arg.tsType}`).join(\", \");\n const callArgs = [...prefix.map((arg) => arg.name), \"1\", \"out\"].join(\", \");\n const jsDoc = singularJsDoc({\n commandName: plan.command.name,\n feature,\n summary: `Returns one ${outParam.objectClass} object name via \\`${plan.command.name}(${prefix.length > 0 ? \"..., \" : \"\"}1, ...)\\`.`,\n body: [\n ...prefix.map((arg) => inParamDocLine(plan.command, arg)),\n ` * @returns The new ${outParam.objectClass} object name`,\n ],\n });\n const body = [` const out = { value: 0 };`, ` ${bindingName}(${callArgs});`, \" return out.value;\"].join(\n \"\\n\",\n );\n const binding = glBind(plan.command.name, renderDescriptorList(descriptors), tVoid);\n return {\n exportName,\n binding: `const ${bindingName} = ${binding};`,\n declaration: `${jsDoc}\\nexport function ${exportName}(${signature}): ${outPlan.scalar.tsAlias} {\\n${body}\\n}`,\n };\n};\n\nexport const deriveDeleteSingular = (\n plan: CommandPlan & { ok: true },\n feature: string,\n usedTypes: Set<string>,\n): RenderedCommand | undefined => {\n if (!DELETE_FAMILY.test(plan.command.name)) return undefined;\n if (plan.params.length !== 2) return undefined;\n const [countPlan, arrayPlan] = plan.params;\n const [countParam, arrayParam] = plan.command.params;\n if (countPlan?.kind !== \"scalar\" || arrayPlan?.kind !== \"array-in\") return undefined;\n if (countParam === undefined || arrayParam === undefined) return undefined;\n if (arrayParam.len !== countParam.name || arrayParam.objectClass === undefined) return undefined;\n const exportName = singularize(commandExportName(plan.command.name));\n usedTypes.add(arrayPlan.scalar.tsAlias);\n const jsDoc = singularJsDoc({\n commandName: plan.command.name,\n feature,\n summary: `Deletes one ${arrayParam.objectClass} object name via \\`${plan.command.name}(1, ...)\\`.`,\n body: [` * @param name - The ${arrayParam.objectClass} object name to delete`],\n });\n return {\n exportName,\n declaration: `${jsDoc}\\nexport function ${exportName}(name: ${arrayPlan.scalar.tsAlias}): void {\\n ${plan.command.name}(1, [name]);\\n}`,\n };\n};\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GlEnum, GlRegistry } from "./model.js";
|
|
2
|
+
type GlProfile = "core";
|
|
3
|
+
export type GlSelection = {
|
|
4
|
+
api: string;
|
|
5
|
+
version: number;
|
|
6
|
+
profile: GlProfile;
|
|
7
|
+
};
|
|
8
|
+
type GlSubset = {
|
|
9
|
+
commands: Map<string, string>;
|
|
10
|
+
enums: Map<string, string>;
|
|
11
|
+
};
|
|
12
|
+
export declare const selectSubset: (registry: GlRegistry, selection: GlSelection) => GlSubset;
|
|
13
|
+
export declare const resolveEnum: (registry: GlRegistry, name: string) => GlEnum;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/khronos/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA+B,UAAU,EAAE,MAAM,YAAY,CAAC;AAElF,KAAK,SAAS,GAAG,MAAM,CAAC;AAExB,MAAM,MAAM,WAAW,GAAG;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,KAAK,QAAQ,GAAG;IACZ,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAmCF,eAAO,MAAM,YAAY,aAAc,UAAU,aAAa,WAAW,KAAG,QAU3E,CAAC;AAEF,eAAO,MAAM,WAAW,aAAc,UAAU,QAAQ,MAAM,KAAG,MAMhE,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const blockApplies = (block, selection) => block.profile === undefined || block.profile === selection.profile;
|
|
2
|
+
const applyRequires = (feature, selection, commands, enums) => {
|
|
3
|
+
for (const block of feature.requires) {
|
|
4
|
+
if (!blockApplies(block, selection))
|
|
5
|
+
continue;
|
|
6
|
+
for (const name of block.commands) {
|
|
7
|
+
if (!commands.has(name))
|
|
8
|
+
commands.set(name, feature.name);
|
|
9
|
+
}
|
|
10
|
+
for (const name of block.enums) {
|
|
11
|
+
if (!enums.has(name))
|
|
12
|
+
enums.set(name, feature.name);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const applyRemoves = (feature, selection, commands, enums) => {
|
|
17
|
+
for (const block of feature.removes) {
|
|
18
|
+
if (!blockApplies(block, selection))
|
|
19
|
+
continue;
|
|
20
|
+
for (const name of block.commands)
|
|
21
|
+
commands.delete(name);
|
|
22
|
+
for (const name of block.enums)
|
|
23
|
+
enums.delete(name);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const selectSubset = (registry, selection) => {
|
|
27
|
+
const features = registry.features
|
|
28
|
+
.filter((feature) => feature.api === selection.api && feature.number <= selection.version)
|
|
29
|
+
.sort((a, b) => a.number - b.number);
|
|
30
|
+
const commands = new Map();
|
|
31
|
+
const enums = new Map();
|
|
32
|
+
for (const feature of features)
|
|
33
|
+
applyRequires(feature, selection, commands, enums);
|
|
34
|
+
for (const feature of features)
|
|
35
|
+
applyRemoves(feature, selection, commands, enums);
|
|
36
|
+
return { commands, enums };
|
|
37
|
+
};
|
|
38
|
+
export const resolveEnum = (registry, name) => {
|
|
39
|
+
const found = registry.enums.find((candidate) => candidate.name === name);
|
|
40
|
+
if (found === undefined) {
|
|
41
|
+
throw new Error(`Enum token ${name} has no definition in the registry`);
|
|
42
|
+
}
|
|
43
|
+
return found;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/khronos/select.ts"],"names":[],"mappings":"AAeA,MAAM,YAAY,GAAG,CAAC,KAAuB,EAAE,SAAsB,EAAW,EAAE,CAC9E,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,OAAO,CAAC;AAEvE,MAAM,aAAa,GAAG,CAClB,OAAkB,EAClB,SAAsB,EACtB,QAA6B,EAC7B,KAA0B,EACtB,EAAE;IACN,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC;YAAE,SAAS;QAC9C,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAC7B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;gBAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CACjB,OAAkB,EAClB,SAAsB,EACtB,QAA6B,EAC7B,KAA0B,EACtB,EAAE;IACN,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,YAAY,CAAC,KAAK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AC;IAC1E,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,oCAAoC,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import type { GlEnum, GlFeature, GlInterfaceBlock, GlRegistry } from \"./model.js\";\n\ntype GlProfile = \"core\";\n\nexport type GlSelection = {\n api: string;\n version: number;\n profile: GlProfile;\n};\n\ntype GlSubset = {\n commands: Map<string, string>;\n enums: Map<string, string>;\n};\n\nconst blockApplies = (block: GlInterfaceBlock, selection: GlSelection): boolean =>\n block.profile === undefined || block.profile === selection.profile;\n\nconst applyRequires = (\n feature: GlFeature,\n selection: GlSelection,\n commands: Map<string, string>,\n enums: Map<string, string>,\n): void => {\n for (const block of feature.requires) {\n if (!blockApplies(block, selection)) continue;\n for (const name of block.commands) {\n if (!commands.has(name)) commands.set(name, feature.name);\n }\n for (const name of block.enums) {\n if (!enums.has(name)) enums.set(name, feature.name);\n }\n }\n};\n\nconst applyRemoves = (\n feature: GlFeature,\n selection: GlSelection,\n commands: Map<string, string>,\n enums: Map<string, string>,\n): void => {\n for (const block of feature.removes) {\n if (!blockApplies(block, selection)) continue;\n for (const name of block.commands) commands.delete(name);\n for (const name of block.enums) enums.delete(name);\n }\n};\n\nexport const selectSubset = (registry: GlRegistry, selection: GlSelection): GlSubset => {\n const features = registry.features\n .filter((feature) => feature.api === selection.api && feature.number <= selection.version)\n .sort((a, b) => a.number - b.number);\n\n const commands = new Map<string, string>();\n const enums = new Map<string, string>();\n for (const feature of features) applyRequires(feature, selection, commands, enums);\n for (const feature of features) applyRemoves(feature, selection, commands, enums);\n return { commands, enums };\n};\n\nexport const resolveEnum = (registry: GlRegistry, name: string): GlEnum => {\n const found = registry.enums.find((candidate) => candidate.name === name);\n if (found === undefined) {\n throw new Error(`Enum token ${name} has no definition in the registry`);\n }\n return found;\n};\n"]}
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,55 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type { ElementProp } from "@gtkx/config";
|
|
2
|
+
import { type GlGenerationReport } from "./khronos/pipeline.js";
|
|
3
|
+
import { type GiStoreOptions } from "./store/gi-store.js";
|
|
4
|
+
import { type JsxStoreOptions } from "./store/jsx-store.js";
|
|
5
|
+
export type GlCodegenOptions = {
|
|
6
|
+
registryPath: string;
|
|
7
|
+
overrideExports: Set<string>;
|
|
8
|
+
outputDir: string;
|
|
9
|
+
resolveFrom: string;
|
|
10
|
+
};
|
|
6
11
|
export type CodegenRunnerOptions = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
readonly gi: GiStoreOptions;
|
|
15
|
-
/** Target for the injected `@gtkx/react-jsx` unit; React is skipped when omitted. */
|
|
16
|
-
readonly jsx?: JsxStoreOptions;
|
|
12
|
+
libraries?: string[];
|
|
13
|
+
girPath?: string[];
|
|
14
|
+
elementProps?: Record<string, ElementProp[]> | undefined;
|
|
15
|
+
gi?: GiStoreOptions;
|
|
16
|
+
jsx?: JsxStoreOptions | undefined;
|
|
17
|
+
gl?: GlCodegenOptions;
|
|
18
|
+
force?: boolean;
|
|
17
19
|
};
|
|
18
|
-
/**
|
|
19
|
-
* Result returned from {@link CodegenRunner.run}.
|
|
20
|
-
*/
|
|
21
20
|
export type CodegenRunnerResult = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
readonly duration: number;
|
|
21
|
+
regenerated: boolean;
|
|
22
|
+
namespaces: number;
|
|
23
|
+
intrinsicElements: number;
|
|
24
|
+
duration: number;
|
|
25
|
+
gl?: GlGenerationReport | undefined;
|
|
28
26
|
};
|
|
29
27
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* optional `@gtkx/react-jsx`) packages into the project's `node_modules`.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```ts
|
|
38
|
-
* import { CodegenRunner } from "@gtkx/codegen";
|
|
28
|
+
* Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
|
|
29
|
+
* configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
|
|
30
|
+
* fingerprint is stale unless `options.force` is set, while the OpenGL modules are regenerated whenever
|
|
31
|
+
* `options.gl` is provided.
|
|
39
32
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* girPath: ["/usr/share/gir-1.0"],
|
|
43
|
-
* gi: { storeDir, linkDir, realFfiDir, realNativeDir, version },
|
|
44
|
-
* }).run();
|
|
45
|
-
* ```
|
|
33
|
+
* @param options - What to generate and where to write it.
|
|
34
|
+
* @returns A summary of what was regenerated and how long the run took.
|
|
46
35
|
*/
|
|
47
|
-
export declare
|
|
48
|
-
private readonly options;
|
|
49
|
-
constructor(options: CodegenRunnerOptions);
|
|
50
|
-
/**
|
|
51
|
-
* Executes the full codegen pipeline and materializes the output packages.
|
|
52
|
-
*/
|
|
53
|
-
run(): Promise<CodegenRunnerResult>;
|
|
54
|
-
}
|
|
36
|
+
export declare const runCodegen: (options: CodegenRunnerOptions) => Promise<CodegenRunnerResult>;
|
|
55
37
|
//# 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,EAAyB,KAAK,cAAc,EAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,OAAO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
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { checkModules } from "./compile.js";
|
|
4
|
+
import { computeFingerprint, isStoreFresh } from "./fingerprint.js";
|
|
5
|
+
import { Library } from "./gir/library.js";
|
|
6
|
+
import { namespaceDirectory } from "./gir/namespace.js";
|
|
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";
|
|
7
12
|
/**
|
|
8
|
-
*
|
|
13
|
+
* Runs the `@gtkx` code generators, producing the `@gtkx/gi`, `@gtkx/jsx`, and `@gtkx/gl` bindings from the
|
|
14
|
+
* configured GObject-introspection libraries and OpenGL registry. The gi store is regenerated only when its
|
|
15
|
+
* fingerprint is stale unless `options.force` is set, while the OpenGL modules are regenerated whenever
|
|
16
|
+
* `options.gl` is provided.
|
|
9
17
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* optional `@gtkx/react-jsx`) packages into the project's `node_modules`.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* import { CodegenRunner } from "@gtkx/codegen";
|
|
17
|
-
*
|
|
18
|
-
* await new CodegenRunner({
|
|
19
|
-
* libraries: ["Gtk-4.0", "Adw-1"],
|
|
20
|
-
* girPath: ["/usr/share/gir-1.0"],
|
|
21
|
-
* gi: { storeDir, linkDir, realFfiDir, realNativeDir, version },
|
|
22
|
-
* }).run();
|
|
23
|
-
* ```
|
|
18
|
+
* @param options - What to generate and where to write it.
|
|
19
|
+
* @returns A summary of what was regenerated and how long the run took.
|
|
24
20
|
*/
|
|
25
|
-
export
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
export const runCodegen = async (options) => {
|
|
22
|
+
const start = Date.now();
|
|
23
|
+
const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);
|
|
24
|
+
const gi = emitGiStoreIfStale(options);
|
|
25
|
+
return {
|
|
26
|
+
regenerated: gi !== undefined,
|
|
27
|
+
namespaces: gi?.namespaces ?? 0,
|
|
28
|
+
intrinsicElements: gi?.intrinsicElements ?? 0,
|
|
29
|
+
duration: Date.now() - start,
|
|
30
|
+
gl,
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const emitGlModules = (options) => {
|
|
34
|
+
const { files, report } = generateGlModules({
|
|
35
|
+
registryPath: options.registryPath,
|
|
36
|
+
overrideExports: options.overrideExports,
|
|
37
|
+
});
|
|
38
|
+
checkModules({
|
|
39
|
+
modules: [...files].map(([fileName, source]) => ({ fileName, source })),
|
|
40
|
+
resolveFrom: options.resolveFrom,
|
|
41
|
+
label: "the generated gl modules",
|
|
42
|
+
});
|
|
43
|
+
mkdirSync(options.outputDir, { recursive: true });
|
|
44
|
+
for (const [fileName, source] of files) {
|
|
45
|
+
writeFileSync(join(options.outputDir, fileName), source);
|
|
29
46
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
return report;
|
|
48
|
+
};
|
|
49
|
+
const emitGiStoreIfStale = (options) => {
|
|
50
|
+
const { gi, libraries, girPath } = options;
|
|
51
|
+
if (gi === undefined || libraries === undefined || girPath === undefined)
|
|
52
|
+
return undefined;
|
|
53
|
+
const elementProps = options.elementProps ?? {};
|
|
54
|
+
if (options.force !== true && isStoreFresh(gi.storeDir, libraries, elementProps))
|
|
55
|
+
return undefined;
|
|
56
|
+
const library = Library.load(libraries, girPath);
|
|
57
|
+
emitGiStore(gi, libraries, elementProps, library);
|
|
58
|
+
return {
|
|
59
|
+
namespaces: library.namespaces.size,
|
|
60
|
+
intrinsicElements: emitJsxStore(options.jsx, elementProps, library),
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const emitGiStore = (gi, libraries, elementProps, library) => {
|
|
64
|
+
const namespaces = [];
|
|
65
|
+
for (const namespace of library.namespaces.values()) {
|
|
66
|
+
namespaces.push({
|
|
67
|
+
directory: namespaceDirectory(namespace),
|
|
68
|
+
rawSource: generateNamespaceModule(namespace, library),
|
|
46
69
|
});
|
|
47
|
-
let widgetCount = 0;
|
|
48
|
-
if (this.options.jsx !== undefined) {
|
|
49
|
-
const reactPipeline = generateReactFiles(repository, this.options.slotProps);
|
|
50
|
-
writeJsxStore(this.options.jsx, reactPipeline.files);
|
|
51
|
-
widgetCount = reactPipeline.widgetCount;
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
namespaces: repository.namespaces.size,
|
|
55
|
-
widgets: widgetCount,
|
|
56
|
-
duration: Date.now() - start,
|
|
57
|
-
};
|
|
58
70
|
}
|
|
59
|
-
|
|
71
|
+
const libs = [...libraries];
|
|
72
|
+
writeGiStore(gi, namespaces, {
|
|
73
|
+
value: computeFingerprint(library.girFiles, libs, elementProps),
|
|
74
|
+
girFiles: library.girFiles,
|
|
75
|
+
libraries: libs,
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const emitJsxStore = (jsx, elementProps, library) => {
|
|
79
|
+
if (jsx === undefined)
|
|
80
|
+
return 0;
|
|
81
|
+
const reactPipeline = generateJsxFiles(library, elementProps);
|
|
82
|
+
writeJsxStore(jsx, reactPipeline.namespaces, reactPipeline.metadata);
|
|
83
|
+
return reactPipeline.intrinsicElementCount;
|
|
84
|
+
};
|
|
60
85
|
//# 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,
|
|
1
|
+
{"version":3,"file":"runner.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,CAAC;AAC/C,CAAC,CAAC","sourcesContent":["import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { ElementProp } from \"@gtkx/config\";\nimport { checkModules } from \"./compile.js\";\nimport { computeFingerprint, isStoreFresh } from \"./fingerprint.js\";\nimport { Library } from \"./gir/library.js\";\nimport { namespaceDirectory } from \"./gir/namespace.js\";\nimport { type GlGenerationReport, generateGlModules } from \"./khronos/pipeline.js\";\nimport { generateNamespaceModule } from \"./store/gi/pipeline.js\";\nimport { type GiNamespaceInput, type GiStoreOptions, writeGiStore } from \"./store/gi-store.js\";\nimport { type JsxStoreOptions, writeJsxStore } from \"./store/jsx-store.js\";\nimport { generateJsxFiles } from \"./store/react/pipeline.js\";\n\nexport type GlCodegenOptions = {\n registryPath: string;\n overrideExports: Set<string>;\n outputDir: string;\n resolveFrom: string;\n};\n\nexport type CodegenRunnerOptions = {\n libraries?: string[];\n girPath?: string[];\n elementProps?: Record<string, ElementProp[]> | undefined;\n gi?: GiStoreOptions;\n jsx?: JsxStoreOptions | undefined;\n gl?: GlCodegenOptions;\n force?: boolean;\n};\n\nexport type CodegenRunnerResult = {\n regenerated: boolean;\n namespaces: number;\n intrinsicElements: number;\n duration: number;\n gl?: GlGenerationReport | undefined;\n};\n\ntype GiEmitResult = {\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, while the OpenGL modules are regenerated whenever\n * `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 */\nexport const runCodegen = async (options: CodegenRunnerOptions): Promise<CodegenRunnerResult> => {\n const start = Date.now();\n const gl = options.gl === undefined ? undefined : emitGlModules(options.gl);\n const gi = emitGiStoreIfStale(options);\n return {\n regenerated: gi !== undefined,\n namespaces: gi?.namespaces ?? 0,\n intrinsicElements: gi?.intrinsicElements ?? 0,\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 checkModules({\n modules: [...files].map(([fileName, source]) => ({ fileName, source })),\n resolveFrom: options.resolveFrom,\n label: \"the generated gl modules\",\n });\n mkdirSync(options.outputDir, { recursive: true });\n for (const [fileName, source] of files) {\n writeFileSync(join(options.outputDir, fileName), source);\n }\n return report;\n};\n\nconst emitGiStoreIfStale = (options: CodegenRunnerOptions): GiEmitResult | undefined => {\n const { gi, libraries, girPath } = options;\n if (gi === undefined || libraries === undefined || girPath === undefined) return undefined;\n const elementProps = options.elementProps ?? {};\n if (options.force !== true && isStoreFresh(gi.storeDir, libraries, elementProps)) return undefined;\n const library = Library.load(libraries, girPath);\n emitGiStore(gi, libraries, elementProps, library);\n return {\n namespaces: library.namespaces.size,\n intrinsicElements: emitJsxStore(options.jsx, elementProps, library),\n };\n};\n\nconst emitGiStore = (\n gi: GiStoreOptions,\n libraries: string[],\n elementProps: Record<string, ElementProp[]>,\n library: Library,\n): void => {\n const namespaces: GiNamespaceInput[] = [];\n for (const namespace of library.namespaces.values()) {\n namespaces.push({\n directory: namespaceDirectory(namespace),\n rawSource: generateNamespaceModule(namespace, library),\n });\n }\n const libs = [...libraries];\n writeGiStore(gi, namespaces, {\n value: computeFingerprint(library.girFiles, libs, elementProps),\n girFiles: library.girFiles,\n libraries: libs,\n });\n};\n\nconst emitJsxStore = (\n jsx: JsxStoreOptions | undefined,\n elementProps: Record<string, ElementProp[]>,\n library: Library,\n): number => {\n if (jsx === undefined) return 0;\n const reactPipeline = generateJsxFiles(library, elementProps);\n writeJsxStore(jsx, reactPipeline.namespaces, reactPipeline.metadata);\n return reactPipeline.intrinsicElementCount;\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SourceModule } from "../compile.js";
|
|
2
|
+
export type CompileStoreParams = {
|
|
3
|
+
storeDir: string;
|
|
4
|
+
files: SourceModule[];
|
|
5
|
+
packageName: string;
|
|
6
|
+
exports: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
export declare const compileStore: (params: CompileStoreParams) => void;
|
|
9
|
+
//# sourceMappingURL=compile-store.d.ts.map
|
|
@@ -0,0 +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,MAAM,MAAM,kBAAkB,GAAG;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AA4BF,eAAO,MAAM,YAAY,WAAY,kBAAkB,KAAG,IAWzD,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { rmSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { compileProject } from "../compile.js";
|
|
4
|
+
const EMIT_OPTIONS = {
|
|
5
|
+
declaration: true,
|
|
6
|
+
removeComments: false,
|
|
7
|
+
sourceMap: false,
|
|
8
|
+
declarationMap: false,
|
|
9
|
+
noEmitOnError: true,
|
|
10
|
+
rootDir: ".",
|
|
11
|
+
outDir: ".",
|
|
12
|
+
};
|
|
13
|
+
const selfPaths = (packageName, exportsMap, storeDir) => {
|
|
14
|
+
const paths = {};
|
|
15
|
+
for (const [key, value] of Object.entries(exportsMap)) {
|
|
16
|
+
if (key === "./package.json" || typeof value !== "object" || value === null)
|
|
17
|
+
continue;
|
|
18
|
+
const target = value.default;
|
|
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;
|
|
25
|
+
};
|
|
26
|
+
export const compileStore = (params) => {
|
|
27
|
+
compileProject({
|
|
28
|
+
projectDir: params.storeDir,
|
|
29
|
+
fileNames: params.files.map((file) => file.fileName),
|
|
30
|
+
compilerOptions: EMIT_OPTIONS,
|
|
31
|
+
paths: selfPaths(params.packageName, params.exports, params.storeDir),
|
|
32
|
+
label: `the generated ${params.packageName} store`,
|
|
33
|
+
});
|
|
34
|
+
for (const file of params.files) {
|
|
35
|
+
rmSync(join(params.storeDir, file.fileName), { force: true });
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=compile-store.js.map
|
|
@@ -0,0 +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;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,cAAc,EAAqB,MAAM,eAAe,CAAC;AASlE,MAAM,YAAY,GAAG;IACjB,WAAW,EAAE,IAAI;IACjB,cAAc,EAAE,KAAK;IACrB,SAAS,EAAE,KAAK;IAChB,cAAc,EAAE,KAAK;IACrB,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,GAAG;IACZ,MAAM,EAAE,GAAG;CACd,CAAC;AAEF,MAAM,SAAS,GAAG,CACd,WAAmB,EACnB,UAAmC,EACnC,QAAgB,EACQ,EAAE;IAC1B,MAAM,KAAK,GAA6B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACpD,IAAI,GAAG,KAAK,gBAAgB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QACtF,MAAM,MAAM,GAAI,KAA+B,CAAC,OAAO,CAAC;QACxD,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,SAAS;QACzC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9D,KAAK,CAAC,GAAG,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA0B,EAAQ,EAAE;IAC7D,cAAc,CAAC;QACX,UAAU,EAAE,MAAM,CAAC,QAAQ;QAC3B,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC;QACpD,eAAe,EAAE,YAAY;QAC7B,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC;QACrE,KAAK,EAAE,iBAAiB,MAAM,CAAC,WAAW,QAAQ;KACrD,CAAC,CAAC;IACH,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,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","sourcesContent":["import { rmSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { compileProject, type SourceModule } from \"../compile.js\";\n\nexport type CompileStoreParams = {\n storeDir: string;\n files: SourceModule[];\n packageName: string;\n exports: Record<string, unknown>;\n};\n\nconst EMIT_OPTIONS = {\n declaration: true,\n removeComments: false,\n sourceMap: false,\n declarationMap: false,\n noEmitOnError: true,\n rootDir: \".\",\n outDir: \".\",\n};\n\nconst selfPaths = (\n packageName: string,\n exportsMap: Record<string, unknown>,\n storeDir: string,\n): Record<string, string[]> => {\n const paths: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(exportsMap)) {\n if (key === \"./package.json\" || typeof value !== \"object\" || value === null) continue;\n const target = (value as { default?: unknown }).default;\n if (typeof target !== \"string\") continue;\n const stem = target.replace(/^\\.\\//, \"\").replace(/\\.js$/, \"\");\n paths[`${packageName}${key.slice(1)}`] = [join(storeDir, stem)];\n }\n return paths;\n};\n\nexport const compileStore = (params: CompileStoreParams): void => {\n compileProject({\n projectDir: params.storeDir,\n fileNames: params.files.map((file) => file.fileName),\n compilerOptions: EMIT_OPTIONS,\n paths: selfPaths(params.packageName, params.exports, params.storeDir),\n label: `the generated ${params.packageName} store`,\n });\n for (const file of params.files) {\n rmSync(join(params.storeDir, file.fileName), { force: true });\n }\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GirFunction } from "../../gir/function.js";
|
|
2
|
+
import type { Library } from "../../gir/library.js";
|
|
3
|
+
export declare const matchAsyncFinish: (library: Library, fn: GirFunction, siblings: GirFunction[]) => GirFunction | undefined;
|
|
4
|
+
//# sourceMappingURL=async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../../src/store/gi/async.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEpD,eAAO,MAAM,gBAAgB,YAChB,OAAO,MACZ,WAAW,YACL,WAAW,EAAE,KACxB,WAAW,GAAG,SAOhB,CAAC"}
|