@ts-for-gir/cli 3.0.0-beta.10
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 +420 -0
- package/lib/commands/doc.d.ts +27 -0
- package/lib/commands/doc.js +48 -0
- package/lib/commands/doc.js.map +1 -0
- package/lib/commands/generate.d.ts +49 -0
- package/lib/commands/generate.js +73 -0
- package/lib/commands/generate.js.map +1 -0
- package/lib/commands/index.d.ts +3 -0
- package/lib/commands/index.js +4 -0
- package/lib/commands/index.js.map +1 -0
- package/lib/commands/list.d.ts +21 -0
- package/lib/commands/list.js +77 -0
- package/lib/commands/list.js.map +1 -0
- package/lib/config.d.ts +88 -0
- package/lib/config.js +471 -0
- package/lib/config.js.map +1 -0
- package/lib/conflict-resolver.d.ts +155 -0
- package/lib/conflict-resolver.js +1103 -0
- package/lib/conflict-resolver.js.map +1 -0
- package/lib/constants.d.ts +18 -0
- package/lib/constants.js +23 -0
- package/lib/constants.js.map +1 -0
- package/lib/dependency-manager.d.ts +34 -0
- package/lib/dependency-manager.js +78 -0
- package/lib/dependency-manager.js.map +1 -0
- package/lib/generation-handler.d.ts +12 -0
- package/lib/generation-handler.js +63 -0
- package/lib/generation-handler.js.map +1 -0
- package/lib/generator.d.ts +5 -0
- package/lib/generator.js +2 -0
- package/lib/generator.js.map +1 -0
- package/lib/gir-factory.d.ts +52 -0
- package/lib/gir-factory.js +376 -0
- package/lib/gir-factory.js.map +1 -0
- package/lib/gir-module.d.ts +259 -0
- package/lib/gir-module.js +2181 -0
- package/lib/gir-module.js.map +1 -0
- package/lib/html-doc-generator.d.ts +13 -0
- package/lib/html-doc-generator.js +18 -0
- package/lib/html-doc-generator.js.map +1 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/injection/callbacks/gjs/Gio-2.0.d.ts +2 -0
- package/lib/injection/callbacks/gjs/Gio-2.0.js +36 -0
- package/lib/injection/callbacks/gjs/Gio-2.0.js.map +1 -0
- package/lib/injection/callbacks/gjs/index.d.ts +2 -0
- package/lib/injection/callbacks/gjs/index.js +3 -0
- package/lib/injection/callbacks/gjs/index.js.map +1 -0
- package/lib/injection/callbacks/index.d.ts +4 -0
- package/lib/injection/callbacks/index.js +4 -0
- package/lib/injection/callbacks/index.js.map +1 -0
- package/lib/injection/callbacks/node-gtk/index.d.ts +2 -0
- package/lib/injection/callbacks/node-gtk/index.js +2 -0
- package/lib/injection/callbacks/node-gtk/index.js.map +1 -0
- package/lib/injection/classes/GLib-2-0.d.ts +2 -0
- package/lib/injection/classes/GLib-2-0.js +35 -0
- package/lib/injection/classes/GLib-2-0.js.map +1 -0
- package/lib/injection/classes/gjs/GLib-2.0.d.ts +2 -0
- package/lib/injection/classes/gjs/GLib-2.0.js +205 -0
- package/lib/injection/classes/gjs/GLib-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/GObject-2.0.d.ts +2 -0
- package/lib/injection/classes/gjs/GObject-2.0.js +634 -0
- package/lib/injection/classes/gjs/GObject-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/Gio-2.0.d.ts +5 -0
- package/lib/injection/classes/gjs/Gio-2.0.js +218 -0
- package/lib/injection/classes/gjs/Gio-2.0.js.map +1 -0
- package/lib/injection/classes/gjs/index.d.ts +2 -0
- package/lib/injection/classes/gjs/index.js +5 -0
- package/lib/injection/classes/gjs/index.js.map +1 -0
- package/lib/injection/classes/index.d.ts +4 -0
- package/lib/injection/classes/index.js +5 -0
- package/lib/injection/classes/index.js.map +1 -0
- package/lib/injection/classes/node-gtk/GLib-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/GLib-2.0.js +19 -0
- package/lib/injection/classes/node-gtk/GLib-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/GObject-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/GObject-2.0.js +66 -0
- package/lib/injection/classes/node-gtk/GObject-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Gdk-4.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Gdk-4.0.js +32 -0
- package/lib/injection/classes/node-gtk/Gdk-4.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Gio-2.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Gio-2.0.js +14 -0
- package/lib/injection/classes/node-gtk/Gio-2.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Graphene-1.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Graphene-1.0.js +133 -0
- package/lib/injection/classes/node-gtk/Graphene-1.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Gtk-3.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Gtk-3.0.js +31 -0
- package/lib/injection/classes/node-gtk/Gtk-3.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Gtk-4.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Gtk-4.0.js +52 -0
- package/lib/injection/classes/node-gtk/Gtk-4.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/Pango-1.0.d.ts +2 -0
- package/lib/injection/classes/node-gtk/Pango-1.0.js +31 -0
- package/lib/injection/classes/node-gtk/Pango-1.0.js.map +1 -0
- package/lib/injection/classes/node-gtk/index.d.ts +2 -0
- package/lib/injection/classes/node-gtk/index.js +19 -0
- package/lib/injection/classes/node-gtk/index.js.map +1 -0
- package/lib/injection/index.d.ts +3 -0
- package/lib/injection/index.js +4 -0
- package/lib/injection/index.js.map +1 -0
- package/lib/injection/injector.d.ts +17 -0
- package/lib/injection/injector.js +139 -0
- package/lib/injection/injector.js.map +1 -0
- package/lib/logger.d.ts +36 -0
- package/lib/logger.js +137 -0
- package/lib/logger.js.map +1 -0
- package/lib/messages.d.ts +31 -0
- package/lib/messages.js +46 -0
- package/lib/messages.js.map +1 -0
- package/lib/module-loader.d.ts +134 -0
- package/lib/module-loader.js +475 -0
- package/lib/module-loader.js.map +1 -0
- package/lib/start.d.ts +2 -0
- package/lib/start.js +15 -0
- package/lib/start.js.map +1 -0
- package/lib/symtable.d.ts +24 -0
- package/lib/symtable.js +63 -0
- package/lib/symtable.js.map +1 -0
- package/lib/template-processor.d.ts +74 -0
- package/lib/template-processor.js +165 -0
- package/lib/template-processor.js.map +1 -0
- package/lib/transformation.d.ts +156 -0
- package/lib/transformation.js +524 -0
- package/lib/transformation.js.map +1 -0
- package/lib/type-definition-generator.d.ts +116 -0
- package/lib/type-definition-generator.js +996 -0
- package/lib/type-definition-generator.js.map +1 -0
- package/lib/types/answer-version.d.ts +4 -0
- package/lib/types/answer-version.js +2 -0
- package/lib/types/answer-version.js.map +1 -0
- package/lib/types/build-type.d.ts +1 -0
- package/lib/types/build-type.js +2 -0
- package/lib/types/build-type.js.map +1 -0
- package/lib/types/class-parent.d.ts +13 -0
- package/lib/types/class-parent.js +2 -0
- package/lib/types/class-parent.js.map +1 -0
- package/lib/types/config-flags.d.ts +4 -0
- package/lib/types/config-flags.js +2 -0
- package/lib/types/config-flags.js.map +1 -0
- package/lib/types/conflict-child-element.d.ts +10 -0
- package/lib/types/conflict-child-element.js +2 -0
- package/lib/types/conflict-child-element.js.map +1 -0
- package/lib/types/conflict-grouped-element.d.ts +6 -0
- package/lib/types/conflict-grouped-element.js +2 -0
- package/lib/types/conflict-grouped-element.js.map +1 -0
- package/lib/types/conflict-grouped-elements.d.ts +4 -0
- package/lib/types/conflict-grouped-elements.js +2 -0
- package/lib/types/conflict-grouped-elements.js.map +1 -0
- package/lib/types/construct-name.d.ts +1 -0
- package/lib/types/construct-name.js +2 -0
- package/lib/types/construct-name.js.map +1 -0
- package/lib/types/dependency-map.d.ts +4 -0
- package/lib/types/dependency-map.js +2 -0
- package/lib/types/dependency-map.js.map +1 -0
- package/lib/types/dependency.d.ts +15 -0
- package/lib/types/dependency.js +2 -0
- package/lib/types/dependency.js.map +1 -0
- package/lib/types/environment.d.ts +1 -0
- package/lib/types/environment.js +2 -0
- package/lib/types/environment.js.map +1 -0
- package/lib/types/file-info.d.ts +14 -0
- package/lib/types/file-info.js +2 -0
- package/lib/types/file-info.js.map +1 -0
- package/lib/types/generate-config.d.ts +34 -0
- package/lib/types/generate-config.js +2 -0
- package/lib/types/generate-config.js.map +1 -0
- package/lib/types/generator-type.d.ts +4 -0
- package/lib/types/generator-type.js +6 -0
- package/lib/types/generator-type.js.map +1 -0
- package/lib/types/gir-alias-element.d.ts +13 -0
- package/lib/types/gir-alias-element.js +2 -0
- package/lib/types/gir-alias-element.js.map +1 -0
- package/lib/types/gir-annotation.d.ts +9 -0
- package/lib/types/gir-annotation.js +2 -0
- package/lib/types/gir-annotation.js.map +1 -0
- package/lib/types/gir-any-element.d.ts +2 -0
- package/lib/types/gir-any-element.js +2 -0
- package/lib/types/gir-any-element.js.map +1 -0
- package/lib/types/gir-any-type.d.ts +5 -0
- package/lib/types/gir-any-type.js +2 -0
- package/lib/types/gir-any-type.js.map +1 -0
- package/lib/types/gir-array-type.d.ts +20 -0
- package/lib/types/gir-array-type.js +3 -0
- package/lib/types/gir-array-type.js.map +1 -0
- package/lib/types/gir-bitfield-element.d.ts +17 -0
- package/lib/types/gir-bitfield-element.js +2 -0
- package/lib/types/gir-bitfield-element.js.map +1 -0
- package/lib/types/gir-boolean.d.ts +1 -0
- package/lib/types/gir-boolean.js +2 -0
- package/lib/types/gir-boolean.js.map +1 -0
- package/lib/types/gir-boxed-element.d.ts +15 -0
- package/lib/types/gir-boxed-element.js +2 -0
- package/lib/types/gir-boxed-element.js.map +1 -0
- package/lib/types/gir-c-include.d.ts +7 -0
- package/lib/types/gir-c-include.js +2 -0
- package/lib/types/gir-c-include.js.map +1 -0
- package/lib/types/gir-callable-attrs.d.ts +15 -0
- package/lib/types/gir-callable-attrs.js +3 -0
- package/lib/types/gir-callable-attrs.js.map +1 -0
- package/lib/types/gir-callable-param-element.d.ts +30 -0
- package/lib/types/gir-callable-param-element.js +2 -0
- package/lib/types/gir-callable-param-element.js.map +1 -0
- package/lib/types/gir-callable-param.d.ts +7 -0
- package/lib/types/gir-callable-param.js +2 -0
- package/lib/types/gir-callable-param.js.map +1 -0
- package/lib/types/gir-callable-return.d.ts +22 -0
- package/lib/types/gir-callable-return.js +2 -0
- package/lib/types/gir-callable-return.js.map +1 -0
- package/lib/types/gir-callback-element.d.ts +15 -0
- package/lib/types/gir-callback-element.js +2 -0
- package/lib/types/gir-callback-element.js.map +1 -0
- package/lib/types/gir-class-element.d.ts +48 -0
- package/lib/types/gir-class-element.js +2 -0
- package/lib/types/gir-class-element.js.map +1 -0
- package/lib/types/gir-constant-element.d.ts +15 -0
- package/lib/types/gir-constant-element.js +2 -0
- package/lib/types/gir-constant-element.js.map +1 -0
- package/lib/types/gir-constructor-element.d.ts +8 -0
- package/lib/types/gir-constructor-element.js +2 -0
- package/lib/types/gir-constructor-element.js.map +1 -0
- package/lib/types/gir-direction.d.ts +5 -0
- package/lib/types/gir-direction.js +7 -0
- package/lib/types/gir-direction.js.map +1 -0
- package/lib/types/gir-doc-element.d.ts +68 -0
- package/lib/types/gir-doc-element.js +2 -0
- package/lib/types/gir-doc-element.js.map +1 -0
- package/lib/types/gir-enum-element.d.ts +19 -0
- package/lib/types/gir-enum-element.js +2 -0
- package/lib/types/gir-enum-element.js.map +1 -0
- package/lib/types/gir-field-element.d.ts +18 -0
- package/lib/types/gir-field-element.js +2 -0
- package/lib/types/gir-field-element.js.map +1 -0
- package/lib/types/gir-function-element.d.ts +8 -0
- package/lib/types/gir-function-element.js +2 -0
- package/lib/types/gir-function-element.js.map +1 -0
- package/lib/types/gir-implements.d.ts +8 -0
- package/lib/types/gir-implements.js +2 -0
- package/lib/types/gir-implements.js.map +1 -0
- package/lib/types/gir-include.d.ts +9 -0
- package/lib/types/gir-include.js +2 -0
- package/lib/types/gir-include.js.map +1 -0
- package/lib/types/gir-info-attrs.d.ts +13 -0
- package/lib/types/gir-info-attrs.js +2 -0
- package/lib/types/gir-info-attrs.js.map +1 -0
- package/lib/types/gir-info-elements.d.ts +5 -0
- package/lib/types/gir-info-elements.js +2 -0
- package/lib/types/gir-info-elements.js.map +1 -0
- package/lib/types/gir-instance-parameter.d.ts +21 -0
- package/lib/types/gir-instance-parameter.js +2 -0
- package/lib/types/gir-instance-parameter.js.map +1 -0
- package/lib/types/gir-interface-element.d.ts +31 -0
- package/lib/types/gir-interface-element.js +2 -0
- package/lib/types/gir-interface-element.js.map +1 -0
- package/lib/types/gir-member-element.d.ts +17 -0
- package/lib/types/gir-member-element.js +2 -0
- package/lib/types/gir-member-element.js.map +1 -0
- package/lib/types/gir-method-element.d.ts +13 -0
- package/lib/types/gir-method-element.js +2 -0
- package/lib/types/gir-method-element.js.map +1 -0
- package/lib/types/gir-module-resolved-by.d.ts +10 -0
- package/lib/types/gir-module-resolved-by.js +2 -0
- package/lib/types/gir-module-resolved-by.js.map +1 -0
- package/lib/types/gir-modules-grouped-map.d.ts +4 -0
- package/lib/types/gir-modules-grouped-map.js +2 -0
- package/lib/types/gir-modules-grouped-map.js.map +1 -0
- package/lib/types/gir-modules-grouped.d.ts +12 -0
- package/lib/types/gir-modules-grouped.js +2 -0
- package/lib/types/gir-modules-grouped.js.map +1 -0
- package/lib/types/gir-namespace.d.ts +30 -0
- package/lib/types/gir-namespace.js +2 -0
- package/lib/types/gir-namespace.js.map +1 -0
- package/lib/types/gir-package.d.ts +7 -0
- package/lib/types/gir-package.js +2 -0
- package/lib/types/gir-package.js.map +1 -0
- package/lib/types/gir-prerequisite.d.ts +5 -0
- package/lib/types/gir-prerequisite.js +2 -0
- package/lib/types/gir-prerequisite.js.map +1 -0
- package/lib/types/gir-property-element.d.ts +21 -0
- package/lib/types/gir-property-element.js +2 -0
- package/lib/types/gir-property-element.js.map +1 -0
- package/lib/types/gir-record-element.d.ts +30 -0
- package/lib/types/gir-record-element.js +2 -0
- package/lib/types/gir-record-element.js.map +1 -0
- package/lib/types/gir-repository.d.ts +16 -0
- package/lib/types/gir-repository.js +2 -0
- package/lib/types/gir-repository.js.map +1 -0
- package/lib/types/gir-signal.d.ts +25 -0
- package/lib/types/gir-signal.js +2 -0
- package/lib/types/gir-signal.js.map +1 -0
- package/lib/types/gir-transfer-ownership-type.d.ts +5 -0
- package/lib/types/gir-transfer-ownership-type.js +7 -0
- package/lib/types/gir-transfer-ownership-type.js.map +1 -0
- package/lib/types/gir-transfer-ownership.d.ts +5 -0
- package/lib/types/gir-transfer-ownership.js +2 -0
- package/lib/types/gir-transfer-ownership.js.map +1 -0
- package/lib/types/gir-type.d.ts +14 -0
- package/lib/types/gir-type.js +2 -0
- package/lib/types/gir-type.js.map +1 -0
- package/lib/types/gir-union-element.d.ts +22 -0
- package/lib/types/gir-union-element.js +2 -0
- package/lib/types/gir-union-element.js.map +1 -0
- package/lib/types/gir-unparsed-number.d.ts +2 -0
- package/lib/types/gir-unparsed-number.js +2 -0
- package/lib/types/gir-unparsed-number.js.map +1 -0
- package/lib/types/gir-var-args.d.ts +5 -0
- package/lib/types/gir-var-args.js +2 -0
- package/lib/types/gir-var-args.js.map +1 -0
- package/lib/types/gir-virtual-method.d.ts +10 -0
- package/lib/types/gir-virtual-method.js +2 -0
- package/lib/types/gir-virtual-method.js.map +1 -0
- package/lib/types/index.d.ts +120 -0
- package/lib/types/index.js +121 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/inheritance-table.d.ts +3 -0
- package/lib/types/inheritance-table.js +2 -0
- package/lib/types/inheritance-table.js.map +1 -0
- package/lib/types/injection-callback.d.ts +16 -0
- package/lib/types/injection-callback.js +2 -0
- package/lib/types/injection-callback.js.map +1 -0
- package/lib/types/injection-class.d.ts +25 -0
- package/lib/types/injection-class.js +2 -0
- package/lib/types/injection-class.js.map +1 -0
- package/lib/types/injection-function.d.ts +7 -0
- package/lib/types/injection-function.js +2 -0
- package/lib/types/injection-function.js.map +1 -0
- package/lib/types/injection-generic-parameter.d.ts +2 -0
- package/lib/types/injection-generic-parameter.js +2 -0
- package/lib/types/injection-generic-parameter.js.map +1 -0
- package/lib/types/injection-instance-parameter.d.ts +2 -0
- package/lib/types/injection-instance-parameter.js +2 -0
- package/lib/types/injection-instance-parameter.js.map +1 -0
- package/lib/types/injection-parameter.d.ts +8 -0
- package/lib/types/injection-parameter.js +2 -0
- package/lib/types/injection-parameter.js.map +1 -0
- package/lib/types/injection-property.d.ts +4 -0
- package/lib/types/injection-property.js +2 -0
- package/lib/types/injection-property.js.map +1 -0
- package/lib/types/injection-type.d.ts +2 -0
- package/lib/types/injection-type.js +2 -0
- package/lib/types/injection-type.js.map +1 -0
- package/lib/types/injection.d.ts +5 -0
- package/lib/types/injection.js +2 -0
- package/lib/types/injection.js.map +1 -0
- package/lib/types/local-name-check.d.ts +4 -0
- package/lib/types/local-name-check.js +2 -0
- package/lib/types/local-name-check.js.map +1 -0
- package/lib/types/local-name-type.d.ts +1 -0
- package/lib/types/local-name-type.js +2 -0
- package/lib/types/local-name-type.js.map +1 -0
- package/lib/types/local-name.d.ts +7 -0
- package/lib/types/local-name.js +2 -0
- package/lib/types/local-name.js.map +1 -0
- package/lib/types/local-names.d.ts +4 -0
- package/lib/types/local-names.js +2 -0
- package/lib/types/local-names.js.map +1 -0
- package/lib/types/module-type.d.ts +1 -0
- package/lib/types/module-type.js +2 -0
- package/lib/types/module-type.js.map +1 -0
- package/lib/types/parsed-gir.d.ts +4 -0
- package/lib/types/parsed-gir.js +2 -0
- package/lib/types/parsed-gir.js.map +1 -0
- package/lib/types/part-of-class.d.ts +7 -0
- package/lib/types/part-of-class.js +2 -0
- package/lib/types/part-of-class.js.map +1 -0
- package/lib/types/part-of-module.d.ts +6 -0
- package/lib/types/part-of-module.js +2 -0
- package/lib/types/part-of-module.js.map +1 -0
- package/lib/types/promisify-func.d.ts +7 -0
- package/lib/types/promisify-func.js +2 -0
- package/lib/types/promisify-func.js.map +1 -0
- package/lib/types/resolve-type.d.ts +4 -0
- package/lib/types/resolve-type.js +6 -0
- package/lib/types/resolve-type.js.map +1 -0
- package/lib/types/sym-table-items.d.ts +4 -0
- package/lib/types/sym-table-items.js +2 -0
- package/lib/types/sym-table-items.js.map +1 -0
- package/lib/types/transformation-case.d.ts +1 -0
- package/lib/types/transformation-case.js +2 -0
- package/lib/types/transformation-case.js.map +1 -0
- package/lib/types/transformations.d.ts +11 -0
- package/lib/types/transformations.js +2 -0
- package/lib/types/transformations.js.map +1 -0
- package/lib/types/ts-alias.d.ts +10 -0
- package/lib/types/ts-alias.js +2 -0
- package/lib/types/ts-alias.js.map +1 -0
- package/lib/types/ts-callback-interface.d.ts +10 -0
- package/lib/types/ts-callback-interface.js +2 -0
- package/lib/types/ts-callback-interface.js.map +1 -0
- package/lib/types/ts-callback.d.ts +17 -0
- package/lib/types/ts-callback.js +2 -0
- package/lib/types/ts-callback.js.map +1 -0
- package/lib/types/ts-class.d.ts +85 -0
- package/lib/types/ts-class.js +2 -0
- package/lib/types/ts-class.js.map +1 -0
- package/lib/types/ts-doc-tag.d.ts +21 -0
- package/lib/types/ts-doc-tag.js +2 -0
- package/lib/types/ts-doc-tag.js.map +1 -0
- package/lib/types/ts-doc.d.ts +16 -0
- package/lib/types/ts-doc.js +2 -0
- package/lib/types/ts-doc.js.map +1 -0
- package/lib/types/ts-enum.d.ts +12 -0
- package/lib/types/ts-enum.js +2 -0
- package/lib/types/ts-enum.js.map +1 -0
- package/lib/types/ts-function.d.ts +55 -0
- package/lib/types/ts-function.js +2 -0
- package/lib/types/ts-function.js.map +1 -0
- package/lib/types/ts-generic-parameter.d.ts +8 -0
- package/lib/types/ts-generic-parameter.js +2 -0
- package/lib/types/ts-generic-parameter.js.map +1 -0
- package/lib/types/ts-instance-parameter.d.ts +4 -0
- package/lib/types/ts-instance-parameter.js +2 -0
- package/lib/types/ts-instance-parameter.js.map +1 -0
- package/lib/types/ts-member.d.ts +10 -0
- package/lib/types/ts-member.js +2 -0
- package/lib/types/ts-member.js.map +1 -0
- package/lib/types/ts-method.d.ts +5 -0
- package/lib/types/ts-method.js +2 -0
- package/lib/types/ts-method.js.map +1 -0
- package/lib/types/ts-parameter.d.ts +15 -0
- package/lib/types/ts-parameter.js +2 -0
- package/lib/types/ts-parameter.js.map +1 -0
- package/lib/types/ts-property.d.ts +17 -0
- package/lib/types/ts-property.js +2 -0
- package/lib/types/ts-property.js.map +1 -0
- package/lib/types/ts-signal.d.ts +17 -0
- package/lib/types/ts-signal.js +2 -0
- package/lib/types/ts-signal.js.map +1 -0
- package/lib/types/ts-type-name.d.ts +1 -0
- package/lib/types/ts-type-name.js +2 -0
- package/lib/types/ts-type-name.js.map +1 -0
- package/lib/types/ts-type-separator.d.ts +1 -0
- package/lib/types/ts-type-separator.js +2 -0
- package/lib/types/ts-type-separator.js.map +1 -0
- package/lib/types/ts-type.d.ts +26 -0
- package/lib/types/ts-type.js +2 -0
- package/lib/types/ts-type.js.map +1 -0
- package/lib/types/ts-var.d.ts +17 -0
- package/lib/types/ts-var.js +2 -0
- package/lib/types/ts-var.js.map +1 -0
- package/lib/types/type-gir-alias.d.ts +2 -0
- package/lib/types/type-gir-alias.js +2 -0
- package/lib/types/type-gir-alias.js.map +1 -0
- package/lib/types/type-gir-class.d.ts +2 -0
- package/lib/types/type-gir-class.js +2 -0
- package/lib/types/type-gir-class.js.map +1 -0
- package/lib/types/type-gir-element.d.ts +3 -0
- package/lib/types/type-gir-element.js +2 -0
- package/lib/types/type-gir-element.js.map +1 -0
- package/lib/types/type-gir-enumeration-member.d.ts +2 -0
- package/lib/types/type-gir-enumeration-member.js +2 -0
- package/lib/types/type-gir-enumeration-member.js.map +1 -0
- package/lib/types/type-gir-enumeration.d.ts +2 -0
- package/lib/types/type-gir-enumeration.js +2 -0
- package/lib/types/type-gir-enumeration.js.map +1 -0
- package/lib/types/type-gir-function.d.ts +1 -0
- package/lib/types/type-gir-function.js +2 -0
- package/lib/types/type-gir-function.js.map +1 -0
- package/lib/types/type-gir-interface.d.ts +2 -0
- package/lib/types/type-gir-interface.js +2 -0
- package/lib/types/type-gir-interface.js.map +1 -0
- package/lib/types/type-gir-method.d.ts +2 -0
- package/lib/types/type-gir-method.js +2 -0
- package/lib/types/type-gir-method.js.map +1 -0
- package/lib/types/type-gir-parameter.d.ts +1 -0
- package/lib/types/type-gir-parameter.js +2 -0
- package/lib/types/type-gir-parameter.js.map +1 -0
- package/lib/types/type-gir-property.d.ts +2 -0
- package/lib/types/type-gir-property.js +2 -0
- package/lib/types/type-gir-property.js.map +1 -0
- package/lib/types/type-gir-variable.d.ts +1 -0
- package/lib/types/type-gir-variable.js +2 -0
- package/lib/types/type-gir-variable.js.map +1 -0
- package/lib/types/type-ts-element.d.ts +3 -0
- package/lib/types/type-ts-element.js +2 -0
- package/lib/types/type-ts-element.js.map +1 -0
- package/lib/types/type-ts-enumeration-member.d.ts +2 -0
- package/lib/types/type-ts-enumeration-member.js +2 -0
- package/lib/types/type-ts-enumeration-member.js.map +1 -0
- package/lib/types/type-ts-function.d.ts +1 -0
- package/lib/types/type-ts-function.js +2 -0
- package/lib/types/type-ts-function.js.map +1 -0
- package/lib/types/type-ts-property.d.ts +1 -0
- package/lib/types/type-ts-property.js +2 -0
- package/lib/types/type-ts-property.js.map +1 -0
- package/lib/types/user-config-load-result.d.ts +6 -0
- package/lib/types/user-config-load-result.js +2 -0
- package/lib/types/user-config-load-result.js.map +1 -0
- package/lib/types/user-config.d.ts +42 -0
- package/lib/types/user-config.js +2 -0
- package/lib/types/user-config.js.map +1 -0
- package/lib/utils.d.ts +292 -0
- package/lib/utils.js +403 -0
- package/lib/utils.js.map +1 -0
- package/package.json +89 -0
- package/src/commands/doc.ts +65 -0
- package/src/commands/generate.ts +88 -0
- package/src/commands/index.ts +3 -0
- package/src/commands/list.ts +96 -0
- package/src/config.ts +528 -0
- package/src/conflict-resolver.ts +1358 -0
- package/src/constants.ts +29 -0
- package/src/dependency-manager.ts +91 -0
- package/src/generation-handler.ts +79 -0
- package/src/generator.ts +10 -0
- package/src/gir-factory.ts +526 -0
- package/src/gir-module.ts +2953 -0
- package/src/html-doc-generator.ts +23 -0
- package/src/index.ts +17 -0
- package/src/injection/callbacks/gjs/Gio-2.0.ts +37 -0
- package/src/injection/callbacks/gjs/index.ts +5 -0
- package/src/injection/callbacks/index.ts +6 -0
- package/src/injection/callbacks/node-gtk/index.ts +3 -0
- package/src/injection/classes/GLib-2-0.ts +36 -0
- package/src/injection/classes/gjs/GLib-2.0.ts +206 -0
- package/src/injection/classes/gjs/GObject-2.0.ts +635 -0
- package/src/injection/classes/gjs/Gio-2.0.ts +219 -0
- package/src/injection/classes/gjs/index.ts +7 -0
- package/src/injection/classes/index.ts +7 -0
- package/src/injection/classes/node-gtk/GLib-2.0.ts +20 -0
- package/src/injection/classes/node-gtk/GObject-2.0.ts +67 -0
- package/src/injection/classes/node-gtk/Gdk-4.0.ts +33 -0
- package/src/injection/classes/node-gtk/Gio-2.0.ts +15 -0
- package/src/injection/classes/node-gtk/Graphene-1.0.ts +134 -0
- package/src/injection/classes/node-gtk/Gtk-3.0.ts +32 -0
- package/src/injection/classes/node-gtk/Gtk-4.0.ts +53 -0
- package/src/injection/classes/node-gtk/Pango-1.0.ts +32 -0
- package/src/injection/classes/node-gtk/index.ts +21 -0
- package/src/injection/index.ts +3 -0
- package/src/injection/injector.ts +184 -0
- package/src/logger.ts +134 -0
- package/src/messages.ts +69 -0
- package/src/module-loader.ts +576 -0
- package/src/start.ts +16 -0
- package/src/symtable.ts +72 -0
- package/src/template-processor.ts +199 -0
- package/src/transformation.ts +584 -0
- package/src/type-definition-generator.ts +1467 -0
- package/src/types/answer-version.ts +4 -0
- package/src/types/build-type.ts +1 -0
- package/src/types/class-parent.ts +14 -0
- package/src/types/config-flags.ts +5 -0
- package/src/types/conflict-child-element.ts +11 -0
- package/src/types/conflict-grouped-element.ts +7 -0
- package/src/types/conflict-grouped-elements.ts +5 -0
- package/src/types/construct-name.ts +11 -0
- package/src/types/dependency-map.ts +4 -0
- package/src/types/dependency.ts +16 -0
- package/src/types/environment.ts +1 -0
- package/src/types/file-info.ts +14 -0
- package/src/types/generate-config.ts +35 -0
- package/src/types/generator-type.ts +4 -0
- package/src/types/gir-alias-element.ts +15 -0
- package/src/types/gir-annotation.ts +10 -0
- package/src/types/gir-any-element.ts +35 -0
- package/src/types/gir-any-type.ts +7 -0
- package/src/types/gir-array-type.ts +23 -0
- package/src/types/gir-bitfield-element.ts +20 -0
- package/src/types/gir-boolean.ts +1 -0
- package/src/types/gir-boxed-element.ts +19 -0
- package/src/types/gir-c-include.ts +7 -0
- package/src/types/gir-callable-attrs.ts +19 -0
- package/src/types/gir-callable-param-element.ts +45 -0
- package/src/types/gir-callable-param.ts +9 -0
- package/src/types/gir-callable-return.ts +25 -0
- package/src/types/gir-callback-element.ts +28 -0
- package/src/types/gir-class-element.ts +71 -0
- package/src/types/gir-constant-element.ts +17 -0
- package/src/types/gir-constructor-element.ts +18 -0
- package/src/types/gir-direction.ts +5 -0
- package/src/types/gir-doc-element.ts +73 -0
- package/src/types/gir-enum-element.ts +28 -0
- package/src/types/gir-field-element.ts +31 -0
- package/src/types/gir-function-element.ts +19 -0
- package/src/types/gir-implements.ts +9 -0
- package/src/types/gir-include.ts +9 -0
- package/src/types/gir-info-attrs.ts +16 -0
- package/src/types/gir-info-elements.ts +8 -0
- package/src/types/gir-instance-parameter.ts +25 -0
- package/src/types/gir-interface-element.ts +53 -0
- package/src/types/gir-member-element.ts +19 -0
- package/src/types/gir-method-element.ts +25 -0
- package/src/types/gir-module-resolved-by.ts +11 -0
- package/src/types/gir-modules-grouped-map.ts +5 -0
- package/src/types/gir-modules-grouped.ts +13 -0
- package/src/types/gir-namespace.ts +47 -0
- package/src/types/gir-package.ts +7 -0
- package/src/types/gir-prerequisite.ts +5 -0
- package/src/types/gir-property-element.ts +31 -0
- package/src/types/gir-record-element.ts +47 -0
- package/src/types/gir-repository.ts +20 -0
- package/src/types/gir-signal.ts +43 -0
- package/src/types/gir-transfer-ownership-type.ts +5 -0
- package/src/types/gir-transfer-ownership.ts +6 -0
- package/src/types/gir-type.ts +16 -0
- package/src/types/gir-union-element.ts +35 -0
- package/src/types/gir-unparsed-number.ts +2 -0
- package/src/types/gir-var-args.ts +6 -0
- package/src/types/gir-virtual-method.ts +22 -0
- package/src/types/index.ts +120 -0
- package/src/types/inheritance-table.ts +3 -0
- package/src/types/injection-callback.ts +20 -0
- package/src/types/injection-class.ts +30 -0
- package/src/types/injection-function.ts +31 -0
- package/src/types/injection-generic-parameter.ts +3 -0
- package/src/types/injection-instance-parameter.ts +3 -0
- package/src/types/injection-parameter.ts +9 -0
- package/src/types/injection-property.ts +7 -0
- package/src/types/injection-type.ts +3 -0
- package/src/types/injection.ts +6 -0
- package/src/types/local-name-check.ts +5 -0
- package/src/types/local-name-type.ts +1 -0
- package/src/types/local-name.ts +8 -0
- package/src/types/local-names.ts +5 -0
- package/src/types/module-type.ts +1 -0
- package/src/types/parsed-gir.ts +5 -0
- package/src/types/part-of-class.ts +9 -0
- package/src/types/part-of-module.ts +8 -0
- package/src/types/promisify-func.ts +9 -0
- package/src/types/resolve-type.ts +4 -0
- package/src/types/sym-table-items.ts +5 -0
- package/src/types/transformation-case.ts +7 -0
- package/src/types/transformations.ts +12 -0
- package/src/types/ts-alias.ts +11 -0
- package/src/types/ts-callback-interface.ts +11 -0
- package/src/types/ts-callback.ts +21 -0
- package/src/types/ts-class.ts +109 -0
- package/src/types/ts-doc-tag.ts +23 -0
- package/src/types/ts-doc.ts +18 -0
- package/src/types/ts-enum.ts +15 -0
- package/src/types/ts-function.ts +70 -0
- package/src/types/ts-generic-parameter.ts +8 -0
- package/src/types/ts-instance-parameter.ts +4 -0
- package/src/types/ts-member.ts +11 -0
- package/src/types/ts-method.ts +6 -0
- package/src/types/ts-parameter.ts +20 -0
- package/src/types/ts-property.ts +22 -0
- package/src/types/ts-signal.ts +21 -0
- package/src/types/ts-type-name.ts +1 -0
- package/src/types/ts-type-separator.ts +1 -0
- package/src/types/ts-type.ts +28 -0
- package/src/types/ts-var.ts +21 -0
- package/src/types/type-gir-alias.ts +2 -0
- package/src/types/type-gir-class.ts +2 -0
- package/src/types/type-gir-element.ts +25 -0
- package/src/types/type-gir-enumeration-member.ts +2 -0
- package/src/types/type-gir-enumeration.ts +2 -0
- package/src/types/type-gir-function.ts +8 -0
- package/src/types/type-gir-interface.ts +2 -0
- package/src/types/type-gir-method.ts +2 -0
- package/src/types/type-gir-parameter.ts +1 -0
- package/src/types/type-gir-property.ts +2 -0
- package/src/types/type-gir-variable.ts +1 -0
- package/src/types/type-ts-element.ts +13 -0
- package/src/types/type-ts-enumeration-member.ts +2 -0
- package/src/types/type-ts-function.ts +1 -0
- package/src/types/type-ts-property.ts +1 -0
- package/src/types/user-config-load-result.ts +6 -0
- package/src/types/user-config.ts +43 -0
- package/src/utils.ts +433 -0
- package/templates/Cogl-2.0.d.ts +0 -0
- package/templates/Gjs/GObject-2.0.d.ts +238 -0
- package/templates/Gjs/Gio-2.0.d.ts +101 -0
- package/templates/Gjs/Gjs.d.ts +204 -0
- package/templates/Gjs/Gjs.js +21 -0
- package/templates/Gjs/GnomeShell.d.ts +154 -0
- package/templates/Gjs/GnomeShell.js +10 -0
- package/templates/Gjs/index.d.ts +594 -0
- package/templates/Gjs/index.js +4 -0
- package/templates/Gjs/misc/dbusUtils.d.ts +15 -0
- package/templates/Gjs/misc/dbusUtils.js +6 -0
- package/templates/Gjs/misc/extensionUtils.d.ts +99 -0
- package/templates/Gjs/misc/extensionUtils.js +6 -0
- package/templates/Gjs/misc/fileUtils.d.ts +51 -0
- package/templates/Gjs/misc/fileUtils.js +6 -0
- package/templates/Gjs/misc/gnomeSession.d.ts +74 -0
- package/templates/Gjs/misc/gnomeSession.js +6 -0
- package/templates/Gjs/misc/parentalControlsManager.d.ts +42 -0
- package/templates/Gjs/misc/parentalControlsManager.js +6 -0
- package/templates/Gjs/misc/signals.d.ts +15 -0
- package/templates/Gjs/misc/signals.js +6 -0
- package/templates/Gjs/module.d.ts +6 -0
- package/templates/Gjs/module.js +16 -0
- package/templates/Gjs/tsconfig.alias.json +10 -0
- package/templates/Gjs/ui/accessDialog.d.ts +19 -0
- package/templates/Gjs/ui/accessDialog.js +6 -0
- package/templates/Gjs/ui/altTab.d.ts +124 -0
- package/templates/Gjs/ui/altTab.js +6 -0
- package/templates/Gjs/ui/animation.d.ts +58 -0
- package/templates/Gjs/ui/animation.js +6 -0
- package/templates/Gjs/ui/appDisplay.d.ts +204 -0
- package/templates/Gjs/ui/appDisplay.js +6 -0
- package/templates/Gjs/ui/appFavorites.d.ts +34 -0
- package/templates/Gjs/ui/appFavorites.js +6 -0
- package/templates/Gjs/ui/appMenu.d.ts +74 -0
- package/templates/Gjs/ui/appMenu.js +6 -0
- package/templates/Gjs/ui/audioDeviceSelection.d.ts +51 -0
- package/templates/Gjs/ui/audioDeviceSelection.js +6 -0
- package/templates/Gjs/ui/background.d.ts +255 -0
- package/templates/Gjs/ui/background.js +5 -0
- package/templates/Gjs/ui/backgroundMenu.d.ts +19 -0
- package/templates/Gjs/ui/backgroundMenu.js +5 -0
- package/templates/Gjs/ui/barLevel.d.ts +42 -0
- package/templates/Gjs/ui/barLevel.js +5 -0
- package/templates/Gjs/ui/boxpointer.d.ts +103 -0
- package/templates/Gjs/ui/boxpointer.js +5 -0
- package/templates/Gjs/ui/calendar.d.ts +261 -0
- package/templates/Gjs/ui/calendar.js +5 -0
- package/templates/Gjs/ui/checkBox.d.ts +22 -0
- package/templates/Gjs/ui/checkBox.js +5 -0
- package/templates/Gjs/ui/closeDialog.d.ts +40 -0
- package/templates/Gjs/ui/closeDialog.js +5 -0
- package/templates/Gjs/ui/components/__init__.d.ts +9 -0
- package/templates/Gjs/ui/components/__init__.js +6 -0
- package/templates/Gjs/ui/components/automountManager.d.ts +8 -0
- package/templates/Gjs/ui/components/automountManager.js +6 -0
- package/templates/Gjs/ui/components/autorunManager.d.ts +8 -0
- package/templates/Gjs/ui/components/autorunManager.js +6 -0
- package/templates/Gjs/ui/components/index.d.ts +6 -0
- package/templates/Gjs/ui/components/index.js +6 -0
- package/templates/Gjs/ui/components/keyring.d.ts +19 -0
- package/templates/Gjs/ui/components/keyring.js +6 -0
- package/templates/Gjs/ui/components/networkAgent.d.ts +10 -0
- package/templates/Gjs/ui/components/networkAgent.js +6 -0
- package/templates/Gjs/ui/components/polkitAgent.d.ts +19 -0
- package/templates/Gjs/ui/components/polkitAgent.js +6 -0
- package/templates/Gjs/ui/components/telepathyClient.d.ts +10 -0
- package/templates/Gjs/ui/components/telepathyClient.js +6 -0
- package/templates/Gjs/ui/dialog.d.ts +78 -0
- package/templates/Gjs/ui/dialog.js +6 -0
- package/templates/Gjs/ui/dnd.d.ts +127 -0
- package/templates/Gjs/ui/dnd.js +6 -0
- package/templates/Gjs/ui/iconGrid.d.ts +172 -0
- package/templates/Gjs/ui/iconGrid.js +6 -0
- package/templates/Gjs/ui/layout.d.ts +311 -0
- package/templates/Gjs/ui/layout.js +6 -0
- package/templates/Gjs/ui/main.d.ts +215 -0
- package/templates/Gjs/ui/main.js +6 -0
- package/templates/Gjs/ui/messageList.d.ts +113 -0
- package/templates/Gjs/ui/messageList.js +6 -0
- package/templates/Gjs/ui/messageTray.d.ts +423 -0
- package/templates/Gjs/ui/messageTray.js +6 -0
- package/templates/Gjs/ui/modalDialog.d.ts +96 -0
- package/templates/Gjs/ui/modalDialog.js +6 -0
- package/templates/Gjs/ui/mpris.d.ts +78 -0
- package/templates/Gjs/ui/mpris.js +6 -0
- package/templates/Gjs/ui/notificationDaemon.d.ts +5 -0
- package/templates/Gjs/ui/notificationDaemon.js +6 -0
- package/templates/Gjs/ui/panel.d.ts +65 -0
- package/templates/Gjs/ui/panel.js +6 -0
- package/templates/Gjs/ui/panelMenu.d.ts +51 -0
- package/templates/Gjs/ui/panelMenu.js +6 -0
- package/templates/Gjs/ui/popupMenu.d.ts +228 -0
- package/templates/Gjs/ui/popupMenu.js +6 -0
- package/templates/Gjs/ui/ripples.d.ts +44 -0
- package/templates/Gjs/ui/ripples.js +6 -0
- package/templates/Gjs/ui/search.d.ts +158 -0
- package/templates/Gjs/ui/search.js +6 -0
- package/templates/Gjs/ui/switcherPopup.d.ts +107 -0
- package/templates/Gjs/ui/switcherPopup.js +6 -0
- package/templates/Gjs/ui/userWidget.d.ts +13 -0
- package/templates/Gjs/ui/userWidget.js +6 -0
- package/templates/Granite-1.0.d.ts +7 -0
- package/templates/Granite-7.0.d.ts +7 -0
- package/templates/GstBase-0.10.d.ts +5 -0
- package/templates/RygelServer-2.6.d.ts +3 -0
- package/templates/node-gtk/GObject-2.0.d.ts +57 -0
- package/templates/node-gtk/index.d.ts +40 -0
- package/templates/node-gtk/index.js +9 -0
- package/templates/node-gtk/module.d.ts +6 -0
- package/templates/node-gtk/module.js +17 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
GirFunctionElement,
|
|
3
|
+
GirDocElement,
|
|
4
|
+
GirVirtualMethodElement,
|
|
5
|
+
GirCallableParamElement,
|
|
6
|
+
GirConstructorElement,
|
|
7
|
+
GirMethodElement,
|
|
8
|
+
GirInstanceParameter,
|
|
9
|
+
GirPropertyElement,
|
|
10
|
+
GirAnnotation,
|
|
11
|
+
TsFunction,
|
|
12
|
+
TsMethod,
|
|
13
|
+
TsParameter,
|
|
14
|
+
TsGenericParameter,
|
|
15
|
+
TsProperty,
|
|
16
|
+
TsType,
|
|
17
|
+
TsDoc,
|
|
18
|
+
InjectionFunction,
|
|
19
|
+
InjectionInstanceParameter,
|
|
20
|
+
InjectionGenericParameter,
|
|
21
|
+
InjectionType,
|
|
22
|
+
InjectionParameter,
|
|
23
|
+
InjectionProperty,
|
|
24
|
+
Environment,
|
|
25
|
+
TypeGirProperty,
|
|
26
|
+
TypeGirElement,
|
|
27
|
+
TypeGirFunction,
|
|
28
|
+
TypeGirEnumerationMember,
|
|
29
|
+
TypeTsElement,
|
|
30
|
+
TypeTsEnumerationMember,
|
|
31
|
+
TypeTsFunction,
|
|
32
|
+
TypeTsProperty,
|
|
33
|
+
TsClass,
|
|
34
|
+
TsInstanceParameter,
|
|
35
|
+
} from './types/index.js'
|
|
36
|
+
|
|
37
|
+
import { GENERIC_NAMES } from './constants.js'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates new gir and ts objects
|
|
41
|
+
*/
|
|
42
|
+
export class GirFactory {
|
|
43
|
+
newGenerics(generics: InjectionGenericParameter[]) {
|
|
44
|
+
const tsGenerics: TsGenericParameter[] = []
|
|
45
|
+
for (let i = 0; i < generics.length; i++) {
|
|
46
|
+
const generic = generics[i]
|
|
47
|
+
const tsGeneric: TsGenericParameter = {
|
|
48
|
+
name: generic.name || GENERIC_NAMES[i],
|
|
49
|
+
...generic,
|
|
50
|
+
}
|
|
51
|
+
tsGenerics.push(tsGeneric)
|
|
52
|
+
}
|
|
53
|
+
return tsGenerics
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
girTypeNameToTsTypeName(girTypeName: 'alias', isStatic: boolean): 'type'
|
|
57
|
+
girTypeNameToTsTypeName(girTypeName: 'enum' | 'bitfield', isStatic: boolean): 'enum'
|
|
58
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirEnumerationMember, isStatic: boolean): TypeTsEnumerationMember
|
|
59
|
+
girTypeNameToTsTypeName(girTypeName: 'callback', isStatic: boolean): 'interface'
|
|
60
|
+
girTypeNameToTsTypeName(girTypeName: 'class' | 'interface' | 'union' | 'record', isStatic: boolean): 'class'
|
|
61
|
+
girTypeNameToTsTypeName(girTypeName: 'constant', isStatic: boolean): 'constant'
|
|
62
|
+
girTypeNameToTsTypeName(girTypeName: 'constructor', isStatic: boolean): 'constructor' | 'static-function'
|
|
63
|
+
girTypeNameToTsTypeName(girTypeName: 'method' | 'virtual', isStatic: boolean): 'method'
|
|
64
|
+
girTypeNameToTsTypeName(girTypeName: 'signal' | 'method', isStatic: boolean): 'event-methods'
|
|
65
|
+
girTypeNameToTsTypeName(girTypeName: 'static-function', isStatic: true): 'static-function'
|
|
66
|
+
girTypeNameToTsTypeName(girTypeName: 'function', isStatic: true): 'static-function'
|
|
67
|
+
girTypeNameToTsTypeName(girTypeName: 'function', isStatic: false): 'function'
|
|
68
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirProperty, isStatic: boolean): TypeTsProperty
|
|
69
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirProperty, isStatic: false): 'property' | 'constructor-property'
|
|
70
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirProperty, isStatic: true): 'static-property'
|
|
71
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirFunction, isStatic: boolean): TypeTsFunction
|
|
72
|
+
girTypeNameToTsTypeName(girTypeName: TypeGirElement, isStatic: boolean): TypeTsElement {
|
|
73
|
+
switch (girTypeName) {
|
|
74
|
+
case 'alias':
|
|
75
|
+
return 'type'
|
|
76
|
+
case 'enum':
|
|
77
|
+
case 'bitfield':
|
|
78
|
+
return 'enum'
|
|
79
|
+
case 'enum-member':
|
|
80
|
+
case 'bitfield-member':
|
|
81
|
+
return 'enum-member'
|
|
82
|
+
case 'callback':
|
|
83
|
+
return 'interface'
|
|
84
|
+
case 'class':
|
|
85
|
+
case 'interface':
|
|
86
|
+
case 'union':
|
|
87
|
+
case 'record':
|
|
88
|
+
return 'class'
|
|
89
|
+
case 'constant':
|
|
90
|
+
return 'constant'
|
|
91
|
+
case 'constructor':
|
|
92
|
+
return 'constructor'
|
|
93
|
+
case 'method':
|
|
94
|
+
case 'virtual':
|
|
95
|
+
return 'method'
|
|
96
|
+
case 'signal':
|
|
97
|
+
return 'event-methods'
|
|
98
|
+
case 'static-function':
|
|
99
|
+
return 'static-function'
|
|
100
|
+
case 'function':
|
|
101
|
+
if (typeof isStatic === 'undefined') {
|
|
102
|
+
throw new Error(
|
|
103
|
+
'You must specify if the function is static or not if you want to convert the type of a function!',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
if (isStatic) {
|
|
107
|
+
return 'static-function'
|
|
108
|
+
}
|
|
109
|
+
return 'function'
|
|
110
|
+
case 'field':
|
|
111
|
+
case 'property':
|
|
112
|
+
if (typeof isStatic === 'undefined') {
|
|
113
|
+
throw new Error(
|
|
114
|
+
'You must specify if the property is static or not if you want to convert the type of a function!',
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
if (isStatic) {
|
|
118
|
+
return 'static-property'
|
|
119
|
+
}
|
|
120
|
+
return 'property'
|
|
121
|
+
}
|
|
122
|
+
throw new Error(`Unknown gir type: "${String(girTypeName)}"!`)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
newGirFunctions(
|
|
126
|
+
injectFunctions: InjectionFunction[],
|
|
127
|
+
parent: TsClass | null,
|
|
128
|
+
overrideToAll: Partial<InjectionFunction> = {},
|
|
129
|
+
) {
|
|
130
|
+
const girFunctionElements: Array<
|
|
131
|
+
GirConstructorElement & GirFunctionElement & GirMethodElement & GirVirtualMethodElement
|
|
132
|
+
> = []
|
|
133
|
+
for (let injectFunction of injectFunctions) {
|
|
134
|
+
injectFunction = { ...injectFunction, ...overrideToAll }
|
|
135
|
+
girFunctionElements.push(this.newGirFunction(injectFunction, parent))
|
|
136
|
+
}
|
|
137
|
+
return girFunctionElements
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
newGirFunction(
|
|
141
|
+
tsData: InjectionFunction,
|
|
142
|
+
parent: TsClass | null,
|
|
143
|
+
): GirConstructorElement & GirFunctionElement & GirMethodElement & GirVirtualMethodElement {
|
|
144
|
+
const _tsData = this.newTsFunction(tsData, parent)
|
|
145
|
+
return {
|
|
146
|
+
$: this.newGirAttr(_tsData.name),
|
|
147
|
+
...this.newGirDocElement(),
|
|
148
|
+
_tsData,
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
newGirCallableParamElement(
|
|
153
|
+
tsData: InjectionParameter | GirCallableParamElement,
|
|
154
|
+
parent: TsFunction,
|
|
155
|
+
): GirCallableParamElement {
|
|
156
|
+
return {
|
|
157
|
+
$: this.newGirAttr(),
|
|
158
|
+
...this.newGirDocElement(),
|
|
159
|
+
_tsData: this.newTsParameter(tsData, parent),
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
newGirCallableParamElements(
|
|
164
|
+
injectionParams: Array<InjectionParameter | GirCallableParamElement> = [],
|
|
165
|
+
parent: TsFunction,
|
|
166
|
+
): GirCallableParamElement[] {
|
|
167
|
+
const result: GirCallableParamElement[] = []
|
|
168
|
+
for (const injectionParam of injectionParams) {
|
|
169
|
+
result.push(this.newGirCallableParamElement(injectionParam, parent))
|
|
170
|
+
}
|
|
171
|
+
return result
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
newGirInstanceParameter(
|
|
175
|
+
data: InjectionInstanceParameter | GirInstanceParameter | TsInstanceParameter,
|
|
176
|
+
): GirInstanceParameter {
|
|
177
|
+
const tsData = (data as GirInstanceParameter)._tsData
|
|
178
|
+
? (data as GirInstanceParameter)._tsData
|
|
179
|
+
: (data as InjectionInstanceParameter | TsInstanceParameter)
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
$: this.newGirAttr(),
|
|
183
|
+
...this.newGirDocElement(),
|
|
184
|
+
_tsData: tsData,
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
newGirInstanceParameters(
|
|
189
|
+
injectionInstanceParams: Array<InjectionInstanceParameter | GirInstanceParameter> = [],
|
|
190
|
+
): GirInstanceParameter[] {
|
|
191
|
+
const result: GirInstanceParameter[] = []
|
|
192
|
+
for (const injectionInstanceParam of injectionInstanceParams) {
|
|
193
|
+
result.push(this.newGirInstanceParameter(injectionInstanceParam))
|
|
194
|
+
}
|
|
195
|
+
return result
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
newGirProperty(tsData: InjectionProperty): GirPropertyElement {
|
|
199
|
+
const _tsData = this.newTsProperty(tsData)
|
|
200
|
+
if (!_tsData.name) throw new Error('The name property is required!')
|
|
201
|
+
return {
|
|
202
|
+
$: {
|
|
203
|
+
...this.newGirAttr(_tsData.name),
|
|
204
|
+
},
|
|
205
|
+
annotation: [],
|
|
206
|
+
...this.newGirDocElement(),
|
|
207
|
+
_tsData,
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
newGirProperties(
|
|
212
|
+
InjectionProps: InjectionProperty[],
|
|
213
|
+
overrideToAll: Partial<InjectionProperty> = {},
|
|
214
|
+
): GirPropertyElement[] {
|
|
215
|
+
const result: GirPropertyElement[] = []
|
|
216
|
+
for (const InjectionProp of InjectionProps) {
|
|
217
|
+
result.push(this.newGirProperty({ ...InjectionProp, ...overrideToAll }))
|
|
218
|
+
}
|
|
219
|
+
return result
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
newTsFunction(tsData: InjectionFunction, parent: TsClass | null): TsFunction {
|
|
223
|
+
const tsFunc: TsFunction & TsMethod = {
|
|
224
|
+
...tsData,
|
|
225
|
+
returnTypes: this.newTsTypes(tsData.returnTypes || []),
|
|
226
|
+
isArrowType: tsData.isArrowType || false,
|
|
227
|
+
isStatic: tsData.isStatic || false,
|
|
228
|
+
isGlobal: tsData.isGlobal || false,
|
|
229
|
+
isVirtual: tsData.isVirtual || false,
|
|
230
|
+
isInjected: tsData.isInjected || false,
|
|
231
|
+
retTypeIsVoid: tsData.returnTypes?.length === 1 && tsData.returnTypes[0]?.type === 'void',
|
|
232
|
+
generics: this.newGenerics(tsData.generics || []),
|
|
233
|
+
overloads: tsData.overloads || [],
|
|
234
|
+
doc: this.newTsDoc(tsData.doc),
|
|
235
|
+
tsTypeName: this.girTypeNameToTsTypeName(tsData.girTypeName, tsData.isStatic || false),
|
|
236
|
+
inParams: [],
|
|
237
|
+
outParams: [],
|
|
238
|
+
instanceParameters: [],
|
|
239
|
+
parent,
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
tsFunc.inParams.push(...this.newGirCallableParamElements(tsData.inParams, tsFunc))
|
|
243
|
+
tsFunc.outParams.push(...this.newGirCallableParamElements(tsData.outParams, tsFunc))
|
|
244
|
+
tsFunc.instanceParameters.push(...this.newGirInstanceParameters(tsData.instanceParameters))
|
|
245
|
+
|
|
246
|
+
return tsFunc
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
newTsProperty(tsData: InjectionProperty): TsProperty {
|
|
250
|
+
tsData.type ||= [this.newTsType()]
|
|
251
|
+
const tsProp: TsProperty = {
|
|
252
|
+
...tsData,
|
|
253
|
+
readonly: tsData.readonly || false,
|
|
254
|
+
isStatic: tsData.isStatic || false,
|
|
255
|
+
isInjected: tsData.isInjected || false,
|
|
256
|
+
type: this.newTsTypes(tsData.type || []),
|
|
257
|
+
doc: this.newTsDoc(tsData.doc),
|
|
258
|
+
tsTypeName: this.girTypeNameToTsTypeName(tsData.girTypeName, tsData.isStatic || false),
|
|
259
|
+
}
|
|
260
|
+
return tsProp
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
newTsType(tsData: InjectionType = {}): TsType {
|
|
264
|
+
tsData.callbacks ||= []
|
|
265
|
+
tsData.generics ||= []
|
|
266
|
+
tsData.nullable ||= false
|
|
267
|
+
tsData.optional ||= false
|
|
268
|
+
|
|
269
|
+
const newTsData: TsType = {
|
|
270
|
+
type: tsData.type || 'void',
|
|
271
|
+
callbacks: tsData.callbacks || [],
|
|
272
|
+
generics: tsData.generics || [],
|
|
273
|
+
nullable: tsData.nullable || false,
|
|
274
|
+
optional: tsData.optional || false,
|
|
275
|
+
isArray: tsData.isArray || false,
|
|
276
|
+
isCallback: tsData.isCallback || false,
|
|
277
|
+
isFunction: tsData.isFunction || false,
|
|
278
|
+
leftSeparator: tsData.leftSeparator || '|',
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return newTsData
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
newTsTypes(tsDataArr: InjectionType[]): TsType[] {
|
|
285
|
+
const types: TsType[] = []
|
|
286
|
+
for (const tsData of tsDataArr) {
|
|
287
|
+
types.push(this.newTsType(tsData))
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (tsDataArr.length === 0) {
|
|
291
|
+
types.push(this.newTsType({}))
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return types
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
newTsParameter(tsData: InjectionParameter | GirCallableParamElement, parent: TsFunction) {
|
|
298
|
+
const types: TsType[] = []
|
|
299
|
+
const tsTypes = (tsData as GirCallableParamElement)._tsData?.type || (tsData as InjectionParameter).type || []
|
|
300
|
+
for (const type of tsTypes) {
|
|
301
|
+
type.type = type.type || 'any'
|
|
302
|
+
types.push(this.newTsType(type))
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const name = (tsData as InjectionParameter).name || (tsData as GirCallableParamElement)._tsData?.name
|
|
306
|
+
const isRest =
|
|
307
|
+
(tsData as InjectionParameter).isRest || (tsData as GirCallableParamElement)._tsData?.isRest || false
|
|
308
|
+
const doc = (tsData as InjectionParameter).doc || (tsData as GirCallableParamElement)._tsData?.doc
|
|
309
|
+
|
|
310
|
+
if (!name) throw new Error('[GirFactory.newTsParameter] The name property is required!')
|
|
311
|
+
|
|
312
|
+
const newTsData: TsParameter = {
|
|
313
|
+
type: types,
|
|
314
|
+
name: name,
|
|
315
|
+
isRest: isRest,
|
|
316
|
+
girTypeName: 'callable-param',
|
|
317
|
+
doc: this.newTsDoc(doc),
|
|
318
|
+
parent,
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return newTsData
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
newTsParameters(datas: Array<InjectionParameter | GirCallableParamElement>, parent: TsFunction) {
|
|
325
|
+
const tsParameters: TsParameter[] = []
|
|
326
|
+
for (const data of datas) {
|
|
327
|
+
tsParameters.push(this.newTsParameter(data, parent))
|
|
328
|
+
}
|
|
329
|
+
return tsParameters
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Generates signal methods like `connect`, `connect_after` and `emit` on Gjs or `connect`, `on`, `once`, `off` and `emit` an node-gtk
|
|
334
|
+
* for a default gir signal element
|
|
335
|
+
* @param signalName The signal name
|
|
336
|
+
* @param callbackType The callback type
|
|
337
|
+
* @param emitInParams
|
|
338
|
+
* @param environment
|
|
339
|
+
* @param withDisconnect If `true` this also generates a `disconnect` method
|
|
340
|
+
* @returns
|
|
341
|
+
*/
|
|
342
|
+
newTsSignalMethods(
|
|
343
|
+
signalName: string | undefined,
|
|
344
|
+
callbackType: string | undefined,
|
|
345
|
+
emitInParams: InjectionParameter[],
|
|
346
|
+
parentClass: TsClass,
|
|
347
|
+
environment: Environment,
|
|
348
|
+
withDisconnect = false,
|
|
349
|
+
) {
|
|
350
|
+
const tsMethods: TsMethod[] = []
|
|
351
|
+
const girTypeName: TypeGirFunction = 'signal'
|
|
352
|
+
|
|
353
|
+
const sigNameInParam: InjectionParameter = {
|
|
354
|
+
name: 'sigName',
|
|
355
|
+
type: [
|
|
356
|
+
this.newTsType({
|
|
357
|
+
type: signalName ? `"${signalName}"` : 'string',
|
|
358
|
+
}),
|
|
359
|
+
],
|
|
360
|
+
doc: this.newTsDoc(),
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
const anyArgsInParam: InjectionParameter = {
|
|
364
|
+
name: 'args',
|
|
365
|
+
isRest: true,
|
|
366
|
+
type: [
|
|
367
|
+
this.newTsType({
|
|
368
|
+
type: `any`,
|
|
369
|
+
isArray: true,
|
|
370
|
+
}),
|
|
371
|
+
],
|
|
372
|
+
doc: this.newTsDoc(),
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
emitInParams.push(anyArgsInParam)
|
|
376
|
+
|
|
377
|
+
const callbackInParam: InjectionParameter = {
|
|
378
|
+
name: 'callback',
|
|
379
|
+
type: [
|
|
380
|
+
this.newTsType({
|
|
381
|
+
type: callbackType || '(...args: any[]) => void',
|
|
382
|
+
}),
|
|
383
|
+
],
|
|
384
|
+
doc: this.newTsDoc(),
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const numberReturnType = this.newTsType({
|
|
388
|
+
type: 'number',
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
const connectTsFn = this.newTsFunction(
|
|
392
|
+
{
|
|
393
|
+
name: 'connect',
|
|
394
|
+
inParams: [sigNameInParam, callbackInParam],
|
|
395
|
+
returnTypes: [numberReturnType],
|
|
396
|
+
girTypeName,
|
|
397
|
+
},
|
|
398
|
+
parentClass,
|
|
399
|
+
)
|
|
400
|
+
tsMethods.push(connectTsFn)
|
|
401
|
+
|
|
402
|
+
if (environment === 'gjs') {
|
|
403
|
+
const connectAfterTsFn = this.newTsFunction(
|
|
404
|
+
{
|
|
405
|
+
name: 'connect_after',
|
|
406
|
+
inParams: [sigNameInParam, callbackInParam],
|
|
407
|
+
returnTypes: [numberReturnType],
|
|
408
|
+
girTypeName,
|
|
409
|
+
},
|
|
410
|
+
parentClass,
|
|
411
|
+
)
|
|
412
|
+
tsMethods.push(connectAfterTsFn)
|
|
413
|
+
} else if (environment === 'node') {
|
|
414
|
+
const afterInParam: InjectionParameter = {
|
|
415
|
+
name: 'after',
|
|
416
|
+
type: [
|
|
417
|
+
this.newTsType({
|
|
418
|
+
type: 'boolean',
|
|
419
|
+
optional: true,
|
|
420
|
+
}),
|
|
421
|
+
],
|
|
422
|
+
doc: this.newTsDoc(),
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const nodeEventEmitterReturnType = this.newTsType({
|
|
426
|
+
type: 'NodeJS.EventEmitter',
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
const onTsFn = this.newTsFunction(
|
|
430
|
+
{
|
|
431
|
+
name: 'on',
|
|
432
|
+
inParams: [sigNameInParam, callbackInParam, afterInParam],
|
|
433
|
+
returnTypes: [nodeEventEmitterReturnType],
|
|
434
|
+
girTypeName,
|
|
435
|
+
},
|
|
436
|
+
parentClass,
|
|
437
|
+
)
|
|
438
|
+
const onceTsFn = this.newTsFunction(
|
|
439
|
+
{
|
|
440
|
+
name: 'once',
|
|
441
|
+
inParams: [sigNameInParam, callbackInParam, afterInParam],
|
|
442
|
+
returnTypes: [nodeEventEmitterReturnType],
|
|
443
|
+
girTypeName,
|
|
444
|
+
},
|
|
445
|
+
parentClass,
|
|
446
|
+
)
|
|
447
|
+
const offTsFn = this.newTsFunction(
|
|
448
|
+
{
|
|
449
|
+
name: 'off',
|
|
450
|
+
inParams: [sigNameInParam, callbackInParam],
|
|
451
|
+
returnTypes: [nodeEventEmitterReturnType],
|
|
452
|
+
girTypeName,
|
|
453
|
+
},
|
|
454
|
+
parentClass,
|
|
455
|
+
)
|
|
456
|
+
tsMethods.push(onTsFn, onceTsFn, offTsFn)
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
const emitTsFn = this.newTsFunction(
|
|
460
|
+
{
|
|
461
|
+
name: 'emit',
|
|
462
|
+
inParams: [sigNameInParam, ...emitInParams],
|
|
463
|
+
girTypeName,
|
|
464
|
+
},
|
|
465
|
+
parentClass,
|
|
466
|
+
)
|
|
467
|
+
tsMethods.push(emitTsFn)
|
|
468
|
+
|
|
469
|
+
if (withDisconnect && environment === 'gjs') {
|
|
470
|
+
const idInParam: InjectionParameter = {
|
|
471
|
+
name: 'id',
|
|
472
|
+
type: [
|
|
473
|
+
this.newTsType({
|
|
474
|
+
type: 'number',
|
|
475
|
+
}),
|
|
476
|
+
],
|
|
477
|
+
doc: this.newTsDoc(),
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const emitTsFn = this.newTsFunction(
|
|
481
|
+
{
|
|
482
|
+
name: 'disconnect',
|
|
483
|
+
inParams: [idInParam],
|
|
484
|
+
girTypeName,
|
|
485
|
+
},
|
|
486
|
+
parentClass,
|
|
487
|
+
)
|
|
488
|
+
tsMethods.push(emitTsFn)
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return tsMethods
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
newGirAttr(
|
|
495
|
+
name = '',
|
|
496
|
+
): (GirConstructorElement & GirFunctionElement & GirMethodElement & GirVirtualMethodElement)['$'] {
|
|
497
|
+
return {
|
|
498
|
+
name,
|
|
499
|
+
'glib:set-property': '',
|
|
500
|
+
'glib:get-property': '',
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
newGirAnnotation(data: Partial<GirAnnotation['$']> = {}): GirAnnotation {
|
|
505
|
+
data.name ||= ''
|
|
506
|
+
data.value ||= []
|
|
507
|
+
return {
|
|
508
|
+
$: data as GirAnnotation['$'],
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
newGirDocElement(text = '', filename = '', line = '', column = ''): GirDocElement {
|
|
513
|
+
return {
|
|
514
|
+
doc: [{ $: { filename, line, column }, _: text }],
|
|
515
|
+
'doc-deprecated': [{ $: {}, _: '' }],
|
|
516
|
+
'source-position': [{ filename: '', line: '', column: [''] }],
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
newTsDoc(data: Partial<TsDoc> = {}): TsDoc {
|
|
521
|
+
return {
|
|
522
|
+
tags: data.tags || [],
|
|
523
|
+
text: data.text || '',
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|